submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s555447598
p00009
C
#include <stdio.h> int main(void){ char check=1; int i,j,k,m,n; int num[150000]; num[0] = 2;    k=0 for(i=3;i<=1000000;i=i+2){ for( j=0; j<=k; j++){ if(i%num[j] == 0){ check =0; break; } if(!check ) break; ...
main.c: In function 'main': main.c:9:1: error: stray '\343' in program 9 | <U+3000><U+3000><U+3000>k=0 | ^~~~~~~~ main.c:9:3: error: stray '\343' in program 9 | <U+3000><U+3000><U+3000>k=0 | ^~~~~~~~ main.c:9:5: error: stray '\343' in program 9 | <U+3000><U+3000><U+3000>k=0 | ...
s139388901
p00009
C
#include <stdio.h> int main(void){ char check=1; int i,j,k,m,n; int num[150000]; num[0] = 2;    k=0; for(i=3;i<=1000000;i=i+2){ for( j=0; j<=k; j++){ if(i%num[j] == 0){ check =0; break; } if(!check ) break; ...
main.c: In function 'main': main.c:9:1: error: stray '\343' in program 9 | <U+3000><U+3000><U+3000>k=0; | ^~~~~~~~ main.c:9:3: error: stray '\343' in program 9 | <U+3000><U+3000><U+3000>k=0; | ^~~~~~~~ main.c:9:5: error: stray '\343' in program 9 | <U+3000><U+3000><U+3000>k=0; | ...
s761690500
p00009
C
#include <stdio.h> int main(void){ char check=1; int i,j,k,m,n; int num[150000]; num[0] = 2; k=0; for(i=3;i<=1000000;i=i+2){ for( j=0; j<=k; j++){ if(i%num[j] == 0){ check =0; break; } if(!check ) break; ...
main.c: In function 'main': main.c:19:1: error: stray '\343' in program 19 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>k++; | ^~~~~~~~ main.c:19:3: error: stray '\343' in program 19 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>k++; | ^~~~~~~~ main.c:19:5: error: stra...
s612859285
p00009
C
#include <stdio.h> int main(void){ char check=1; int i,j,k,m,n; int num[150000]; num[0] = 2; k=0; for(i=3;i<=1000000;i=i+2){ for( j=0; j<=k; j++){ if(i%num[j] == 0){ check =0; break; } if(!check ) break; ...
main.c: In function 'main': main.c:19:1: error: stray '\343' in program 19 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>k++; | ^~~~~~~~ main.c:19:3: error: stray '\343' in program 19 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>k++; | ^~~~~~~~ main.c:19:5: error: stra...
s103279602
p00009
C
#include <stdio.h> int main(void){ char check=1; int i,j,k,m,n; int num[150000]; num[0] = 2; k=0; for(i=3;i<=1000000;i=i+2){ for( j=0; j<=k; j++){ if(i%num[j] == 0){ check =0; break; } if(!check ) break; ...
main.c: In function 'main': main.c:25:1: error: stray '\343' in program 25 | <U+3000><U+3000> while( scanf("%d",&n) != EOF){ | ^~~~~~~~ main.c:25:3: error: stray '\343' in program 25 | <U+3000><U+3000> while( scanf("%d",&n) != EOF){ | ^~~~~~~~
s343609520
p00009
C
#include <stdio.h> int main(void){ int n; int prime[270000]; prime[0]=2; int i,j,k=1,num,check; for( i=3; i<1000000;i=i+2){ check =1; for(j=0;j<k; j++){ if(a%prime[j] == 0 ){ check =0; break; } if(check){ ...
main.c: In function 'main': main.c:11:18: error: 'a' undeclared (first use in this function) 11 | if(a%prime[j] == 0 ){ | ^ main.c:11:18: note: each undeclared identifier is reported only once for each function it appears in main.c:24:1: error: expected declaration or statement a...
s186106395
p00009
C
#include <stdio.h> int main(void){ int n; int prime[270000]; prime[0]=2; int i,j,k=1,num,check; for( i=3; i<1000000;i=i+2){ check =1; for(j=0;j<k; j++){ if(i%prime[j] == 0 ){ check =0; break; } if(check){ ...
main.c: In function 'main': main.c:25:1: error: expected declaration or statement at end of input 25 | } | ^
s726272452
p00009
C
#include <stdio.h> int prime_check(int a){ int prime[270000]; prime[0]=2; prime[1]=3; int i,j,k=0; int check; if( a ==1) return 0; for(i=1;<=166667;i++){ check =1; for(j=0;j<=k;j++){ if((6*i+1)% prime[j] == 0) check =0; } if(check){ k++; prime[k]=i; } ...
main.c: In function 'prime_check': main.c:11:17: error: expected expression before '<=' token 11 | for(i=1;<=166667;i++){ | ^~
s191656852
p00009
C
#include <stdio.h> int check(unsigned long num) { unsigned long i; if(num == 1){ return 0; } if(num == 2){ return 1; } if(num == 3){ return 1; } if(num == 4){ return 0; } for(i=2; i<(num/2); i++){ if((num%i) == 0){ return 0; } } return 1; } int main() { unsigned long n, i, j, buf, cnt; bool flag=1...
main.c: In function 'main': main.c:24:9: error: unknown type name 'bool' 24 | bool flag=1; | ^~~~ main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 |
s115611517
p00009
C
#include<iostream> using namespace std; int F(int n) { int result=0; if (n==1 || n==0) result=0; else { for(int i=2;i<=n;i++) { int flag=0; for(int j=2;j<i;j++) { if(i%j==0) flag=1; } if(flag==0) result++; } } return result; } int main() { int number=0; while(1) { scanf("...
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s281056066
p00009
C
#include<conio.h> #include<stdio.h> int F(int n) { int result=0; if (n==1 || n==0) result=0; else { for(int i=2;i<=n;i++) { int flag=0; for(int j=2;j<i;j++) { if(i%j==0) flag=1; } if(flag==0) result++; } } return result; } int main() { int number=0; while(1) { scanf("%d"...
main.c:1:9: fatal error: conio.h: No such file or directory 1 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s236956032
p00009
C
#include<stdio.h> #include<math.h> #define max 1000000 int main() { int a; int x,y,z; int r[max]; for(x=3;x<=max;x+=2){ r[x]=1; } while((scanf("%d",&a))!=EOF){ if(a==1){ printf("%d",1); continue; } y=sqrt((double)a); for(z=3;z<=y;z+=2) if(r[x]==1){ for(x=3;x<=a/z;x+=2){ r[x*z]=0; ...
main.c: In function 'main': main.c:30:33: error: 't' undeclared (first use in this function) 30 | t++; | ^ main.c:30:33: note: each undeclared identifier is reported only once for each function it appears in
s121668858
p00009
C
#include <stdio.h> #define N 100000 #define rep(i,n) for(int i=0;i<n;i++) int main(void) { bool a[N+1]; int prime[N], n; rep(i,N) { a[i] = true; } a[0] = a[1] = false; for(int i=2;i*i<=N;i++) { if(a[i]) { prime[i] = prime[i-1] + 1; for(int...
main.c: In function 'main': main.c:7:5: error: unknown type name 'bool' 7 | bool a[N+1]; | ^~~~ main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | #define N 100000 main.c...
s382945600
p00009
C
#include <stdio.h> int main(void) { int a; while(scanf("%d", &a) != EOF) { printf("%d\n", prime(a)); } } int prime(int n) { int i, j, count = 0; for(i = 2;i <= n;i++) { for(j = 2;j*j <= i;j++) { if(i%j == 0) break; } if(j*j > i) count++; } return count; } return count; }
main.c: In function 'main': main.c:5:20: error: implicit declaration of function 'prime' [-Wimplicit-function-declaration] 5 | printf("%d\n", prime(a)); | ^~~~~ main.c: At top level: main.c:20:1: error: expected identifier or '(' before 'return' 20 | return count; | ^~~~~~ main...
s311686021
p00009
C
#include <stdio.h> int main(){ int n,i,j,a,f; int a[1000000]; for(i=2;i<1000000;i++){ a[i]=1; } for(i=2;i<1000000;i++){ for(j=2;j<i;j++){ a=i%j; if(a==0){ a[i]=0; break; } } } a[2]=1; while(scanf("%d",&n) != EOF){ f=0; for(i=2;i<=n;i++){ f+=a[i]; } printf("%d\n",f) } return 0; }
main.c: In function 'main': main.c:5:5: error: conflicting types for 'a'; have 'int[1000000]' 5 | int a[1000000]; | ^ main.c:4:11: note: previous declaration of 'a' with type 'int' 4 | int n,i,j,a,f; | ^ main.c:24:17: error: expected ';' before '}' token 24 | printf("%d\n",f) ...
s909661595
p00009
C
#include<stdio.h> #include<cmath> #include<iostream> using namespace std; int a[1000010]; int main() { int fun(int n); int n,i,j,k,m; while(scanf("%d",&n)!=EOF) { memset(a,0,sizeof(a)); m=fun(n); printf("%d\n",m); } return 0; } int fun(int m) { int i,j,k=0,q; for(i=2;i<=m;i++) { for(j=2;i*j<=m;j++) {...
main.c:2:9: fatal error: cmath: No such file or directory 2 | #include<cmath> | ^~~~~~~ compilation terminated.
s824710411
p00009
C
#include <stdio.h> #include <math.h> int judgeprime(long num){ int primeflag=1,i; if(num%2==0){primeflag=0;} else for(i=3;i<sqrt(num);i+=2){ if( num%i==0 ){ primeflag=0; break; } } if(num==0||num==1||num==4){primeflag=0;} else if(num==2){primeflag=1;} return primeflag; } int ma...
main.c:42:1: error: expected identifier or '(' before numeric constant 42 | 04:57:02 ~/programming/AOJ | ^~
s732131182
p00009
C
#include <stdio.h> #include <math.h> int main (void) { int n; int *list; while (scanf ("%d", &n) != EOF) { list = (int *) calloc (sizeof (int), n + 1); list[0] = list[1] = 0; for (int i = 2; i <= sqrt (n); i++) { if (list[i] == 0) { for (int j = i + 1; j <= n; j++) if (j % ...
main.c: In function 'main': main.c:10:22: error: implicit declaration of function 'calloc' [-Wimplicit-function-declaration] 10 | list = (int *) calloc (sizeof (int), n + 1); | ^~~~~~ main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'calloc' 2 | #include <math.h...
s079011806
p00009
C
#include<stdio.h> #define N 1000000 int main(void) { int ans,n,i; int a,m,TBL[N]; float AM=10; // forの条件式をスルーするために10代入 for(a=3;a<N;a+=2) TBL[a]=0; for(a=3;a<N;a+=2){ if(TBL[a]==0){ TBL[a]==1; for(m=2;AM<N;m++){ AM=a*m; TBL[AM]=-1; } } } while(scanf("%d",&n)!=EOF){ ans=1; for(i=3;i<=n;i+=...
main.c: In function 'main': main.c:14:36: error: array subscript is not an integer 14 | TBL[AM]=-1; | ^
s037626150
p00009
C
#include <stdio.h> #define NPRIMES 1000 #define FALSE 0 #define TRUE 1 int main(void) { int n; int i,j; int flag; int primes[NPRIMES]; int level; printf("Enter value of N > "); scanf("%d",&n); level = 0; for(i=2;i<=n;i++) { for(j = 0, flag = TRUE; j<level && flag; j++) fla...
main.c:29:1: error: expected identifier or '(' before '}' token 29 | } | ^
s680379864
p00009
C
#include<stdio.h> #define N 1000000 int main(void) { int ans,n,i; int a,m,TBL[N]; float AM=10; // forの条件式をスルーするために10代入 for(a=3;a<N;a+=2) TBL[a]=0; for(a=3;a<N;a+=2){ if(TBL[a]==0){ TBL[a]==1; for(m=2;AM<N;m++){ AM=a*m; TBL[AM]=-1; } } } while(scanf("%d",&n)!=EOF){ ans=1; for(i=3;i<=n;i+=...
main.c: In function 'main': main.c:14:36: error: array subscript is not an integer 14 | TBL[AM]=-1; | ^
s571783543
p00009
C
#include<iostream> using namespace std; #define N 200000 int main() { int a[N]={0},n,i,j,z; for(i=2;i<=N/2;i++){ if(a[i]==0){ for(j=2;j*i<=N;j++){ a[i*j]=1; } } } while((cin>>n)!=0){ z=0; for(i=2;i<=n;i++){ if(a[i]==0)z++; } cout<<z<<endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s053052926
p00009
C
int main(void){ int i,j,sq_n,count; double n; while(scanf("%lf",&n)!=EOF){ count=0; sq_n=sqrt(n); for(i=0;i<n;i++) prime[i]=1; prime[0]=0; for(i=1;i<sq_n;i++){ if(prime[i]==1){ for(j=(i+1);(i+1)*j<=n;j++) { ...
main.c: In function 'main': main.c:6:11: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 6 | while(scanf("%lf",&n)!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(void){ main.c:...
s063989421
p00009
C
#include "sort.h" int main() { int n; int result; while(scanf("%d",&n)!=EOF) { if(n <= 1) printf("Error input!"); else if(n == 2) { result = 1; } else if(n == 3) { result = 2; } else ...
main.c:1:10: fatal error: sort.h: No such file or directory 1 | #include "sort.h" | ^~~~~~~~ compilation terminated.
s892444638
p00009
C
#include<stdio.h> int main(void) { int a,j,i; while(scanf("%d",&a)!=EOF){ int b=0,count=0; for(j=2;j<=a;j++){ for(i=2;i<a;i++){ if(a%i=0) b=1; } if(b==0) count+=1; } printf("%d\n",count); } return 0; }
main.c: In function 'main': main.c:11:15: error: lvalue required as left operand of assignment 11 | if(a%i=0) | ^
s204272181
p00009
C
#include <stdio.h> int main(){ int sosuu[100000] = { 2, 3, 5 }, i, x, y = 3,n,z; while (scanf("%d", &n) ! = EOF){ z = 0; for (i = 3; i < n + 1; i += 2){ for (x = 0; x < y; x++){ if (i % sosuu[x] == 0){ break; } if (x + 1 == y){ sosuu[y] = i, y++;} } } for (i = 0; i < y; i++){ if (sosuu[i] >...
main.c: In function 'main': main.c:6:31: error: expected ')' before '!' token 6 | while (scanf("%d", &n) ! = EOF){ | ~ ^ ~ | )
s294022656
p00009
C
#include <stdio.h> int main(void){ int n; while(true){ scanf("%d",n); if(n==EOF){ break; } int m; bool check=true; for(m=2;m<n-1;m++){ if(n%m==0){ check=false; break; } } if(check==true){ printf("%d",n); return 0; }
main.c: In function 'main': main.c:5:7: error: 'true' undeclared (first use in this function) 5 | while(true){ | ^~~~ main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | ma...
s189032913
p00009
C
#include <stdio.h> int main(void){ int n; while(true){ scanf("%d",n); if(n==EOF){ break; } int m; boolean check=true; for(m=2;m<n-1;m++){ if(n%m==0){ check=false; break; } } if(check==true){ printf("%d",n); return 0; }
main.c: In function 'main': main.c:5:7: error: 'true' undeclared (first use in this function) 5 | while(true){ | ^~~~ main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | ma...
s787611289
p00009
C
#include <stdio.h> int main(void){ int n; while(true){ scanf("%d",n); if(n==EOF){ break; } int m; bool check=true; for(m=2;m<n-1;m++){ if(n%m==0){ check=false; break; } } if(check==true){ printf("%d",n); } } return 0; }
main.c: In function 'main': main.c:5:7: error: 'true' undeclared (first use in this function) 5 | while(true){ | ^~~~ main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | ma...
s823544882
p00009
C
#include <stdio.h> int main(void){ int n; while(true){ scanf("%d",n); if(n==EOF){ break; } int m; int check=1; for(m=2;m<n-1;m++){ if(n%m==0){ check=0; break; } } if(check==1){ printf("%d",n); } } return 0; }
main.c: In function 'main': main.c:5:7: error: 'true' undeclared (first use in this function) 5 | while(true){ | ^~~~ main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | ma...
s109064284
p00009
C
#include <stdio.h> int main(void){ int n; while(true){ scanf("%d",n); if(n==-1){ break; } int m; int check=1; for(m=2;m<n-1;m++){ if(n%m==0){ check=0; break; } } if(check==1){ printf("%d",n); } } return 0; }
main.c: In function 'main': main.c:5:7: error: 'true' undeclared (first use in this function) 5 | while(true){ | ^~~~ main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | ma...
s117918856
p00009
C++
#include <iostream> using namespace std; const int max=500000; int prime[max]; int main() { ios::sync_with_stdio(false); cin.tie(0); for(int i=0; i<max; i++) prime[i]=1; for(int i=3; i<1000; i+=2) { if(!prime[i>>1]) continue; for(int j=(i*i)/2; j<max; j+=i) prime[j]=0; } for(in...
a.cc:5:11: error: reference to 'max' is ambiguous 5 | int prime[max]; | ^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14...
s408329465
p00009
C++
#include<iostream> using namespace std; int n; int a[1000000]; int sum[1000000]; int main(int argc, char const *argv[]) { for (int i = 2; i < 1000000; ++i) { if (!a[i]) for (int j = i*2; j < 1000000; j+=i) a[j]=1; } for (int i = 2; i <1000000 ; ++i) sum[i]=sum[i-1]+(a[i]==0?1:0); while (cin>>n) ...
a.cc:26:9: error: expected declaration before '}' token 26 | } | ^
s526653169
p00009
C++
#include<bits/stdc++.h> using namespace std; #define maxPN 1000000 #define PNs 1000100 int countPN = 0, countPNs = 0; long long PrimeNum[maxPN], temp; bool PN[PNs]; bool IsPrimeNumber(long long x); void PrimeN(){ int i, j; PrimeNum[0] = 2; PN[2] = true;PrimeNum[countPN++] = 2; PN[3] = true;PrimeN...
a.cc: In function 'int main()': a.cc:65:14: error: expected '}' at end of input 65 | return 0; | ^ a.cc:42:11: note: to match this '{' 42 | int main(){ | ^
s272401758
p00009
C++
import math import sys def prime_calc(n): rootN = math.floor(math.sqrt(n)) prime = [2] data = [i + 1 for i in range(2,n,2)] while True: p = data[0] if rootN < p: return len(prime + data) prime.append(p) data = [e for e in data if e % p != 0] def main(): ...
a.cc:1:1: error: 'import' does not name a type 1 | import math | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s865438473
p00009
C++
import math import sys def prime_calc(n): rootN = int(n**0.5) prime = [2] data = [i + 1 for i in range(2,n,2)] while True: p = data[0] if rootN <= p: return len(prime + data) prime.append(p) data = [e for e in data if e % p != 0] def main(): l = [] ...
a.cc:1:1: error: 'import' does not name a type 1 | import math | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s285903044
p00009
C++
import math import sys def prime_calc(n): rootN = math.floor(math.sqrt(n)) prime = [2] data = [i + 1 for i in range(2,n,2)] while True: p = data[0] if rootN <= p: return len(prime + data) prime.append(p) data = [e for e in data if e % p != 0] def main(): ...
a.cc:1:1: error: 'import' does not name a type 1 | import math | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s696511407
p00009
C++
#include<stdio.h> int prime[1000000]; int main(){ prime[0]=-1; prime[1]=-1; for(int i=2;i<1000000;i++){ if(prime[i]==0){ prime[i]=1; for(int j=i*2;j<1000000;j+=i)prime[j]=-1; } } int now; while(~scanf("%d",&now)){ int ans=0; for(int i=1;i<n...
a.cc: In function 'int main()': a.cc:17:6: error: expected '}' at end of input 17 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s152700028
p00009
C++
nclude <iostream> #include <cstdio> #include <algorithm> #include <string> #include <cstring> #include <cctype> #include <cmath> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <list> #include <stdio.h> #include <string.h> #include <cstdlib> #include <math.h> #include <bitset>...
a.cc:1:1: error: 'nclude' does not name a type 1 | nclude <iostream> | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu...
s851132548
p00009
C++
#include <stdio.h> #include <math.h> int primes[78498], num_primes = 1; int calculated = 2; int count_pos(int n) { for (int i = 0; i < num_primes; i++) { if (primes[i] == n) { return i + 1; } else if (primes[i] > n) { return i; } } return num_primes; } int main() { primes[0] = 2; while (true) { in...
a.cc: In function 'int main()': a.cc:21:22: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 21 | if (!scanf_s("%d", &n)) break; | ^~~~~~~ | scanf
s545388254
p00009
C++
int primes[78498], num_primes; int calculated; int count_pos(int n) { for (int i = 0; i < num_primes; i++) { if (primes[i] == n) { return i + 1; } else if (primes[i] > n) { return i; } } return num_primes; } int main() { primes[0] = 2; calculated = 2; num_primes = 1; while (true) { int n; if (!...
a.cc: In function 'int main()': a.cc:20:22: error: 'scanf_s' was not declared in this scope 20 | if (!scanf_s("%d", &n)) break; | ^~~~~~~ a.cc:24:49: error: 'sqrt' was not declared in this scope 24 | int max = (int)(sqrt(i)) + 1; | ...
s177957932
p00009
C++
int primes[78498], num_primes; int calculated; int count_pos(int n) { for (int i = 0; i < num_primes; i++) { if (primes[i] == n) { return i + 1; } else if (primes[i] > n) { return i; } } return num_primes; } int main() { primes[0] = 2; calculated = 2; num_primes = 1; while (true) { int n; if (!...
a.cc: In function 'int main()': a.cc:20:22: error: 'scanf' was not declared in this scope 20 | if (!scanf("%d", &n)) break; | ^~~~~ a.cc:24:49: error: 'sqrt' was not declared in this scope 24 | int max = (int)(sqrt(i)) + 1; | ...
s551541168
p00009
C++
#include<bits/stdc++.h> bool f[1000005]; int tot[1000003]; int main() { memset(f,true,sizeof(f)); for(int i=2;i<=1000;i++) { if (f[i]) { for(int j=i+i;j<=1000000;j=j+i) { f[j]=false; } } } for(int i=2;i<=1000000;i++) ...
a.cc: In function 'int main()': a.cc:26:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 26 | while(cin>>in) cout<<tot[in]<<endl; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /...
s688120829
p00009
C++
#include <iostream> #include<string> #include<cmath> #include<algorithm> #include<cctype> #include<queue> #include<stack> #include<stdio.h> #include<vector> #include<set> #include<map> #include<iomanip> #define rep(i,n) for(int i=0;i<n;i++) typedef int long long ll; using namespace std; /*int main(){ ll n; ...
a.cc: In function 'int main()': a.cc:70:24: error: 'I' was not declared in this scope 70 | if(IsPrime[I]){ | ^
s117481020
p00009
C++
#include <iostream> #include<string> #include<cmath> #include<algorithm> #include<cctype> #include<queue> #include<stack> #include<stdio.h> #include<vector> #include<set> #include<map> #include<iomanip> #define rep(i,n) for(int i=0;i<n;i++) typedef int long long ll; using namespace std; /*int main(){ ll n; ...
a.cc: In function 'int main()': a.cc:70:24: error: 'I' was not declared in this scope 70 | if(IsPrime[I]){ | ^
s384578456
p00009
C++
#include<cstdio> #include<vector> #include<iostream> using namespace std; vector<bool> prime(1000010, 1); signed main(){ prime[0] = 0; prime[1] = 0; prime[2] = ( const ) 1; int ret = 0; int n; scanf( "%d", &n ); for( int i = 2; i * i <= n; i++ ){ if( prime[i] ){ for( int j = 1; ( ...
a.cc: In function 'int main()': a.cc:10:46: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive] 10 | prime[0] = 0; prime[1] = 0; prime[2] = ( const ) 1; | ^~~~~
s577716637
p00009
C++
//↓template↓ #include "bits/stdc++.h" using namespace std; #define Would #define you #define all(n) n.begin(),n.end() const long long INF = 1e18; const long long MOD = 1e9 + 7; const double pi = acos(-1); const int SIZE = 1 << 17; int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30]; long long fac[200005], finv[2000...
a.cc: In function 'long long int isp(long long int)': a.cc:41:35: error: 'res' was not declared in this scope 41 | if (n%i == 0) { ++res; } | ^~~ a.cc:43:16: error: 'res' was not declared in this scope 43 | return res; | ^~~
s732283076
p00009
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,i; i=0; vector<int> an(1000000),as(1000000); an[0]=2; for(int j=3;j<1000000;j++){ for(int u=0;u<1000000;u++){ if(an[u]==0){ an[u]=j; break; } if(j%an[u]==0){ break; } else{ continue; } } } for(int u=1;u<1000000;u++){ if(u==an[i]){ as[u]=as[u-1]+1...
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s832651575
p00009
C++
#include<iostream> #include<algorithm> #include<vector> #include<cmath> #include<cstdio> #include<string> #include<cmath> typedef long long int ll; using namespace std; bool priN[1000000]={}; bool pri[1000000]={}; bool isPrime(int n){ if(priN[n]==true)return pri[n]; for(int i=3;i<=sqrt((double)n);i++){ if(n%i==0...
a.cc: In function 'int main()': a.cc:34:20: error: expected '(' before 'n' 34 | if n<2 sum--; | ^ | (
s200790163
p00009
C++
#include<utility> #include<vector> #include<cmath> #include<cstdio> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define it ::iterator #define all(in) in.begin(),in.end() const double PI=acos(-1); const double ESP=1e-10; using namespace std; #define MA...
a.cc: In function 'int main()': a.cc:25:9: error: 'cin' was not declared in this scope 25 | while(cin>>in){ | ^~~ a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include<cstdio> +++ |+#include <iostream> 5 | #define...
s560589300
p00009
C++
#include <iostream> #include <algorithm> using namespace std; int count(int n); int main(void){ while (true){ int n; cin >> n; if (!n){ break; } cout << count(n) << endl; } return 0; } int count(int n){ int ct = 0; int *prime = new int[n]; for (int i = 0; i <= n;i++){ prime[i] = 0; } prime[2] = ...
a.cc: In function 'int count(int)': a.cc:28:30: error: 'sqrt' was not declared in this scope 28 | for (int i = 3; i <= sqrt(n); i = i + 2){ | ^~~~
s167255469
p00009
C++
#include <iostream> using namespace std; int count(int n); int main(void){ while (true){ int n; cin >> n; if (!n){ break; } cout << count(n) << endl; } return 0; } int count(int n){ int ct = 0; //bool *prime = new bool[n]; bool prime[999999]; for (int i = 0; i <= n;i++){ prime[i] = 0; } prime[2...
a.cc: In function 'int count(int)': a.cc:28:30: error: 'sqrt' was not declared in this scope 28 | for (int i = 3; i <= sqrt(n); i = i + 2){ | ^~~~
s917677531
p00009
C++
#include <iostream> using namespace std; int count(int n); int main(void){ while (true){ int n; cin >> n; if (!n){ break; } cout << count(n) << endl; } return 0; } int count(int n){ int ct = 0; bool *prime = new bool[n]; //bool prime[999999]; for (int i = 0; i <= n;i++){ prime[i] = 0; } prime[2...
a.cc: In function 'int count(int)': a.cc:28:30: error: 'sqrt' was not declared in this scope 28 | for (int i = 3; i <= sqrt(n); i = i + 2){ | ^~~~
s458474305
p00009
C++
#include <iostream> #include <algorithm> using namespace std; int count(int n); int main(void){ while (true){ int n; cin >> n; if (!n){ break; } cout << count(n) << endl; } return 0; } int count(int n){ int ct = 0; bool *prime = new bool[n]; //bool prime[999999]; for (int i = 0; i <= n;i++){ prim...
a.cc: In function 'int count(int)': a.cc:29:30: error: 'sqrt' was not declared in this scope 29 | for (int i = 3; i <= sqrt(n); i = i + 2){ | ^~~~
s203433856
p00009
C++
#include <iostream> #include <algorithm> using namespace std; int count(int n); int main(void){ while (true){ int n; cin >> n; if (!n){ break; } cout << count(n) << endl; } return 0; } int count(int n){ int ct = 0; bool *prime = new bool[n]; //bool prime[999999]; for (int i = 0; i <= n;i++){ prim...
a.cc: In function 'int count(int)': a.cc:29:30: error: 'sqrt' was not declared in this scope 29 | for (int i = 3; i <= sqrt(n * 1.0); i = i + 2){ | ^~~~
s467669897
p00009
C++
#include <iostream> #include <vector> using namespace std; int main() { const int N = 1000000; vector<bool> vec(N, true); double limit = sqrt(N); for (int i = 2; i < limit; i++){ for (int j = 2; i * j < N; j++){ vec[i * j] = false; } } int n, cnt = 0; while (cin >> n){ for (int i = 2; i <= n; i++){ ...
a.cc: In function 'int main()': a.cc:9:24: error: 'sqrt' was not declared in this scope 9 | double limit = sqrt(N); | ^~~~
s557882471
p00009
C++
#include<stdio.h> #include<string.h> #define range 999999 int total_added = 4; struct primes{ int key; int counts; }; primes p[range]; bool is_prime(int key) { int i; for (i = 2; i <= sqrt(key); i++) { if (key%i == 0)return false; } return true; } void init() { p[0].key = 2; p[0].counts = 1; p[1].key =...
a.cc: In function 'bool is_prime(int)': a.cc:14:26: error: 'sqrt' was not declared in this scope 14 | for (i = 2; i <= sqrt(key); i++) | ^~~~
s598925626
p00009
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> using namespace std; int main(){ int j,s[1000000]=0; long i,n,d=0; for(i=3;i<1000000;i++){ for(j=2;j*j<i;j+=2){ if(j%i==0){ d--; break; } ...
a.cc: In function 'int main()': a.cc:11:22: error: array must be initialized with a brace-enclosed initializer 11 | int j,s[1000000]=0; | ^
s839809824
p00009
C++
#include <iostream > using namespace std; int main() { for (int i=0; i<=30; i++) { int N; cin >> N; int count = 0; for (int i = 1; i <= N; ++i) { bool isPrime = true ; for (int j = 2; j ...
a.cc:1:11: fatal error: iostream : No such file or directory 1 | #include <iostream > | ^~~~~~~~~~~ compilation terminated.
s374360655
p00009
C++
#include <iostream> #include <list> #include <algorithm> int main(){ int NUM; while(std::cin >> NUM){ std::list<int> numList,primeList; for(int i=2;i<=NUM;++i){ numList.push_back(i); } for(int i=numList.front();i<std::sqrt(NUM);i=numList.front()){ primeList.push_back(i); numList.erase(std::remove_...
a.cc: In function 'int main()': a.cc:13:50: error: 'sqrt' is not a member of 'std'; did you mean 'sort'? 13 | for(int i=numList.front();i<std::sqrt(NUM);i=numList.front()){ | ^~~~ | sort
s734619230
p00009
C++
#include <iostream> #include <cmath> using namespace std; int prime(int); int main(){ int a,n; n=0; while ( cin >> a){ for (int i=2;i<a;i++){ if (prime(i)==0){ n++; } } cout << n << endl; } } int prime(int x){ if(x==2 || x==3 || x==5 ...
a.cc: In function 'int prime(int)': a.cc:25:103: error: expected ';' before 'return' 25 | if(x%i==0 || x%(i+4)==0 || x%(i+6)==0 || x%(i+12)==0 || x%(i+16)==0 || x%(i+22)==0 || x%(i+24) | ^ | ...
s276973647
p00009
C++
#include <iostream> #include <vector> #include <algorithm> int main() { int n; while (std::cin >> n) { std::vector<int> nums; ++n; for (int i = 0; i < n; ++i) { nums.push_back(i); } for (int i = 0; i < n; ++i) { if (nums.at(i) < 2) continue; for (int j = nums.at(i) * 2; j < n; j += nums.at(i)) { ...
a.cc: In function 'int main()': a.cc:22:35: error: 'c' was not declared in this scope 22 | ++c | ^
s711372547
p00009
C++
#include <iostream> using namespace std; int a[999999]={}; int main(){ int n,ans=0; vector<int> v; for(int i = 2; i*i < 999999; i++){ for(int j = 0; j < 999999; j+=i){ if(i!=j) a[j]=1; } } while(cin >> n){ v.push_back(n); } for(int i = 0; i < v.size(); i++){ for(int j = 2; j <= v[i]; j++){ if(a[j...
a.cc: In function 'int main()': a.cc:8:9: error: 'vector' was not declared in this scope 8 | vector<int> v; | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2...
s498068729
p00009
C++
__bowl1 = Array.new __bowl2 = Array.new __bowl3 = Array.new __bowl4 = Array.new __bowl5 = Array.new india = gets.chomp.to_i loop do srilanka = gets.chomp.to_i __bowl.push(srilanka) thai = gets.chomp.to_i puts __bowl.pop - thai india -= 1 if india == 0 break end end
a.cc:1:1: error: '__bowl1' does not name a type 1 | __bowl1 = Array.new | ^~~~~~~
s816413279
p00009
C++
__bowl1 = Array.new __bowl2 = Array.new __bowl3 = Array.new __bowl4 = Array.new __bowl5 = Array.new india = gets.chomp.to_i loop do srilanka = gets.chomp.to_i __bowl.push(srilanka) thai = gets.chomp.to_i puts __bowl.pop - thai india -= 1 if india == 0 break end end
a.cc:1:1: error: '__bowl1' does not name a type 1 | __bowl1 = Array.new | ^~~~~~~
s979461580
p00009
C++
#include <stdio.h> int isprime(int n){ for(int = 2; i * i <= n; i++) { if(n % i == 0) return 0; //素数でない } return 1; //素数である } int main() { int n; int ans[2] = {}; while(scanf("%d", &n) != 0) { for(int i = n; i >= 5; i--) { if(isprime(i) == 1) { ans[...
a.cc: In function 'int isprime(int)': a.cc:4:13: error: expected unqualified-id before '=' token 4 | for(int = 2; i * i <= n; i++) { | ^ a.cc:4:12: error: expected ';' before '=' token 4 | for(int = 2; i * i <= n; i++) { | ^~ | ; a.cc:4:13: error: expe...
s547052541
p00009
C++
while True: try: n=int(input()) a=[True]*(n+1) a[0]=a[1]=False for i in range(2,int(n**0.5)+1): if a[i]: for j in range(i**2,n+1,i): a[j]=False print(a.count(True)) except: break
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while True: | ^~~~~
s722361177
p00009
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> using namespace std; int main(){ int n,cnt=0,ans,sosu[100000]={0}; for(int i=2;i<100000;i++){ bool flag=true; for(int j=2;j<=sqrt(i);j++){ if(i%j==0)flag=false; } if(flag){ sosu[cnt]=i; cnt++; } } while(cin>>n){ ans=0,cnt=0; ...
a.cc: In function 'int main()': a.cc:10:32: error: 'sqrt' was not declared in this scope 10 | for(int j=2;j<=sqrt(i);j++){ | ^~~~
s964868652
p00009
C++
#include <iostream> using namespace System; using namespace std; const int MAX_N =1000000; int main(){ bool sosu[MAX_N]={};//false:sosu for(int i=2;i<MAX_N;i++){ if(!sosu[i]){ for(int j=2;j*i<MAX_N;j++){ sosu[j*i]=true; } } } for(int n;cin>>n;){ int ans=0; for(int i=2;i<=n;i++){ if(!sosu[i])ans...
a.cc:2:17: error: 'System' is not a namespace-name 2 | using namespace System; | ^~~~~~
s153054568
p00009
C++
#include <iostream> #include <string> using namespace std; int main() { while(1){ long int xx,sqrtx,q,count=1; long double n; cin >> n; xx=n; sqrtx = sqrt(n); long int *ar = new long int [xx]; long int *p = new long int [xx]; for(long int i=2 ; i<=xx ; i++){ // 2〜xまでの整数 ar[i]=i; } int i=...
a.cc: In function 'int main()': a.cc:12:17: error: 'sqrt' was not declared in this scope; did you mean 'sqrtx'? 12 | sqrtx = sqrt(n); | ^~~~ | sqrtx
s290767884
p00009
C++
int count_prime( unsigned int const& n ) { if ( n <= 0 || 1000000 <= n ) return -1; std::vector<bool> memo_prime( n+1, true ); for ( unsigned int i = 2; i < n; ++i ) { for ( unsigned int j = 2; i*j <= n; ++j ) { memo_prime.at(i*j) = false; } } memo_prime.at(0)...
a.cc: In function 'int count_prime(const unsigned int&)': a.cc:4:10: error: 'vector' is not a member of 'std' 4 | std::vector<bool> memo_prime( n+1, true ); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#incl...
s454514161
p00009
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; constexpr int LIM = 1000000; static char isprime[LIM]; static int numofprime[LIM]; void setprime(int N) { fill(isprime, isprime + N + 1, 1); isprim...
a.cc: In function 'void setprime(int)': a.cc:19:31: error: 'sqrt' was not declared in this scope 19 | for(int x = 2, lim = (int)sqrt(N); x <= lim; ++x) { | ^~~~
s611593332
p00009
C++
#include <iostream> int main(int argc, const char * argv[]) { // insert code here... while(true) { int n; std::cin >> n; if(std::cin.eof())break; int count = 0; std: for(int i=2;i<n;i++) { bool flag = true; for(in...
a.cc:23:27: error: stray '#' in program 23 | break;#include <iostream> | ^ a.cc: In function 'int main(int, const char**)': a.cc:23:28: error: 'include' was not declared in this scope 23 | break;#include <iostream> | ...
s985769080
p00009
C++
#coding: UTF-8 from bisect import bisect_right max_number = 1000000 prime_flag_list = [True] * max_number prime_flag_list[0] = False prime_flag_list[1] = False prime_flag_list[4::2] = [False] * len(prime_flag_list[4::2]) for i in range(3, int(max_number**0.5) + 1, 2): prime_flag_list[i*i::i] = [False] * len(pr...
a.cc:1:2: error: invalid preprocessing directive #coding 1 | #coding: UTF-8 | ^~~~~~ a.cc:3:1: error: 'from' does not name a type 3 | from bisect import bisect_right | ^~~~
s688455416
p00009
C++
int main(){ int i , j , n , pn , cn=0; while(cin>>n){ pn=1; for(i=3 ; i<=n ; i++){ for (j=2 ; j<i ; j++){ if (i%j==0) goto skip; } pn++; skip:; } if(n==0 || n==1 ) { cout << 0 << endl; } else { cout << pn << endl; } cn++; if(cn>=30) break; } return 0; }
a.cc: In function 'int main()': a.cc:4:15: error: 'cin' was not declared in this scope; did you mean 'cn'? 4 | while(cin>>n){ | ^~~ | cn a.cc:14:25: error: 'cout' was not declared in this scope 14 | cout << 0 << endl; | ...
s316454808
p00009
C++
int main(){ int i , j , n , pn , cn=0; while(cin>>n){ pn=1; for(i=3 ; i<=n ; i++){ for (j=2 ; j<i ; j++){ if (i%j==0) goto skip; } pn++; skip:; } if(n==0 || n==1 ) { cout << 0 << endl; } else { cout << pn << endl; } cn++; if(cn>=30) break; } return 0; }
a.cc: In function 'int main()': a.cc:4:15: error: 'cin' was not declared in this scope; did you mean 'cn'? 4 | while(cin>>n){ | ^~~ | cn a.cc:14:25: error: 'cout' was not declared in this scope 14 | cout << 0 << endl; | ...
s308931754
p00009
C++
#include <math.h> #include <iostream> #include <ios> #include <iomanip> #include <algorithm> #include <functional> #include <string> #define YES "YES" #define NO "NO" #define space ' ' using namespace std; void func(); int main(void) { func(); return 0; } #define MAXIMUM 1000000 bool table[MAXIMUM]; int cnt[...
a.cc:29:9: error: "not" cannot be used as a macro name as it is an operator in C++ 29 | #define not true | ^~~ a.cc: In function 'void func()': a.cc:33:23: error: expected primary-expression before ';' token 33 | table[0] = not; | ^ a.cc:34:23: error: expected pri...
s971046589
p00009
C++
#include <math.h> #include <iostream> #include <ios> #include <iomanip> #include <algorithm> #include <functional> #include <string> #define YES "YES" #define NO "NO" #define space ' ' #define not true #define prime false using namespace std; void init(); void func(); int main(void) { func(); return 0; } #de...
a.cc:12:9: error: "not" cannot be used as a macro name as it is an operator in C++ 12 | #define not true | ^~~ a.cc:32:9: error: "not" cannot be used as a macro name as it is an operator in C++ 32 | #define not true | ^~~ a.cc: In function 'void init()': a.cc:37:31: error: expected pri...
s746520706
p00009
C++
#include <math.h> #include <iostream> #include <ios> #include <iomanip> #include <algorithm> #include <functional> #include <string> #define YES "YES" #define NO "NO" #define space ' ' using namespace std; void init(); void func(); int main(void) { func(); return 0; } #define MAXIMUM 1000000 bool table[MAXIM...
a.cc:30:6: error: expected unqualified-id before 'not' token 30 | bool not = true; | ^~~ a.cc: In function 'void init()': a.cc:35:31: error: expected primary-expression before ';' token 35 | table[0] = not; | ^ a.cc:36:23: error: expected primary-expr...
s502416888
p00009
C++
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNextInt()){ int n=sc.nextInt(); int prime=0; if(n>=2){ prime+=1; if(n>2){ for(int i=3;i<=n;i++){ if(prime_number(i)){ prime++; } } } } } System.out.println(prime); } public static boolean pr...
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:7: error: expected ':' before 'static' 4 | public static void main(String[] args){ | ^~~~~~~ | : a.cc:4:25: error: 'String'...
s016911023
p00009
C++
#include<iostream> #define N 999999 #define FOR(i,a,b) for( int i = ( a ); i < ( b ); i++ ) #define WHILE(n) while( std::cin >> n ) int p[(N+1)/2];int m[N+1];int mk();int main(){int n;p[0]=2;m[1]=0;m[2]=1;mk();WHILE(n){cout<<m[n]<<i'\n';}return 0;}int mk(){int i,j,e=1;REP(i,3,N_MAX){for(j=0;p[j]*p[j]<=i;j++){if(i%p[j]=...
a.cc: In function 'int main()': a.cc:5:88: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 5 | int p[(N+1)/2];int m[N+1];int mk();int main(){int n;p[0]=2;m[1]=0;m[2]=1;mk();WHILE(n){cout<<m[n]<<i'\n';}return 0;}int mk(){int i,j,e=1;REP(i,3,N_MAX){for(j=0;p[j]*p[j]<=i;j++){if(i%p[j]==0){goto ...
s785013640
p00009
C++
#pragma warning (disable:4996) #include<iostream> #include<cstdio> #include<queue> #include<cstring> #include<string> #include<cmath> #include<algorithm> #define MAX 1000000 using namespace std; int amount[MAX]; int vis[MAX]; int prime[MAX]; int main(){ memset(vis, 0, sizeof(vis)); memset(prime, 0, sizeof(prime)); ...
a.cc: In function 'int main()': a.cc:38:2: error: expected '}' at end of input 38 | } | ^ a.cc:14:11: note: to match this '{' 14 | int main(){ | ^
s004108050
p00009
C++
#pragma warning (disable:4996) #include<iostream> #include<cstdio> #include<queue> #include<cstring> #include<string> #include<cmath> #include<algorithm> #define MAX 1000000 using namespace std; int amount[MAX]; int vis[MAX]; int prime[MAX]; int main(){ memset(vis, 0, sizeof(vis)); memset(prime, 0, sizeof(prime)); ...
a.cc: In function 'int main()': a.cc:38:2: error: expected '}' at end of input 38 | } | ^ a.cc:14:11: note: to match this '{' 14 | int main(){ | ^
s581006927
p00009
C++
qa
a.cc:1:1: error: 'qa' does not name a type 1 | qa | ^~
s213081319
p00009
C++
#include <iostream> #include <cmath> #include <algorithm> template<int N> class primes { public: constexpr static auto NN = static_cast<int>(std::sqrt(N)); public: constexpr primes() { for( int i=2; i<N; ++i ) not_primes[i] = false; for( int i=2; i<NN; ++i ) { if (...
a.cc: In function 'int main()': a.cc:38:35: in 'constexpr' expansion of 'primes<1000000>()' a.cc:14:9: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit) 14 | for( int i=2; i<N; ++i ) | ^~~
s302296748
p00009
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<int> prime_num{ 2, 3 }; int n; while (cin >> n){ int result; if (n <= 1) { result = 0; } else if (n == 2){ result = 1; } else if (n < prime_num.back()){ result = count_if(prime_num.begin(), prime...
a.cc: In function 'int main()': a.cc:33:58: error: expected ';' before '}' token 33 | cout << result << endl;javascript:void(0) | ^ | ; 34 | } | ~ ...
s109075066
p00009
C++
#include <stdio.h> #include <stdlib.h> #include <string.h> int prime(int n) { int k; for(k = 2; k * k <= n; k++) { if(n % k == 0) return 0; } return 1; } int cntPrime(int n) { int cnt = 0, i, k; for(i = 2; i <= n; i++) { cnt += prime(i); } return cnt; } int main() { int a; int arg[1024] =...
a.cc:33:1: error: expected class-name before '~' token 33 | ~ | ^
s962774714
p00009
C++
#include <stdio.h> #include <stdlib.h> #include <string.h> int prime(int n) { int k; for(k = 2; k * k <= n; k++) { if(n % k == 0) return 0; } return 1; } int cntPrime(int n) { int cnt = 0, i, k; for(i = 2; i <= n; i++) { cnt += prime(i); } return cnt; } int main() { int a; int arg[1024] =...
a.cc:32:2: error: expected class-name at end of input 32 | ~ | ^
s184056988
p00009
C++
#include <cmath> #include <iostream> using namespace std; bool isprime(int n) { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) return false; } return true; } int main() { int N[31]; int C[31]; memset(N, 0, sizeof(N)); for (int i = 0; i < 3; i++) { for (int j = 2; j <= N[i]; j++) { if (isprim...
a.cc: In function 'int main()': a.cc:19:20: error: 'memset' was not declared in this scope 19 | int C[31]; memset(N, 0, sizeof(N)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> ...
s368949239
p00009
C++
#include<iostream> #include<cstdio> #include<vector> using namespace std; vector<int>soe(int n); int main(void) { int num; while(cin >> num){ vector<int>sosu(num); sosu = soe(num); int a_size = sosu.size(); cout << a_size << endl; /*for(int i = 1; i < num; i++){ cout << sosu[i] <<endl; }*/ } retu...
a.cc: In function 'std::vector<int> soe(int)': a.cc:32:51: error: cannot convert 'std::vector<int>::iterator' to 'const char*' 32 | hyo.erase(remove(hyo.begin(), hyo.end(), j), hyo.end()); | ~~~~~~~~~^~ | ...
s064708337
p00009
C++
#include <stdio.h> #define MAX_SIZE(1000001) int prime[MAX_SIZE]; int main() { int n, i, j; for (i = 0; i < MAX_SIZE; i++){ prime[i] = 1; } prime[0] = prime[1] = 0; for (i = 2; i * i < MAX_SIZE; i++){ if (prime[i] == 1){ for (j = i * i; j < MAX_SIZE; j += i){ prime[j] = 0; } } } for (i = 1...
a.cc:3:18: error: expected parameter name, found "1000001" 3 | #define MAX_SIZE(1000001) | ^~~~~~~ a.cc:5:11: error: 'MAX_SIZE' was not declared in this scope 5 | int prime[MAX_SIZE]; | ^~~~~~~~ a.cc: In function 'int main()': a.cc:11:17: error: 'MAX_SIZE' was not declared...
s068561045
p00009
C++
import java.util.Scanner; public class Main { //?¨???????????????? public int kazu(int num){ //?´???°??????????????????????????°???????????? int count = 0; //?´???°????????????????????? boolean result; for(int i = 2; i < num; i++){ //?´???°??§????????¨????...
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s951316024
p00009
C++
public static void main(String[] args) { int n = 35; int a,b,c,d; int cnt = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if(i+j > n) break; for (int k = 0; k < 10; k++) { if(i+ j + k > n) break; for (int l = 0; l < 10; l++) { if(i+j+k+l > n) break; if(i+j+k+...
a.cc:1:9: error: expected unqualified-id before 'public' 1 | public static void main(String[] args) { | ^~~~~~
s028395637
p00009
C++
#include<iostream> const int MAX_N=1000000; using namespace std; bool value[MAX_N]; int main(){ int n; while(cin>>n){ int count=0; for(int i=1;i<=n;++i){ value[i]=true; } for(int i=2;i<=n;++i){ if(value[i]){ for(int j=2;j<=n/i;++j){ value[j*i]=false; } } for(int i=2;i<=n;++i){ if(value[i])...
a.cc: In function 'int main()': a.cc:25:2: error: expected '}' at end of input 25 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s795251863
p00009
C++
#include<iostream> #define Max 1000000 bool prime[Max]; void IsPrime(){ prime[0]=prime[1]=0;prime[2]=1; for(int i=3;i<Max;i++) prime[i]=i%2==0?0:1; int t=(int)sqrt(Max*1.0); for(int i=3;i<=t;i++) if(prime[i]) for(int j=i*i;j<Max;j+=2*i)//?化 ...
a.cc: In function 'void IsPrime()': a.cc:9:17: error: 'sqrt' was not declared in this scope 9 | int t=(int)sqrt(Max*1.0); | ^~~~
s847144475
p00009
C++
#include<iostream> #include<cstdio> #include <cstring> using namespace std; int main() { int n; while(scanf("%d",&n)!=EOF) { int count=0; bool a[1000001]; memset() for(int i=2;i*i<=n;i++) { if(a[i]==false) { for(int j=i;j<=n;j+=i) { if(j==i) continue; a[j]=true; } ...
a.cc: In function 'int main()': a.cc:12:23: error: too few arguments to function 'void* memset(void*, int, size_t)' 12 | memset() | ~~~~~~^~ In file included from /usr/include/c++/14/cstring:43, from a.cc:3: /usr/include/string.h:61:14: note: declared here 61...
s057295013
p00009
C++
#include <iostream> #include <cstring> using namespace std; #define maxn 1000000 int isprime(int n) { int p = 0; memset(prime,true,sizeof(prime)); prime[0] = prime[1] = false; for(int i=2;i<=n;i++) { if(prime[i]) { for(int j=2*i;j<=n;j+=i) prime[j] = false; p++; } } return p;...
a.cc: In function 'int isprime(int)': a.cc:10:10: error: 'prime' was not declared in this scope 10 | memset(prime,true,sizeof(prime)); | ^~~~~
s528088455
p00009
C++
#include<iostream> #include<string> using namespace std; const int MAX_N=10000000; bool data[10000000]; int sum[10000000]; void solve() { for (int i = 2; 2 * i < MAX_N;i++) if (data[i]) for (int j = 2 * i; j < MAX_N; j = j + i) data[j] = false; data[0] = data[1] = false; for (int i = 0; i < MAX_N; i++) sum[i...
a.cc: In function 'void solve()': a.cc:10:13: error: reference to 'data' is ambiguous 10 | if (data[i]) | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:4...
s834558140
p00009
C++
#include <utility> #include <iostream> using namespace std; #define MAX_N 99999 #define MAX_D 30 bool prime_check(int n, int k = 2) { if (n < k * k) { return true; } if (n % k == 0) { return false; } return prime_check(n, k + 1); } int main() { int n; bool isprime[MAX_N + 1]; for (int i = 2; i < MAX_N + 1...
a.cc: In function 'int main()': a.cc:31:25: error: 'count' was not declared in this scope 31 | cout << count(isprime + 2, isprime + n + 1, true) << endl; | ^~~~~
s085644853
p00009
C++
#include <utility> #include <iostream> using namespace std; #define MAX_N 99999 #define MAX_D 30 bool prime_check(int n, int k = 2) { if (n < k * k) { return true; } if (n % k == 0) { return false; } return prime_check(n, k + 1); } int main() { int n; bool isprime[MAX_N + 1]; for (int i = 2; i < MAX_N + 1...
a.cc: In function 'int main()': a.cc:31:25: error: 'count' was not declared in this scope 31 | cout << count(isprime + 2, isprime + n + 1, true) << endl; | ^~~~~