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
from collections import Counter M=10**7 _,*l=map(int,open(0).read().split()) d=[1]*(sorted(M)) C=Counter(l) s=0 for a,b in C.items(): if b != 1:d[a]=0 elif d[a]:s+=1 for j in range(a,M,a):d[j]=0 print(s)
from collections import Counter M=10**7 _,*l=map(int,open(0).read().split()) d=[1]*(M) C=Counter(sorted(l)) s=0 for a,b in C.items(): if b != 1:d[a]=0 elif d[a]:s+=1 for j in range(a,M,a):d[j]=0 print(s)
[["-", 0, 662, 12, 657, 12, 23, 0, 652, 63, 22], ["-", 12, 657, 12, 23, 0, 652, 3, 4, 0, 24], ["-", 12, 657, 12, 23, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
105
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a.at(i); sort(a.begin(), a.end()); int max_num = a.at(n - 1); vector<bool> no_div(max_num + 1, false); for (auto num : a) { no_div.at...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a.at(i); sort(a.begin(), a.end()); int max_num = a.at(n - 1); vector<bool> no_div(max_num + 1, false); for (auto num : a) { no_div.at...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
271
n = int(input()) a = list(map(int,input().split())) maxa = max(a) d = {} for ai in a: if ai in d: d[ai] += 1 else: d[ai] = 1 d = sorted(d.items()) #print(d) e = [True for _ in range(maxa+1)] for ai,c in d: if c > 1: e[ai] = False else: for i in range(2,maxa//ai+1): e[ai*i] = False ans =...
n = int(input()) a = list(map(int,input().split())) maxa = max(a) d = {} for ai in a: if ai in d: d[ai] += 1 else: d[ai] = 1 d = sorted(d.items()) #print(d) e = [True for _ in range(maxa+1)] for ai,c in d: if c > 1: e[ai] = False for i in range(2,maxa//ai+1): e[ai*i] = False ans = 0 for ai,_ ...
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
149
N = int(input()) A = list(map(int,input().split())) b = sorted(list(A)) dp = [0]*(max(A)+4) m_a = max(A) for i in b: dp[i] += 1 if dp[i]==1 : for j in range(i*2, m_a,i): dp[j] +=100 print(dp.count(1))
N = int(input()) A = list(map(int,input().split())) b = sorted(list(A)) dp = [0]*(max(A)+1) m_a = max(A)+1 for i in b: dp[i] += 1 if dp[i]==1 : for j in range(i*2, m_a,i): dp[j] +=100 print(dp.count(1))
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
102
n = int(input()) A = sorted(map(int, input().split())) nux = A[-1]+1 ans = 0 table = [True]*nux for i, s in enumerate(A): if table[s] == False: continue if i == n-1: ans += 1 if A[i+1] != s: ans += 1 b = 1 while b*s <= nux: table[b*s] = False b += 1 print(ans)...
n = int(input()) A = sorted(map(int, input().split())) nux = A[-1]+1 ans = 0 table = [True]*nux for i, s in enumerate(A): if table[s] == False: continue if i == n-1: ans += 1 elif A[i+1] != s: ans += 1 b = 1 while b*s < nux: table[b*s] = False b += 1 print(ans...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 18]]
5
111
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; typedef long double ld; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) #define F first #define S second constexpr char ln = ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; typedef long double ld; const int inf = 1e9 + 7; const ll longinf = 1LL << 60; #define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) #define F first #define S second constexpr char ln = ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 31, 22], ["-", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 0, 11, 31,...
1
290
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; int a[1 << 18]; int div[1 << 20] = {}; for (int i = 0; i < n; i++) { cin >> a[i]; div[a[i]]++; } bool ip[1 << 20]; fill(begin(ip), end(ip), 1); for (int i = 2; i < 1 << 20; i++) { if (ip[i]) { for (int j = 1; j...
#include <bits/stdc++.h> using namespace std; main() { int n; cin >> n; int a[1 << 18]; int div[1 << 20] = {}; for (int i = 0; i < n; i++) { cin >> a[i]; div[a[i]]++; } bool ip[1 << 20]; fill(begin(ip), end(ip), 1); for (int i = 2; i < 1 << 20; i++) { if (ip[i]) { for (int j = 1; j...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 48], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22]]
1
206
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 2147483647; const double pi = 3.1415926535897932384626; inline ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 2147483647; const double pi = 3.1415926535897932384626; inline ll read() { ll x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
300
N = int(input()) ls = list(map(int,input().split())) Pls = [0] * (10**6+1) for i in ls: Pls[i] += 1 ii = 0 for j in range(len(Pls)): if Pls[j] == 0: continue elif Pls[j] == 1: ii += 1 t = 2*j while t <= 10**6+1: Pls[t] = 0 t += j else: ...
N = int(input()) ls = list(map(int,input().split())) Pls = [0] * (10**6+1) for i in ls: Pls[i] += 1 ii = 0 for j in range(len(Pls)): if Pls[j] == 0: continue elif Pls[j] == 1: ii += 1 t = 2*j while t <= 10**6: Pls[t] = 0 t += j else: ...
[["-", 64, 196, 0, 52, 15, 666, 0, 657, 17, 72], ["-", 64, 196, 0, 52, 15, 666, 0, 657, 12, 612], ["-", 8, 196, 0, 52, 15, 666, 0, 657, 17, 72], ["-", 8, 196, 0, 52, 15, 666, 0, 657, 12, 612]]
5
135
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; #define ll long long #define _GLIBCXX_DEBUG const ll MOD = 1000000007; const ll Mod = 998244353; const int MAX = 510000; const double PI = 3.14159265358979; const vector<int> dx = {1, 0, 0, -1}; const vector<int> dy = {0, 1, -1, 0}; // 約数...
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; #define ll long long #define _GLIBCXX_DEBUG const ll MOD = 1000000007; const ll Mod = 998244353; const int MAX = 510000; const double PI = 3.14159265358979; const vector<int> dx = {1, 0, 0, -1}; const vector<int> dy = {0, 1, -1, 0}; // 約数...
[["+", 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
394
n = int(input()) a = sorted(list(map(int,input().split()))) m = max(a)+1 c = [0]*m for x in a: for i in range(x,m,x): if c[i]<2:c[i]+=1 else:break ans = 0 for i in a: if c[i]==1: ans += 1 print(ans)
n = int(input()) a = sorted(list(map(int,input().split()))) m = max(a)+1 c = [0]*m for x in a: for i in range(x,m,x): if c[i]<2:c[i]+=1 ans = 0 for i in a: if c[i]==1: ans += 1 print(ans)
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 57, 75, 76, 8, 196, 0, 93, 0, 94]]
5
100
#include <bits/stdc++.h> using namespace std; signed main() { int n; cin >> n; map<int, int> m; while (n--) { int a; cin >> a; m[a]++; } int ans = 0; for (auto p : m) { int v = p.first, c = p.second; if (!c) continue; ans += c == 1; for (int i = 2 * v; i < 1e6 + 1; i++) ...
#include <bits/stdc++.h> using namespace std; signed main() { int n; cin >> n; map<int, int> m; while (n--) { int a; cin >> a; m[a]++; } int ans = 0; for (auto p : m) { int v = p.first, c = p.second; if (!c) continue; ans += c == 1; for (int i = 2 * v; i < 1e6 + 1; i += ...
[["-", 0, 338, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 338, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 338, 8, 9, 0, 7, 26, 11, 12, 22]]
1
127
#include <bits/stdc++.h> using namespace std; const int MAX = 1000010; int main() { int N; cin >> N; vector<int> A(N); vector<int> num(MAX); for (int i = 0; i < N; i++) { cin >> A[i]; num[A[i]]++; } for (int i = 1; i < MAX; i++) { if (num[i] != 1) continue; for (int j = i + i; j <...
#include <bits/stdc++.h> using namespace std; const int MAX = 1000010; int main() { int N; cin >> N; vector<int> A(N); vector<int> num(MAX); for (int i = 0; i < N; i++) { cin >> A[i]; num[A[i]]++; } for (int i = 1; i < MAX; i++) { if (num[i] == 0) continue; for (int j = i + i; j <...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
169
def main(): import sys input=sys.stdin.readline n=int(input()) a=list(map(int,input().split())) adic={} for i in range(n): if a[i] in adic: adic[a[i]]+=1 else: adic[a[i]]=1 ans=0 a=list(set(a)) maxa=max(a) dp=[True for i in range(maxa+1)] ...
def main(): import sys input=sys.stdin.readline n=int(input()) a=list(map(int,input().split())) adic={} for i in range(n): if a[i] in adic: adic[a[i]]+=1 else: adic[a[i]]=1 ans=0 a=list(set(a)) a.sort() maxa=max(a) dp=[True for i in ran...
[["+", 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, 25]]
5
165
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long...
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
317
n = int(input()) a_list = list(map(int,input().split())) a_list = sorted(a_list) flag = [0]*n ans = 0 m = max(a_list) b_list = [0]*(m+1) for i in a_list: b_list[i] = 1 for i in a_list: if b_list[i] == 1: ans += 1 for j in range(i , m+1 ,i): b_list[j]+= 1 print(ans)
n = int(input()) a_list = list(map(int,input().split())) a_list = sorted(a_list) flag = [0]*n ans = 0 m = max(a_list) b_list = [0]*(m+1) for i in a_list: b_list[i] += 1 for i in a_list: if b_list[i] == 1: ans += 1 for j in range(i , m+1 ,i): b_list[j]+= 1 print(ans)
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107]]
5
109
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector<char>; using VecD = vector<ld>; using VecS = vector<string>; using Graph = vector<V...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector<char>; using VecD = vector<ld>; using VecS = vector<string>; using Graph = vector<V...
[["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
763
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define repa(i, a, n) for (int i = (a); i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define rrepa(i, a, n) for (int i = n - 1; i >= (a); i--) #define all(a) (a).begin(), (a).end() #define MOD 1000000007...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define repa(i, a, n) for (int i = (a); i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define rrepa(i, a, n) for (int i = n - 1; i >= (a); i--) #define all(a) (a).begin(), (a).end() #define MOD 1000000007...
[["-", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
315
//#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define loopinc(i, a, b, inc) for (int i = a; i < (b); i += inc) #define loop(i, a, b) for (...
//#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define loopinc(i, a, b, inc) for (int i = a; i < (b); i += inc) #define loop(i, a, b) for (...
[["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
711
#include <iostream> #include <stdio.h> #include <vector> using namespace std; int main() { int n, tmp; cin >> n; int count_a[1000001] = {0}; int a_max = -1; vector<int> b; int count = 0; for (int i = 0; i < n; i++) { cin >> tmp; count_a[tmp]++; if (a_max < tmp) { a_max = tmp; } } ...
#include <iostream> #include <stdio.h> #include <vector> using namespace std; int main() { int n, tmp; cin >> n; int count_a[1000001] = {0}; int a_max = -1; vector<int> b; int count = 0; for (int i = 0; i < n; i++) { cin >> tmp; count_a[tmp]++; if (a_max < tmp) { a_max = tmp; } } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
262
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <vector> using namespace std; typedef long long ll; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = ...
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <stdio.h> #include <vector> using namespace std; typedef long long ll; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = ...
[["+", 0, 57, 64, 9, 0, 57, 75, 76, 0, 95], ["+", 64, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 64, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
268
#include <bits/stdc++.h> using namespace std; #define deb(var) \ "[" << (#var) << " : " << var << "]" \ << " " #define debv(v) \ "[" << (#v) << ...
#include <bits/stdc++.h> using namespace std; #define deb(var) \ "[" << (#var) << " : " << var << "]" \ << " " #define debv(v) \ "[" << (#v) << ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60]]
1
260
#include <bits/stdc++.h> using namespace std; #define deb(var) \ "[" << (#var) << " : " << var << "]" \ << " " #define debv(v) \ "[" << (#v) << ...
#include <bits/stdc++.h> using namespace std; #define deb(var) \ "[" << (#var) << " : " << var << "]" \ << " " #define debv(v) \ "[" << (#v) << ...
[["-", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["-", 64, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
278
n = int(input()) original_ary = sorted(list(map(int, input().split()))) bool_ary = [0] * original_ary[-1] for num in original_ary: bool_ary[num-1] += 1 if bool_ary[num-1] == 1: for multiple in range(num * 2, original_ary[-1], num): bool_ary[multiple-1] = 2 print(bool_ary.count(1))
n = int(input()) original_ary = sorted(list(map(int, input().split()))) bool_ary = [0] * original_ary[-1] for num in original_ary: bool_ary[num-1] += 1 if bool_ary[num-1] == 1: for multiple in range(num * 2, original_ary[-1]+1, num): bool_ary[multiple-1] = 2 print(bool_ary.count(1))
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
97
import numpy as np length = int(input()) As = list(map(int, input().split())) As.sort() # indexを数値と紐づけるために+1増やした数にする check = np.zeros(10**6+1) answer = 0 # 与えられた数列の小さいものから順にループ for i in range(length): if check[As[i]] == 0: # 与えられた数値の倍数すべてに1を立てる # checkは0始まりのため、0と倍数要素に1が立つ check[::As[i]]...
import numpy as np length = int(input()) As = list(map(int, input().split())) As.sort() # indexを数値と紐づけるために+1増やした数にする check = np.zeros(10**6+1) answer = 0 # 与えられた数列の小さいものから順にループ for i in range(length): if check[As[i]] == 0: # 与えられた数値の倍数すべてに1を立てる # checkは0始まりのため、0と倍数要素に1が立つ check[::As[i]]...
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 79], ["+", 64, 196, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 8, 196, 0, 57, 64, 196, 0, 57, 0, 102], ["-", 64, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 64, 196, 0, 57, 15, 679, 17, 354]]
5
115
n = int(input()) A = map(int, input().split()) maxA = max(A) # C[a] = A内のaの個数 C = {a: 0 for a in A} for a in A: C[a] += 1 # D[a]=1: Aにaより小さいaの約数が存在する D = {a: 0 for a in A} for a in A: if C[a] > 0: t = 2 while a * t <= maxA: D[a * t] = 1 t += 1 ans = 0 for a in A: if C...
n = int(input()) A = list(map(int, input().split())) maxA = max(A) # C[a] = A内のaの個数 C = {a: 0 for a in A} for a in A: C[a] += 1 # D[a]=1: Aにaより小さいaの約数が存在する D = {a: 0 for a in A} for a in A: if C[a] > 0: t = 2 while a * t <= maxA: D[a * t] = 1 t += 1 ans = 0 for a in A: ...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
127
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll INF = 1ll << 60; #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define DEBUG(x) std:...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; // const ll MOD = 998244353; const ll INF = 1ll << 60; #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define DEBUG(x) std:...
[["-", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 69, 28, 22], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
287
# Contest No.: ABC170 # Problem No.: D # Solver: JEMINI # Date: 20200614 import sys import heapq def main(): n = int(input()) nums = list(map(int, sys.stdin.readline().split())) nums.sort() check = [False] * (10 ** 6 + 1) for i in range(1, n): if nums[i] == nums[i - 1]: ...
# Contest No.: ABC170 # Problem No.: D # Solver: JEMINI # Date: 20200614 import sys import heapq def main(): n = int(input()) nums = list(map(int, sys.stdin.readline().split())) nums.sort() check = [False] * (10 ** 6 + 1) for i in range(1, n): if nums[i] == nums[i - 1]: ...
[["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 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
190
// Problem : D - Not Divisible // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_d // 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 lo...
// Problem : D - Not Divisible // Contest : AtCoder - AtCoder Beginner Contest 170 // URL : https://atcoder.jp/contests/abc170/tasks/abc170_d // 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 lo...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
428
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, a; cin >> n; map<int, int> nums; for (int i = 0; i < n; i++) { cin >> a; nums[a]++; } int an...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, a; cin >> n; map<int, int> nums; for (int i = 0; i < n; i++) { cin >> a; nums[a]++; } int an...
[["-", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120], ["+", 0, 1, 0, 2, 3, 4, 0, 118, 119, 120]]
1
226
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, n) for (int i = (a); i < (n); i++) #define all(v) v.begin(), v.end() #define fi first #define se second #define sz(x) int(x.size()) using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define FOR(i, a, n) for (int i = (a); i < (n); i++) #define all(v) v.begin(), v.end() #define fi first #define se second #define sz(x) int(x.size()) using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
299
def main(): n=int(input()) a=sorted(map(int,input().split())) maxa=a[-1] tf=[True]*maxa r=0 n-=1 for i in range(n): # maxa以外の処理 a_i=a[i] if tf[a_i-1] ==True: # これまでに素の場合のみ処理実行 for j in range(a_i - 1,maxa,a_i): tf[j]=False if a_i < a[i+1]: # a[i]とa[i+1]が同値の場合を排除 print(a_...
def main(): n=int(input()) a=sorted(map(int,input().split())) maxa=a[-1] tf=[True]*maxa r=0 n-=1 for i in range(n): # maxa以外の処理 a_i=a[i] if tf[a_i-1] ==True: # これまでに素の場合のみ処理実行 for j in range(a_i - 1,maxa,a_i): tf[j]=False if a_i < a[i+1]: # a[i]とa[i+1]が同値の場合を排除 r+=1 i...
[["-", 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, 25]]
5
134
/* Author: ankrypt */ #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; template <class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define MOD 1000000007...
/* Author: ankrypt */ #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; template <class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define MOD 1000000007...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
437
n=int(input()) a = list(map(int, input().strip().split())) a.sort() lim=10**6+3 ans=0 multiples=[False]*lim for i in range(n): if multiples[i]==True: continue if i!=n-1 and a[i]==a[i+1]: pass else: ans+=1 for j in range(a[i],lim,a[i]): multiples[j]=True print(ans)
n=int(input()) a = list(map(int, input().strip().split())) a.sort() lim=10**6+1 ans=0 multiples=[False]*lim for i in range(n): if multiples[a[i]]==True: continue elif i!=n-1 and a[i]==a[i+1]: pass else: ans+=1 for j in range(a[i],lim,a[i]): multiples[j]=True print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 57, 15, 666, 0, 206, 206, 206, 51, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0,...
5
121
import sys input = sys.stdin.readline N = int(input()) AList = list(map(int, input().split())) AList.sort() dp = [0] * (AList[-1] + 1) for i in AList: dp[i] += 1 if dp[i] == 1: for p in range(2 * i, len(dp), i): dp[j] += 2 print(dp.count(1))
import sys input = sys.stdin.readline N = int(input()) AList = list(map(int, input().split())) AList.sort() dp = [0] * (AList[-1] + 1) for i in AList: dp[i] += 1 if dp[i] == 1: for p in range(2 * i, len(dp), i): dp[p] += 2 print(dp.count(1))
[["-", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22]]
5
105
#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; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fi first #define se second...
#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; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define fi first #define se second...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
568
// Lets go to the next level // AIM EXP at CF *__* asap // Hit A,B,C faster and reach Expert // Remember you were also a novice when you started, // hence never be rude to anyone who wants to learn something!Be calm and help // everyone. Never open the rank list until and unless you are done with solving // problems! ...
// Lets go to the next level // AIM EXP at CF *__* asap // Hit A,B,C faster and reach Expert // Remember you were also a novice when you started, // hence never be rude to anyone who wants to learn something!Be calm and help // everyone. Never open the rank list until and unless you are done with solving // problems! ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
550
n= int(input()) l=list(map(int,input().split())) l.sort() maxnum=l[len(l)-1] flag=[0]*(maxnum+1) for num in l: flag[num]+=1 if flag[num]>1: continue for j in range(num*2, maxnum, num): flag[j]+=1 #print(flag) ans=0 for num in l: if flag[num]==1: ans+=1 print(ans)
n= int(input()) l=list(map(int,input().split())) l.sort() maxnum=l[len(l)-1] flag=[0]*(maxnum+1) for num in l: flag[num]+=1 if flag[num]>1: continue for j in range(num*2, maxnum+1, num): flag[j]+=1 #print(flag) ans=0 for num in l: if flag[num]==1: ans+=1 print(ans)
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
116
n = int(input()) a = list(map(int, input().split())) a.sort() if a[0] == 1: if len(a) == 1 or a[1] != 1: print(1) else: print(0) else: a_max = a[-1] seive = [True for _ in range(a_max + 1)] a += [-1] ret = 0 add = 1 for i in range(n): if a[i] != a[i+1]: ...
n = int(input()) a = list(map(int, input().split())) a.sort() if a[0] == 1: if len(a) == 1 or a[1] != 1: print(1) else: print(0) else: a_max = a[-1] seive = [True for _ in range(a_max + 1)] a += [-1] ret = 0 add = 1 for i in range(n): if a[i] != a[i+1]: ...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
168
def main(): n, *A = map(int, f.read().split()) A.sort() n = A[-1] isPrime = [True] * (n + 1) prep = 0 for i in A: if prep == i: isPrime[prep] = False continue if isPrime[i]: for j in range(i * 2, n + 1, i): isPrime[j] = False ...
def main(): n, *A = map(int, open(0).read().split()) A.sort() n = A[-1] isPrime = [True] * (n + 1) prep = 0 for i in A: if prep == i: isPrime[prep] = False continue if isPrime[i]: for j in range(i * 2, n + 1, i): isPrime[j] = Fa...
[["-", 0, 652, 63, 319, 500, 652, 63, 319, 500, 22], ["+", 63, 319, 500, 652, 63, 319, 500, 652, 63, 22], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 612], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
140
import numpy as np n,*a=map(int,open(0).read().split()) l=np.zeros(max(a)+1) a.sort() a+=[10**7] r=0 for i,j in zip(a,a[1:]): if l[i]==0: l[::i]=1 if i!=j: r+=1 print(i) print(r)
import numpy as np n,*a=map(int,open(0).read().split()) l=np.zeros(max(a)+1) a.sort() a+=[10**7] r=0 for i,j in zip(a,a[1:]): if l[i]==0: l[::i]=1 if i!=j: r+=1 print(r)
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
102
#!/usr/bin/env python3 import sys sys.setrecursionlimit(300000) def solve(N: int, A: "List[int]"): counts = {} for a in A: if not a in counts: counts[a] = 0 counts[a] += 1 M = max(A) s = set(A) ret = 0 used = [False] * (M + 1) for i in range(1, M + 1): ...
#!/usr/bin/env python3 import sys sys.setrecursionlimit(300000) def solve(N: int, A: "List[int]"): counts = {} for a in A: if not a in counts: counts[a] = 0 counts[a] += 1 M = max(A) s = set(A) ret = 0 used = [False] * (M + 1) for i in range(1, M + 1): ...
[["-", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 22]]
5
295
#include <cstdlib> #include <iostream> #include <vector> template <typename T> void fin(T const &t) { std::cout << t << std::endl; exit(0); } int const MAXA = 1e6; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); int N; std::cin >> N; std::vector<int> c(MAXA + 1, 0), c2(MAXA + 1, 0); for...
#include <cstdlib> #include <iostream> #include <vector> template <typename T> void fin(T const &t) { std::cout << t << std::endl; exit(0); } int const MAXA = 1e6; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); int N; std::cin >> N; std::vector<int> c(MAXA + 1, 0), c2(MAXA + 1, 0); for...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
226
N = int(input()) A_list = [int(n) for n in input().split()] import numpy as np A_array = np.array(A_list) sort_A = np.sort(A_array) n_array = np.zeros(10**6) for a in sort_A: if n_array[a - 1] >= 2: continue a_times = np.array(range(a, 10**6+1, a)) n_array[(a_times -1).a...
N = int(input()) A_list = [int(n) for n in input().split()] import numpy as np A_array = np.array(A_list) sort_A = np.sort(A_array) n_array = np.zeros(10**6) for a in sort_A: if n_array[a - 1] >= 2: continue a_times = np.array(range(a, 10**6+1, a)) n_array[(a_times -1).a...
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
120
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int asc(const void *a, const void *b) { return *(int *)a - *(int *)b; } int bisect_left(int x, int a[], int left, int right) { int mid; right++; while (left < right) { mid = (left + right) / 2; if (a[mid] <...
#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int asc(const void *a, const void *b) { return *(int *)a - *(int *)b; } int bisect_left(int x, int a[], int left, int right) { int mid; right++; while (left < right) { mid = (left + right) / 2; if (a[mid] <...
[["-", 0, 43, 49, 50, 49, 80, 81, 16, 31, 13], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 31, 13], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
341
#include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define mll map<ll, ll> #define pb push_back #define mp make_pair #define endl "\n" #define MAX 1e18 #define F first #define S second #define all(s) s.begin(), s.end() #define mod 998244353 ll lcm(ll a, ll b) { return (a * b) / (_...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define mll map<ll, ll> #define pb push_back #define mp make_pair #define endl "\n" #define MAX 1e18 #define F first #define S second #define all(s) s.begin(), s.end() #define mod 998244353 ll lcm(ll a, ll b) { return (a * b) / (_...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
355
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using Graph = vector<vector<int>>; tem...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdlib> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using Graph = vector<vector<int>>; tem...
[["-", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13]]
1
290
#include <bits/stdc++.h> #define ll long long #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) #define INF = 1001001001 #define pi = acos(-1) using namespace std; int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; } int main() { int n; cin >> n; vector<int> a(n); int ans = 0; vector<l...
#include <bits/stdc++.h> #define ll long long #define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0])) #define INF = 1001001001 #define pi = acos(-1) using namespace std; int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; } int main() { int n; cin >> n; vector<int> a(n); int ans = 0; vector<i...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 338, 39, 361, 0, 190], ["+", 0, 30, 0, 14, 8, 9, 0, 338, 39, 40], ["-", 0, 338, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 338...
1
208
from collections import Counter n = int(input()) a = list(map(int, input().split())) c = Counter(a) dp = [True] * (10 ** 6 + 1) s = list(set(a)) for x in s: e = x * 2 while e <= 10 ** 6: dp[e] = False e += x ret = 0 for x in a: if c[x] == 1 and dp[x] == True: ret += 1 print(ans)
from collections import Counter n = int(input()) a = list(map(int, input().split())) c = Counter(a) dp = [True] * (10 ** 6 + 1) s = list(set(a)) for x in s: e = x * 2 while e <= 10 ** 6: dp[e] = False e += x ret = 0 for x in a: if c[x] == 1 and dp[x] == True: ret += 1 print(ret)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
113
n = int(input()) a = list(map(int,input().split())) a.sort() max_a = a[-1] is_available = [True] * (max_a + 1) ans = 0 for i, x in enumerate(a[:-1]): if not a[i+1] == x and is_available[x]: ans += 1 for b in range(x, m + 1, x): is_available[b] = False if is_available[a[-1]]: ans += 1 ...
n = int(input()) a = list(map(int,input().split())) a.sort() max_a = a[-1] is_available = [True] * (max_a + 1) ans = 0 for i, x in enumerate(a[:-1]): if not a[i+1] == x and is_available[x]: ans += 1 for b in range(x, max_a + 1, x): is_available[b] = False if is_available[a[-1]]: ans += ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
122
n = int(input()) a = list(map(int,input().split())) a.sort() dp = [True] * a[-1] ans = 0 m = a[-1] for i, x in enumerate(a[:-1]): if not a[i+1] == x and dp[x]: ans += 1 for b in range(x, m + 1, x): dp[b] = False if dp[a[-1]]: ans += 1 print(ans)
n = int(input()) a = list(map(int,input().split())) a.sort() dp = [True] * (a[-1] + 1) ans = 0 m = a[-1] for i, x in enumerate(a[:-1]): if not a[i+1] == x and dp[x]: ans += 1 for b in range(x, m + 1, x): dp[b] = False if dp[a[-1]]: ans += 1 print(ans)
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
122
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<int> v(n); vector<bool> flag(1000000, true); for (int i = 0; i < n; i++) { int a; cin >> a; v[i] = a; } sort(v.begin(), v.end()); ll ans = 0; for (int i = 0; i < n; i++) { int...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector<int> v(n); vector<bool> flag(10000010, true); for (int i = 0; i < n; i++) { int a; cin >> a; v[i] = a; } sort(v.begin(), v.end()); ll ans = 0; for (int i = 0; i < n; i++) { in...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 13], ["+",...
1
181
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); List<Integer> p = new ArrayList<>(); int[] yaku = new int[1000000]; Arra...
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); List<Integer> p = new ArrayList<>(); int[] yaku = new int[1000005]; Arra...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 499], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499]]
3
226
n, *a = map(int, open(0).read().split()) a.sort() am = a[-1] + 1 dp = [True] * am ans = 0 dup = set() for x in a: d = dp[x] ...
n, *a = map(int, open(0).read().split()) a.sort() am = a[-1] + 1 dp = [True] * am ans = 0 dup = set() for x in a: d = dp[x] if d: ans += 1 for i in range(x, am, x): dp[i] = False dp[x] = None elif d == None: dup.add(x) print(ans - len(dup))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
112
#include <bits/stdc++.h> using namespace std; int main() { long N; cin >> N; long A[N]; for (long i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); bool C[1000001]; fill(C, C + 1000001, false); for (long i = 0; i < N; i++) { if (C[i]) continue; if (i < N - 1 && A[i] == A[i + 1]) C...
#include <bits/stdc++.h> using namespace std; int main() { long N; cin >> N; long A[N]; for (long i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); bool C[1000001]; fill(C, C + 1000001, false); for (long i = 0; i < N; i++) { if (C[A[i]]) continue; if (i < N - 1 && A[i] == A[i + 1]) ...
[["+", 15, 339, 51, 69, 341, 342, 0, 69, 28, 22], ["+", 51, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 51, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
215
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> #define rep(i, m, n) for (int i = m; i < n; i++) #define co(n) cout << n << endl #define all(n) (n).begin(), (n).end() #define pb(n, m) n.push_back(m) #define pi(n, m) n.insert(n.begin(), m); #define ee(n) n.erase(n.end() - 1) #define eb(n) n.erase(...
#include <bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> #define rep(i, m, n) for (int i = m; i < n; i++) #define co(n) cout << n << endl #define all(n) (n).begin(), (n).end() #define pb(n, m) n.push_back(m) #define pi(n, m) n.insert(n.begin(), m); #define ee(n) n.erase(n.end() - 1) #define eb(n) n.erase(...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
303
#include <bits/stdc++.h> using namespace std; int c[1000005]; int main() { int n; cin >> n; int a[n + 1]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; for (int i = 0; i < n; i++) { for (int j = a[i]; j <= a[n - 1]; j++) c[j]++; } for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> using namespace std; int c[1000005]; int main() { int n; cin >> n; int a[n + 1]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; for (int i = 0; i < n; i++) { for (int j = a[i]; j <= a[n - 1]; j += a[i]) c[j]++; } for (int i = 0; i < n; i++...
[["-", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 8, 9, 0, 7, 26, 11, 12, 69, 28, 22], ["+", 0, 7, 26, 11, 12, 69, 341, 342, 0, 70], ["+", 0, 7, 26, 11, 12, 69, 341, 342, 0, 22], ["+", 0, 7, 26, 11, 12, 69, 341, 342, 0, 73]]
1
147
N = int(input()) A = list(map(int, input().split())) A.sort() dlen = A[-1]+3 d = [True]*dlen for a in A: if d[a]: for i in range(a*2, dlen, a): d[i] = False res = 0 for i in range(N): if i > 1: if A[i] == A[i-1]: continue if i < N-1: if A[i] == A[i+1]: ...
N = int(input()) A = list(map(int, input().split())) A.sort() dlen = A[-1]+3 d = [True]*dlen for a in A: if d[a]: for i in range(a*2, dlen, a): d[i] = False res = 0 for i in range(N): if i > 0: if A[i] == A[i-1]: continue if i < N-1: if A[i] == A[i+1]: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
144
#include <bits/stdc++.h> #define lol long long #define gcd(x, y) __gcd(x, y) #define mt make_tuple #define mp make_pair #define fi first #define se second #define fixed fixed << setprecision(14) using namespace std; using pii = pair<int, int>; template <class A, class B> inline bool chmax(A &a, const B &b) { return ...
#include <bits/stdc++.h> #define lol long long #define gcd(x, y) __gcd(x, y) #define mt make_tuple #define mp make_pair #define fi first #define se second #define fixed fixed << setprecision(14) using namespace std; using pii = pair<int, int>; template <class A, class B> inline bool chmax(A &a, const B &b) { return ...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 13]]
1
417
N = int(input()) S = list(map(int, input().split())) S.sort() ans = 0 A = [True]*(10**6+1) for i in range(0, N): if not A[S[i]]: continue if 0 < i: if S[i-1] == S[i]: continue if i < N-1: if S[i] == S[i+1]: for j in range(1, 10**6//S[i]+1): A...
N = int(input()) S = list(map(int, input().split())) S.sort() ans = 0 A = [True]*(10**6+1) for i in range(0, N): if not A[S[i]]: continue if 0 < i: if S[i-1] == S[i]: continue if i < N-1: if S[i] == S[i+1]: for j in range(1, 10**6//S[i]+1): A...
[["+", 64, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
173
from collections import Counter N = int(input()) A = list(map(int, input().split())) cnt = Counter(A) A.sort() ans = 0 P = [0] * (10 ** 6 + 1) print(cnt) for a in A: if P[a] == 0: for i in range(10 ** 7): x = a * i if x > 10 ** 6: break P[x] = 1 if...
from collections import Counter N = int(input()) A = list(map(int, input().split())) cnt = Counter(A) A.sort() ans = 0 P = [0] * (10 ** 6 + 1) for a in A: if P[a] == 0: for i in range(10 ** 7): x = a * i if x > 10 ** 6: break P[x] = 1 if cnt[a] == ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
117
from collections import Counter n=int(input()) *a,=map(int, input().split()) sa=Counter(a) if 1 in sa: if sa[1]>1: print(0) else: print(1) exit() # def fct(x): # f1=[1] # f2=[] # for i in range(2,min(int(x**(1/2)+7),x)): # if x%i==0: # f1.append(i) # ...
from collections import Counter n=int(input()) *a,=map(int, input().split()) sa=Counter(a) if 1 in sa: if sa[1]>1: print(0) else: print(1) exit() # def fct(x): # f1=[1] # f2=[] # for i in range(2,min(int(x**(1/2)+7),x)): # if x%i==0: # f1.append(i) # ...
[["+", 64, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
198
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n; scanf("%d", &n); vector<int> a(n); rep(i, n) scanf("%d", &a[i]); vector<int> f(1000001); rep(i, n) f[a[i]]++; for (int x = 1; x <= 1000000; x++) if (f[x] == 1) { for (int y = 2 *...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n; scanf("%d", &n); vector<int> a(n); rep(i, n) scanf("%d", &a[i]); vector<int> f(1000001); rep(i, n) f[a[i]]++; for (int x = 1; x <= 1000000; x++) if (f[x] > 0) { for (int y = 2 * ...
[["-", 0, 7, 8, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 7, 8, 57, 15, 339, 51, 16, 12, 13]]
1
163
from collections import Counter n = int(input()) A = sorted(map(int, input().split())) c = Counter(A) yes_or_no = [1 for i in range(A[n-1])] for a in A: t = a*2 while t <= A[n-1]: yes_or_no[t] = 0 t += a ans = 0 for a in A: if c[a] == 1 and yes_or_no[a] == 1: ans += 1 print(ans)
from collections import Counter n = int(input()) A = sorted(map(int, input().split())) c = Counter(A) yes_or_no = [True for i in range(A[n-1]+1)] for a in A: t = a*2 while t <= A[n-1]: yes_or_no[t] = False t += a ans = 0 for a in A: if c[a] == 1 and yes_or_no[a] == True: ans += 1 print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 658, 8, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 658, 8, 146], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 147], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 0, 61...
5
111
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; int main() { int N; vector<int> A; map<int, int> map; int res; cin >> N; rep(i, N) { int tmp; cin >> tmp; A.push_back(tmp); map[tmp] = map[tmp] + 1; } res = A.size(); if (map[1] == ...
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; int main() { int N; vector<int> A; map<int, int> map; int res; cin >> N; rep(i, N) { int tmp; cin >> tmp; A.push_back(tmp); map[tmp] = map[tmp] + 1; } res = A.size(); if (map[1] == ...
[["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 13], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 22], ["-", 0, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 0, 9, 0, 57, 64, 9, 0, 93, 0, 35], ["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
221
def main(): import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline from collections import Counter N = int(input()) A = list(map(int, input().split())) counter_A = Counter(A) flag = [True] * 1000001 count = 0 for i in sorted(counter_A.keys()): if counter_A[i...
def main(): import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline from collections import Counter N = int(input()) A = list(map(int, input().split())) counter_A = Counter(A) flag = [True] * 1000001 count = 0 for i in sorted(counter_A.keys()): if counter_A[i...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355]]
5
121
/*input 5 24 11 8 3 16 */ #include <bits/stdc++.h> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, a, b) for (int i = a; i < b; i++) #define all(c) c.begin(), c.end() #define init(arr, num) memset(arr, num, sizeof(arr)) #define fast ...
/*input 5 24 11 8 3 16 */ #include <bits/stdc++.h> using namespace std; #define int long long int #define rep(i, n) for (int i = 0; i < n; i++) #define rep2(i, a, b) for (int i = a; i < b; i++) #define all(c) c.begin(), c.end() #define init(arr, num) memset(arr, num, sizeof(arr)) #define fast ...
[["-", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["-", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
435
#include <bits/stdc++.h> using namespace std; #define all(x) begin(x), end(x) using i64 = int_fast64_t; using f64 = double; using p64 = pair<i64, i64>; constexpr i64 INF = INT_FAST64_MAX / 2; constexpr f64 EPS = DBL_EPSILON; void solve() { i64 n; cin >> n; map<i64, i64> acnt; i64 maxa = 0; for (i64 i = 0;...
#include <bits/stdc++.h> using namespace std; #define all(x) begin(x), end(x) using i64 = int_fast64_t; using f64 = double; using p64 = pair<i64, i64>; constexpr i64 INF = INT_FAST64_MAX / 2; constexpr f64 EPS = DBL_EPSILON; void solve() { i64 n; cin >> n; map<i64, i64> acnt; i64 maxa = 0; for (i64 i = 0;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 0, 338, 8, 9, 0, 57, 64, 116, 0, 117], ["-", 0, 338, 8, 9, 0, 57, 64, 116, 0, 35]]
1
227
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x, to) for (x = 0; x < (to); x++) #define FORR(x, arr) for (auto &x : arr) #define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++) #define ALL(a) (a.begin()), ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29]]
1
317
N = int(input()) A = list(map(int,input().split())) A.sort() c = Counter(A) lst = [1] * (10**6+1) res = 0 for i,a in enumerate(A): if lst[a] == 0: continue if i==N-1 or A[i+1] != a: res += 1 for j in range(a, 10**6+1, a): lst[j] = 0 print(res)
from collections import Counter N = int(input()) A = list(map(int,input().split())) A.sort() c = Counter(A) lst = [1] * (10**6+1) res = 0 for i,a in enumerate(A): if lst[a] == 0: continue if i==N-1 or A[i+1] != a: res += 1 for j in range(a, 10**6+1, a): lst[j] = 0 print(res)
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
116
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); List<Integer> list = new ArrayList<>(); for (int i = 0; i < N; i++) { int num = sc.nextInt(); list.add(num); } if (N == 1) { System.ou...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); List<Integer> list = new ArrayList<>(); for (int i = 0; i < N; i++) { int num = sc.nextInt(); list.add(num); } if (N == 1) { System.ou...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
3
245
// // main.cpp // ABC_170_D // // Created by Joe Mori on 2020/06/14. // Copyright © 2020 Joe Mori. All rights reserved. // #include <bits/stdc++.h> #include <iostream> int main() { // insert code here... int N, count = 0; std::cin >> N; std::vector<int> a(N); for (int i = 0; i < N; i++) { std::cin >...
// // main.cpp // ABC_170_D // // Created by Joe Mori on 2020/06/14. // Copyright © 2020 Joe Mori. All rights reserved. // #include <bits/stdc++.h> #include <iostream> int main() { // insert code here... int N, count = 0; std::cin >> N; std::vector<int> a(N); for (int i = 0; i < N; i++) { std::cin >...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
240
n = int(input()) a = list(map(int, input().split())) MAX = 1000005 cnt = [0] * MAX for x in a: if cnt[x] != 0: continue #cnt配列の各倍数のところに+1 for i in range(x, MAX, x): cnt[i] += 1 ans = 0 for x in a: if cnt[x] == 1: ans += 1 print(ans)
n = int(input()) a = list(map(int, input().split())) MAX = 1000005 cnt = [0] * MAX for x in a: if cnt[x] != 0: cnt[x] = 2 continue #cnt配列の各倍数のところに+1 for i in range(x, MAX, x): cnt[i] += 1 ans = 0 for x in a: if cnt[x] == 1: ans += 1 print(ans)
[["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 0, 73], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
91
# D - Not Divisible N = int(input()) A = list(int(a) for a in input().split()) A.sort() M = max(A) is_D = [0] * (M+1) for i, a in enumerate(A): if is_D[a]: is_D[a] = 2 continue for j in range(2*a, M+1, a): is_D[j] += 1 ans = 0 for a in A: if is_D[a] == 1: ans += 1 print(an...
# D - Not Divisible N = int(input()) A = list(int(a) for a in input().split()) A.sort() M = max(A) is_D = [0] * (M+1) for i, a in enumerate(A): if is_D[a]: is_D[a] = 2 continue for j in range(a, M+1, a): is_D[j] += 1 ans = 0 for a in A: if is_D[a] == 1: ans += 1 print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 612], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 48]]
5
118
n = int(input()) a = list(map(int, input().split())) m = (10 ** 6 + 1) cnt = [0] * m for x in a: if cnt[x] != 0: cnt[x] = 2 continue for i in range(x, m, x): cnt += 1 ans = 0 for x in a: if cnt[x] == 1: ans += 1 print(ans)
n = int(input()) a = list(map(int, input().split())) m = 10 ** 6 + 1 cnt = [0] * m for x in a: if cnt[x] != 0: cnt[x] = 2 continue for i in range(x, m, x): cnt[i] += 1 ans = 0 for x in a: if cnt[x] == 1: ans += 1 print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 23, 0, 24], ["-", 0, 656, 0, 1, 0, 662, 12, 23, 0, 25], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 0, 73]]
5
99
n = int(input()) a = list(map(int, input().split())) a.sort() dp = [0]*(1000000+1) cnt = 0 for i in range(len(a)): if dp[a[i]]==1: continue while(a[i]*j<=a[-1]): dp[a[i]*j] = 1 j += 1 if i!=len(a)-1 and a[i+1]==a[i]: dp[a[i]] = 1 continue cnt += 1 dp[a[i]] = 1 j = 2 print(cnt)
n = int(input()) a = list(map(int, input().split())) a.sort() dp = [0]*(1000000+1) cnt = 0 for i in range(len(a)): if dp[a[i]]==1: continue j = 2 while(a[i]*j<=a[-1]): dp[a[i]*j] = 1 j += 1 if i!=len(a)-1 and a[i+1]==a[i]: dp[a[i]] = 1 continue cnt += 1 dp[a[i]] = 1 print(cnt)
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 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, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
148
from collections import Counter input() a_list = list(map(int, input().split())) c = Counter(a_list) divisible = [True] * (10**6+1) for el, count in c.items(): if count!=1: divisible[el] = False continue else: for i in range(el*2, 10**6+1, el): divisible[i] = False a_list =...
from collections import Counter input() a_list = list(map(int, input().split())) c = Counter(a_list) divisible = [True] * (10**6+1) for el, count in c.items(): if count!=1: divisible[el] = False for i in range(el*2, 10**6+1, el): divisible[i] = False a_list = list(set(a_list)) ans = len( [...
[["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
122
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> A(N); int m = 0; for (int i = 0; i < N; i++) { cin >> A[i]; m = m > A[i] ? m : A[i]; } // cout << m << endl; vector<bool> B(m + 1, false); sort(A.begin(), A.end()); in...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int> A(N); int m = 0; for (int i = 0; i < N; i++) { cin >> A[i]; m = m > A[i] ? m : A[i]; } // cout << m << endl; vector<bool> B(m + 1, false); sort(A.begin(), A.end()); in...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 35]]
1
202
#include <bits/stdc++.h> using namespace std; #define int long long int #define endl '\n' #define pb push_back #define PI 3.14159265 int M = 998244353; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; int a[n]; unordered_map<int, int> m; bool e = false; ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define endl '\n' #define pb push_back #define PI 3.14159265 int M = 998244353; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; int a[n]; unordered_map<int, int> m; bool e = false; ...
[["-", 75, 76, 0, 1, 0, 16, 12, 16, 31, 22], ["-", 75, 76, 0, 1, 0, 16, 12, 16, 17, 33], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 62]]
1
293
import bisect n = int(input()) a = list(map(int, input().split())) a.sort() k = len(a) ok = [0] * k for i in range(k): if i < k - 1 and a[i] == a[i + 1]: ok[i] = 1 ok[i+1] = 1 times = 2 while a[i] * times < a[-1]: r = bisect.bisect_left(a, a[i] * times) l = bisect.bisect_le...
import bisect n = int(input()) a = list(map(int, input().split())) a.sort() k = len(a) ok = [0] * k for i in range(k): if i < k - 1 and a[i] == a[i + 1]: ok[i] = 1 ok[i+1] = 1; continue times = 2 while a[i] * times <= a[-1]: r = bisect.bisect_left(a, a[i] * times + 1) ...
[["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 7, 8, 196, 0, 52, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 52, 15, 666, 667, 19], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612]]
5
175
n = int(input()) a = map(int, input().split()) a = list(sorted(a)) big = a[n-1] mark = [0]*big for x in a: mark[x] += 1 if mark[x] > 1: continue for j in range(x*2, big+1, x): mark[j] += 1 ans = 0 for x in a: if mark[x] == 1: ans += 1 print(ans)
n = int(input()) a = map(int, input().split()) a = list(sorted(a)) big = a[n-1] mark = [0]*(big+1) for x in a: mark[x] += 1 if mark[x] > 1: continue for j in range(x*2, big+1, x): mark[j] += 1 ans = 0 for x in a: if mark[x] == 1: ans += 1 print(ans)
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
111
N = int(input()) A = list(map(int,input().split())) A.sort() l = [0] * A[-1] for i in range(N): l[A[i] - 1] += 1 for i in range(N): if l[A[i] - 1] > 1: l[A[i] - 1] = 0 elif l[A[i] - 1] == 0: continue else: temp = A[i] while True: temp += A[i] if te...
N = int(input()) A = list(map(int,input().split())) A.sort() l = [0] * A[-1] for i in range(N): l[A[i] - 1] += 1 for i in range(N): if l[A[i] - 1] > 1: l[A[i] - 1] = 0 elif l[A[i] - 1] == 0: continue temp = A[i] while True: temp += A[i] if temp > A[-1]: br...
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102]]
5
148
N = int(input()) A = list(map(int,input().split())) U = [0]*(10**6+1) for e in A: U[e] += 1 ans = 0 for k in range(1,10**6+1+1): if U[k] == 1: ans += 1 if U[k] > 0: for l in range(2*k,10**6+1+1,k): if U[l] > 0: U[l] += 1 print(ans)
N = int(input()) A = list(map(int,input().split())) U = [0]*(10**6+1) for e in A: U[e] += 1 ans = 0 for k in range(1,10**6+1): if U[k] == 1: ans += 1 if U[k] > 0: for l in range(2*k,10**6+1,k): if U[l] > 0: U[l] += 1 print(ans)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
125
N = int(input()) A = list(map(int, input().split())) A.sort() maxnum = A[-1] checklist = [True]*(maxnum+1) before = 0 for a in A: if before == a: checklist[a] = False continue num = 1 while num * a <= maxnum: checklist[a * num] = False num += 1 before = a ans = 0 for ...
N = int(input()) A = list(map(int, input().split())) A.sort() maxnum = A[-1] checklist = [True]*(maxnum+1) before = 0 for a in A: if before == a: checklist[a] = False continue num = 2 while num * a <= maxnum: checklist[a * num] = False num += 1 before = a ans = 0 for ...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
110
package main import ( "bufio" "fmt" "os" "strconv" "strings" "sort" ) var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10) func main() { N := getStdinInt() A := getStdinIntArr() sort.Ints(A) list := make([]int, A[N-1]+1) list, _ = fill(list, 1, 0, A[N-1]+1) count := m...
package main import ( "bufio" "fmt" "os" "strconv" "strings" "sort" ) var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10) func main() { N := getStdinInt() A := getStdinIntArr() sort.Ints(A) list := make([]int, A[N-1]+1) list, _ = fill(list, 1, 0, A[N-1]+1) count := m...
[["-", 0, 7, 0, 430, 10, 431, 31, 432, 0, 22], ["+", 0, 7, 0, 430, 10, 431, 31, 432, 0, 22], ["-", 0, 7, 0, 430, 15, 16, 31, 16, 12, 22], ["+", 0, 7, 0, 430, 15, 16, 31, 16, 12, 22], ["-", 64, 196, 0, 7, 0, 430, 26, 463, 0, 22], ["+", 64, 196, 0, 7, 0, 430, 26, 463, 0, 22], ["-", 0, 436, 31, 432, 0, 437, 71, 16, 12, 22...
7
673
package main import ( "bufio" "fmt" "os" "strconv" ) type IntList []int func enumDivisors(n int) (res []int) { for i := 1; i*i <= n; i++ { if n%i == 0 { res = append(res, i) if n/i != i { res = append(res, n/i) } } } return } func lib_NewIntList(length int, initialValue int) IntList { ret :=...
package main import ( "bufio" "fmt" "os" "strconv" ) type IntList []int func enumDivisors(n int) (res []int) { for i := 1; i*i <= n; i++ { if n%i == 0 { res = append(res, i) if n/i != i { res = append(res, n/i) } } } return } func lib_NewIntList(length int, initialValue int) IntList { ret :=...
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 433], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 79], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 433]]
7
403
import collections N = int(input()) A = list(map(int, input().split())) A = collections.Counter(A) B = [] C = [] for i in A: if A[i] == 1: B.append(i) else: C.append(i) B = sorted(B) if len(B) == 0: print(0) exit() mb = B[-1] ok = [True] * (mb+1) if len(C) > 0: C = sorted(C) fo...
import collections N = int(input()) A = list(map(int, input().split())) A = collections.Counter(A) B = [] C = [] for i in A: if A[i] == 1: B.append(i) else: C.append(i) B = sorted(B) if len(B) == 0: print(0) exit() mb = 1000000 ok = [True] * (mb+1) if len(C) > 0: C = sorted(C) ...
[["-", 0, 656, 0, 1, 0, 662, 12, 206, 51, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 206, 0, 70], ["-", 0, 1, 0, 662, 12, 206, 206, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 206, 206, 664, 28, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 206, 0, 73], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
212
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
[["-", 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], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45]]
1
1,356
N = int(input()) A = list(map(int, input().split())) if N == 1: print(1) exit() check_list = [0] * (10**6 + 1) cnt = 0 for i in range(len(A)): tmp = A[i] while True: if tmp > A[-1]: break check_list[tmp] += 1 tmp += A[i] for a in A: if check_list[a] == 1: ...
N = int(input()) A = sorted(list(map(int, input().split()))) if N == 1: print(1) exit() check_list = [0] * (10**6 + 1) cnt = 0 for i in range(len(A)): tmp = A[i] while True: if tmp > A[-1]: break check_list[tmp] += 1 tmp += A[i] for a in A: if check_list[a...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
115
n = gets.to_i a = gets.split.map(&:to_i).sort! max_v = a.max check = Array.new(max_v + 1, true) a.each_with_index do |x, i| t = 2 if i > 0 && a[i] == a[i + 1] t = 1 end while x * t <= max_v do check[x * t] = false t += 1 end end ans = 0 a.each do |x| ans += 1 if check[x] end puts ans
n = gets.to_i a = gets.split.map(&:to_i).sort! max_v = a.max check = Array.new(max_v + 1, true) a.each_with_index do |x, i| t = 2 if i > 0 && a[i] == a[i - 1] t = 1 end while x * t <= max_v do check[x * t] = false t += 1 end end ans = 0 a.each do |x| ans += 1 if check[x] end puts ans
[["-", 15, 738, 12, 738, 12, 742, 0, 738, 17, 72], ["+", 15, 738, 12, 738, 12, 742, 0, 738, 17, 33]]
4
108
// #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, start, end) for (int i = (int)start; i <= (int)end; i++) #define vrep(i, n) for (int i = (int)n - 1; i >= 0; i--) #define vrep1(i, n) for (int i ...
// #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define rep2(i, start, end) for (int i = (int)start; i <= (int)end; i++) #define vrep(i, n) for (int i = (int)n - 1; i >= 0; i--) #define vrep1(i, n) for (int i ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 15, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 15, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
1,178
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func main() { sc.Split(bufio.ScanWords) n := nextInt() as := make([]int, n) for i := 0; i < n; i++ { as[i] = nextInt() } sort.Ints(as) max := int(1e6) var isNotPrime = make([]bool, max+1) isNotPrime[0] = true isNotPrime[1] = true x := 2 ...
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func main() { sc.Split(bufio.ScanWords) n := nextInt() as := make([]int, n) for i := 0; i < n; i++ { as[i] = nextInt() } sort.Ints(as) max := int(1e6) var isNotPrime = make([]bool, max+1) isNotPrime[0] = true isNotPrime[1] = true x := 2 ...
[["+", 12, 432, 0, 451, 8, 452, 0, 453, 0, 433], ["+", 0, 436, 12, 432, 0, 451, 8, 452, 0, 21]]
7
494
#include <bits/stdc++.h> using namespace std; typedef double db; typedef long long ll; //Òç³ö»á±ä³É¸ºÖµ typedef long double ldb; typedef unsigned long long ull; //×Ô¶¯È¡Ä£2^64 const double pi = acos(-1.0); const int mod = 1e9 + 7; // 998244353; const int inf = 0x7fffffff; // 2^31-1 const ll INF = 0x7fffffffffffffff;...
#include <bits/stdc++.h> using namespace std; typedef double db; typedef long long ll; //Òç³ö»á±ä³É¸ºÖµ typedef long double ldb; typedef unsigned long long ull; //×Ô¶¯È¡Ä£2^64 const double pi = acos(-1.0); const int mod = 1e9 + 7; // 998244353; const int inf = 0x7fffffff; // 2^31-1 const ll INF = 0x7fffffffffffffff;...
[["-", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["-", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
327
N = int(input()) A = [int(x) for x in input().split()] K = 10**6+1 num = [0] * K l = [False] * K for i in range(N): num[A[i]]+=1 l[A[i]] = True for i in range(2, K): if num[i]>0: if num[i]>1: l[i] = False j = 2 while i*j < K: l[i*j] = False j += ...
N = int(input()) A = [int(x) for x in input().split()] K = 10**6+1 num = [0] * K l = [False] * K for i in range(N): num[A[i]]+=1 l[A[i]] = True for i in range(1, K): if num[i]>0: if num[i]>1: l[i] = False j = 2 while i*j < K: l[i*j] = False j += ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
153
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; #define ll long long ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; #define ll long long ...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
285
#include <stdio.h> #include <stdlib.h> #define MAX 1000100 int n; int f[MAX]; int g[MAX]; int main(int argc, char *argv[]) { int a; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a); if (f[a]) g[a] = 1; f[a] = 1; } for (int i = 2; i < MAX; i++) { if (f[i] == 0) co...
#include <stdio.h> #include <stdlib.h> #define MAX 1000100 int n; int f[MAX]; int g[MAX]; int main(int argc, char *argv[]) { int a; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a); if (f[a]) g[a] = 1; f[a] = 1; } for (int i = 1; i < MAX; i++) { if (f[i] == 0) co...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
0
194
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << '[' << #x << " is: " << x << "] " \ << "\n"; #define imod(a, n) (a % n + n) % n; #define int long long const double eps = 1e-9, PI = acos(-1)...
#include <bits/stdc++.h> using namespace std; #define debug(x) \ cout << '[' << #x << " is: " << x << "] " \ << "\n"; #define imod(a, n) (a % n + n) % n; #define int long long const double eps = 1e-9, PI = acos(-1)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 338, 8, 9, 0, 57, 15, 339, 0, 25], ["+", 0, 338, 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], ["-", 0, 338, 8, 9, 0, 57, 64, 9, 0, 45]]
1
193
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mp makepair #define deb(x) cout << x << "\n"; #define deB(x, y) cout << x << " " << y << "\n"; #define Deb(x, y, z) cout << x << " " << y << " " << z << "\n" #define YES cout << "YES\n"; #d...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mp makepair #define deb(x) cout << x << "\n"; #define deB(x, y) cout << x << " " << y << "\n"; #define Deb(x, y, z) cout << x << " " << y << " " << z << "\n" #define YES cout << "YES\n"; #d...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 57, 64, 9, 0, 52, 8, 9, 0, 46]]
1
249
#include <algorithm> #include <cstdio> #include <cstring> #include <map> #include <set> #include <stack> #include <vector> #define MAX_N 90 using namespace std; bool criba[MAX_N + 1]; int ocurrences[MAX_N + 1]; int main() { int N, i, A, j, counter; scanf("%d", &N); memset(ocurrences, 0, sizeof ocurrences); ...
#include <algorithm> #include <cstdio> #include <cstring> #include <map> #include <set> #include <stack> #include <vector> #define MAX_N 1000000 using namespace std; bool criba[MAX_N + 1]; int ocurrences[MAX_N + 1]; int main() { int N, i, A, j, counter; scanf("%d", &N); memset(ocurrences, 0, sizeof ocurrence...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
224
def examA(): X = LI() for i in range(len(X)): if X[i]==0: ans = i+1 print(ans) return def examB(): X, Y = LI() ans = "No" for i in range(X+1): if i*2+(X-i)*4==Y: ans = "Yes" print(ans) return def examC(): X, N = LI() P = LI() P = ...
def examA(): X = LI() for i in range(len(X)): if X[i]==0: ans = i+1 print(ans) return def examB(): X, Y = LI() ans = "No" for i in range(X+1): if i*2+(X-i)*4==Y: ans = "Yes" print(ans) return def examC(): X, N = LI() P = LI() P = ...
[["-", 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, 25], ["-", 0, 656, 0, 14, 8, 196, 0, 7, 12, 22], ["+", 0, 656, 0, 14, 8, 196, 0, 7, 12, 22]]
5
1,363