buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> usi...
#include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <cstdlib> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> usi...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
717
#include <bits/stdc++.h> using namespace std; bool fun(int x, unordered_map<int, int> &m) { if (x % 2 == 0) { if (m[2] == 0) { m[2] = 1; while (x % 2 == 0) { x = x / 2; } } else { return false; } } for (int i = 3; i <= sqrt(x); i += 2) { if (x % i == 0) { i...
#include <bits/stdc++.h> using namespace std; bool fun(int x, unordered_map<int, int> &m) { if (x % 2 == 0) { if (m[2] == 0) { m[2] = 1; while (x % 2 == 0) { x = x / 2; } } else { return false; } } for (int i = 3; i <= sqrt(x); i += 2) { if (x % i == 0) { ...
[["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
364
c=[m:=0]*6**8 n,a=open(0) for a in a.split():c[int(a)]+=1 print(('not','psaeitr'[any((m:=max(m,sum(c[i::i])))>1for i in range(2,6**8))::2]+'wise')[m<int(n)],'coprime')
c=[m:=0]*6**8 n,a=open(0) for a in a.split():c[int(a)]+=1 print(('not','psaeitr'[any([(m:=max(m,sum(c[i::i])))>1for i in range(2,6**8)])::2]+'wise')[m<int(n)],'coprime')
[["+", 206, 663, 0, 652, 3, 4, 0, 658, 0, 70], ["+", 206, 663, 0, 652, 3, 4, 0, 658, 0, 73]]
5
105
#include <bits/stdc++.h> #define A_MAX 1000000 using namespace std; int scanint() { char c = getchar_unlocked(); int x = 0; for (; (c < 48) || (c > 57); c = getchar_unlocked()) ; for (; (c > 47) && (c < 58); c = getchar_unlocked()) x = 10 * x + c - 48; return x; } int min_factor[A_MAX + 1]; int q[...
#include <bits/stdc++.h> #define A_MAX 1000000 using namespace std; int scanint() { char c = getchar_unlocked(); int x = 0; for (; (c < 48) || (c > 57); c = getchar_unlocked()) ; for (; (c > 47) && (c < 58); c = getchar_unlocked()) x = 10 * x + c - 48; return x; } int min_factor[A_MAX + 1]; int q[...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
370
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stri...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stri...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
405
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define IOS std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); inline int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; } const int maxn = 1E6 + 5; int prime[maxn], sz; // sz一个多少个素数 bool vis[maxn]; // vis为0是素数 void get_prime() { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define IOS std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); inline int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; } const int maxn = 1e6 + 5; int prime[maxn], sz; bool vis[maxn]; void get_prime() { vis[1] = 1; for (int i = 2; ...
[["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
478
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr int MAX = 1e6; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { int n; cin >> n; vector<int> a(n); map<int, int> count; for (int &ai : a) { cin >> ai; ++count[ai]; } vector<bool> p(MAX + 1, ...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr int MAX = 1e6; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { int n; cin >> n; vector<int> a(n); map<int, int> count; for (int &ai : a) { cin >> ai; ++count[ai]; } vector<bool> p(MAX + 1, ...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]]
1
282
def li(): return [int(x) for x in input().split()] N = int(input()) A = li() import math from functools import reduce from collections import defaultdict # 最大公約数(リスト引数) # 空のリストを渡さないよう注意 def GCD_list(numbers): return reduce(math.gcd, numbers) # 数列全ての高速素因数分解 MAX = 10 ** 6 is_prime = [True] * (MAX + 1) divs ...
def li(): return [int(x) for x in input().split()] N = int(input()) A = li() import math from functools import reduce from collections import defaultdict # 最大公約数(リスト引数) # 空のリストを渡さないよう注意 def GCD_list(numbers): return reduce(math.gcd, numbers) # 数列全ての高速素因数分解 MAX = 10 ** 6 is_prime = [True] * (MAX + 1) divs ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 147], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 146], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 146], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 147]]
5
296
import math from functools import reduce k=10**6+1 def judge(n,a): c=[0]**k for x in a: c[x]=+1 t=any(sum(c[i::i])>1 for i in range(2,k)) t+=reduce(gcd,a)>1 return ['pairwise','setwise','not'][t]+' coprime' n=int(input()) a=list(map(int,input().split())) print(judge(n,a))
from math import gcd from functools import reduce k=10**6+1 def judge(n,a): c=[0]*k for x in a: c[x]+=1 #対応する数の個数を記録 t=any(sum(c[i::i])>1 for i in range(2,k)) #自身を約数に持つ数が2つ以上与えられたリストに存在するような数が一つでもあるかどうか t+=reduce(gcd,a)>1 #全体について1以外の公約数があれば1加える return ['pairwise','setwise','not'][t]+' coprime' #全体に公約数があれば...
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 578], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, ...
5
131
import math from functools import reduce k=10**6+1 def judge(n,a): c=[0]**k for x in a: c[x]=+1 t=any(sum(c[i::i])>1 for i in range(2,k)) t+=reduce(gcd,a)>1 return ['pairwise','setwise','not'][t]+' coprime' n=int(input()) a=list(map(int,input().split())) print(judge(n,a))
from math import gcd from functools import reduce k=10**6+1 def judge(n,a): c=[0]*k for x in a: c[x]+=1 t=any(sum(c[i::i])>1 for i in range(2,k)) t+=reduce(gcd,a)>1 return ['pairwise','setwise','not'][t]+' coprime' n=int(input()) a=list(map(int,input().split())) print(judge(n,a))
[["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 578], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, ...
5
131
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int A = 1000005; int main() { int n; cin >> n; vector<int> a(n); vector<int> c(A); rep(i, n) { cin >> a[i]; c[a[i]]++; } bool pairwize = true; for...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int A = 1000005; int main() { int n; cin >> n; vector<int> a(n); vector<int> c(A); rep(i, n) { cin >> a[i]; c[a[i]]++; } bool pairwize = true; for...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
223
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #define INF 0x3f3f3f3f #define eps 1e-10 using namespace std; int n, a[1000005], hcf, pc, sc, nc; bool prime[1000005]; map<int, int> tim; int...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #define INF 0x3f3f3f3f #define eps 1e-10 using namespace std; int n, a[1000005], hcf, pc, sc, nc; bool prime[1000005]; map<int, int> tim; int...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
338
#include <bits/stdc++.h> #define rep(i, x, y) for (int i = x; i <= y; i++) using namespace std; void cmax(int &x, const int &y) { x = x > y ? x : y; } void cmin(int &x, const int &y) { x = x < y ? x : y; } const int N = 1e6 + 1; vector<int> d[N]; int cnt[N]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); ...
#include <bits/stdc++.h> #define rep(i, x, y) for (int i = x; i <= y; i++) using namespace std; void cmax(int &x, const int &y) { x = x > y ? x : y; } void cmin(int &x, const int &y) { x = x < y ? x : y; } const int N = 1e6 + 1; vector<int> d[N]; int cnt[N]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); ...
[["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
293
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (ll i = a; i < b; i++) #define Rep(i, a, b) for (ll i = a; i <= b; i++) #define repr(i, a, b) for (ll i = b - 1; i >= a; i--) #define _GLIBCXX_DEBUG #define Vl vector<ll> #define Vs vector<string> #define Vp vector<pair<ll, ll>> using ll = long long...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (ll i = a; i < b; i++) #define Rep(i, a, b) for (ll i = a; i <= b; i++) #define repr(i, a, b) for (ll i = b - 1; i >= a; i--) #define _GLIBCXX_DEBUG #define Vl vector<ll> #define Vs vector<string> #define Vp vector<pair<ll, ll>> using ll = long long...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
724
#include <bits/stdc++.h> using namespace std; using ll = long long; int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } int main(void) { int n; bool ispc = true, issc = true; cin >> n; vector<int> a(n + 1), b(1000001, 0); for (int i = 1; i <= n; i++) cin >> a[i]; for...
#include <bits/stdc++.h> using namespace std; using ll = long long; int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } int main(void) { int n; bool ispc = true, issc = true; cin >> n; vector<int> a(n + 1), b(1000001, 0); for (int i = 1; i <= n; i++) cin >> a[i]; for...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
256
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < n; i++) #define rep_1 (i, j, n) for (int i = j; i < n; i++) typedef long long ll; typedef ...
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <math.h> #include <queue> #include <string> #include <vector> using namespace std; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < n; i++) #define rep_1 (i, j, n) for (int i = j; i < n; i++) typedef long long ll; typedef ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
356
import math N = int(input()) Alist = list(map(int,input().split())) box = [0]*(N+1) sign = math.gcd(Alist[0],Alist[1]) Amax = max(Alist[0],Alist[1]) for i in range(0,len(Alist)): A = Alist[i] sign = math.gcd(sign, A) Amax = max(Amax, A) box[i] += 1 setwise = (sign == 1) pairwise = (sign == 1) Amax = mat...
import math N = int(input()) Alist = list(map(int,input().split())) box = [0]*(10**6+1) sign = math.gcd(Alist[0],Alist[1]) Amax = max(Alist[0],Alist[1]) for i in range(0,len(Alist)): A = Alist[i] sign = math.gcd(sign, A) Amax = max(Amax, A) box[A] += 1 setwise = (sign == 1) pairwise = (sign == 1) Amax =...
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 31, 612], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 17, 578], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 12, 612], ["-", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22]]
5
195
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define mp make_pair #define pb(x) push_back(x) #define vi vector<int> #define vs vector<string> #define vll vector<long long> #define vc vector<char> #define vs vector...
[["-", 28, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 22]]
1
475
#include <bits/stdc++.h> using namespace std; inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar(); return s * w; } long long prime[1000003], c...
#include <bits/stdc++.h> using namespace std; inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar(); return s * w; } long long prime[1000003], c...
[["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 57, 64, 9, 0, 57, 64, 57, 0, 121], ["+", 64, 9, 0, 57, 64, 57, 15, 339, 0, 24]]
1
483
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <vector> #define f f...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <vector> #define f f...
[["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
538
#include <bits/stdc++.h> using namespace std; int p[1111111], s[1111111]; int main() { for (int i = 2; i < 1111; i++) { if (p[i]) continue; for (int j = i * i; j < 1111111; j += i) if (!p[j]) p[j] = i; } int n, g = 0, f = 0; cin >> n; for (int i = 0; i < n; i++) { int a; s...
#include <bits/stdc++.h> using namespace std; int p[1111111], s[1111111]; int main() { for (int i = 2; i < 1111; i++) { if (p[i]) continue; for (int j = i * i; j < 1111111; j += i) if (!p[j]) p[j] = i; } int n, g = 0, f = 0; cin >> n; for (int i = 0; i < n; i++) { int a; s...
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
231
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <vector> #define ll long long #define sf(a) scanf("%lld", &a) #define pf(b) printf("%lld", b) #define sp printf(" ") #define nw ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <vector> #define ll long long #define sf(a) scanf("%lld", &a) #define pf(b) printf("%lld", b) #define sp printf(" ") #define nw ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
620
#include <bits/stdc++.h> using namespace std; #define ll long long #define scn(n) scanf("%d", &n) #define lscn(n) scanf("%lld", &n) #define pri(n) printf("%d", n) #define lpri(n) printf("%lld", n) #define priln(n) printf("%d\n", n) #define lpriln(n) printf("%lld\n", n) #define F first #define S second #define vec vecto...
#include <bits/stdc++.h> using namespace std; #define ll long long #define scn(n) scanf("%d", &n) #define lscn(n) scanf("%lld", &n) #define pri(n) printf("%d", n) #define lpri(n) printf("%lld", n) #define priln(n) printf("%d\n", n) #define lpriln(n) printf("%lld\n", n) #define F first #define S second #define vec vecto...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
556
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repI(i, d, n) for (int i = (d); i < (n); ++i) #define reps1(i, n) for (int i = 1; i < (n); ++i) using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <clas...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repI(i, d, n) for (int i = (d); i < (n); ++i) #define reps1(i, n) for (int i = 1; i < (n); ++i) using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <clas...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 66, 17, 48], ["+", 15, 339, 51, 16, 12, 16, 31, 66, 28, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
507
import math N = int(input()) A = list(map(int, input().split())) m = [0] * int(1e6+1) for i in range(N): m[A[i]] += 1 pw = True for p in range(2, N+1): c = 0 for i in range(p, len(m), p): c += m[i] if c > 1: pw = False break if pw: print('pairwise coprime') exit() d = A[...
import math N = int(input()) A = list(map(int, input().split())) m = [0] * int(1e6+1) for i in range(N): m[A[i]] += 1 pw = True for p in range(2, len(m)): c = 0 for i in range(p, len(m), p): c += m[i] if c > 1: pw = False break if pw: print('pairwise coprime') exit() d =...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
162
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAX_A = 1000005; int main() { int N; cin >> N; vector<int> A(N); vector<int> C(MAX_A); bool pairwaise = 1; for (int i = 0; i < N; i++) { cin >> A.at(i); C.at(A.at(i))++; } for (int i = 2; i < MAX_A; i++) { int c...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAX_A = 1000005; int main() { int N; cin >> N; vector<int> A(N); vector<int> C(MAX_A); bool pairwaise = 1; for (int i = 0; i < N; i++) { cin >> A.at(i); C.at(A.at(i))++; } for (int i = 2; i < MAX_A; i++) { int c...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
225
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int A = 1000005; int gcd(int a, int b) { int x = max(a, b); int y = min(a, b); int r = x % y; while (r != 0) { x = y; y = r; r = x % y; } return y...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int A = 1000005; int gcd(int a, int b) { int x = max(a, b); int y = min(a, b); int r = x % y; while (r != 0) { x = y; y = r; r = x % y; } return y...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
289
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1e9 + 7; vector<ll> prime_table(ll n) { //素数全列挙 vector<ll> prime(n + 1); for (int i = 0; i <= n; i++) { prime[i] = i; } for (int i = 2; i * i <= n; i++) { if (prime[i] !=...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1e9 + 7; vector<ll> prime_table(ll n) { //素数全列挙 vector<ll> prime(n + 1); for (int i = 0; i <= n; i++) { prime[i] = i; } for (int i = 2; i * i <= n; i++) { if (prime[i] !=...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
403
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(a) (ll)(a.size()) #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define FOR(i, a, b) for (i = a; i < b; i++) const ll L = 1e6 + 1; vector<ll> ad[L];...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(a) (ll)(a.size()) #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define FOR(i, a, b) for (i = a; i < b; i++) const ll L = 1e6 + 1; vector<ll> ad[L];...
[["-", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 11, 12, 13]]
1
348
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (i = 0; i < n; ++i) #define all(v) v.begin(), v.end() using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int i, j; int max_number = 1e6; vector<int> era(max_number + 1, 0); for (i = 2; i <= sqrt(max_number); ++i) ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (i = 0; i < n; ++i) #define all(v) v.begin(), v.end() using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int i, j; int max_number = 1e6; vector<int> era(max_number + 1, 0); for (i = 2; i <= sqrt(max_number); ++i) ...
[["-", 0, 57, 64, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 57, 64, 9, 0, 57, 64, 116, 0, 117]]
1
508
#pragma GCC optimize(3) #include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int n, x, num[1000005], ok = 1, g; int main() { cin >> n; for (int i = 0; i < n; ++i) { scanf("%d", &x); ++num[x]; g = gcd(x, g); } for (int i = 2; i <= 1000; ++i) { int ...
#pragma GCC optimize(3) #include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int n, x, num[1000005], ok = 1, g; int main() { cin >> n; for (int i = 0; i < n; ++i) { scanf("%d", &x); ++num[x]; g = gcd(x, g); } for (int i = 2; i <= 1000000; ++i) { i...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
192
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namespace std; bool arr[1000...
#include <bits/stdc++.h> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namespace std; bool arr[1000...
[["-", 28, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 22]]
1
462
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> #define ull unsigned ll #define pb push_back #define mp make_pair using namespace std; int used[1000001]; int used1[1000001]; vector<int> pr; void fill_prime() { for (ll i = 2; i <= 10...
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> #define ull unsigned ll #define pb push_back #define mp make_pair using namespace std; int used[1000001]; int used1[1000001]; vector<int> pr; void fill_prime() { for (ll i = 2; i <= 10...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
326
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } template <class S, class T> ostream &op...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } template <class S, class T> ostream &op...
[["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
903
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #inc...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdint> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #inc...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
405
#include <iostream> #include <map> #include <vector> using namespace std; int gcd(int a, int b) { if (a > b) swap(a, b); while (b % a != 0) { int tmp = b % a; b = a; a = tmp; } return a; } int main() { int n, i, j, jud, t; cin >> n; vector<int> a(n); for (i = 0; i < n; ++i) cin >> ...
#include <iostream> #include <map> #include <vector> using namespace std; int gcd(int a, int b) { if (a > b) swap(a, b); while (b % a != 0) { int tmp = b % a; b = a; a = tmp; } return a; } int main() { int n, i, j, jud, t; cin >> n; vector<int> a(n); for (i = 0; i < n; ++i) cin >> ...
[["-", 0, 7, 8, 9, 0, 7, 26, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 12, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
397
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #inc...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #inc...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
315
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int long long #pragma GCC optimize("O2") #define sz(x) ((long long)(x).size()) #define all(x) x.begin(), x.end() #define rall(x) (x).rbegin(), (x).rend() #define endl "\n" #define ff first #define ss second #define mp make_pair #define pb push...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int long long #pragma GCC optimize("O2") #define sz(x) ((long long)(x).size()) #define all(x) x.begin(), x.end() #define rall(x) (x).rbegin(), (x).rend() #define endl "\n" #define ff first #define ss second #define mp make_pair #define pb push...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 147], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 146]]
1
642
//--------------------------------------------------------------- #include <bits/stdc++.h> using namespace std; #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <numeric> #include <sstream> #include <vector> //...
//--------------------------------------------------------------- #include <bits/stdc++.h> using namespace std; #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdlib> #include <iostream> #include <math.h> #include <numeric> #include <sstream> #include <vector> //...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
476
#include <bits/stdc++.h> int main() { int N; std::cin >> N; std::vector<int> A(N); for (int i = 0; i < N; i++) { std::cin >> A[i]; } std::vector<bool> PM(1e6 + 1, true); std::vector<int> PM_list; std::vector<int> PM_list_sqrt; std::map<int, int> PM_map; for (int i = 2; i <= 1e6; i++) { if ...
#include <bits/stdc++.h> int main() { int N; std::cin >> N; std::vector<int> A(N); for (int i = 0; i < N; i++) { std::cin >> A[i]; } std::vector<bool> PM(1e6 + 1, true); std::vector<int> PM_list; std::vector<int> PM_list_sqrt; std::map<int, int> PM_map; for (int i = 2; i <= 1e6; i++) { if ...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
439
from functools import lru_cache def main(): n=int(input()) a=list(map(int,input().split())) x=set() y=a[0] pair=True for i in a: if pair: p=set(prime_factorize(i)) if len(x&p)>0: pair=False x|=p y=math.gcd(y, i) if pair: ...
from functools import lru_cache import math def main(): n=int(input()) a=list(map(int,input().split())) x=set() y=a[0] pair=True for i in a: if pair: p=set(prime_factorize(i)) if len(x&p)>0: pair=False x|=p y=math.gcd(y, i) ...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
390
from math import gcd from functools import reduce n=int(input()) a=list(map(int,input().split())) d=[0]*(10**6) for i in a: d[i-1]+=1 num=2 while num<=10**6: if sum([d[i*num-1] for i in range(1,10**6//num+1)])>1: break num+=1 else: print('setwise coprime') exit() g=reduce(gcd,a) if g==1: print('pairwi...
from math import gcd from functools import reduce n=int(input()) a=list(map(int,input().split())) d=[0]*(10**6) for i in a: d[i-1]+=1 num=2 while num<=10**6: if sum([d[i*num-1] for i in range(1,10**6//num+1)])>1: break num+=1 else: print('pairwise coprime') exit() g=reduce(gcd,a) if g==1: print('setwi...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
142
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using ll = long long; using namespace std; constexpr int MOD = 1e9 + 7; constexpr ll ...
#include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using ll = long long; using namespace std; constexpr int MOD = 1e9 + 7; constexpr ll ...
[["-", 0, 338, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 338, 8, 9, 0, 7, 15, 16, 17, 19]]
1
424
//#include <cstdio> #include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> //#include <queue> //#include <stack> #include <cassert> #include <cstring> using namespace std; #ifdef LOCAL_DEBUG #include <local_debug.h> #define DEBUG(...) DBG2::print(#__VA_ARGS__, __LIN...
//#include <cstdio> #include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> //#include <queue> //#include <stack> #include <cassert> #include <cstring> using namespace std; #ifdef LOCAL_DEBUG #include <local_debug.h> #define DEBUG(...) DBG2::print(#__VA_ARGS__, __LIN...
[["-", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
461
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18; void print() { cout << endl; } template <typename Head, typename... Tail> void print(Head head, Tail... tail) { int size = sizeof...(Tail); cout << head; if (size > 0) { cout << " "; } print(tail....
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18; void print() { cout << endl; } template <typename Head, typename... Tail> void print(Head head, Tail... tail) { int size = sizeof...(Tail); cout << head; if (size > 0) { cout << " "; } print(tail....
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
720
N=gets.to_i array=gets.chomp.split(" ").map(&:to_i) maxim=array.max ARRAY=Array.new(maxim+1, 0) array.each do |a| ARRAY[a]=1 end setwise=false c=2 while c<=maxim do count=0 n=c while n<=maxim do count+=ARRAY[n] n+=c end if count == N puts "not coprime" exit en...
N=gets.to_i array=gets.chomp.split(" ").map(&:to_i) maxim=array.max ARRAY=Array.new(maxim+1, 0) array.each do |a| ARRAY[a]+=1 end setwise=false c=2 while c<=maxim do count=0 n=c while n<=maxim do count+=ARRAY[n] n+=c end if count == N puts "not coprime" exit e...
[["-", 0, 652, 196, 737, 8, 736, 0, 662, 0, 32], ["+", 0, 652, 196, 737, 8, 736, 0, 755, 17, 107]]
4
120
#include <algorithm> #include <bitset> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordere...
#include <algorithm> #include <bitset> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <unordered_map> #include <unordere...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 146], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
294
from collections import Counter def prime_factorize(n): a = set() while n % 2 == 0: a.add(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.add(f) n //= f else: f += 2 if n != 1: a.add(n) return a n = int(input()) inpu...
from collections import Counter def prime_factorize(n): a = set() while n % 2 == 0: a.add(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.add(f) n //= f else: f += 2 if n != 1: a.add(n) return a n = int(input()) inpu...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
180
from math import gcd # Python3.6以降 # -------------------------------------------------------------- # n以下の素数列挙: O-nlogn # def primes(n): # prs = [] # is_prime = [True] * (n + 1) # is_prime[0] = False # is_prime[1] = False # for i in range(2, int(n**0.5)+1): # if not is_prime[i]: # ...
from math import gcd # Python3.6以降 # -------------------------------------------------------------- # n以下の素数列挙: O-nlogn # def primes(n): # prs = [] # is_prime = [True] * (n + 1) # is_prime[0] = False # is_prime[1] = False # for i in range(2, int(n**0.5)+1): # if not is_prime[i]: # ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
198
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef pair<int, int> P; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a =...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
344
#include <bits/stdc++.h> using namespace std; #define ll long long #define lvector vector<ll> #define cvector vector<char> #define svector vector<string> #define lque queue<ll> #define lpque priority_queue<ll> #define dlpque priority_queue<ll, lvector, greater<ll>> #define P pair<ll, ll> #define ALL(a) a.begin(), a.end...
#include <bits/stdc++.h> using namespace std; #define ll long long #define lvector vector<ll> #define cvector vector<char> #define svector vector<string> #define lque queue<ll> #define lpque priority_queue<ll> #define dlpque priority_queue<ll, lvector, greater<ll>> #define P pair<ll, ll> #define ALL(a) a.begin(), a.end...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 12, 22]]
1
262
import functools from math import gcd N = int(input()) A = list(map(int, input().split())) MAX = 10 * 6 + 10 if functools.reduce(gcd, A) == 1: print("setwise coprime") exit() prime_list = [i for i in range(MAX + 1)] p = 2 while p * p <= MAX: if prime_list[p] == p: for q in range(2*p, MAX+1, p): ...
import functools from math import gcd N = int(input()) A = list(map(int, input().split())) MAX = 10 ** 6 + 10 if functools.reduce(gcd, A) != 1: print("not coprime") exit() prime_list = [i for i in range(MAX + 1)] p = 2 while p * p <= MAX: if prime_list[p] == p: for q in range(2*p, MAX+1, p): ...
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 79], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
192
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) #define all(a) (a).begin(), (a).end() template <ty...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) #define all(a) (a).begin(), (a).end() template <ty...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
1,178
# Date [ 2020-08-29 21:59:01 ] # Problem [ e.py ] # Author Koki_tkg # After Contest import sys import math # import bisect # import numpy as np # from decimal import Decimal # from numba import njit, i8, u1, b1 #JIT compiler # from itertools import combinations, product # from collections import Counter, deque, defaul...
# Date [ 2020-08-29 21:59:01 ] # Problem [ e.py ] # Author Koki_tkg # After Contest import sys import math # import bisect # import numpy as np # from decimal import Decimal # from numba import njit, i8, u1, b1 #JIT compiler # from itertools import combinations, product # from collections import Counter, deque, defaul...
[["-", 0, 7, 8, 196, 0, 57, 15, 206, 206, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 206, 22], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22]]
5
543
#include <bits/stdc++.h> using namespace std; //定数 const long long MOD1 = 1000000007; const long long MOD2 = 998244353; const long double PI = 3.1415926535897932; const long long MAXLL = 9223372036854775807; const long long INF = 2305843009213693951; const long long dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const long long ...
#include <bits/stdc++.h> using namespace std; //定数 const long long MOD1 = 1000000007; const long long MOD2 = 998244353; const long double PI = 3.1415926535897932; const long long MAXLL = 9223372036854775807; const long long INF = 2305843009213693951; const long long dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const long long ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
965
#include <bits/stdc++.h> using namespace std; std::vector<bool> IsPrime; void sieve(size_t max) { if (max + 1 > IsPrime.size()) { // resizeで要素数が減らないように IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保 } IsPrime[0] = false; // 0は素数ではない IsPrime[1] = false; // 1は素数ではない for (size_t i = 2; i * i <= max;...
#include <bits/stdc++.h> using namespace std; std::vector<bool> IsPrime; void sieve(size_t max) { if (max + 1 > IsPrime.size()) { // resizeで要素数が減らないように IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保 } IsPrime[0] = false; // 0は素数ではない IsPrime[1] = false; // 1は素数ではない for (size_t i = 2; i * i <= max;...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
401
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep1(i, n) for (ll i = 1; i <= n; ++i) #define revrep(i, n) for (ll i = n - 1; n >= 0; --i) inline constexpr ll Inf = (1ULL << 62) - 1; class primes { public: vector<int> pr; primes(int n) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep1(i, n) for (ll i = 1; i <= n; ++i) #define revrep(i, n) for (ll i = n - 1; n >= 0; --i) inline constexpr ll Inf = (1ULL << 62) - 1; class primes { public: vector<int> pr; primes(int n) { ...
[["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 24], ["+", 51, 16, 12, 16, 31, 74, 39, 77, 39, 78], ["+", 15, 339, 51, 16, 12, 16, 31, 74, 0, 25]]
1
560
// Problem: E - Coprime // Contest: AtCoder - AtCoder Beginner Contest 177 // URL: https://atcoder.jp/contests/abc177/tasks/abc177_e // Memory Limit: 1024 MB // Time Limit: 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; typedef long long ll; typede...
// Problem: E - Coprime // Contest: AtCoder - AtCoder Beginner Contest 177 // URL: https://atcoder.jp/contests/abc177/tasks/abc177_e // Memory Limit: 1024 MB // Time Limit: 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 73]]
1
387
from math import gcd n = int(input()) A = list(map(int, input().split())) min_A = min(A) max_A = max(A) def is_pairwise(): arr = [0] * (max_A + 1) for a in A: arr[a] = 1 max_counter = 0 for num in range(2, max_A + 1): counter = 0 for i in range(1, 10**6 + 1): try: ...
from math import gcd n = int(input()) A = list(map(int, input().split())) min_A = min(A) max_A = max(A) def is_pairwise(): arr = [0] * (max_A + 1) for a in A: arr[a] += 1 max_counter = 0 for num in range(2, max_A + 1): counter = 0 for i in range(1, 10**6 + 1): try: ...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107]]
5
241
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using pll = pair<ll, ll>; #define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i) #define all(x) (x).begin(), (x).end() template <class T1, class T2> inline void chmax(T1 &a, const T2 &b) { if (a < b) a...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using pll = pair<ll, ll>; #define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i) #define all(x) (x).begin(), (x).end() template <class T1, class T2> inline void chmax(T1 &a, const T2 &b) { if (a < b) a...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
407
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 3; int num[N]; int main() { int n, x; cin >> n; int z = 0; for (int i = 1; i <= n; i++) { cin >> x; num[x]++; z = __gcd(z, x); } if (z != 1) { cout << "not coprime" << endl; return 0; } for (int i = 1; i < N; i++) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 3; int num[N]; int main() { int n, x; cin >> n; int z = 0; for (int i = 1; i <= n; i++) { cin >> x; num[x]++; z = __gcd(z, x); } if (z != 1) { cout << "not coprime" << endl; return 0; } for (int i = 2; i < N; i++) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
169
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define irep(i, n) for (int i = (int)(n)-1; i >= 0; --i) using namespace std; using ll = long long; using PL = pair<ll, ll>; using P = pair<int, int>; constexpr int INF = 1000000000; constexpr long long HINF = 1000000000000000; constexpr long...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define irep(i, n) for (int i = (int)(n)-1; i >= 0; --i) using namespace std; using ll = long long; using PL = pair<ll, ll>; using P = pair<int, int>; constexpr int INF = 1000000000; constexpr long long HINF = 1000000000000000; constexpr long...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
489
#include <bits/stdc++.h> using namespace std; void sieve(vector<vector<int>> &g) { vector<int> sv(g.size(), true); for (int i = 2; i * i < sv.size(); ++i) { if (!sv.at(i)) continue; for (int j = i + i; j < sv.size(); j += i) { sv.at(j) = false; g.at(j).emplace_back(i); } } } int ma...
#include <bits/stdc++.h> using namespace std; void sieve(vector<vector<int>> &g) { vector<int> sv(g.size(), true); for (int i = 2; i < sv.size(); ++i) { if (!sv.at(i)) continue; for (int j = i + i; j < sv.size(); j += i) { sv.at(j) = false; g.at(j).emplace_back(i); } } } int main()...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22]]
1
368
/* Atcoder ABC177E */ #include <bits/stdc++.h> using namespace std; #define int long long int n, a[1000005]; bool apr[1000005]; signed main() { cin >> n; for (int i = 1; i <= n; cin >> a[i++]) ; int gcd = a[1]; for (int i = 2; i <= n; i++) gcd = __gcd(gcd, a[i]); for (int i = 1; i <= n; i++) { ...
/* Atcoder ABC177E */ #include <bits/stdc++.h> using namespace std; #define int long long int n, a[1000005]; bool apr[1000005]; signed main() { cin >> n; for (int i = 1; i <= n; cin >> a[i++]) ; int gcd = a[1]; for (int i = 2; i <= n; i++) gcd = __gcd(gcd, a[i]); for (int i = 1; i <= n; i++) { ...
[["-", 64, 9, 0, 52, 15, 339, 51, 16, 17, 79], ["+", 64, 9, 0, 52, 15, 339, 51, 16, 17, 60]]
1
241
// author: tarang #include <bits/stdc++.h> #define ll long long #define endl '\n' #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
// author: tarang #include <bits/stdc++.h> #define ll long long #define endl '\n' #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
304
from math import gcd def main(): input() # N array = [int(x) for x in input().split()] MAX_A = 10 ** 6 + 2 histgram = [0] * MAX_A for x in array: histgram[int(x)] += 1 pairwise = True for divider in range(2, MAX_A): count = 0 for counted in histgram[divider::divide...
from math import gcd def main(): input() # N array = [int(x) for x in input().split()] MAX_A = 10 ** 6 + 2 histgram = [0] * MAX_A for x in array: histgram[int(x)] += 1 pairwise = True for divider in range(2, MAX_A): count = 0 for counted in histgram[divider::divide...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
148
#include <algorithm> #include <cstdlib> #include <iostream> #include <iterator> #include <list> #include <set> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) typedef pair<int, int> P; int n; int a[1000005]; int cnt[1000005]; bool pairwise = true; int gcd(int...
#include <algorithm> #include <cstdlib> #include <iostream> #include <iterator> #include <list> #include <set> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) typedef pair<int, int> P; int n; int a[1000005]; int cnt[1000005]; bool pairwise = true; int gcd(int...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
257
#include <algorithm> #include <cstdlib> #include <iostream> #include <iterator> #include <list> #include <set> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) typedef pair<int, int> P; int n; int a[1000005]; set<int> S[1000005]; set<int> A; bool pairwise = tru...
#include <algorithm> #include <cstdlib> #include <iostream> #include <iterator> #include <list> #include <set> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) typedef pair<int, int> P; int n; int a[1000005]; set<int> S[1000005]; set<int> A; bool pairwise = tru...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]]
1
384
#include <bits/stdc++.h> using namespace std; int n, a[1000010], g; vector<int> p; int cnt[1000010]; bool isprime(int x) { int s = sqrt(x); for (int i = 2; i <= s; i++) if (x % i == 0) return 0; return 1; } int main() { for (int i = 2; i <= 1000; i++) if (isprime(i)) p.push_back(i); scanf(...
#include <bits/stdc++.h> using namespace std; int n, a[1000010], g; vector<int> p; int cnt[1000010]; bool isprime(int x) { int s = sqrt(x); for (int i = 2; i <= s; i++) if (x % i == 0) return 0; return 1; } int main() { for (int i = 2; i <= 1000; i++) if (isprime(i)) p.push_back(i); scanf(...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
359
#include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define F first #define S second #define pss pair<string, string> #define pcc pair<char, char> #define pll pair<ll, ll> #define pii pair<int, int> #define piii pair<int, pii> #define vi vector<int> #define vii vector<pii> #define pb push_back ...
#include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define F first #define S second #define pss pair<string, string> #define pcc pair<char, char> #define pll pair<ll, ll> #define pii pair<int, int> #define piii pair<int, pii> #define vi vector<int> #define vii vector<pii> #define pb push_back ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
461
#include <bits/stdc++.h> using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define FOR(i, j, k, in) for (int i = j; i < k; i += in) #define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in) #define REP(i, j) FOR(i, 0, j, 1) #define RREP(i, j) RFOR(i, j, 0, 1) #define MP make_pair #define PB push_back #d...
#include <bits/stdc++.h> using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define FOR(i, j, k, in) for (int i = j; i < k; i += in) #define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in) #define REP(i, j) FOR(i, 0, j, 1) #define RREP(i, j) RFOR(i, j, 0, 1) #define MP make_pair #define PB push_back #d...
[["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 73]]
1
515
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #inc...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #inc...
[["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13]]
1
687
#include <bits/stdc++.h> #define FASTIO using namespace std; using ll = long long; using Vi = vector<int>; using Vl = vector<ll>; using Pii = pair<int, int>; using Pll = pair<ll, ll>; constexpr int I_INF = numeric_limits<int>::max(); constexpr ll L_INF = numeric_limits<ll>::max(); template <typename T1, typename T2>...
#include <bits/stdc++.h> #define FASTIO using namespace std; using ll = long long; using Vi = vector<int>; using Vl = vector<ll>; using Pii = pair<int, int>; using Pll = pair<ll, ll>; constexpr int I_INF = numeric_limits<int>::max(); constexpr ll L_INF = numeric_limits<ll>::max(); template <typename T1, typename T2>...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78]]
1
750
#include <algorithm> #include <cmath> //abs()かfabs()で少数絶対値 #include <cstdlib> //abs()で整数絶対値 #include <deque> #include <functional> //sort第三引数greater<型名>()で降順 #include <iomanip> //cout<<setw(数字) で空白による桁揃え #include <iostream> //cout<<right で右揃え #include <map> #include <queue> #include <string> #include <vector> u...
#include <algorithm> #include <cmath> //abs()かfabs()で少数絶対値 #include <cstdlib> //abs()で整数絶対値 #include <deque> #include <functional> //sort第三引数greater<型名>()で降順 #include <iomanip> //cout<<setw(数字) で空白による桁揃え #include <iostream> //cout<<right で右揃え #include <map> #include <queue> #include <string> #include <vector> u...
[["-", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["-", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]]
1
345
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef map<ll, ll>::iterator itll; typedef long double ld; typedef map<ll, ll> mapll; #define con continue #define pb push_back #define fi first #define se second #define fr front() #define INF 1000000000000000000 #define all...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef map<ll, ll>::iterator itll; typedef long double ld; typedef map<ll, ll> mapll; #define con continue #define pb push_back #define fi first #define se second #define fr front() #define INF 1000000000000000000 #define all...
[["-", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 27, 28, 69, 341, 342, 0, 27, 28, 22], ["-", 0, 27, 28, 69, 341, 342, 0, 27, 17, 29], ["+", 0, 1, 0, 27, 28, 69, 341, 342, 0, 22]]
1
543
#include <bits/stdc++.h> #define vc vector<int> #define um unordered_map<int, int> #define ll long long #define rep(i, a, b) for (__typeof(a) i = a; i < b; i++) #define si(a) a.size() #define all(a) a.begin(), a.end() #define ss(a) a.second #define ff(a) a.first #define M 1000000 #define pb push_back #define repit(i, a...
#include <bits/stdc++.h> #define vc vector<int> #define um unordered_map<int, int> #define ll long long #define rep(i, a, b) for (__typeof(a) i = a; i < b; i++) #define si(a) a.size() #define all(a) a.begin(), a.end() #define ss(a) a.second #define ff(a) a.first #define M 1000000 #define pb push_back #define repit(i, a...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
490
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define dup(x, y) (((x) + (y)-1) / (y)) #define ALL(x) (x).begin(), (x).end() typedef long long ll; typedef pair<int, int> pii; const double EPS = 1e-10; const int INF = 1e9; const ll LINF = 1e15; const int MOD = 1000000007; c...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define dup(x, y) (((x) + (y)-1) / (y)) #define ALL(x) (x).begin(), (x).end() typedef long long ll; typedef pair<int, int> pii; const double EPS = 1e-10; const int INF = 1e9; const ll LINF = 1e15; const int MOD = 1000000007; c...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
355
#include <bits/stdc++.h> /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>*/ #define pll pair<long long, long long> #define pb push_back #define ll long long #define ff first #define ss second #define D(x) cerr << #x " = " << (x) << endl #define vll vector<ll> #define IOS ...
#include <bits/stdc++.h> /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>*/ #define pll pair<long long, long long> #define pb push_back #define ll long long #define ff first #define ss second #define D(x) cerr << #x " = " << (x) << endl #define vll vector<ll> #define IOS ...
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]]
1
285
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD (long long)(1e9 + 7) #define INF (1LL << 60) #define rep(i, n) for (ll i = 0; i < (n); i++) #define rep1(i, n) for (ll i = 1; i <= (n); i++) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MOD (long long)(1e9 + 7) #define INF (1LL << 60) #define rep(i, n) for (ll i = 0; i < (n); i++) #define rep1(i, n) for (ll i = 1; i <= (n); i++) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
612
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define ALL(c) (c).begin(), (c).end() #define pb push_back #define eb emplace_back const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, in...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) #define ALL(c) (c).begin(), (c).end() #define pb push_back #define eb emplace_back const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, in...
[["+", 0, 11, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 48]]
1
460
#include <iostream> #include <vector> //ユークリッドの互除法 int GCD(int x, int y) { if (x % y == 0) { return y; } return GCD(y, x % y); } // O(A+NloglogN)解 int main() { using namespace std; int MAX_A = 1000000; vector<int> lowerst_prime(MAX_A + 1, 0); //最小の素因数をいれる(2以上をみていけばいい) vec...
#include <iostream> #include <vector> //ユークリッドの互除法 int GCD(int x, int y) { if (x % y == 0) { return y; } return GCD(y, x % y); } // O(A+NloglogN)解 int main() { using namespace std; int MAX_A = 1000000; vector<int> lowerst_prime(MAX_A + 1, 1e9); //最小の素因数をいれる(2以上をみていけばいい) v...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
347
import math N = int(input()) A = list(map(int, input().split())) maxA = max(A) + 1 C = [0] * maxA g = 0 for a in A: C[a] += 1 g = math.gcd(g, a) pairwise = True for i in range(2, maxA): cnt = 0 for j in range(i, maxA, i): cnt += C[j] if cnt > 1: pairwise = False if pairwise: ...
import math N = int(input()) A = list(map(int, input().split())) maxA = max(A) + 1 C = [0] * maxA g = 0 for a in A: C[a] += 1 g = math.gcd(g, a) pairwise = True for i in range(2, maxA): cnt = 0 for j in range(i, maxA, i): cnt += C[j] if cnt > 1: pairwise = False if pairwise: ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
139
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 1e6 + 10; const int mod = 1e9 + 7; ll a[maxn]; int mp[maxn]; int vis[maxn]; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { ios::sync_with_stdio(false); cin.tie...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 1e6 + 10; const int mod = 1e9 + 7; ll a[maxn]; int mp[maxn]; int vis[maxn]; ll gcd(ll a, ll b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { ios::sync_with_stdio(false); cin.tie...
[["+", 0, 7, 8, 9, 0, 338, 8, 9, 0, 46], ["-", 0, 338, 8, 9, 0, 57, 64, 9, 0, 46]]
1
400
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long bool ok = false; // ll fct[1000004]; set<ll> st; void f(ll x) { if (ok) return; for (ll i = 1; i * i <= x; i++) { if (x % i == 0) { ll a = i; ll b = a / i; if (a == b) { a = i; b = 1; ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long bool ok = false; // ll fct[1000004]; set<ll> st; void f(ll x) { if (ok) return; for (ll i = 1; i * i <= x; i++) { if (x % i == 0) { ll a = i; ll b = x / i; if (a == b) { a = i; b = 1; ...
[["-", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22]]
1
303
import math n = int(input()) a_list = list(map(int, input().split())) a_max = (10**6)+1 hist = [0] * a_max for a in a_list: hist[a] += 1 pairwise = True for i in range(2, a_max, 1): count = 0 for j in range(2, a_max, i): count += hist[j] if count > 1: pairwise = False if pairwise: ...
import math n = int(input()) a_list = list(map(int, input().split())) a_max = (10**6)+1 hist = [0] * a_max for a in a_list: hist[a] += 1 pairwise = True for i in range(2, a_max, 1): count = 0 for j in range(i, a_max, i): count += hist[j] if count > 1: pairwise = False if pairwise: ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
158
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1e9; int main() { int n; const int max_n = 1e6; int a[max_n + 1]; int max_a = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; max_a = max(max_a, a[i]); } // eratosthenes vector<int> d(max_a + 1...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1e9; int main() { int n; const int max_n = 1e6; int a[max_n + 1]; int max_a = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; max_a = max(max_a, a[i]); } // eratosthenes vector<int> d(max_a + 1...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
312
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const int MAX = 1000005; const int mod = 1000000007; /* global variables */ // vector<int> cnt(MAX, 0); vector<int> cnt(20, 0); vector<int> p(MAX); vector<int> a; int N; ...
#include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* constant */ const int INF = 1 << 30; const int MAX = 1000005; const int mod = 1000000007; /* global variables */ // vector<int> cnt(MAX, 0); vector<int> cnt(MAX, 0); vector<int> p(MAX); vector<int> a; int N;...
[["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 4, 0, 22]]
1
599
import math N = 1000001 spf = [*range(N)] i = 2 while i * i < N: if spf[i] == i: for j in range(i * i, N, i): if spf[j] == j: spf[j] = i i += 1 r = 'pairwise' input() d = None u = set() for x in map(int, input().split()): d = math.gcd(d or x, x); s = set() while x > 1: p = spf[x...
import math N = 1000001 spf = [*range(N)] i = 2 while i * i < N: if spf[i] == i: for j in range(i * i, N, i): if spf[j] == j: spf[j] = i i += 1 r = 'pairwise' input() d = None u = set() for x in map(int, input().split()): d = math.gcd(d or x, x); s = set() while x > 1: p = spf[x...
[["-", 0, 652, 3, 4, 0, 679, 31, 679, 12, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 679, 17, 354], ["+", 0, 1, 0, 652, 3, 4, 0, 679, 17, 354], ["+", 0, 1, 0, 652, 3, 4, 0, 679, 12, 22]]
5
162
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define F first ...
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define F first ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43...
1
317
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) using namespace std; typedef long long ll; const long long mod = 1000000007; int gcd(int n, int m) { if (n < m) swap(n, m); if (m == 0) return 0; while (m > 0) { int res = n % m; n = m; m = ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(x) int(x.size()) using namespace std; typedef long long ll; const long long mod = 1000000007; int gcd(int n, int m) { if (n < m) swap(n, m); if (m == 0) return n; // 0's deviser is all numbers. while (m > 0) { int re...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 22]]
1
277
#include <bits/stdc++.h> #define rep(i, start, end) for (long long i = start; i < end; ++i) #define repreverse(i, start, end) for (long long i = start; i >= end; --i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define len(x) ((long long)(x).size()) #define lcm(a, b) ((a) / __gcd((a),...
#include <bits/stdc++.h> #define rep(i, start, end) for (long long i = start; i < end; ++i) #define repreverse(i, start, end) for (long long i = start; i >= end; --i) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define len(x) ((long long)(x).size()) #define lcm(a, b) ((a) / __gcd((a),...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
958
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define all(v) (v).begin(), (v).end() using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vii = vector<vector<int>>; const ll LINF = 1LL << 60; const int INF = 1 << 29; const ll MOD = 1e9 + 7; template <typename T> bool...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define all(v) (v).begin(), (v).end() using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vii = vector<vector<int>>; const ll LINF = 1LL << 60; const int INF = 1 << 29; const ll MOD = 1e9 + 7; template <typename T> bool...
[["-", 0, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["-", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 0, 27, 28, 69, 341, 342, 0, 2, 63, 22], ["+", 28, 69, 341, 342, 0, 2, 3, 4, 0, 24], ["-", 28, 69, 341, 342, 0, 69, 341, 342, 0, 73], ["+", 28, 69, 341, 342, 0, 2, 3, 4, 0, 25]]
1
452
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { static final int INF = (int)(1e9 + 10); static final int MOD = (int)(1e9 + 7); // static final int N = (int) (4e5 + 5); // static ArrayList<Integer>[] graph; // static boolean visited[]; // ...
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { static final int INF = (int)(1e9 + 10); static final int MOD = (int)(1e9 + 7); // static final int N = (int) (4e5 + 5); // static ArrayList<Integer>[] graph; // static boolean visited[]; // ...
[["-", 0, 195, 8, 196, 0, 1, 0, 11, 12, 499], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 12, 499], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]]
3
1,581
#include <algorithm> #include <bitset> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; using intl = int64_t; using Graph = vector<vector<int>>; int mai...
#include <algorithm> #include <bitset> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; using intl = int64_t; using Graph = vector<vector<int>>; int mai...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 338, 12, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 338, 12, 69, 341, 342, 0, 22], ["-", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 31, 69, 341, 342, 0, 22]]
1
314
/*----------------------------------------------------* * लेखक --> अमित सिंह * संस्थान --> राष्ट्रीय प्रौद्योगिकी संस्थान, कुरुक्षेत्र *-----------------------------------------------------*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define w(t) ...
/*----------------------------------------------------* * लेखक --> अमित सिंह * संस्थान --> राष्ट्रीय प्रौद्योगिकी संस्थान, कुरुक्षेत्र *-----------------------------------------------------*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define w(t) ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
253
import sys sys.setrecursionlimit(10**9) n, m = map(int, input().split()) root = [-1] * n def find_root(x): if root[x] < 0: return x else: root[x] == find_root(root[x]) return root[x] def unite(x, y): x = find_root(x) y = find_root(y) if x == y: return root[x]...
import sys sys.setrecursionlimit(10**9) n, m = map(int, input().split()) root = [-1] * n def find_root(x): if root[x] < 0: return x else: root[x] = find_root(root[x]) return root[x] def unite(x, y): x = find_root(x) y = find_root(y) if x == y: return root[x] ...
[["-", 75, 76, 8, 196, 0, 1, 0, 666, 667, 60], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32]]
5
182
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1e9 #define PI 3.14159265359 #define MOD 1000000007 #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define F first #define S second typedef long long ll; const int dx[4] = {1, 0, -1, 0}...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1e9 #define PI 3.14159265359 #define MOD 1000000007 #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define F first #define S second typedef long long ll; const int dx[4] = {1, 0, -1, 0...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
487
#include <bits/stdc++.h> using namespace std; #define rp(i, k, n) for (int i = k; i < n; i++) typedef long long ll; typedef double ld; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (b < a...
#include <bits/stdc++.h> using namespace std; #define rp(i, k, n) for (int i = k; i < n; i++) typedef long long ll; typedef double ld; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (b < a...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
370
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define DEBUG(x) cout << #x << "=...
#include <algorithm> #include <cassert> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; #define DEBUG(x) cout << #x << "=...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40]]
1
722
#include <bits/stdc++.h> using namespace std; int f[200010]; int ans[200010]; int vis[200010]; int cnt = 1; vector<int> ve[200010]; map<int, int> ma[200010]; int val = 0; void dfs(int x) { int sz = ve[x].size(); for (int i = 0; i < sz; i++) { if (!vis[ve[x][i]]) { vis[ve[x][i]] = 1; val++; dfs...
#include <bits/stdc++.h> using namespace std; int f[200010]; int ans[200010]; int vis[200010]; int cnt = 1; vector<int> ve[200010]; map<int, int> ma[200010]; int val = 0; void dfs(int x) { int sz = ve[x].size(); for (int i = 0; i < sz; i++) { if (!vis[ve[x][i]]) { vis[ve[x][i]] = 1; val++; dfs...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
306