#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> b[i]; b[i]%=k; } re(i, n) { std::cin >> a[i]; a[i]%=k; } sort(all(a)); ll ans = 0; for(int i=0;i> b[i]; re(i, n) std::cin >> a[i]; vll d;//kの約数 d.push_back(1); d.push_back(k); for(ll i=2;i*i<=k;i++){ if(k%i==0){ d.push_back(i); if(i*i!=k) d.push_back(k/i); } } vll cnt(d.size(), 0); for(int i=0;i mp; for(int i=0;i> n >> m >> k; char op;std::cin >> op; if(op=='+') solve_add(); else solve_mul(); }