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
import numpy as np i4 = np.int32 i8 = np.int64 def find(x, parents): if parents[x] == x: return x else: return find(parents[x], parents) def union (x, y, parents, depth): x = find(x, parents) y = find(y, parents) if x == y: return if depth[x] == depth[y]: dep...
import numpy as np i4 = np.int32 i8 = np.int64 def find(x, parents): if parents[x] == x: return x else: return find(parents[x], parents) def union (x, y, parents, depth): x = find(x, parents) y = find(y, parents) if x == y: return if depth[x] == depth[y]: dep...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
309
#include <bits/stdc++.h> #define ll long long using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; //定数 //円周率 const double pi = 3.141592653589793238462643383279; //天井 const int INF = 1000000000; // = 10^9 const ll LINF = 100000000000000000; // = 10^17 // ABC文字列 const string ABC = "ABCDEFGHIJ...
#include <bits/stdc++.h> #define ll long long using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; //定数 //円周率 const double pi = 3.141592653589793238462643383279; //天井 const int INF = 1000000000; // = 10^9 const ll LINF = 100000000000000000; // = 10^17 // ABC文字列 const string ABC = "ABCDEFGHIJ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
1,256
#include <bits/stdc++.h> using namespace std; #define ll long long int #define T \ int t; \ cin >> t; \ whil...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define T \ int t; \ cin >> t; \ whil...
[["-", 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
323
import sys input = sys.stdin.readline ins = lambda: input().rstrip() ini = lambda: int(input().rstrip()) inm = lambda: map(int, input().split()) inl = lambda: list(map(int, input().split())) out = lambda x: print('\n'.join(map(str, x))) def dfs(x): stack = [x] visited = 0 checked[x] = 1 while stack: ...
import sys input = sys.stdin.readline ins = lambda: input().rstrip() ini = lambda: int(input().rstrip()) inm = lambda: map(int, input().rstrip().split()) inl = lambda: list(map(int, input().split())) out = lambda x: print('\n'.join(map(str, x))) def dfs(x): stack = [x] visited = 0 checked[x] = 1 while ...
[["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 8, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
267
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define watch(x) cout << (#x) << "=" << (x) << '\n' #define mset(d, val) memset(d, val, sizeof(d)) #define setp(x) cout << fixed << setprecision(x) #define forn(i, a, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define watch(x) cout << (#x) << "=" << (x) << '\n' #define mset(d, val) memset(d, val, sizeof(d)) #define setp(x) cout << fixed << setprecision(x) #define forn(i, a, ...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
582
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; #define For(i, n) for (int i = 0; i < (int)n; ++i) #define Rep(i, n) for (int i = 1; i <= (int)n; ++i) #define ll long long #define lld long double #define F first #define S second #define pb push_back #define endl "\n" #...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; #define For(i, n) for (int i = 0; i < (int)n; ++i) #define Rep(i, n) for (int i = 1; i <= (int)n; ++i) #define ll long long #define lld long double #define F first #define S second #define pb push_back #define endl "\n" #...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
347
/* � Ashiq Uddin Pranto Department of Computer Science and Engineering BATCH 27 University Of Rajshahi,Bangladesh */ #include <bits/stdc++.h> #define ll long long #define ld long double #define FOR(x, y) for (ll i = x; i <= y; i++) #define pb(x) push_back(x) #define mp make_pair #define pii pair<int, int> #de...
/* � Ashiq Uddin Pranto Department of Computer Science and Engineering BATCH 27 University Of Rajshahi,Bangladesh */ #include <bits/stdc++.h> #define ll long long #define ld long double #define FOR(x, y) for (ll i = x; i <= y; i++) #define pb(x) push_back(x) #define mp make_pair #define pii pair<int, int> #de...
[["-", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["-", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["-", 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]]
1
815
#include <bits/stdc++.h> typedef long long ll; #define REP(i, n) for (int i = 0; i < n; i++) #define REP2(i, a, b) for (int i = a; i <= b; i++) #define REPR(i, a, b) for (int i = a; i >= b; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define MOD 1000000007 #define PI 3.14159265358979323846 #de...
#include <bits/stdc++.h> typedef long long ll; #define REP(i, n) for (int i = 0; i < n; i++) #define REP2(i, a, b) for (int i = a; i <= b; i++) #define REPR(i, a, b) for (int i = a; i >= b; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 2e9 #define MOD 1000000007 #define PI 3.14159265358979323846 #de...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
635
#include <bits/stdc++.h> using namespace std; const int nax = 2e5 + 5; vector<int> grafo[nax]; queue<int> q; int n, m; bitset<nax> v; int bfs(int k) { int cont = 0; q.push(k); while (!q.empty()) { int co = q.front(); q.pop(); if (v[co]) continue; cont++; v[co] = 1; for (int x : graf...
#include <bits/stdc++.h> using namespace std; const int nax = 2e5 + 5; vector<int> grafo[nax]; queue<int> q; int n, m; bitset<nax> v; int bfs(int k) { int cont = 0; q.push(k); while (!q.empty()) { int co = q.front(); q.pop(); if (v[co]) continue; cont++; v[co] = 1; for (int x : graf...
[["-", 8, 9, 0, 338, 12, 69, 341, 342, 0, 22], ["+", 8, 9, 0, 338, 12, 69, 341, 342, 0, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
229
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; using P = pair<ll, ll>; constexpr ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) #define REPS(i, n) for (ll(i) = 1; (i) <= (n); (i)++) #define RREP(i, n) for (ll(i) = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; using P = pair<ll, ll>; constexpr ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) #define REPS(i, n) for (ll(i) = 1; (i) <= (n); (i)++) #define RREP(i, n) for (ll(i) = ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["-", 75, 76, 0, 9, 0, 1, 0, 11, 17, 32], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 17, 107]]
1
485
from collections import deque N, M = map(int, input().split()) edge = [[] for i in range(N)] for i in range(M): A, B = map(int, input().split()) A -= 1 B -= 1 edge[A].append(B) edge[B].append(A) ans = 0 color = [-1] * N nextcolor = 0 for st in range(N): if color[st] != -1: continue q = deque() q.append(st...
from collections import deque N, M = map(int, input().split()) edge = [[] for i in range(N)] for i in range(M): A, B = map(int, input().split()) A -= 1 B -= 1 edge[A].append(B) edge[B].append(A) ans = 0 color = [-1] * N nextcolor = 0 for st in range(N): if color[st] != -1: continue q = deque() q.append(st...
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
193
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; // using fs = unordered_set; //#define fs set//unordered_set vector<ll> S(0); ll FFi(ll i) { if (S[i] == i) return i; return S[i] = FFi(S[i]); } void marge(ll a, ll b) { ll aa = FFi(a), bb = FFi(b); if (aa == bb) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; // using fs = unordered_set; //#define fs set//unordered_set vector<ll> S(0); ll FFi(ll i) { if (S[i] == i) return i; return S[i] = FFi(S[i]); } void marge(ll a, ll b) { ll aa = FFi(a), bb = FFi(b); if (aa == bb) ...
[["+", 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, 2, 3, 4, 0, 25]]
1
303
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long // ll ad[200005][200005]; static const int num = 200005; vector<ll> ad[num]; ll vt[num]; ll sum = 1; void dfs(ll nd, ll pt) { vt[nd] = 1; for (auto it : ad[nd]) { if (it != pt && vt[it] == 0) { sum += 1; // cout<<...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long // ll ad[200005][200005]; static const int num = 200005; vector<ll> ad[num]; ll vt[num]; ll sum = 1; void dfs(ll nd, ll pt) { vt[nd] = 1; for (auto it : ad[nd]) { if (it != pt && vt[it] == 0) { sum += 1; // cout<<...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
226
#include <bits/stdc++.h> #define fr(i, a, n) for (ll i = a; i < n; i++) #define YES cout << "YES" << endl #define all(v) v.begin(), v.end() #define NO cout << "NO" << endl #define pb(x) emplace_back(x) #define fastio \ std::ios_base::sync_with_stdio(fals...
#include <bits/stdc++.h> #define fr(i, a, n) for (ll i = a; i < n; i++) #define YES cout << "YES" << endl #define all(v) v.begin(), v.end() #define NO cout << "NO" << endl #define pb(x) emplace_back(x) #define fastio \ std::ios_base::sync_with_stdio(fals...
[["+", 0, 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
273
#include <bits/stdc++.h> using namespace std; #define INF (1 << 30) #define EPS 1e-10 #define MOD 1000000007 #define rep(i, n) FOR(i, 0, n) #define FOR(i, x, n) for (int i = (x); i < (n); ++i) #define all(v) (v).begin(), (v).end() using ll = long long; template <class T> bool chmax(T &a, T b) { if (a < b) { ...
#include <bits/stdc++.h> using namespace std; #define INF (1 << 30) #define EPS 1e-10 #define MOD 1000000007 #define rep(i, n) FOR(i, 0, n) #define FOR(i, x, n) for (int i = (x); i < (n); ++i) #define all(v) (v).begin(), (v).end() using ll = long long; template <class T> bool chmax(T &a, T b) { if (a < b) { ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
354
// Youtube解説AC #include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) using ll = long long; const int MOD = 1e9 + 7; const int INF = 1001001001; // const ll INF = 1000000000000000000LL; const int A = 1000005; ll gcd(ll a, ll b) { if (a < b) swap(a, b); bool have_mod =...
// Youtube解説AC #include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < int(N); ++i) using ll = long long; const int MOD = 1e9 + 7; const int INF = 1001001001; // const ll INF = 1000000000000000000LL; const int A = 1000005; ll gcd(ll a, ll b) { if (a < b) swap(a, b); bool have_mod =...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
290
#include <bits/stdc++.h> using namespace std; #define ll long long int #define All(a) (a).begin(), (a).end() vector<int> X(1000001); ll gcd(ll a, ll b) { b %= a; if (b == 0) return a; else gcd(b, a); } void solve() { int n, m; scanf("%d", &n); vector<int> A(n); for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define All(a) (a).begin(), (a).end() vector<int> X(1000001); ll gcd(ll a, ll b) { b %= a; if (b == 0) return a; else gcd(b, a); } void solve() { int n, m; scanf("%d", &n); vector<int> A(n); for (int i = 0; i < n; i++) { ...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
281
#include <bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define mes(a, b) memset((a), (b), sizeof((a))) #define syio \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define mes(a, b) memset((a), (b), sizeof((a))) #define syio \ std::ios::sync_with_stdio(false); \ std::cin.tie(0); ...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
456
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; typedef complex<double> cp; #define debug(a) cout << #a << ":" << a << endl; #define fr freopen("in.txt", "r", stdin); #define Fill(x, a) memset(x, a, sizeof(x)) #define cpy(a, b) memcpy(a, b, sizeof(a)) const double PI = acos(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; typedef complex<double> cp; #define debug(a) cout << #a << ":" << a << endl; #define fr freopen("in.txt", "r", stdin); #define Fill(x, a) memset(x, a, sizeof(x)) #define cpy(a, b) memcpy(a, b, sizeof(a)) const double PI = acos(...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
522
#include <bits/stdc++.h> using namespace std; #define int long long const int mxn = 1e6 + 3, du = 1e9 + 7; int n; int a[mxn]; int seive[mxn]; int cnt[mxn]; int ok; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); for (int i = 2; i <= 1000; i++) if (!seive[i]) for (int j = i *...
#include <bits/stdc++.h> using namespace std; #define int long long const int mxn = 1e6 + 3, du = 1e9 + 7; int n; int a[mxn]; int seive[mxn]; int cnt[mxn]; int ok; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); for (int i = 2; i <= 1000; i++) if (!seive[i]) for (int j = i *...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
291
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep2(i, n) f...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep2(i, n) f...
[["-", 0, 57, 64, 9, 0, 7, 26, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 26, 11, 12, 22]]
1
798
#include <bits/stdc++.h> using namespace std; // bit op int popcnt(unsigned int x) { return __builtin_popcount(x); } int popcnt(unsigned long long x) { return __builtin_popcountll(x); } int bsr(unsigned int x) { return 31 - __builtin_clz(x); } int bsr(unsigned long long x) { return 63 - __builtin_clzll(x); } int bsf(...
#include <bits/stdc++.h> using namespace std; // bit op int popcnt(unsigned int x) { return __builtin_popcount(x); } int popcnt(unsigned long long x) { return __builtin_popcountll(x); } int bsr(unsigned int x) { return 31 - __builtin_clz(x); } int bsr(unsigned long long x) { return 63 - __builtin_clzll(x); } int bsf(...
[["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
3,666
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 1; int m[N], vis[N]; int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); int n; cin >> n; int a[n]; for (int i = 0; i < N; i++) m[i] = vis[i] = 0; for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]]++; } bool chec...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 1; int m[N], vis[N]; int main() { // freopen("input.txt","r",stdin); ios_base::sync_with_stdio(false), cin.tie(nullptr); int n; cin >> n; int a[n]; for (int i = 0; i < N; i++) m[i] = vis[i] = 0; for (int i = 0; i < n; i++) { cin >> ...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 64, 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
272
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a; int maxV = 1e6 + 1; bool flag[maxV] = {0}; int gcd = 0; for (int i = 0; i < n; i++) { cin >> a; flag[a] = 1; gcd = __gcd(gcd, a); } bool f1 = true; for (int i = 2; i < maxV; i++) { int cnt = 0;...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a; int maxV = 1e6 + 1; int flag[maxV] = {0}; int gcd = 0; for (int i = 0; i < n; i++) { cin >> a; flag[a]++; gcd = __gcd(gcd, a); } bool f1 = true; for (int i = 2; i < maxV; i++) { int cnt = 0; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
185
#include <cmath> #include <iostream> #include <set> #include <vector> #define N 1000000 typedef long long ll; using namespace std; int prime[N + 1]; int D[N + 1]; int used[N + 1]; int main() { for (int i = 0; i <= N; ++i) { prime[i] = 1; D[i] = i; used[i] = 0; } prime[0] = prime[1] = 0; int p ...
#include <cmath> #include <iostream> #include <set> #include <vector> #define N 1000000 typedef long long ll; using namespace std; int prime[N + 1]; int D[N + 1]; int used[N + 1]; int main() { for (int i = 0; i <= N; ++i) { prime[i] = 1; D[i] = i; used[i] = 0; } prime[0] = prime[1] = 0; int p ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
386
from math import gcd N = int(input()) A = list(map(int,input().split())) g = A[0] for i in range(1,N): g = gcd(g,A[i]) if g>1: print("not comprime") exit() MAXN = 10**6 + 9 D = [i for i in range(MAXN+1)] p = 2 while(p*p <=MAXN): if D[p]==p: for q in range(2*p,MAXN+1,p): if D[q]==q...
from math import gcd N = int(input()) A = list(map(int,input().split())) g = A[0] for i in range(1,N): g = gcd(g,A[i]) if g>1: print("not coprime") exit() MAXN = 10**6 + 9 D = [i for i in range(MAXN+1)] p = 2 while(p*p <=MAXN): if D[p]==p: for q in range(2*p,MAXN+1,p): if D[q]==q:...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
212
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define MOD 1000000007LL #define rep(i, n) for (ll(i) = 0LL; (i) < (ll)(n); (i)++) #define rep2(i, s, e) for (ll(i) = (ll)(s); (i) < (ll)(e); (i)++) #define repi(i, n) for (ll(i) = 0LL; (i) <= ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define MOD 1000000007LL #define rep(i, n) for (ll(i) = 0LL; (i) < (ll)(n); (i)++) #define rep2(i, s, e) for (ll(i) = (ll)(s); (i) < (ll)(e); (i)++) #define repi(i, n) for (ll(i) = 0LL; (i) <= ...
[["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
706
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; int a[n]; const int mxnum = 1000001; int num[mxnum]; for (int i = 0; i < mxnum; i++) { num[i] = 0; } for (int i = 0; i < n; i++) { cin >> a[i]; num[a[i]]++; } bool pw = true; for (int ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; int a[n]; const int mxnum = 1000001; int num[mxnum]; for (int i = 0; i < mxnum; i++) { num[i] = 0; } for (int i = 0; i < n; i++) { cin >> a[i]; num[a[i]]++; } bool pw = true; for (int ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
240
import sys input = sys.stdin.buffer.readline def main(): N = int(input()) a = list(map(int,input().split())) pr = [0]*(max(a)+1) flag = True for num in a: pr[num] += 1 for i in range(2, max(a)+1): count = sum(pr[i::i]) if count == N: print("not coprime") ...
import sys input = sys.stdin.buffer.readline def main(): N = int(input()) a = list(map(int,input().split())) pr = [0]*(max(a)+1) flag = True for num in a: pr[num] += 1 for i in range(2, max(a)+1): count = sum(pr[i::i]) if count == N: print("not coprime") ...
[["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
142
#include <bits/stdc++.h> using namespace std; const int MX = 1'000'000 + 1; int main() { int n; cin >> n; vector<int> a(n); int p[MX]; for (int &i : a) { cin >> i; p[i]++; } int pw = 1; for (int i = 2; i < MX; i++) { int cnt = 0; for (int j = i; j < MX; j += i) cnt += p[j]; if...
#include <bits/stdc++.h> using namespace std; const int MX = 1'000'000 + 1; int main() { int n; cin >> n; vector<int> a(n); int p[MX] = {0}; for (int &i : a) { cin >> i; p[i]++; } int pw = 1; for (int i = 2; i < MX; i++) { int cnt = 0; for (int j = i; j < MX; j += i) cnt += p[j]; ...
[["+", 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, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
198
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; int ky[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int kx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; i...
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; int ky[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int kx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; i...
[["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]]
1
404
from math import gcd MAX = 10**6 sieve = [i for i in range(MAX+1)] p = 2 while p * p <= MAX: if sieve[p] == p: for i in range(p*2, MAX+1, p): if sieve[i] == i: sieve[i] = p p += 1 N = int(input()) A = list(map(int, input().split())) pf = [] for a in A: tmp = set() ...
from math import gcd MAX = 10**6 sieve = [i for i in range(MAX+1)] p = 2 while p * p <= MAX: if sieve[p] == p: for i in range(p*2, MAX+1, p): if sieve[i] == i: sieve[i] = p p += 1 N = int(input()) A = list(map(int, input().split())) pf = [] for a in A: tmp = set() ...
[["-", 0, 656, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 206, 51, 22]]
5
230
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define int long long int const int mod = 1000000007; #define PI 3.1415926535897932384626 typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpii; map<int, int> primes; void fa...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define int long long int const int mod = 1000000007; #define PI 3.1415926535897932384626 typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpii; map<int, int> primes; void fa...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 28, 22]]
1
282
#include <bits/stdc++.h> using namespace std; #define MAX_SIZE 1000005 int nums[MAX_SIZE]; vector<bool> check(MAX_SIZE, false); int main() { int n; scanf("%d", &n); memset(nums, 0, sizeof(nums)); int max_a = 0; for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); nums[x]++; if (x > max_a...
#include <bits/stdc++.h> using namespace std; #define MAX_SIZE 1000005 int nums[MAX_SIZE]; vector<bool> check(MAX_SIZE, false); int main() { int n; scanf("%d", &n); memset(nums, 0, sizeof(nums)); int max_a = 0; for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); nums[x]++; if (x > max_a...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
245
#include <bits/stdc++.h> using namespace std; #define int long long #define tcase \ int _; \ cin >> _; \ while (...
#include <bits/stdc++.h> using namespace std; #define int long long #define tcase \ int _; \ cin >> _; \ while (...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13]]
1
325
def divplis(N): lis = [i for i in range(N+1)] for i in range(int(N**0.5+1),1,-1): if lis[i] == i: lis[i::i] = [i]*(N//i) return lis divp = divplis(10**6+1) N = int(input()) d = [0]*(10**6+1) A = [int(i) for i in input().split()] def pfact(N): b = 0 while N != 1: n = di...
def divplis(N): lis = [i for i in range(N+1)] for i in range(int(N**0.5+1),1,-1): if lis[i] == i: lis[i::i] = [i]*(N//i) return lis divp = divplis(10**6+1) N = int(input()) d = [0]*(10**6+1) A = [int(i) for i in input().split()] def pfact(N): b = 0 while N != 1: n = di...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 19]]
5
202
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <memory> #include <queue> #inc...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
3,347
#include <bits/stdc++.h> using namespace std; const int A = 1000005; int main() { int n; cin >> n; vector<int> a(n); //頻度を求める配列 vector<int> c(A); for (int i = 0; i < n; ++i) { cin >> a[i]; c[a[i]]++; } bool pairwise = true; for (int i = 2; i < A; ++i) { int cnt = 0; for (int j = i;...
#include <bits/stdc++.h> using namespace std; const int A = 1000005; int main() { int n; cin >> n; vector<int> a(n); //頻度を求める配列 vector<int> c(A); for (int i = 0; i < n; ++i) { cin >> a[i]; c[a[i]]++; } bool pairwise = true; for (int i = 2; i < A; ++i) { int cnt = 0; for (int j = i;...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
217
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i) static const ll INFTY = 1L << 62L; void solver(ll *a, ll n) { ll ans = a[0]; rep(i, 1, n) ans = gcd(ans, a[i]); if (ans != 1) { cout << "not coprime\n"; return; } ll...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i) static const ll INFTY = 1L << 62L; void solver(ll *a, ll n) { ll ans = a[0]; rep(i, 1, n) ans = gcd(ans, a[i]); if (ans != 1) { cout << "not coprime\n"; return; } ll...
[["+", 51, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
300
#include <iostream> #include <stdio.h> //#include <bits/stdc++.h> #include <algorithm> #include <array> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <float.h> #include <iomanip> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #...
#include <iostream> #include <stdio.h> //#include <bits/stdc++.h> #include <algorithm> #include <array> #include <cassert> #include <cmath> #include <cstdint> #include <cstring> #include <float.h> #include <iomanip> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13]]
1
545
#include <algorithm> #include <cmath> #include <iostream> #include <unordered_set> #include <vector> using namespace std; int main() { vector<int> prime; bool judge; prime.push_back(2); for (int i = 3; i < 1000; i++) { judge = true; for (int j = 0; j < (int)prime.size(); j++) { if (prime[j] > sqr...
#include <algorithm> #include <cmath> #include <iostream> #include <unordered_set> #include <vector> using namespace std; int main() { vector<int> prime; bool judge; prime.push_back(2); for (int i = 3; i < 1000; i++) { judge = true; for (int j = 0; j < (int)prime.size(); j++) { if (prime[j] > sqr...
[["-", 0, 57, 15, 339, 51, 16, 12, 2, 63, 22], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 24], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 22], ["-", 15, 339, 51, 16, 12, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
457
n = int(input()) A = list(map(int, input().split())) maxV = (10 ** 6 + 1) sieve = [i for i in range(maxV)] p = 2 while p*p < maxV: if sieve[p] == p: for q in range(p*2, maxV, p): if sieve[q] == q: sieve[q] = p p += 1 from math import gcd g = 0 primes = set() for a in A: ...
n = int(input()) A = list(map(int, input().split())) maxV = (10 ** 6 + 1) sieve = [i for i in range(maxV)] p = 2 while p*p < maxV: if sieve[p] == p: for q in range(p*2, maxV, p): if sieve[q] == q: sieve[q] = p p += 1 from math import gcd g = 0 primes = set() for a in A: ...
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
194
n=int(input()) A=[int(x) for x in input().split()] u=10**6+1 C=[0]*u D=[0]*2+[1]*(u-2) def e(): n=4 while n<u: D[n]=0 n+=2 i=3 while i*i<u: if D[i]: n=i*2 while n<u: D[n]=0 n+=i i+=2 def gcd(a,b): while a%b: a,b=b,a%b return b for a in A: C[a]+=1 e() ...
n=int(input()) A=[int(x) for x in input().split()] u=10**6+1 C=[0]*u D=[0]*2+[1]*(u-2) def e(): n=4 while n<u: D[n]=0 n+=2 i=3 while i*i<u: if D[i]: n=i*2 while n<u: D[n]=0 n+=i i+=2 def gcd(a,b): while a%b: a,b=b,a%b return b for a in A: C[a]+=1 e() ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
246
from math import gcd """ pairwise coprimeであるための条件は、全てのAに関して素因数に重複がないことである。 したがって、各Aに関して素因数分解を行う⇒各数の素因数の種類数をカウントし総和する。⇒全体の素因数の種類数をカウントし、先ほどの総和と比較する。 """ N = int(input()) A = list(map(int,input().split())) primes = [] def primeFinder(n): memo = [1]*(n+1) memo[0] = 0 memo[1] = 0 for i in range(2,n+1): ...
from math import gcd """ pairwise coprimeであるための条件は、全てのAに関して素因数に重複がないことである。 したがって、各Aに関して素因数分解を行う⇒各数の素因数の種類数をカウントし総和する。⇒全体の素因数の種類数をカウントし、先ほどの総和と比較する。 """ N = int(input()) A = list(map(int,input().split())) primes = [] def primeFinder(n): memo = [1]*(n+1) memo[0] = 0 memo[1] = 0 for i in range(2,n+1): ...
[["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22]]
5
255
from math import gcd from functools import reduce def make_prime_table(n): sieve = list(range(n + 1)) sieve[0] = -1 sieve[1] = -1 for i in range(4, n + 1, 2): sieve[i] = 2 for i in range(3, int(n ** 0.5) + 1, 2): if sieve[i] != i: continue for j in range(i * i, n...
from math import gcd from functools import reduce def make_prime_table(n): sieve = list(range(n + 1)) sieve[0] = -1 sieve[1] = -1 for i in range(4, n + 1, 2): sieve[i] = 2 for i in range(3, int(n ** 0.5) + 1, 2): if sieve[i] != i: continue for j in range(i * i, n...
[["-", 12, 652, 3, 4, 0, 657, 31, 664, 28, 531], ["+", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
291
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexp...
#include <algorithm> #include <bitset> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template <class T> constexp...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
248
#E_Coprime import math import functools # エラトステネスの篩 def primes(n): is_prime = [1] * (n + 1) is_prime[0] = 0 is_prime[1] = 0 D_prime = [i for i in range(n+1)] D_prime[0] = 0 D_prime[1] = 1 for i in range(2, int(n**0.5) + 1): if not is_prime[i]: D_prime[i] = i ...
#E_Coprime import math import functools # エラトステネスの篩 def primes(n): is_prime = [1] * (n + 1) is_prime[0] = 0 is_prime[1] = 0 D_prime = [i for i in range(n+1)] D_prime[0] = 0 D_prime[1] = 1 for i in range(2, int(n**0.5) + 1): if not is_prime[i]: D_prime[i] = i ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
333
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; // Policy based data structure typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; #define ll long long int #define pii pair<ll, ll> ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; // Policy based data structure typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; #define ll long long int #define pii pair<ll, ll> ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 9, 0, 57, 64, 116, 0, 35], ["-", 0, 9, 0, 1, 0, 11, 31, 69, 28, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 8, 9...
1
458
#include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (n - 1); i > (a - 1); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) #define rirep(i, x) f...
#include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define reps(i, a, n) for (int i = (n - 1); i > (a - 1); --i) #define arep(i, x) for (auto &&i : (x)) #define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i) #define rirep(i, x) f...
[["+", 8, 9, 0, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
687
#include <algorithm> #include <iostream> using namespace std; const int sz = 1e6 + 1; bool sieve[sz], f; int cnt[sz], num[sz]; inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } void func(int n) { int d = 2, pre = 0; while (sieve[n]) { if (n % d == 0) { n /= d; if (pre != d) { ...
#include <algorithm> #include <iostream> using namespace std; const int sz = 1e6 + 1; bool sieve[sz], f; int cnt[sz], num[sz]; inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } void func(int n) { int d = 2, pre = 0; while (sieve[n]) { if (n % d == 0) { n /= d; if (pre != d) { ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
342
import static java.lang.System.out; import java.io.*; import java.util.*; public class Main { static MyReader in = new MyReader(); public static void main(String[] args) { int N = in.i(); int[] A = in.ii(N); String ans = solve(N, A); out.println(ans); } static String solve(int N, int[] A) { ...
import static java.lang.System.out; import java.io.*; import java.util.*; public class Main { static MyReader in = new MyReader(); public static void main(String[] args) { int N = in.i(); int[] A = in.ii(N); String ans = solve(N, A); out.println(ans); } static String solve(int N, int[] A) { ...
[["-", 0, 57, 64, 196, 0, 37, 0, 5, 0, 491], ["+", 0, 57, 64, 196, 0, 37, 0, 5, 0, 491]]
3
842
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) using P = pair<ll, ll>; int main() { ll n; cin >> n; vector<ll> a(n); vector<ll> c(1000005, 0); rep(i, n) { cin >> a.at(i); c.at(a.at(i))++; ...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) using P = pair<ll, ll>; int main() { ll n; cin >> n; vector<ll> a(n); vector<ll> c(1000005, 0); rep(i, n) { cin >> a.at(i); c.at(a.at(i))++; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
241
#include <bits/stdc++.h> using namespace std; const int N = 2e6; long long prime[N]; int freq[N]; bool seive() { for (int i = 2; i <= 1e6; i++) { if (!prime[i]) { int c = 0; for (int j = 2 * i; j <= 1e6; j += i) { prime[j]++; if (freq[j]) { if (c) return false; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e6; long long prime[N]; int freq[N]; bool seive() { for (int i = 2; i <= 1e6; i++) { // if(freq[i]>1)return false ; if (!prime[i]) { int c = 0; for (int j = i; j <= 1e6; j += i) { prime[j]++; if (freq[j]) { if...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
225
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; #define sync \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define input(arr, n) ...
#include <bits/stdc++.h> typedef long long int ll; typedef long double ld; #define sync \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define input(arr, n) ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
611
#include <bits/stdc++.h> #define be(v) (v).begin(), (v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod = 1000000007, INF = (1LL << 60); #define doublecout(a) cout << fixed << setprecision(10) << a << endl; bool mp[1000001]; int p[1000001]; int M = 1000000; bool prime(int n) { ...
#include <bits/stdc++.h> #define be(v) (v).begin(), (v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod = 1000000007, INF = (1LL << 60); #define doublecout(a) cout << fixed << setprecision(10) << a << endl; bool mp[1000001]; int p[1000001]; int M = 1000000; bool prime(int n) { ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 132], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 90]]
1
379
import sys input = sys.stdin.buffer.readline def gcd(a: int, b: int) -> int: """a, bの最大公約数(greatest common divisor: GCD)を求める 計算量: O(log(min(a, b))) """ while b: a, b = b, a % b return a def multi_gcd(array: list) -> int: """arrayのGCDを求める""" n = len(array) ans = array[0] fo...
import sys input = sys.stdin.buffer.readline def gcd(a: int, b: int) -> int: """a, bの最大公約数(greatest common divisor: GCD)を求める 計算量: O(log(min(a, b))) """ while b: a, b = b, a % b return a def multi_gcd(array: list) -> int: """arrayのGCDを求める""" n = len(array) ans = array[0] fo...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
319
#include <array> #include <iostream> #include <limits> #include <utility> #include <vector> constexpr int MAX_A = 1'000'000; std::array<int, MAX_A + 1> minPrime; int main(void) { std::fill(minPrime.begin(), minPrime.end(), std::numeric_limits<int>::max()); minPrime[0] = 1; minPrime[1] = 1; for (int p = 2; p <...
#include <array> #include <iostream> #include <limits> #include <utility> #include <vector> constexpr int MAX_A = 1'000'000; std::array<int, MAX_A + 1> minPrime; int main(void) { std::fill(minPrime.begin(), minPrime.end(), std::numeric_limits<int>::max()); minPrime[0] = 1; minPrime[1] = 1; for (int p = 2; p <...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
448
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; bool pairwise = true; vector<int> atable(10000005, 0); vector<int> A(N); for (auto &&e : A) { cin >> e; if (atable[e] > 0) { pairwise = false; } atable[e]++;...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; bool pairwise = true; vector<int> atable(10000005, 0); vector<int> A(N); for (auto &&e : A) { cin >> e; if (e > 1 && atable[e] > 0) { pairwise = false; } ata...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48]]
1
259
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, cnt[N], freq[N], x[N], vi[N]; int main() { #ifdef LOCAL freopen("input", "r", stdin); #endif scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &x[i]); freq[x[i]]++; } for (int i = 0; i < n; i++) { if (vi[x[i...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, cnt[N], freq[N], x[N], vi[N]; int main() { #ifdef LOCAL freopen("input", "r", stdin); #endif scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &x[i]); freq[x[i]]++; } for (int i = 0; i < n; i++) { if (vi[x[i...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
346
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fir first #define sec second #define SZ(a) (int)((a).size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef double db; typedef pair<int, int> Pii; typedef pair<ll, int> Pli; typedef unsigned long long ul...
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fir first #define sec second #define SZ(a) (int)((a).size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef double db; typedef pair<int, int> Pii; typedef pair<ll, int> Pli; typedef unsigned long long ul...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 15, 16, 12, 74, 51, 23, 0, 13], ["+", 0, 7, 15, 16, 12, 74, 51, 23, 0, 13]]
1
379
import sys import math def soinsu(dic, x): i = 2 while i*i <= x: if x % i == 0 and i in dic.keys(): print(i, dic) return False while x % i == 0: dic.setdefault(i, 0) dic[i] += 1 x //= i i += 1 if x == 1: return True if x in dic.keys(): ...
import sys import math def soinsu(dic, x): i = 2 while i*i <= x: if x % i == 0 and i in dic.keys(): return False while x % i == 0: dic.setdefault(i, 0) dic[i] += 1 x //= i i += 1 if x == 1: return True if x in dic.keys(): return False ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
219
import sys input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return input().rstrip().decode() def II(): return int(input()) def FI(): return float(input()) def MI(): return map(int,input().split()) def MF(): return map(float,input().split()) def LI(): return li...
import sys input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return input().rstrip().decode() def II(): return int(input()) def FI(): return float(input()) def MI(): return map(int,input().split()) def MF(): return map(float,input().split()) def LI(): return li...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 31, 612], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 48], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["+", 3, 4, 0, 657, 31, 657, 12, 657, 12, 612], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612...
5
363
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define fileio ...
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define fileio ...
[["-", 0, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 0, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
322
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define all(x) (x).beg...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define all(x) (x).beg...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
487
#include <bits/stdc++.h> using namespace std; const int mod = (int)(1e9) + 7; using ll = long long; vector<int> v(1000005); int cnt[1000005]; int main() { vector<int> primes; for (int i = 2; i <= 1005; i++) { int sq = sqrt(i); int f = 0; for (int j = 2; j <= sq; j++) { if (i % j == 0) ...
#include <bits/stdc++.h> using namespace std; const int mod = (int)(1e9) + 7; using ll = long long; vector<int> v(1000005); int cnt[1000005]; int main() { vector<int> primes; for (int i = 2; i <= 1005; i++) { int sq = sqrt(i); int f = 0; for (int j = 2; j <= sq; j++) { if (i % j == 0) ...
[["+", 64, 9, 0, 52, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
374
#include <bits/stdc++.h> #include <math.h> #include <time.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) const ll MOD = 1000000007; const long double PI = 3.14159265358979; const ll MAX = 0; bool IsPrime(ll num) { if (num < 2) return false; else if (num == 2) ret...
#include <bits/stdc++.h> #include <math.h> #include <time.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < n; i++) const ll MOD = 1000000007; const long double PI = 3.14159265358979; const ll MAX = 0; bool IsPrime(ll num) { if (num < 2) return false; else if (num == 2) ret...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
623
#include <bits/stdc++.h> using namespace std; using lint = long int; #define MAX 1000010 int N, tmp, a, GCD; vector<lint> A(1000010); vector<lint> spf(1000010); vector<lint> emerge(1000010, 0); bool SC = true, PC = true; int gcd(int x, int y) { if (x % y == 0) return y; else return gcd(y, x % y); } int m...
#include <bits/stdc++.h> using namespace std; using lint = long int; #define MAX 1000000 int N, tmp, a, GCD; vector<lint> A(1000010); vector<lint> spf(1000010); vector<lint> emerge(1000010, 0); bool SC = true, PC = true; int gcd(int x, int y) { if (x % y == 0) return y; else return gcd(y, x % y); } int m...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98]]
1
380
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define MOD 1000000007 #define MAX 100010 #define aout(a) \ REP(i, sizeof(a)) cout << a[i] << " "; ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define MOD 1000000007 #define MAX 100010 #define aout(a) \ REP(i, sizeof(a)) cout << a[i] << " "; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
427
#include <bits/stdc++.h> using namespace std; int a[2000005], b[2000005]; int mx = 1000005, cc = 0; bool vis[2000005]; bool sieve() { int cnt = 0; for (int i = 2; i <= mx; i += 2) { if (b[i] != 0) cnt += b[i]; vis[i] = true; } if (cnt > 1) return false; for (int i = 3; i <= mx; i++) { i...
#include <bits/stdc++.h> using namespace std; int a[2000005], b[2000005]; int mx = 1000005, cc = 0; bool vis[2000005]; bool sieve() { int cnt = 0; for (int i = 2; i <= mx; i += 2) { if (b[i] != 0) cnt += b[i]; vis[i] = true; } if (cnt > 1) return false; for (int i = 3; i * i <= mx; i++) { ...
[["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 22], ["-", 64, 1, 0, 11, 12, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 12, 69, 341, 342, 0, 22]]
1
363
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; using pii = pair<int, int>; using vi ...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> #define reps(i, s, n) for (int(i) = (s); (i) < (n); (i)++) #define rep(i, n) reps(i, 0, n) using namespace std; using ll = long long; using pii = pair<int, int>; using vi ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 57, 0, 121], ["+", 0, 57, 64, 9, 0, 57, 15, 339, 0, 24], ["+", 64, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
358
from functools import reduce from itertools import combinations from math import gcd def func(A): is_A = [False] * (10**6+1) for a in A: is_A[a] = True if all(x < 1 for x in is_A[2:]): return False n = 0 for i in range(2, 10**6+1, 2): if is_A[i]: n += 1 if n...
from functools import reduce from itertools import combinations from math import gcd def func(A): is_A = [0] * (10**6+1) for a in A: is_A[a] += 1 if any(x > 1 for x in is_A[2:]): return False n = 0 for i in range(2, 10**6+1, 2): if is_A[i]: n += 1 if n > 1: ...
[["-", 0, 1, 0, 662, 12, 657, 31, 634, 0, 147], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 146], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612], ["-", 0, 14, 8, 196, 0, 57, 15, 652, 63, 22], ["+",...
5
226
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; // import java.util.ArrayList; // import java.util.Arrays; import java.util.HashMap; // import java.util.LinkedList; // import java.util.Queue; im...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; // import java.util.ArrayList; // import java.util.Arrays; import java.util.HashMap; // import java.util.LinkedList; // import java.util.Queue; im...
[["-", 0, 57, 64, 196, 0, 7, 26, 27, 0, 29], ["+", 0, 57, 64, 196, 0, 7, 26, 11, 17, 107], ["+", 0, 57, 64, 196, 0, 7, 26, 11, 12, 22]]
3
733
N=int(input()) A=list(map(int, input().split())) A=sorted(A) import math import bisect def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.appen...
N=int(input()) A=list(map(int, input().split())) A=sorted(A) import math import bisect def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.appen...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 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
390
#include <iostream> #include <unordered_map> #include <vector> const int ps[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 19...
#include <iostream> #include <unordered_map> #include <vector> const int ps[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 19...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
706
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int m; cin >> m; unordered_map<int, int> mp; vector<int> v(m); for (int &x : v) cin >> x, mp[x]++; int g = __gcd(v[0], v[1]); for (int i =...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int m; cin >> m; unordered_map<int, int> mp; vector<int> v(m); for (int &x : v) cin >> x, mp[x]++; int g = __gcd(v[0], v[1]); for (int i =...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
312
#include <bits/stdc++.h> using namespace std; using lli = long long; #define rep(i, n) for (int i = 0; i < n; i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } r...
#include <bits/stdc++.h> using namespace std; using lli = long long; #define rep(i, n) for (int i = 0; i < n; i++) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } r...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
321
import sys import math input_methods=['clipboard','file','key'] using_method=0 input_method=input_methods[using_method] tin=lambda : map(int, input().split()) lin=lambda : list(tin()) mod=1000000007 #+++++ def gcd(a, b): return math.gcd(a, b) def is_pc(al): mm=((10**6)+5) dd = [0]* mm kk = [-1]* mm for v i...
import sys import math input_methods=['clipboard','file','key'] using_method=0 input_method=input_methods[using_method] tin=lambda : map(int, input().split()) lin=lambda : list(tin()) mod=1000000007 #+++++ def gcd(a, b): return math.gcd(a, b) def is_pc(al): mm=((10**6)+5) dd = [0]* mm kk = [-1]* mm for v i...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107]]
5
381
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(obj) (obj).begin(), (obj).end() #define debug(var) \ do { \ ...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(obj) (obj).begin(), (obj).end() #define debug(var) \ do { \ ...
[["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 51, 16, 12, 69, 341, 342, 0, 16, 17, 85]]
1
803
### ---------------- ### ここから ### ---------------- import sys from io import StringIO import unittest import copy def resolve(): readline=sys.stdin.readline n=int(readline()) arr=list(map(int, readline().rstrip().split())) n=len(arr) be=[0]*(10**6+1) xxx=0 for i in range(n): be[arr...
### ---------------- ### ここから ### ---------------- import sys from io import StringIO import unittest import copy def resolve(): readline=sys.stdin.readline n=int(readline()) arr=list(map(int, readline().rstrip().split())) n=len(arr) be=[0]*(10**6+1) xxx=n for i in range(n): be[arr...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22]]
5
206
// Shinchan Loves Coding :))) #include <bits/stdc++.h> #include <map> #include <set> #include <stack> using namespace std; #define night_rider \ ios::sync_with_stdio(false); \ cin.tie(NULL); #define int long ...
// Shinchan Loves Coding :))) #include <bits/stdc++.h> #include <map> #include <set> #include <stack> using namespace std; #define night_rider \ ios::sync_with_stdio(false); \ cin.tie(NULL); #define int long ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
715
#include <bits/stdc++.h> #define endl '\n' #define pb push_back #define mp make_pair #define LL long long #define INF 0x3f3f3f3f #define Inf 1000000000000000000LL #define F first #define S second using namespace std; typedef pair<int, int> pii; int n, m; int a[1000010], ans[1000010]; int gcd(int x, int y) { if (y == ...
#include <bits/stdc++.h> #define endl '\n' #define pb push_back #define mp make_pair #define LL long long #define INF 0x3f3f3f3f #define Inf 1000000000000000000LL #define F first #define S second using namespace std; typedef pair<int, int> pii; int n, m; int a[1000010], ans[1000010]; int gcd(int x, int y) { if (y == ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
317
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1000000000000000000 using namespace std; #define N 1000001 ll gcd(ll a, ll b) { if (a < b) return gcd(b, a); if (b == 0) return a; else return gcd(b, a % b); } vector<bool> isprime; void make_table() { isprime[...
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1000000000000000000 using namespace std; #define N 1000001 ll gcd(ll a, ll b) { if (a < b) return gcd(b, a); if (b == 0) return a; else return gcd(b, a % b); } vector<bool> isprime; void make_table() { isprime[...
[["-", 0, 1, 0, 11, 12, 2, 63, 118, 28, 22], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 17, 131], ["-", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
540
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <deque> // deque #include <iomanip> // setprecision #include <iostream> // cout, endl, cin #include <map> // map #include <math.h> // sqrt #include <queue> // queue, priority_queue...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <deque> // deque #include <iomanip> // setprecision #include <iostream> // cout, endl, cin #include <map> // map #include <math.h> // sqrt #include <queue> // queue, priority_queue...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
445
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; template...
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; template...
[["+", 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], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
569
from math import * import sys import collections import itertools import pprint from collections import deque from heapq import * import copy input=sys.stdin.readline N=int(input()) A=list(map(int,input().split())) n = 10**6 d={} pairflag=1 setflag=0 primes = set(range(2, n+1)) for i in range(2, int(n**0.5+1)): pri...
from math import * import sys import collections import itertools import pprint from collections import deque from heapq import * import copy input=sys.stdin.readline N=int(input()) A=list(map(int,input().split())) n = 10**6 d={} pairflag=1 setflag=0 primes = set(range(2, n+1)) for i in range(2, int(n**0.5+1)): pri...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
351
#include <bits/stdc++.h> using namespace std; #define MAXN 1000000 int n; int a[1000005]; bool isPrime[1000005]; vector<int> primes; bool isUsed[1000005]; int gcd(int a, int b) { if (a > b) swap(a, b); if (a == 0) return b; if (a == 1) return 1; return gcd(a, b % a); } int main() { scanf("%d",...
#include <bits/stdc++.h> using namespace std; #define MAXN 1000000 int n; int a[1000005]; bool isPrime[1000005]; vector<int> primes; bool isUsed[1000005]; int gcd(int a, int b) { if (a > b) swap(a, b); if (a == 0) return b; if (a == 1) return 1; return gcd(a, b % a); } int main() { scanf("%d",...
[["-", 0, 57, 64, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 7, 26, 11, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 91, 17, 111]]
1
442
#include <bits/stdc++.h> #define loop(s, e, i) for (int i = s; i < e; ++i) #define print(s) cout << s << endl; using namespace std; using ll = long long; using lld = long long; /* 浮動小数点の入力 cout << fixed << setprecision(9) << endl; */ ll gcd(ll a, ll b) { if (a < b) { return gcd(b, a); } while (b != 0) { ...
#include <bits/stdc++.h> #define loop(s, e, i) for (int i = s; i < e; ++i) #define print(s) cout << s << endl; using namespace std; using ll = long long; using lld = long long; /* 浮動小数点の入力 cout << fixed << setprecision(9) << endl; */ ll gcd(ll a, ll b) { if (a < b) { return gcd(b, a); } while (b != 0) { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
417
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define F first #define S second #define pb push_back #define mp make_pair ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } int main() { ios_base::sync_with_stdio(fa...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define F first #define S second #define pb push_back #define mp make_pair ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } int main() { ios_base::sync_with_stdio(fa...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22]]
1
429
// Mayank Agarwal // IIIT Hyderabad #include <bits/stdc++.h> using namespace std; const long long int M = 1000000007; #define ll long long int #define ld double #define pb push_back #define mp make_pair ll power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p...
// Mayank Agarwal // IIIT Hyderabad #include <bits/stdc++.h> using namespace std; const long long int M = 1000000007; #define ll long long int #define ld double #define pb push_back #define mp make_pair ll power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p...
[["-", 0, 52, 15, 339, 51, 16, 12, 69, 28, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 22], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
482
#include <bits/stdc++.h> using namespace std; int maxGCD(vector<int> v) { int i; int vmax = 0; for (i = 0; i < v.size(); i++) { vmax = max(v[i], vmax); } vector<int> count(vmax + 5, 0); for (i = 0; i < v.size(); i++) { count[v[i]]++; } for (i = vmax; i >= 1; i--) { int j = i; int cnt = ...
#include <bits/stdc++.h> using namespace std; int maxGCD(vector<int> v) { int i; int vmax = 0; for (i = 0; i < v.size(); i++) { vmax = max(v[i], vmax); } vector<int> count(vmax + 5, 0); for (i = 0; i < v.size(); i++) { count[v[i]]++; } for (i = vmax; i >= 1; i--) { int j = i; int cnt = ...
[["-", 0, 52, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 52, 8, 9, 0, 57, 64, 37, 0, 22]]
1
382
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long const int mod = 1000000007; const int MOD = 998244353; const ll INF = 10000000000...
#include <algorithm> #include <cmath> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long const int mod = 1000000007; const int MOD = 998244353; const ll INF = 10000000000...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 28, 22], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 17, 131], ["+", 0, 7, 15, 16, 12, 2, 63, 118, 119, 120], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
535
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << '\n' #define out(x) cout << x << '\n' #define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define rep(i, n) for (int i = 0; i < (int)(n)...
#include <bits/stdc++.h> using namespace std; // def #define debug(x) cout << #x << ": " << x << '\n' #define out(x) cout << x << '\n' #define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--) #define rep(i, n) for (int i = 0; i < (int)(n)...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
429
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { while (1) { y %= x; if (y == 0) return x; x %= y; if (x == 0) return y; } } int main() { int n; cin >> n; int N = 1000001; vector<int> furui(N); for (int i = 0; i < N; i++) furui[i] = i; for (int i = 2;...
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { while (1) { y %= x; if (y == 0) return x; x %= y; if (x == 0) return y; } } int main() { int n; cin >> n; int N = 1000001; vector<int> furui(N); for (int i = 0; i < N; i++) furui[i] = i; for (int i = 2;...
[["-", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22]]
1
330
#include <bits/stdc++.h> using namespace std; #define int long long #define ull unsigned long long #define ll long long #define M 1000000007 #define pb push_back #define p_q priority_queue #define pii pair<ll, ll> #define vi vector<ll> #define vii vector<pii> #define mi map<ll, ll> #define mii map<pii, ll> #define all(...
#include <bits/stdc++.h> using namespace std; #define int long long #define ull unsigned long long #define ll long long #define M 1000000007 #define pb push_back #define p_q priority_queue #define pii pair<ll, ll> #define vi vector<ll> #define vii vector<pii> #define mi map<ll, ll> #define mii map<pii, ll> #define all(...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
508
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; // const long long MOD = 998244353; const long long INF_LL = 1e18 + 11; const int INF_int = 1e9 + 11; #define ll long long #define mp std::make_pair #define rep(i, n) for (int i = 0; i < n; i++) #define lrep(i, n) for (long long i = 0; i < n; ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; // const long long MOD = 998244353; const long long INF_LL = 1e18 + 11; const int INF_int = 1e9 + 11; #define ll long long #define mp std::make_pair #define rep(i, n) for (int i = 0; i < n; i++) #define lrep(i, n) for (long long i = 0; i < n; ...
[["-", 64, 1, 0, 27, 28, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 27, 28, 69, 341, 342, 0, 22]]
1
542
mod = 10**9 + 7 def gcd(a, b): return a if b == 0 else gcd(b, a % b) def solve(): n = int(input()) a = list(map(int, input().split())) primes = [] isprime = [True for i in range(1001)] for i in range(2, 1001): if isprime[i]: primes.append(i) for j in range(i * i, ...
mod = 10**9 + 7 def gcd(a, b): return a if b == 0 else gcd(b, a % b) def solve(): n = int(input()) a = list(map(int, input().split())) primes = [] isprime = [True for i in range(1001)] for i in range(2, 1001): if isprime[i]: primes.append(i) for j in range(i * i, ...
[["-", 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], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
287
#include <bits/stdc++.h> using namespace std; #define ll long long #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.ti...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.ti...
[["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85]]
1
392
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scan() string { sc.Scan() return sc.Text() } func iScan() int { n, _ := strconv.Atoi(Scan()) return n } func fScan() float64 { n, _ := strconv.ParseFloat(Scan(), 64) return n } func stringToInt(s string) int { n,...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scan() string { sc.Scan() return sc.Text() } func iScan() int { n, _ := strconv.Atoi(Scan()) return n } func fScan() float64 { n, _ := strconv.ParseFloat(Scan(), 64) return n } func stringToInt(s string) int { n,...
[["+", 0, 435, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 79], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 433]]
7
1,375
#include <bits/stdc++.h> #define LL long long #define pb push_back #define SZ(x) ((int)x.size() - 1) #define ms(a, b) memset(a, b, sizeof a) #define F(i, a, b) for (int i = (a); i <= (b); ++i) #define DF(i, a, b) for (int i = (a); i >= (b); --i) using namespace std; inline int read() { char ch = getchar(); int w = ...
#include <bits/stdc++.h> #define LL long long #define pb push_back #define SZ(x) ((int)x.size() - 1) #define ms(a, b) memset(a, b, sizeof a) #define F(i, a, b) for (int i = (a); i <= (b); ++i) #define DF(i, a, b) for (int i = (a); i >= (b); --i) using namespace std; inline int read() { char ch = getchar(); int w = ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 85], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
326
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define EPS 0.0000000001 #define pb push_back #define space " " #define ar array #define pi pair<int, int> #define ff first #define ss second void solve() { int n; int maxN = 1000000; cin >> n; bool pairwise = true...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define EPS 0.0000000001 #define pb push_back #define space " " #define ar array #define pi pair<int, int> #define ff first #define ss second void solve() { int n; int maxN = 1000000; cin >> n; bool pairwise = true...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
420