submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s845856590
p00009
Java
#include <iostream> using namespace std; int main(void){ bool a[600001]; while(!cin.eof()){ int n; cin >> n; for(int i = 2; i <= n; i++){ a[i] = true; } for(int i = 2; i * i <= n; i++){ if(!a[i]) continue; for(int j = i + 1; j <= n; j++) if(!(j % i)){ a[j] = false; } } int ans =...
Main.java:1: error: illegal character: '#' #include <iostream> ^ Main.java:1: error: class, interface, enum, or record expected #include <iostream> ^ Main.java:7: error: not a statement cin >> n; ^ Main.java:26: error: not a statement cout << ans << endl; ^ Main.java:3: error: unnamed c...
s587388532
p00009
Java
#include<iostream> #include<stdio.h> #include<math.h> int prime(int x) { int i,j=1; int l; l=sqrt(x); for(i=2;i<=l+1;i++) { if(x%i==0) { j=0; break; } } //if(j==0)return 0; if(x==2||j==1) return 1; } using namespace std; int main() { ...
Main.java:1: error: illegal character: '#' #include<iostream> ^ Main.java:2: error: illegal character: '#' #include<stdio.h> ^ Main.java:3: error: illegal character: '#' #include<math.h> ^ Main.java:7: error: unnamed classes are a preview feature and are disabled by default. int l; ^ (use --enable-preview to ...
s455112144
p00009
Java
import java.util.Scanner; import java.util.HashSet; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); HashSet<int> set = new HashSet<int>; for (int i = 2; i < n; i++) { set.add(i); } for (int i =...
Main.java:10: error: '(' or '[' expected HashSet<int> set = new HashSet<int>; ^ 1 error
s509846288
p00009
Java
import java.util.Scanner; import java.util.HashSet; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); HashSet<int> set = new HashSet<int>(); for (int i = 2; i < n; i++) { set.add(i); } for (int i...
Main.java:10: error: unexpected type HashSet<int> set = new HashSet<int>(); ^ required: reference found: int Main.java:10: error: unexpected type HashSet<int> set = new HashSet<int>(); ^ required: reference found: int 2 errors
s522100309
p00009
Java
import java.util.Scanner; import java.util.HashSet; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); boolean[] isPrime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { isPrime[i] = true } fo...
Main.java:12: error: ';' expected isPrime[i] = true ^ 1 error
s749022992
p00009
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true){ String num=br.readLine(); if(num==null){ break; } int n = Integer.parseInt(num); boolean ...
Main.java:24: error: illegal start of type return 0; ^ Main.java:26: error: class, interface, enum, or record expected } ^ 2 errors
s015461612
p00009
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true){ String num=br.readLine(); if(num==null){ break; } int n = Integer.parseInt(num); boolean ...
Main.java:25: error: class, interface, enum, or record expected } ^ 1 error
s102585930
p00009
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true){ String num=br.readLine(); if(num==null){ break; } int n = Integer.parseInt(num); boolean ...
Main.java:25: error: class, interface, enum, or record expected } ^ 1 error
s270460665
p00009
Java
import java.util.Scanner; public class Main09{ public static void main(String[] args){ while(true){ Scanner in = new Scanner(System.in); String x = in.nextLine(); int a = Integer.parseInt(x); int n =0; int[] p = new int[(a+1)]; int[] q = new int[(a+1)]; for(int i =1;i<=a;i++){ for(int j=1;j<i;j+...
Main.java:3: error: class Main09 is public, should be declared in a file named Main09.java public class Main09{ ^ 1 error
s989609209
p00009
Java
public class Main{ public static void main(String[] args){ while(true){ Scanner in = new Scanner(System.in); String x = in.nextLine(); int a = Integer.parseInt(x); int n =0; int[] p = new int[(a+1)]; int[] q = new int[(a+1)]; for(int i =1;i<=a;i++){ for(int j=1;j<i;j++){ if(i%j == 0){ p[...
Main.java:4: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s951973261
p00009
Java
import java.io.*; public class Main09 { public static void main(String[] args){ BufferedReader reader =new BufferedReader(new InputStreamReader(System.in)); String line; try{ while((line=reader.readLine()) != null){ int x =Integer.parseInt(line); int[] p=new int[x+1]; int[] q=new int[x+1]; in...
Main.java:3: error: class Main09 is public, should be declared in a file named Main09.java public class Main09 { ^ 1 error
s166510757
p00009
Java
import java.io.*; public class Main { public static void main(String[] args){ BufferedReader reader =new BufferedReader(new InputStreamReader(System.in)); String line; try{ while((line=reader.readLine()) != null){ int x =Integer.parseInt(line); int[] p=new int[x+1]; int[] q=new int[x+1]; int ...
Main.java:29: error: incompatible types: unexpected return value return 0; ^ 1 error
s671961849
p00009
Java
import java.io.*; public class Niam { public static void main(String[] args){ try{ BufferedReader reader =new BufferedReader(new InputStreamReader(System.in)); String line; while((line=reader.readLine()) != null){ int x =Integer.parseInt(line); int[] p=new int[x+1]; int n=0; for(int ...
Main.java:3: error: class Niam is public, should be declared in a file named Niam.java public class Niam { ^ 1 error
s228112939
p00009
C
#include<stdio.h> #include<math.h> #include<stdbool.h> static int count = 1; static int prime[5000] = {2,3}; static bool primebool[5000] = {true,true}; int primesearch(int); void primecount(int,int); void reset(); int main(){ int n; while(scanf("%d", &n) != EOF){ if (n>1){ primecount(0,n); printf...
/usr/bin/ld: /tmp/ccywatTb.o: in function `main': main.c:(.text+0x43): undefined reference to `reset' /usr/bin/ld: /tmp/ccywatTb.o: in function `primesearch': main.c:(.text+0x14f): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
s172848883
p00009
C
include<stdio.h> #include<math.h> #include<stdbool.h> static int count = 1; bool primebool(int); void primecount(int,int); void reset(); int main(){ int n; while(scanf("%d", &n) != EOF){ if (n>2){ primecount(3,n); printf("%d\n", count); reset(); } else if (n==2){ printf("1\n")...
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ main.c: In function 'main': main.c:13:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 13 | while(scanf("%d", &n) != EOF){ | ^~~~~ main.c:...
s408717032
p00009
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { while (true) { int n, ans = 0; scanf("%d", &n); if (n >= 2)ans++; for (int i = 3; i <= n; i += 2) { int h = 1; for (int j = 3; j*j <= i&&h==1; j += 2) { if (i%j == 0)h = 0; } ans += h; } printf("%d\n", ans); } }
main.c: In function 'main': main.c:5:16: error: 'true' undeclared (first use in this function) 5 | while (true) { | ^~~~ main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include<stdio.h> +++ |+#include <std...
s586372384
p00009
C
#include<stdio.h> int main() { while (true) { int n, ans = 0; scanf("%d", &n); if (n >= 2)ans++; for (int i = 3; i <= n; i += 2) { int h = 1; for (int j = 3; j*j <= i&&h==1; j += 2) { if (i%j == 0)h = 0; } ans += h; } printf("%d\n", ans); } }
main.c: In function 'main': main.c:5:16: error: 'true' undeclared (first use in this function) 5 | while (true) { | ^~~~ main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include<stdio.h> +++ |+#include <std...
s089627957
p00009
C
include<stdio.h>
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^
s899825983
p00009
C
#include <stdio.h> #include <math.h> int main(){     while(1){         int n,i,cnt=0,sw=1,sosuu[100000],t;         if(scanf("%d",&n)==EOF) break;         if(n<=1){             cnt=0;         }else{             sosuu[cnt]=2;             cnt++;             for(i=3;i<=n;i+=2){                 sw=1;                 for(t...
main.c: In function 'main': main.c:6:1: error: stray '\302' in program 6 | <U+00A0><U+00A0><U+00A0><U+00A0>while(1){ | ^~~~~~~~ main.c:6:2: error: stray '\302' in program 6 | <U+00A0><U+00A0><U+00A0><U+00A0>while(1){ | ^~~~~~~~ main.c:6:3: error: stray '\302' in program 6 | <U+00A0><U+00...
s647359231
p00009
C
#include<stdio.h> int Isprime(int n); int main(){ int n,i,cnt,times; times=0; while((scanf("%d\n",&n)!=EOF)||times<30){ cnt=0; for(i=1;i<=n;i++){ cnt+=Isprime(i); } printf("%d\n",cnt); times++; } int Isprime(int n){ int i,isp; isp=1; if(n==1){ isp=0; } for(i=2;i<n;i++){ if(n%i==0){ isp=0; } } return is...
main.c: In function 'main': main.c:30:1: error: expected declaration or statement at end of input 30 | } | ^
s717079400
p00009
C
#include<stdio.h> int Isprime(int n); int main(){ int n,i,cnt,times; times=0; while((scanf("\n%d",&n)!=EOF)||(times<30)){ cnt=0; for(i=1;i<=n;i++){ cnt+=Isprime(i); } printf("%d\n",cnt); times++; } int Isprime(int n){ int i,isp; isp=1; if(n==1){ isp=0; } for(i=2;i<n;i++){ if(n%i==0){ isp=0; } } return ...
main.c: In function 'main': main.c:30:1: error: expected declaration or statement at end of input 30 | } | ^
s717785955
p00009
C
#include<stdio.h> int Isprime(int n); int main(){ int n,i,cnt,times; times=0; while((scanf("\n%d",&n)!=EOF)||(times<30)){ cnt=0; for(i=1;i<=n;i++){ cnt+=Isprime(i); } printf("%d\n",cnt); times++; } return 0; } int Isprime(int n){ int i,isp; int prime[167]; prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 3...
main.c: In function 'Isprime': main.c:23:12: error: expected expression before '{' token 23 | prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 22...
s703195533
p00009
C
#include<stdio.h> int Isprime(int n); int main(){ int n,i,cnt,times; int prime[167]; prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 22...
main.c: In function 'main': main.c:8:12: error: expected expression before '{' token 8 | prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 2...
s613311476
p00009
C
#include<stdio.h> int Isprime(int n); int main(){ int n,i,cnt,times; int prime[167]; prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 23...
main.c: In function 'main': main.c:8:7: error: expected expression before '{' token 8 | prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 22...
s015572792
p00009
C
#include<stdio.h> int Isprime(int n); int main(){ int n,i,cnt,times; int prime[168]; prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 23...
main.c: In function 'main': main.c:8:7: error: expected expression before '{' token 8 | prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 22...
s094547023
p00009
C
int main () { int a,b=9,c=9,d=9,e=9,f=0,g=1000,h; int kaisu[1000]; for(g=0;g<1000;g++){kaisu[g]=1;} while(scanf("%d",&a)!=EOF){ if(a==1)kaisu[f]--; for(b=3;b<=a;b+=2){ /*for(c=2;c<b;c++){ // printf("%d",c); if(b%c==0){ break;} } if(c>=b){ kaisu[f]++; } */ if(IsPrime(b)==1)kaisu[...
main.c: In function 'main': main.c:7:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 7 | while(scanf("%d",&a)!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main () { ma...
s091532837
p00009
C
#include <cstdio> #include <vector> using namespace std; int main() { int n; while (scanf("%d", &n) != EOF){ vector<int> prime; if (n >= 2){ prime.push_back(2); } for (int i = 3; i <= n; i++){ int j; for (j = 0; j < prime.size(); j++){ if (i % prime[j] == 0){ break; } } if (...
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s865322882
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; } ...
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s276897046
p00009
C
#include <stdio.h> int z[30],count[30]; int main(void) { int i,j,n=0,k; for (i=0; z[i] != ; i++){ scanf("%d", &z[i]); n++; } printf("nの個数%d\n", n); for (n -= 1; n>=0; n--){ for (i=2; i*i<=z[n]; i++){ if (z[n]%i != 0){ count[n]++; } } printf("%d\n", count[n]); } return 0; }
main.c: In function 'main': main.c:8:27: error: expected expression before ';' token 8 | for (i=0; z[i] != ; i++){ | ^
s649915150
p00009
C
#include<stdio.h> #include<math.h> #define N 1000000 bool is_prime[N]; int sieve(int n){ int p=0; for(int i=0;i<=n;i++) is_prime[i]=true; is_prime[0]=is_prime[1]=false; for(int i=0;i<=n;i++){ if(is_prime[i]){ p++; for(int j=i*2;j<=n;j=j+i){ is_prime[j]=false; } } } return p; } int main() ...
main.c:5:1: error: unknown type name 'bool' 5 | bool is_prime[N]; | ^~~~ main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include<math.h> +++ |+#include <stdbool.h> 3 | #define N 1000000 main.c: In function 'sieve': main.c:11...
s032197538
p00009
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int i; int* check = (int*) malloc(sizeof(int)*10); for (i=0; i<999999; i++) { int num, j, count = 0; scanf("%d", &num); check = (int*) realloc(sizeof(int)*10); ...
main.c: In function 'main': main.c:14:32: error: passing argument 1 of 'realloc' makes pointer from integer without a cast [-Wint-conversion] 14 | check = (int*) realloc(sizeof(int)*10); | ^~~~~~~~~~~~~~ | | | ...
s382612718
p00009
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int i; int* check = (int*) malloc(sizeof(int)*10); for (i=0; i<999999; i++) { int num, j, count = 0; scanf("%d", &num); check = (int*) realloc(sizeof(int)*10); ...
main.c: In function 'main': main.c:14:32: error: passing argument 1 of 'realloc' makes pointer from integer without a cast [-Wint-conversion] 14 | check = (int*) realloc(sizeof(int)*10); | ^~~~~~~~~~~~~~ | | | ...
s754565273
p00009
C
int main(){ int num; int ans=0; int i,j,k; int box[100000]; while(scanf("%d",&num)!=EOF){ for(i=0;i<num;i++){ for(j=0;j<num;j++)box[i]=1; } for(i=2;i<sqrt(num);i++){ if(box[i]==1){ for(j=2;i*j<num;j++){ box[i*j]=0; } } } for(i=0;i<num;i++)if(box[i]==1)ans++; printf("%d\n"...
main.c: In function 'main': main.c:7:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 7 | while(scanf("%d",&num)!=EOF){ | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(){ ma...
s700986942
p00009
C
#include<stdio.h> int main(){ int i,j,total,n; while(scanf("%d",&n)!=0){ total=n-1; for(i=2;i<=n;i++){ for(j=2;j<i;j++){ if(i%j==0){ total--; break; } } } printf("%d\n"total); } return(0); }
main.c: In function 'main': main.c:14:18: error: expected ')' before 'total' 14 | printf("%d\n"total); | ~ ^~~~~ | )
s379127216
p00009
C
#include<stdio.h> int main(void){ int i,n,j,count=0; while((scanf("%d",&n))!=EOF){ for(i=0;i<=n;i++){ for(j=0;j<i;j++){ if(i%j==0){ coount++; break; } } } count=n-count; printf("%d",count); count=0; } return 0; }
main.c: In function 'main': main.c:9:1: error: 'coount' undeclared (first use in this function); did you mean 'count'? 9 | coount++; | ^~~~~~ | count main.c:9:1: note: each undeclared identifier is reported only once for each function it appears in
s948043446
p00009
C
#include<stdio.h> int main (void) { int n,i,count,t,prime,l; for(l=0;l<30;l++ ){ scanf("%d",&n); 1 prime = 0; for(t=1;t<=n;t++){ count= 0; for(i=1;i<=t;i++){ if(t%i == 0){ count += 1; }else{ ; } } if(count == 2){ prime += 1; }else{ ; } } printf("%d\n",prime); } return 0; }
main.c: In function 'main': main.c:8:10: error: expected ';' before 'prime' 8 | 1 | ^ | ; 9 | 10 | prime = 0; | ~~~~~
s835897726
p00009
C
#include<stdio.h> int main (void) { int n,i,count,t,prime,l; for(l=0;l<30;l++ ){ scanf("%d",&n); 1 prime = 0; for(t=1;t<=n;t++){ count= 0; for(i=1;i<=t;i++){ if(t%i == 0){ count += 1; }else{ ; } } if(count == 2){ prime += 1; }else{ ; } } printf("%d\n",prime); } return 0; }
main.c: In function 'main': main.c:8:10: error: expected ';' before 'prime' 8 | 1 | ^ | ; 9 | 10 | prime = 0; | ~~~~~
s867714523
p00009
C
#include<stdio.h> int main (void) { int n,i,count,t,prime,l; for(l=0;l<30;l++){ scanf("%d",&n); 1 prime = 0; for(t=1;t<=n;t++){ count= 0; for(i=1;i<=t;i++){ if(t%i == 0){ count += 1; }else{ ; } } if(count == 2){ prime += 1; }else{ ; } } printf("%d\n",prime); } return 0; }
main.c: In function 'main': main.c:8:10: error: expected ';' before 'prime' 8 | 1 | ^ | ; 9 | 10 | prime = 0; | ~~~~~
s461337198
p00009
C
#include<stdio.h> int main(void) int i,j,n; while(scanf("%d",&n)!=EOF) { int num[1000000]={0}; for(i=2;i<=n/2;i++) { for(j=2;j*i<n;j++) { num[i*j]++; } } for(i=2;i<=n;i++) { if(num[i]==0) printf("%d",&i); } } return 0; }
main.c: In function 'main': main.c:4:1: error: expected declaration specifiers before 'while' 4 | while(scanf("%d",&n)!=EOF) { | ^~~~~ main.c:15:1: error: expected declaration specifiers before 'return' 15 | return 0; | ^~~~~~ main.c:16:1: error: expected declaration specifiers before '}' token 16...
s536321857
p00009
C
#include<stdio.h> int main(void) { int i,j,n; while(scanf("%d",&n)!=EOF) { int num[1000000]={0}; for(i=2;i<=n/2;i++) { for(j=2;j*i<n;j++) { num[i*j]++; } } for(i=2;i<=n;i++) { if(num[i]==0) printf("%d",&i); } } } return 0; }
main.c:15:1: error: expected identifier or '(' before 'return' 15 | return 0; | ^~~~~~ main.c:16:1: error: expected identifier or '(' before '}' token 16 | } | ^
s337142629
p00009
C
#include<stdio.h> int main(void) { int i,j,n; while(scanf("%d",&n)!=EOF) { int num[1000000]={0}; for(i=2;i<=n/2;i++) { for(j=2;j*i<n;j++) { num[i*j]++; } } for(i=2;i<=n;i++) { if(num[i]==0) printf("%d",i); } } } return 0; }
main.c:15:1: error: expected identifier or '(' before 'return' 15 | return 0; | ^~~~~~ main.c:16:1: error: expected identifier or '(' before '}' token 16 | } | ^
s284065817
p00009
C
#include <stdio.h> #include <math.h> int b[999999]; int prime(int x) { for (int i = 2; i < sqrt(x) + 1; i++) { if (x%i == 0) { return 0; } } return 1; } int main(){ int n; b[0] = 0; b[1] = 0; b[2] = 1; int count = 1; for (int i = 3; i <= 999999; i++) { if (prime(i))count++; b[i] = count; } while ...
/usr/bin/ld: /tmp/ccuQaPrn.o: in function `prime': main.c:(.text+0x4e): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
s923868734
p00009
C
#include <stdio.h> #define MAX(1000001) int prime[MAX]; int main() { int n, i, j; for (i = 0; i < MAX; i++){ prime[i] = 1; } prime[0] = prime[1] = 0; for (i = 2; i * i < MAX; i++){ if (prime[i] == 1){ for (j = i * i; j < MAX; j += i){ prime[j] = 0; } } } for (i = 1; i < MAX - 1; i++){ prim...
main.c:3:13: error: expected parameter name, found "1000001" 3 | #define MAX(1000001) | ^~~~~~~ main.c:5:11: error: 'MAX' undeclared here (not in a function) 5 | int prime[MAX]; | ^~~
s301727829
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...
main.c:3:18: error: expected parameter name, found "1000001" 3 | #define MAX_SIZE(1000001) | ^~~~~~~ main.c:5:11: error: 'MAX_SIZE' undeclared here (not in a function) 5 | int prime[MAX_SIZE]; | ^~~~~~~~
s483010439
p00009
C
int a,b=0,c=0,i,j,l,n,ans[3]={0}; for(a=0;a<=2;a++){ scanf("%d",&n); if(n>=2){ for(i=2;i<=n;i++){ for(j=2;j<=i;j++){ if(i%j==0 && i!=j){ b++; } } if(b==0){ ans[a]++; } else{ b=0; } } } } printf("\n%d\n%d\n%d",ans[0],ans[1],ans[2]);
main.c:3:9: error: expected identifier or '(' before 'for' 3 | for(a=0;a<=2;a++){ | ^~~ main.c:3:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token 3 | for(a=0;a<=2;a++){ | ^~ main.c:3:23: error: expected '=', ',', ';', 'asm' or '__...
s633658883
p00009
C
#include <stdio.h> #include <string.h> int main() { char inp[96]; int n,i,flg,len,ans,k; int dt[100]; /**--init --**/ for (;;) { gets(inp); len = strlen(inp); if (len==0) { return 1; } sscanf(inp,"%d",&n); /**-- CALC --**/ ans=0; for (i=2 ; i<=n ; i++) { flg=0; for (k=2 ; k<=i ; k++) ...
main.c: In function 'main': main.c:12:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 12 | gets(inp); | ^~~~ | fgets main.c:36:1: error: expected expression before '?' token 36 | ???????????????...
s522535677
p00009
C
#include<stdio.h> #include<math.h> /*??????????????¨?????¢??° */ /*????????????0????????\????????¨???*/ void print_rist(bool *rist, int num){ int i = 2; while(i <= num) { if (rist[i] != 0) { printf("%d ", i); } i++; } printf("\n"); } main(){ bool rist[1000000]; int i, j,prime; unsigned int in...
main.c:6:17: error: unknown type name 'bool' 6 | void print_rist(bool *rist, int num){ | ^~~~ main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include<math.h> +++ |+#include <stdbool.h> 3 | main.c:19:1: error...
s527666138
p00009
C
#include <stdio.h> const int MAX_V = 999999; int main() { int i, k, n; int prime[MAX_V + 1], cnt[MAX_V + 1]; for( i = 2; i <= MAX_V; i++) { prime[i] = 1; } for( i = 2; i * i <= MAX_V; i++) { if(prime[i]) { for( k = 2 * i; k <= MAX_V; k += i) { prime[k] = 0; } } } cnt[0] = 0; for( i = 0 i <= MA...
main.c: In function 'main': main.c:18:19: error: expected ';' before 'i' 18 | for( i = 0 i <= MAX_V; i++) { | ^~ | ; main.c:18:35: error: expected ';' before ')' token 18 | for( i = 0 i <= MAX_V; i++) { | ^ ...
s070927053
p00009
C
#include<stdio.h> const int MAX_V = 10000; int main(void){ int i,k,n; int prime[MAX_V+1],sum[MAX_V+1] = {0},cnt[MAX_V] = {0}; for(i = 2; i < MAX_V; i ++){ prime[i] = 1; cnt[i] ++; } for(i = 2; i * i < MAX_V; i ++){ if(prime[i]){ for(k = 2 * i; k < MAX_V; k += i){ ...
main.c: In function 'main': main.c:5:39: error: variable-sized object may not be initialized except with an empty initializer 5 | int prime[MAX_V+1],sum[MAX_V+1] = {0},cnt[MAX_V] = {0}; | ^ main.c:5:56: error: variable-sized object may not be initialized except with a...
s367945380
p00009
C
#include<stdio.h> const int MAX_V = 10000; int main(void){ int i,k,n; int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0},cnt[MAX_V] = {0}; for(i = 2; i < MAX_V; i ++){ prime[i] = 1; cnt[i] ++; } for(i = 2; i * i < MAX_V; i ++){ if(prime[i]){ for(k = 2 * i; k < MAX_V; k +...
main.c: In function 'main': main.c:5:26: error: variable-sized object may not be initialized except with an empty initializer 5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0},cnt[MAX_V] = {0}; | ^ main.c:5:45: error: variable-sized object may not be initialized except with an empty...
s055480156
p00009
C
#include<stdio.h> int main(void){ const int MAX_V = 10000; int i,k,n; int prime[MAX_V+1],sum[MAX_V+1] = {0}; for(i = 2; i < MAX_V; i ++){ prime[i] = 1; } for(i = 2; i * i < MAX_V; i ++){ if(prime[i]){ for(k = 2 * i; k < MAX_V; k += i){ prime[k] = 0; ...
main.c: In function 'main': main.c:5:39: error: variable-sized object may not be initialized except with an empty initializer 5 | int prime[MAX_V+1],sum[MAX_V+1] = {0}; | ^
s524880062
p00009
C
#include<stdio.h> int main(void){ const int MAX_V = 10000; int i,k,n; int prime[MAX_V+1],sum[MAX_V+1] = {0}; prime[0] = 0; prime[1] = 0; for(i = 2; i < MAX_V; i ++){ prime[i] = 1; } for(i = 2; i * i < MAX_V; i ++){ if(prime[i]){ for(k = 2 * i; k < MAX_V; k += ...
main.c: In function 'main': main.c:5:39: error: variable-sized object may not be initialized except with an empty initializer 5 | int prime[MAX_V+1],sum[MAX_V+1] = {0}; | ^
s271941429
p00009
C
#include<stdio.h> int main(void){ const int MAX_V = 10000; int i,k,n; int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0}; for(i = 2; i < MAX_V; i ++){ prime[i] = 1; } for(i = 2; i * i < MAX_V; i ++){ if(prime[i]){ for(k = 2 * i; k < MAX_V; k += i){ prime[k] =...
main.c: In function 'main': main.c:5:26: error: variable-sized object may not be initialized except with an empty initializer 5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0}; | ^ main.c:5:45: error: variable-sized object may not be initialized except with an empty initializer ...
s726714806
p00009
C
#include<stdio.h> const int MAX_V = 10000; int prime[MAX_V+1],sum[MAX_V+1]; int main(void){ int i,k,n,ans; for(i = 0; i < MAX_V + 1; i ++){ prime[i] = 1; sum[i] = 0; } prime[0] = 0; prime[1] = 0; for(i = 2; i * i < MAX_V; i ++){ if(prime[i]){ for(k = 2 * i; k ...
main.c:3:5: error: variably modified 'prime' at file scope 3 | int prime[MAX_V+1],sum[MAX_V+1]; | ^~~~~ main.c:3:20: error: variably modified 'sum' at file scope 3 | int prime[MAX_V+1],sum[MAX_V+1]; | ^~~
s214814466
p00009
C
#include <stdio.h> const int MAX_V = 1000000; int prime[MAX_V + 1]; int main(){ //?´???°??¨?????? int i, k; for( i = 2; i <= MAX_V; i++) { prime[i] = 1; } for( i = 2; i * i <= MAX_V; i++){ if(prime[i]) { for( k = 2 * i; k <= MAX_V; k += i){ prime[k] = 0; } } } //?´???????????±??????? int sum[MAX...
main.c:3:5: error: variably modified 'prime' at file scope 3 | int prime[MAX_V + 1]; | ^~~~~
s367022364
p00009
C
#include <stdio.h> const int MAX_V = 1000000; int prime[MAX_V+1]; int main(){ //?´???°??¨?????? int i, k; for( i = 2; i <= MAX_V; i++) { prime[i] = 1; } for( i = 2; i * i <= MAX_V; i++){ if(prime[i]) { for( k = 2 * i; k <= MAX_V; k += i){ prime[k] = 0; } } } //?´???????????±??????? int sum[MAX_V...
main.c:3:5: error: variably modified 'prime' at file scope 3 | int prime[MAX_V+1]; | ^~~~~
s511018876
p00009
C
#include <stdio.h> const int MAX_V = 999999; int prime[MAX_V+1]; int main(){ //?´???°??¨?????? int i, k; for( i = 2; i <= MAX_V; i++) { prime[i] = 1; } for( i = 2; i * i <= MAX_V; i++){ if(prime[i]) { for( k = 2 * i; k <= MAX_V; k += i){ prime[k] = 0; } } } //?´???????????±??????? int sum[MAX_V ...
main.c:3:5: error: variably modified 'prime' at file scope 3 | int prime[MAX_V+1]; | ^~~~~
s064608145
p00009
C
#include <stdio.h> const int MAX_V = 999999; int prime[MAX_V+1]; int main(){ //?´???°??¨?????? int i, k; for( i = 2; i <= MAX_V; i++) { prime[i] = 1; } for( i = 2; i * i <= MAX_V; i++){ if(prime[i]) { for( k = 2 * i; k <= MAX_V; k += i){ prime[k] = 0; } } } //?´???????????±??????? int sum[MAX_V ...
main.c:3:5: error: variably modified 'prime' at file scope 3 | int prime[MAX_V+1]; | ^~~~~
s578614119
p00009
C
#include <Stdio.h> int main() { int n,i,j,flag=0,cnt,h,k; while(scanf("%d",&n)) { if(n==2) printf("1"); else if(n==3) printf("2"); else { cnt=2; h=n/2; for(k=4; k<=n; k++) { for(j=2; j<=h...
main.c:1:10: fatal error: Stdio.h: No such file or directory 1 | #include <Stdio.h> | ^~~~~~~~~ compilation terminated.
s426871712
p00009
C
#include <stdio.h> int prime[999999]; int main() { int i, k, n, N = 0; for(i = 2; i <= 999999; i++) { prime[i] = 1; } for(i = 2; i*i <= 999999; i++) { if(prime[i]) { for(k = 2 * i; k <= 999999; k += i) { prime[k] = 0; } } } for(i = 2; i <= 999999; i++) { if(prime[i] == ...
main.c: In function 'main': main.c:28:1: error: expected declaration or statement at end of input 28 | } | ^
s907982036
p00009
C
#include <cstdio> #include <cstring> const int MAX_n = 999999; bool isPrime[MAX_n+1]; int sum[MAX_n+1]; int main() { memset(isPrime,true,sizeof(isPrime)); for(int i = 2; 2*i <= MAX_n ; ++i) if(isPrime[i]) for(int j = 2*i; j <= MAX_n; j+=i) isPrime[j] = false; isPrime[0] =...
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s250739964
p00009
C
#include "stdio.h" #define MAX_N 999999 bool is_prime[MAX_N+1]; int sieve(int n) { int p=0,i; for(i=0;i<=n;i++) is_prime[i]=true; is_prime[0]=is_prime[1]=false; for(i=2;i<=n;i++) { if(is_prime[i]) { p++; for(int j=2*i;j<=n;j+=i) is_prime[j]=false; } } return p; } int main() { int n; while(scanf("%...
main.c:3:1: error: unknown type name 'bool' 3 | bool is_prime[MAX_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 MAX_N 999999 main.c: In function 'sieve'...
s825379964
p00009
C
#include <stdio.h> int prime[2000000]; int main(void) { int n; int i, j; prime[2] = 1; for (i = 3; i < 1000000; i += 2){ for (j = 3; j * j <= i; j += 2){ if (i % j == 0){ break; } } prime[i] = prime[i - 1]; prime[i + 1] = prime[i...
main.c:34:5: error: redefinition of 'main' 34 | int main(void) | ^~~~ main.c:5:5: note: previous definition of 'main' with type 'int(void)' 5 | int main(void) | ^~~~
s357523170
p00009
C
//?´???°????????°????±???????????????°?????? #include <stdio.h> int main(void) { int num; int i, j; int flag; int count = 0; scanf("%d", &num); for(i=2; i<=num; i++){ flag = 0; for(j=2; j<num; j++){ if(i!=j && i%j==0 ){ flag = 1; // printf("%d %d\n", i, j); break; } } if(flag ...
main.c: In function 'main': main.c:35:9: error: expected declaration or statement at end of input 35 | return 0; | ^~~~~~
s092341235
p00009
C
#include <iostream> #include <string> #include <stack> #include <math.h> #include <algorithm> #include <cstdlib> #include <ctime> #include <vector> using namespace std; int sieve(int n); int prime[1000000]; bool is_prime[1000000]; int main() { int p = 0; for (int i = 0; i <= 999999; i++) { is_prime[i] = true; }...
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s244615993
p00009
C
#include<stdio.h> #include<math.h> int prime(int n); int main() { int k,j,n; int store,sum=0; while(scanf("%d",&n)!=EOF) { for(j=1;j<=n;j++) { store=prime(j); if(store==1) { sum++; } } printf("%d\n",sum); sum=0; } return 0; } int prime(int n) { int i; float x,k; ...
main.c: In function 'prime': main.c:42:11: error: expected expression before 'float' 42 | x=float(n); | ^~~~~ main.c:45:11: error: expected expression before 'int' 45 | l=int(k); | ^~~
s309330429
p00009
C
#include <stdio.h> #include <math.h> #define N 1000000 int main(){ int i, j, n, answer; int a[N]; for(i=0; i<N; ++i) a[i]=0; a[2] = 1; for(i=3; i<N; i+=2) a[i]=1; for(i=3; i<=N-1; i+=2){ if(a[i]==0) continue; for(j=i+i; j<N; j+=i) a[j] = 0; } while(scanf("%d", &n) != EOF){ answer = 0; for(i=...
main.c: In function 'main': main.c:21:17: error: expected ';' before '}' token 21 | return 0 | ^ | ; 22 | } | ~
s007626887
p00009
C
/* Volume0-0009 */ //#include <iostream> #include <stdio.h> #include <stdlib.h> #define N 1000000 #define TRUE (int)(0==0) #define FALSE !TRUE #define BUFLEN 1024 //using std; int syserr(char *str) { fputs(str, stderr); exit(-1); } int main(int argc, char *argv[]){ int f[N]; memset(f, TRUE, N); f[1]=FALSE;...
main.c: In function 'main': main.c:22:3: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 22 | memset(f, TRUE, N); | ^~~~~~ main.c:7:1: note: include '<string.h>' or provide a declaration of 'memset' 6 | #include <stdlib.h> +++ |+#include <string.h> 7 | main.c:2...
s729262291
p00009
C
#include<stdio.h> int main(void){ int x,i,t=0; while(scanf("%d",&x)!=EOF){ for(i=2;i*i<x){ if(x%i==0) break; t++; } printf("%d",t); } return 0; }
main.c: In function 'main': main.c:5:14: error: expected ';' before ')' token 5 | for(i=2;i*i<x){ | ^ | ;
s326265338
p00009
C
#include <stdio.h> int main(void){ int n; int a,b; int cnt1,cnt2; while(1){ n=-1; cnt1=0; cnt2=0; scanf("%d", &n); if(n==-1)break; if(n==1){ puts("0"); continue; } if(n==2){ puts("1"); continue;...
main.c: In function 'main': main.c:27:30: error: 'cnt' undeclared (first use in this function); did you mean 'cnt2'? 27 | if(n % a == 0)cnt++; | ^~~ | cnt2 main.c:27:30: note: each undeclared identifier is reported only once for eac...
s601169846
p00009
C
#include<stdio.h> #include<Math.h> int main(){ int n; int a[30][10000]; int b; int i, j, p; int c[30]; p = 0; while (scanf("%d", &n) != EOF){ b = (int)pow((double)n, 0.5); c[p] = 0; a[p][0] = -1; for (i = 2; i <= b; i++){ for (j = 2; j <= n / i; j++){ a[p][i*j - 1] = -1; } } for (i = 1; i ...
main.c:2:9: fatal error: Math.h: No such file or directory 2 | #include<Math.h> | ^~~~~~~~ compilation terminated.
s777991889
p00009
C
#include<stdio.h> #include<Math.h> int main(){ int n; int a[10000]; int b; int i, j, p; int c[30]; p = 0; while (scanf("%d", &n) != EOF){ b = (int)pow((double)n, 0.5); c[p] = 0; a[0] = -1; for (i = 2; i <= b; i++){ for (j = 2; j <= n / i; j++){ a[i*j - 1] = -1; } } for (i = 1; i <= n; i++)...
main.c:2:9: fatal error: Math.h: No such file or directory 2 | #include<Math.h> | ^~~~~~~~ compilation terminated.
s282525764
p00009
C
#include<stdio.h> #include<Math.h> int main(){ int n; int a[10000]; int b; int i, j, p; int c[30]; p = 0; while (scanf("%d", &n) != EOF){ b = (int)pow((double)n, 0.5); c[p] = 0; a[0] = -1; for (i = 2; i <= b; i++){ for (j = 2; j <= n / i; j++){ a[i*j - 1] = -1; } } for (i = 1; i <= n; i++)...
main.c:2:9: fatal error: Math.h: No such file or directory 2 | #include<Math.h> | ^~~~~~~~ compilation terminated.
s458562153
p00009
C
#include<stdio.h> int prime_elements[1000001]={0}; int main(void){ int i,j,result,num_input; for(i=2;i<=1000000;i++){ if(prime_elements[i]==0){ for(j=2;i*j<=1000000;j++){ prime_elements[i*j]=1; } } } while(scanf("%d",&num_input)!=EOF){ re...
main.c: In function 'main': main.c:16:20: error: 'input' undeclared (first use in this function); did you mean 'int'? 16 | for(i=2;i<=input;i++){ | ^~~~~ | int main.c:16:20: note: each undeclared identifier is reported only once for each function it appears i...
s768178706
p00009
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <math.h> bool is_prime_num(int n) { if (n < 2) { return false; } else if (n == 2) { return true; } else if (n % 2 == 0) { return false; } for (int i = 3; i <= (int)sqrt(n); i+=2) { if (n % i == 0) { return false; } } return tru...
/usr/bin/ld: /tmp/ccpoGAXe.o: in function `is_prime_num': main.c:(.text+0x6b): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
s722079952
p00009
C
#include<stdio.h> #include<math.h> int isprime(int x){ int i; if(x==2) return 1; if(x<2 || x%2 == 0) return 0; for(i=3;i<=sqrt(double(x));i+=2) if(x%i == 0) return 0; return 1; } int main(){ int count = 0; int i,n; double a; while(scanf("%d",&n) != EOF){ for(i=1;i<=n;i++) count += isprime(i); p...
main.c: In function 'isprime': main.c:9:25: error: expected expression before 'double' 9 | for(i=3;i<=sqrt(double(x));i+=2) | ^~~~~~
s502121292
p00009
C
#include<stdio.h> #include<math.h> int isprime(int x){ int i; double a = sqrt(double(x)); if(x==2) return 1; if(x<2 || x%2 == 0) return 0; for(i=3;i<=int(a);i+=2) if(x%i == 0) return 0; return 1; } int main(){ int count = 0; int i,n; double a; while(scanf("%d",&n) != EOF){ for(i=1;i<=n;i++) coun...
main.c: In function 'isprime': main.c:5:25: error: expected expression before 'double' 5 | double a = sqrt(double(x)); | ^~~~~~ main.c:10:20: error: expected expression before 'int' 10 | for(i=3;i<=int(a);i+=2) | ^~~
s854107776
p00009
C
#include<stdio.h> #include<math.h> int isprime(int x){ int i; if(x==2) return 1; if(x<2 || x%2 == 0) return 0; for(i=3;i<=sqrt(double(x));i+=2) if(x%i == 0) return 0; return 1; } int main(){ int count = 0; int i,n; while(scanf("%d",&n) != EOF){ for(i=1;i<=n;i++) count += isprime(i); printf("%d\n...
main.c: In function 'isprime': main.c:9:25: error: expected expression before 'double' 9 | for(i=3;i<=sqrt(double(x));i+=2) | ^~~~~~
s181994775
p00009
C
#include <stdio.h> int main() { int n, i, j; int ans; char era[1000000]; while(scanf("%d", &n) != EOF){ era[i] = {1}; ans=0; for(i=2; i<=n; i++){ if(era[i] == 1){ ans++; for(j=i; j<=n; j+=i) era[j]=0; } } printf("%d\n", ans); } return 0; }
main.c: In function 'main': main.c:11:14: error: expected expression before '{' token 11 | era[i] = {1}; | ^
s447389288
p00009
C
#include <stdio.h> int main() { int n, i, j; int ans; char era[1000000]; while(scanf("%d", &n) != EOF){ era[] = {1}; ans=0; for(i=2; i<=n; i++){ if(era[i] == 1){ ans++; for(j=i; j<=n; j+=i) era[j]=0; } } printf("%d\n", ans); } return 0; }
main.c: In function 'main': main.c:11:9: error: expected expression before ']' token 11 | era[] = {1}; | ^
s961823680
p00009
C
#include<stdio.h> int main(){ int n,i,wareta; wareta = 0; while(scanf("%d\n", &n) != EOF){ for(i=2,i<n;i++){ if(n%i == 0){wareta=wareta+1;} } printf("%d\n", sprintf(hoge, "%d", a+b)); } return 0; }
main.c: In function 'main': main.c:11:18: error: expected ';' before ')' token 11 | for(i=2,i<n;i++){ | ^ | ; main.c:16:24: error: 'hoge' undeclared (first use in this function) 16 | printf("%d\n", sprintf(hoge, "%d", a+b)); | ^~~~ main....
s963655126
p00009
C
#include<stdio.h> int main(){ int n,i,cnt=0,sw=1,sosuu[1000000],t; while(scanf("%d\n", &n) != EOF){ if(n>1){ sosuu[cnt]=2 cnt++; for(i=3;i<=n;i+=2){ sw=1; for(t=0;t<cnt&&sosuu[t]*sosuu[t]<=i;t++){ if(i%sosuu[t] == 0){ sw=0; break; } } ...
main.c: In function 'main': main.c:10:17: error: expected ';' before 'cnt' 10 | sosuu[cnt]=2 | ^ | ; 11 | cnt++; | ~~~ main.c:25:4: error: expected '}' before 'else' 25 | else{cnt=0;} | ^~~~ main.c: At top level: main.c:34:5: e...
s213990742
p00009
C
#include <iostream> #include <cstring> #include <cstdio> using namespace std; int main() { long long a,b,ans; int t; scanf("%d",&t); while (t--) { scanf("%lld%lld",&a,&b); ans=(b-a+1)*(a+b)/2-a-a+2; printf("%lld\n",ans); } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s476450287
p00009
C
#include <bits/stdc++.h> #define ll long long using namespace std; ll a[1000000],p[1000000]; ll sieve( ll n) { ll i,j,k=0,m; a[0]=1; a[1]=1; p[k++]=2; m=sqrt(n); for(i=4; i<=n; i+=2) a[i]=1; for(i=3; i<=m; i+=2) if(a[i]==0) for(j=i*i; j<=n; j+=i*2) ...
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s084983761
p00009
C
#include <stdio.h> int is_prime(int); int main() { int input_count; int prime_count; int input; int for_cnt; int output_array[30]; for(for_cnt = 0; for_cnt < 30; for_cnt++) {ac output_array[for_cnt] = 0; } input_count = 0; while(input_count < 30) { scanf("%d", &input); if(input > 999999 ||...
main.c: In function 'main': main.c:14:10: error: unknown type name 'ac' 14 | {ac | ^~ main.c:15:41: error: variable-sized object may not be initialized except with an empty initializer 15 | output_array[for_cnt] = 0; | ^ main.c: ...
s521453827
p00009
C
#include <stdio.h> int is_prime(int); int main() { int input_count; int prime_count; int input; int for_cnt; int output_array[30]; for(for_cnt = 0; for_cnt < 30; for_cnt++) {ac output_array[for_cnt] = 0; } input_count = 0; while(input_count < 30) { scanf("%d", &input); if(input > 999999 ||...
main.c: In function 'main': main.c:14:10: error: unknown type name 'ac' 14 | {ac | ^~ main.c:15:41: error: variable-sized object may not be initialized except with an empty initializer 15 | output_array[for_cnt] = 0; | ^ main.c: ...
s887087270
p00009
C
#include <stdio.h> int is_prime(int); int main() { int input_count; int prime_count; int input; int for_cnt; int output_array[30]; for(for_cnt = 0; for_cnt < 30; for_cnt++) { output_array[for_cnt] = 0; } input_count = 0; while(input_count < 30) { scanf("%d", &input); if(input > 999999 || i...
main.c:61:1: error: unknown type name 'BOOL' 61 | BOOL is_prime(int test_num) | ^~~~
s430591340
p00009
C
#include <stdio.h> #include <stdlib.h> typedef int BOOL; #define TRUE 1; #define FALSE 0; int is_prime(int); int main() { int input_count; int prime_count; int input; int for_cnt; int output_array[30]; for(for_cnt = 0; for_cnt < 30; for_cnt++) { output_array[for_cnt] = 0; } input_count = 0; do...
main.c: In function 'main': main.c:44:46: error: expected ';' before 'if' 44 | while(input_count < 30 && input != 0) | ^ | ; 45 | 46 | if(input_count < 30) | ~~ ...
s919479100
p00009
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int is_prime(int test_num) { int divisor; if(test_num == 1) { return 0; } else if(test_num == 2 || test_num == 3 || test_num == 5 || test_num == 7) { return 1; } else if((test_num % 2) == 0) { return 0; } for(divisor = 3 ; divisor <= (sqrt(te...
main.c:74:5: error: redefinition of 'is_prime' 74 | int is_prime(int test_num) | ^~~~~~~~ main.c:5:5: note: previous definition of 'is_prime' with type 'int(int)' 5 | int is_prime(int test_num) | ^~~~~~~~
s215471630
p00009
C
#include <stdio.h> #include <math.h> int is_prime1(int); int is_prime2(int); int prime[168]; int main() { int input, input_count, prime_count, cnt; int output[30]; /*Make prime table*/ prime[0] = 2; prime_cnt = 1; for(cnt = 3; cnt < 1000; cnt += 2) { if(is_prime1(cnt)) { prime[prime_cnt] = cnt; pr...
main.c: In function 'main': main.c:16:9: error: 'prime_cnt' undeclared (first use in this function); did you mean 'prime_count'? 16 | prime_cnt = 1; | ^~~~~~~~~ | prime_count main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in
s292039226
p00009
C
#include <stdio.h> int main(){ int n; int num while( scanf("%d", &n) > 0){ int i,j; for(i=2; i<=n; i++){ for(j=2; j<=i; j++){ if( (i%j) == 0 ) break; else continue; if( i == j ) ...
main.c: In function 'main': main.c:6:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'while' 6 | while( scanf("%d", &n) > 0){ | ^~~~~ main.c:13:26: error: 'num' undeclared (first use in this function) 13 | num++; | ...
s160725896
p00009
C
#include <stdio.h> int main(){ int n,i, j, k,l; l=0; scanf("%d",n); for(i=n;i>2;i--){ for(j=2;j<(n-1);j++){ k=n%j; if(K==0){return 0;} else{if(j==n-2){l=l+1;}} } } printf("%d",l); }
main.c: In function 'main': main.c:11:23: error: 'K' undeclared (first use in this function) 11 | if(K==0){return 0;} | ^ main.c:11:23: note: each undeclared identifier is reported only once for each function it appears in
s473421747
p00009
C
#include <stdio.h> int main(void){ int n,i, j, k,l; l=0; scanf("%d",n); for(i=n;i>2;i--){ for(j=2;j<(n-1);j++){ k=n%j; if(K==0){return 0;} else{if(j==n-2){l=l+1;}} } } printf("%d",l); }
main.c: In function 'main': main.c:11:23: error: 'K' undeclared (first use in this function) 11 | if(K==0){return 0;} | ^ main.c:11:23: note: each undeclared identifier is reported only once for each function it appears in
s697237500
p00009
C
#include<stdio.h> int IsPrimeNum(int i){ int j; if(i==1){ return 0; }else if(i==2){ return 1; } if(i%2==0){ return 0; } for(j=3; j<=i/j; j++){ if(i%j==0){ return 0; } } return 1; } int primeNum(int n){ int cout = 0, i; for(i=1; i<=n; i++){ if(IsPrimeNum(i)){ ...
main.c: In function 'main': main.c:42:25: error: 'iOA' undeclared (first use in this function) 42 | printf("%d\n", list[iOA]); | ^~~ main.c:42:25: note: each undeclared identifier is reported only once for each function it appears in
s659644940
p00009
C
int primeNum(int n){ int cout = 0, i; for(i=1; i<=n; i++){ if(IsPrimeNum(i)){ cout += 1; } } return cout; } int main(){ int n; int list[50]; int j = 0; while(scanf("%d", &n) != EOF){ list[j] = primeNum(n); j += 1; } int i; for(i=0; i<j; i++) printf("%d\n", list[i]); re...
main.c: In function 'primeNum': main.c:4:8: error: implicit declaration of function 'IsPrimeNum'; did you mean 'primeNum'? [-Wimplicit-function-declaration] 4 | if(IsPrimeNum(i)){ | ^~~~~~~~~~ | primeNum main.c: In function 'main': main.c:15:9: error: implicit declaration of function '...
s221407659
p00009
C
#include <stdio.h> #include <cmath> //?找第K小的除数 int main() { long long n; int k; scanf("%lld%d",&n,&k); long long d=0,m=0;//第1小是除数是1 int flag=0; int i=1; int b=sqrt(n); for(;i<=b;i++) { if(n%i==0)//i是n除数 { d=i; m++; } if(m==k) ...
main.c:2:10: fatal error: cmath: No such file or directory 2 | #include <cmath> | ^~~~~~~ compilation terminated.
s828678335
p00009
C
#include<cstdio> #include<iostream> #define M 31 int prime(int n); int main(void) { int i,j,t=0,a[M],b[M]={0}; while(scanf("%d",&a[t])) t++; for(i=0;i<t;i++) for(j=2;j<=a[t];j++) b[i]+=prime(j); for(i=0;i<t;i++) printf("%d\n",b[i]); return 0; } int prime(int n) { int l; if(...
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s010172257
p00009
C
#include<stdio.h> #include<stdlib.h> #include<math.h> typedef long long ll; bool prime(ll n) { ll i; int flag=0; if(n==2) return true; else if(n<2) { return false; } else { /* if((int)sqrt(n)==sqrt(n)) { for(i=2;i<(int)sqrt(n)+1&&flag==0;i++) { if(n%i==0) { return false; fl...
main.c:7:1: error: unknown type name 'bool' 7 | bool prime(ll n) | ^~~~ main.c:4:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 3 | #include<math.h> +++ |+#include <stdbool.h> 4 | main.c: In function 'prime': main.c:12:24: error: 'true'...
s849536595
p00009
C
#include<cstdio> #include<cmath> #define SIZE 1000000 #define sizE 600000 int prime[sizE], nprime=0; int mark[SIZE]; void sieve() { int i,j, limit=sqrt(SIZE*1.0)+2; mark[0]=1; mark[1]=1; for(i=4; i<=SIZE; i+=2) mark[i]=1; prime[nprime]=2; for(i=3; i<=SIZE; i+=2) { if...
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s311425333
p00009
C
#include<iostream> using namespace std; const long N = 1000000; long prime[N] = {0},num_prime; int isNotPrime[N] = {1, 1}; int main() { int n; while(cin >> n) { num_prime = 0; for(long i = 2 ; i <= n ; i ++) { if(! isNotPrime[i]) prime[num_prime ++]=i; ...
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.