criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>

int sosuu(int x){

  int i;
  if (x < 2)
    return 0;
  else if (x == 2)
    return 1;
  if (x % 2 == 0)
    return 0;
  for (i = 3;i*i <= x; i+=2){
    if(x%i == 0)
      return 0;
  }
  return 1;
}

int main(){

  int n,x,i
  int count = 0;
  scanf("%d",&n);
  for(i = 0;i<n;i++){
    scanf("%d",&x);
    if(sosuu(x))count++;
  }
  printf("%d\n",count);

  return 0;
}
    

Compiler output:
main.c: In function 'main':
main.c:22:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
   22 |   int count = 0;
      |   ^~~
main.c:24:7: error: 'i' undeclared (first use in this function)
   24 |   for(i = 0;i<n;i++){
      |       ^
main.c:24:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:17: error: 'count' undeclared (first use in this function)
   26 |     if(sosuu(x))count++;
      |                 ^~~~~
Language: C

#include<stdio.h>

int sosuu(int x){

  int i;
  if (x < 2) return 0;
  else if (x == 2) return 1;
  if (x % 2 == 0) return 0;
  for (i = 3;i*i <= x; i+=2){
    if(x%i == 0) return 0;
  }
  return 1;
}

int main(){

  int n,x,i
  int count = 0;
  scanf("%d",&n);
  for(i = 0;i<n;i++){
    scanf("%d",&x);
    if(sosuu(x))count++;
  }
  printf("%d\n",count);

  return 0;
}
    

Compiler output:
main.c: In function 'main':
main.c:18:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
   18 |   int count = 0;
      |   ^~~
main.c:20:7: error: 'i' undeclared (first use in this function)
   20 |   for(i = 0;i<n;i++){
      |       ^
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:17: error: 'count' undeclared (first use in this function)
   22 |     if(sosuu(x))count++;
      |                 ^~~~~
Language: C

#include <stdio.h>

int main(void)
{
  int i,j,n,kazu[n],z;
  for(i=0;i<n;i++){
    scanf("%d",&kazu[n]);
  }
  for(i=0;i<n;i++)
    for(j=2;j<=kazu[i];j++){
      if(kazu[i]/j==1){
        z++;
      }
    }
  }
  printf("%d",z);
  return 0;
}

Compiler output:
main.c:16:10: error: expected declaration specifiers or '...' before string constant
   16 |   printf("%d",z);
      |          ^~~~
main.c:16:15: error: unknown type name 'z'
   16 |   printf("%d",z);
      |               ^
main.c:17:3: error: expected identifier or '(' before 'return'
   17 |   return 0;
      |   ^~~~~~
main.c:18:1: error: expected identifier or '(' before '}' token
   18 | }
      | ^
Language: C

#include <stdio.h>

int main(void)
{
  int i,j,n,kazu[n],z;
  for(i=0;i<n;i++){
    scanf("%d",&kazu[n]);
  }
  for(i=0;i<n;i++)
    for(j=2;j<=kazu[i];j++){
      if(kazu[i]/j==1){
        z++;
      }
    }
  }
  printf("%d\n",z);
  return 0;
}

Compiler output:
main.c:16:10: error: expected declaration specifiers or '...' before string constant
   16 |   printf("%d\n",z);
      |          ^~~~~~
main.c:16:17: error: unknown type name 'z'
   16 |   printf("%d\n",z);
      |                 ^
main.c:17:3: error: expected identifier or '(' before 'return'
   17 |   return 0;
      |   ^~~~~~
main.c:18:1: error: expected identifier or '(' before '}' token
   18 | }
      | ^
Language: C

#include <stdio.h>

int main(void)
{
  int i,j,n,kazu[n],z;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&kazu[n]);
  }
  for(i=0;i<n;i++)
    for(j=2;j<=kazu[i];j++){
      if(kazu[i]/j==1){
        z++;
      }
    }
  }
  printf("%d\n",z);
  return 0;
}

Compiler output:
main.c:17:10: error: expected declaration specifiers or '...' before string constant
   17 |   printf("%d\n",z);
      |          ^~~~~~
main.c:17:17: error: unknown type name 'z'
   17 |   printf("%d\n",z);
      |                 ^
main.c:18:3: error: expected identifier or '(' before 'return'
   18 |   return 0;
      |   ^~~~~~
main.c:19:1: error: expected identifier or '(' before '}' token
   19 | }
      | ^
Language: C

#include <stdio.h>
#include <stdio.h>
int main(void){
  int a, b, c, d;
  int total=0;
  scanf("%d", &a);
  
  for(  ; a>0 ; a-- ){
    scanf("%d", &b);
    
    if(b==2||b==1)
      total = total+1;
      
    else if(b >= 3){
      for( c=1 ; c<sqrt(b) ; b=b+2){
        if(b%c=0)
          break;
        total = total+1;
      }
    }
    
    else break;
  }
    
  printf("%d", total);
}

Compiler output:
main.c: In function 'main':
main.c:15:20: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
   15 |       for( c=1 ; c<sqrt(b) ; b=b+2){
      |                    ^~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'sqrt'
    1 | #include <stdio.h>
  +++ |+#include <math.h>
    2 | #include <stdio.h>
main.c:15:20: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
   15 |       for( c=1 ; c<sqrt(b) ; b=b+2){
      |                    ^~~~
main.c:15:20: note: include '<math.h>' or provide a declaration of 'sqrt'
main.c:16:15: error: lvalue required as left operand of assignment
   16 |         if(b%c=0)
      |               ^
Language: C

#include<stdio.h>
int main(void)
{
int i,j,n,prime;

for (int i = 0, i <= 1000;i++)
{
if(prime(n)){

printf("%d\n",n);
j++;
}
}
printf("%d\n"j);
return 0;
}

   

Compiler output:
main.c: In function 'main':
main.c:6:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
    6 | for (int i = 0, i <= 1000;i++)
      |                   ^~
main.c:6:30: error: expected ';' before ')' token
    6 | for (int i = 0, i <= 1000;i++)
      |                              ^
      |                              ;
main.c:8:4: error: called object 'prime' is not a function or function pointer
    8 | if(prime(n)){
      |    ^~~~~
main.c:4:11: note: declared here
    4 | int i,j,n,prime;
      |           ^~~~~
main.c:14:14: error: expected ')' before 'j'
   14 | printf("%d\n"j);
      |       ~      ^
      |              )
Language: C

#include <stdio.h>
#include <math.h>
 
#define ELEMENT_CNT_MIN (1)
#define ELEMENT_CNT_MAX (10000)
#define ELEMENT_MIN (2)
#define ELEMENT_MAX (100000000)
#define FAILUER (-1)
#define SUCCESS (0)
#define TRUE  (1)
#define FALSE (0)
 
int get_int_sequence(int *p_num, int min, int max, int size);
int get_int(int *p_num, int min, int max);
int judge_constraint(int test_num, int min, int max);
int put_prime_cnt_in_list(int *p_num, int size);
int is_prime(int x);
 
int main(void){
     
    int element_num;
    int element[ELEMENT_CNT_MAX];
     
    if(get_int(&element_num, ELEMENT_CNT_MIN, ELEMENT_CNT_MAX) == FAILUER )
    {
        return FAILUER ;
    }
     
    if(get_int_sequence(&element[0], ELEMENT_MIN, ELEMENT_MAX, element_num) == FAILUER )
    {
        return FAILUER ;
    }
     
    printf("%d\n", put_prime_cnt_in_list(&element[0], element_num));
     
    return SUCCESS;
}
 
int is_prime(int x)
{
    int i;
     
    if(x == 2)
    {
        return FALSE;
    }
    if((x < 2) || (x % 2 == 0))
    {
        return TRUE;
    }
    /* target is odd num >= 3 */
    i = 3;
    while(i <= sqrt(x))
    {
        if(x % i == 0)
        {
            return TRUE;
        }
        i += 2;
    }
     
    return FALSE;
}
 
int put_prime_cnt_in_list(int *p_num, int size)
{
    int i;
    int cnt = 0;
     
    for(i = 0; i < size; i++)
    {
        if(is_prime(p_num[i]) == TURE)
        {
            cnt++;
        }
    }
     
    return cnt;
}
 
 
int get_int_sequence(int *p_num, int min, int max, int size)
{
    int i;
     
    for(i = 0; i < size; i++)
    {
        if(get_int(&p_num[i], min, max) == FAILUER)
        {
            return FAILUER;
        }
    }
     
    return SUCCESS;
}
 
int get_int(int *p_num, int min, int max)
{
    scanf("%d", p_num);
     
    if(judge_constraint(*p_num, min, max) == FAILUER)
    {
        return FAILUER;
    }
     
    return SUCCESS;
}
int judge_constraint(int test_num, int min, int max)
{
    if(test_num < min || test_num > max)
    {
        return FAILUER;
    }
     
    return SUCCESS;
}

Compiler output:
main.c: In function 'put_prime_cnt_in_list':
main.c:72:34: error: 'TURE' undeclared (first use in this function); did you mean 'TRUE'?
   72 |         if(is_prime(p_num[i]) == TURE)
      |                                  ^~~~
      |                                  TRUE
main.c:72:34: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
#include <cmath>
using namespace std;
 
bool IsPrime(int a) {
    if(a==2) return true;
 
    if (a<2 || a%2==0) return false;
 
    int i = 3;
    while(i<=sqrt(a)) {
        if(a%i==0) return false;
        i = i + 2;
    }
 
    return true;
}
 
int main() {
    int n;
    cin >> n;
    int a[n], i, j=0;
 
    for(i=0; i<n; i++) {
        cin >> a[i];
        if(IsPrime(a[i])) j++;
    }
    cout << j << endl;
 
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include<fstream>
using namespace std;
bool IsPrime(int n){
	int k=0;
	for (int i=1;i<=n;i++){
		if (n%i==0)
			k++;
	}
	if (k>2)
		return false;
	else return true;
}




int main(){
	int n,p=0;
	cin>>n;
	int a[n];
	for (int i=0;i<n;i++){
		cin>>a[i];
	}
	for (int i=0;i<n;i++){
		if (IsPrime(a[i])==true)
			p++;
	}
   cout<<p;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

bool is_prime(int a){
 if (a == 1) {
 return false;
}
 for (int i = 2; i <= sqrt(a); i++){
  if (a % i == 0){
   return false;
  }
 }
 return true;
}

int main(){
 int n;
 cin >> n;
 int a;
 int k = 0;
 for (int i = 0; i < n; i++){
  cin >> a;
  if (is_prime(a)){
   k++;
  }
  a = 0;
 }
 cout << k <<  endl;
 return 0;
}

Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

bool judge(int p){
    if(p==2)return true;
    if(p<2 | p%2==0)return false;
    int i = 3;
    int sqrtx = sqrt(p);
    while(i<sqrtx){
        if(p%i == 0){
            return false;
        }else{
            i = i + 2;
        }
    }
    return true;
}
int main(){
    int n = 0; int cnt =0;
    scanf("%d",&n);
    int input;
    bool frag;
    for(int i = 0; i < n; i++){
        scanf("%d",&input);
        if(input){
            frag = judge(input);
            if(frag)cnt++;
        }
    }
    printf("%d",cnt);
}

Compiler output:
main.c:5:1: error: unknown type name 'bool'
    5 | bool judge(int p){
      | ^~~~
main.c:4:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    3 | #include <stdlib.h>
  +++ |+#include <stdbool.h>
    4 | 
main.c: In function 'judge':
main.c:6:20: error: 'true' undeclared (first use in this function)
    6 |     if(p==2)return true;
      |                    ^~~~
main.c:6:20: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:6:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:28: error: 'false' undeclared (first use in this function)
    7 |     if(p<2 | p%2==0)return false;
      |                            ^~~~~
main.c:7:28: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'main':
main.c:23:5: error: unknown type name 'bool'
   23 |     bool frag;
      |     ^~~~
main.c:23:5: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>


int main(){
  int N;
  int i,j;
  int a;
  scanf("%d",&N);
  
  for(i=1;i<=N;i++){
    scanf("%d",&a);
    if(a==2) printf("2\n");//a==2は、約数として奇数のみを調べていくため、事前にチェック
    if(a%2!=0){
      j=3;
      while(1){
        if( a < j*j){
          printf("%d\n");
          break;
        }//この条件を満たすまで奇数の約数がなかったら素数
        
        if(a%j==0) break;//割り切れたら素数じゃない
        j+=2;
      j
    }
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:25:8: error: expected ';' before '}' token
   25 |       j
      |        ^
      |        ;
   26 |     }
      |     ~   
main.c:29:1: error: expected declaration or statement at end of input
   29 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>


int main(){
  int N;
  int i,j;
  int a;
  int count=0;
  scanf("%d",&N);
  
  for(i=1;i<=N;i++){
    scanf("%d",&a);
    if(a==2) count+=1~;//a==2は、約数として奇数のみを調べていくため、事前にチェック
    if(a%2!=0){
      j=3;
      while(1){
        if( a < j*j){
          count+=1;
          break;
        }//この条件を満たすまで奇数の約数がなかったら素数
        
        if(a%j==0) break;//割り切れたら素数じゃない
        j+=2;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:22: error: expected ';' before '~' token
   15 |     if(a==2) count+=1~;//a==2は、約数として奇数のみを調べていくため、事前にチェック
      |                      ^
      |                      ;
Language: C

#include<stdio.h>

int main(){

int n, i, j, num, count = 0, cnt = 0;

scanf("%d",&n);

for(i = 0; i < n; i++){

cnt = 0

scanf("%d",&num);

for(j = 1; j <= num; j++){

if(num % j == 0) cnt++

}

if(cnt == 2) count++;

}

printf("%d\n",count);

return 0;

}


Compiler output:
main.c: In function 'main':
main.c:11:8: error: expected ';' before 'scanf'
   11 | cnt = 0
      |        ^
      |        ;
   12 | 
   13 | scanf("%d",&num);
      | ~~~~~   
main.c:17:23: error: expected ';' before '}' token
   17 | if(num % j == 0) cnt++
      |                       ^
      |                       ;
   18 | 
   19 | }
      | ~
Language: C

#include <stdio.h>
#include <math.h>

#define NUM_MIN ( ( int ) 1 )
#define NUM_MAX ( ( int ) 10000 )
#define INT_MIN ( ( int ) 2 )
#define INT_MAX ( ( int ) 100000000 )

typedef enum
{
	kSuccess,
	kError
}Result;

Result checkNumRange( int num, int min, int max );
int isPrimeNum( int num );

int main( void )
{
	int i;
	int num;
	int array[NUM_MAX];
	int primeNumCount = 0;

	scanf( "%d\n", &num );
	if( checkNumRange( num, NUM_MIN, NUM_MAX ) == kError )
	{
		return -1;
	}

	for( i = 0; i < num; num++ )
	{
		scanf( "%d\n", &array[i] );
		if( checkNumRange( array[i], INT_MIN, INT_MAX ) == kError )
		{
			return -1;
		}

		if( isPrimeNum( array[i] ) == 0 )
		{
			++primeNumCount;
		}
	}

	printf( "%d\n", primeNumCount );

	return 0;
}

Result checkNumRange( int num, int min, int max )
{
	return ( ( num >= min ) && ( num <= max ) ) ? kSuccess : kError;
}

int isPrimeNum( int num )
{
	int i;
	int sqrt;

	if( num == 2 )
	{
		return 0;
	}

	if( ( num < 2 ) || ( ( num % 2 ) != 0 ) )
	{
		return -1;
	}

	sqrt = sqrt( num );
	for( i = 3; i <= sqrt; i += 2 )
	{
		if( ( num % i ) == 0 )
		{
			return -1;
		}
	}

	return 0;
}




Compiler output:
main.c: In function 'isPrimeNum':
main.c:70:16: error: called object 'sqrt' is not a function or function pointer
   70 |         sqrt = sqrt( num );
      |                ^~~~
main.c:58:13: note: declared here
   58 |         int sqrt;
      |             ^~~~
Language: C

#include<stdio.h>

int main(void)
{
	int i,j,n;
	int sosuu = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
	
			scanf("%d", &j);
	
		if (j != 1) {
			if ((j % 2) != 0 || (j == 2)) {
				if ((j % 3) != 0 || (j == 3))
　　　　　　　　　　　while (j <= 1 && j < 10000){
					sosuu++;
                              }
			}
		}
	}

	printf("%d", sosuu);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:17:1: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      | ^~~~~~~~
main.c:17:3: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |         ^~~~~~~~
main.c:17:5: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                 ^~~~~~~~
main.c:17:7: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                         ^~~~~~~~
main.c:17:9: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                 ^~~~~~~~
main.c:17:11: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                         ^~~~~~~~
main.c:17:13: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                                 ^~~~~~~~
main.c:17:15: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                                         ^~~~~~~~
main.c:17:17: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                                                 ^~~~~~~~
main.c:17:19: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                                                         ^~~~~~~~
main.c:17:21: error: stray '\343' in program
   17 | <U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000><U+3000>while (j <= 1 && j < 10000){
      |                                                                                 ^~~~~~~~
Language: C

//16D8101002H Iori Anzai 螳芽･ｿ 莨顔ｹ・險隱・C

#include<stdio.h>
#include<math.h>
#define N 1000

int main(void)
{
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
  }
  

  int n;
  scanf("%d",&n);

  int x[N];
  int cnt[N]={};
  int i;
  int cntp=0;
  double rtx[n];

  for(i=0;i<n;i++)
    rtx[i]=sqrt(x[i]);

  int j;
  for(i=0;i<n;i++){
    if(x[i]%2==1){
      for(j=2;j<=rtx[i]+1;j+=1){
	if(x[i]%j==0){
	  cnt[i]++;
	}
      }
    }
    else{
      cnt[i]++;
    }
  }

  for(i=0;i<n;i++){
    if(x[i]!=1&&cnt[i]==0) cntp++;
  }
  for(i=0;i<n;i++){
    if(x[i]==2) cntp++;
  }
  printf("%d",cntp);
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:9:7: error: 'i' undeclared (first use in this function)
    9 |   for(i=0;i<n;i++){
      |       ^
main.c:9:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:13: error: 'n' undeclared (first use in this function); did you mean 'yn'?
    9 |   for(i=0;i<n;i++){
      |             ^
      |             yn
main.c:10:17: error: 'x' undeclared (first use in this function)
   10 |     scanf("%d",&x[i]);
      |                 ^
Language: C

#include<stdio.h>

int main(){
  int S,h,m,s;
  scanf("%d %d %d", &S, &M, &L);

  S / 3600 = h;
  S % 3600 = m;
  m / 60 = m;
  m % 60 = s;

  printf("%d:%d:%d\n",&h,&m,&s);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:26: error: 'M' undeclared (first use in this function)
    5 |   scanf("%d %d %d", &S, &M, &L);
      |                          ^
main.c:5:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:30: error: 'L' undeclared (first use in this function)
    5 |   scanf("%d %d %d", &S, &M, &L);
      |                              ^
main.c:7:12: error: lvalue required as left operand of assignment
    7 |   S / 3600 = h;
      |            ^
main.c:8:12: error: lvalue required as left operand of assignment
    8 |   S % 3600 = m;
      |            ^
main.c:9:10: error: lvalue required as left operand of assignment
    9 |   m / 60 = m;
      |          ^
main.c:10:10: error: lvalue required as left operand of assignment
   10 |   m % 60 = s;
      |          ^
Language: C

#include<stdio.h>
int main()
{
 int x;
 scanf("%d",&x);

 isPrime(x)
  if x<=1
   return false

  for i=2tox-1
   if x%i==0
    return false

  return true
}



Compiler output:
main.c: In function 'main':
main.c:7:2: error: implicit declaration of function 'isPrime' [-Wimplicit-function-declaration]
    7 |  isPrime(x)
      |  ^~~~~~~
main.c:7:12: error: expected ';' before 'if'
    7 |  isPrime(x)
      |            ^
      |            ;
    8 |   if x<=1
      |   ~~        
main.c:11:9: error: invalid suffix "tox" on integer constant
   11 |   for i=2tox-1
      |         ^~~~
Language: C

#include<stdio.h>
int main()
{
 int x;
 scanf("%d",&x);

 isPrime(x){
  if x<=1
   return false}

  {for i=2tox-1
   if x%i==0
    return false}

  return true
}



Compiler output:
main.c: In function 'main':
main.c:7:2: error: implicit declaration of function 'isPrime' [-Wimplicit-function-declaration]
    7 |  isPrime(x){
      |  ^~~~~~~
main.c:7:12: error: expected ';' before '{' token
    7 |  isPrime(x){
      |            ^
      |            ;
main.c:11:10: error: invalid suffix "tox" on integer constant
   11 |   {for i=2tox-1
      |          ^~~~
Language: C

#include<stdio.h>
int main(void)
{
 int a,b,c,d;
 scanf("%d",&a);
 
 for(b=2;b<=a;b++){
  d=0;
  for(c=2;c<=b;c++){
  if(b%c==0 && b!=c){
   d++;
   break;
}
}
  if(d==0){
   printf("%d\n",b);
  }
 return 0;
}


Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
Language: C

#include<stdio.h>

int main(void){
int a,b,n 

 if(a == 2)
   n + 1 = n;
 if(a == 3)
   n + 1 = n;
 if(a % 2 == 0)
  n = n;
 if(a % 3 == 0)
  n = n;
 if(b = sqrt(a))
  n = n;
return 0 ;
}


Compiler output:
main.c: In function 'main':
main.c:6:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'if'
    6 |  if(a == 2)
      |  ^~
main.c:9:4: error: 'n' undeclared (first use in this function)
    9 |    n + 1 = n;
      |    ^
main.c:9:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:9: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
   14 |  if(b = sqrt(a))
      |         ^~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'sqrt'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | 
main.c:14:9: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
   14 |  if(b = sqrt(a))
      |         ^~~~
main.c:14:9: note: include '<math.h>' or provide a declaration of 'sqrt'
Language: C

#include <stdio.h>
#include <math.h>
int main(void)
{
	int n, x, i, j, count, ans = 0;
	scanf_s("%d", &n);
	if (n >= 1 && n <= 10000) {
		for (i = 0; i < n; i++) {
			scanf_s("%d", &x);
			if (x >= 2 && x <= (pow(10.0, 8.0))) {
				count = 0;
				for (j = 1; j <= x; j++) {
					if (x % j == 0) count++;
					if (count > 2) break;
				}
				if (count == 2) ans++;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    6 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>
int prime(int x){
int a; 
if(x < 2)
 return 0; 
if(x == 2)
 return 1;
 if(x % 2 == 0)
 return 0;
 for(i = 3;a * a <= x;a += 2)
 if(x % a == 0)
 return 0;
 return 1; }

 int main(void){
 int a,n, c = 0, b;
 scanf("%d", &n);
 for(i = 0;a < n;a++){
 scanf("%d", &b); c += prime(b);
 }
 printf("%d\n", c);
 return 0;
} 


Compiler output:
main.c: In function 'prime':
main.c:10:6: error: 'i' undeclared (first use in this function)
   10 |  for(i = 3;a * a <= x;a += 2)
      |      ^
main.c:10:6: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:18:6: error: 'i' undeclared (first use in this function)
   18 |  for(i = 0;a < n;a++){
      |      ^
Language: C

#include<stdio.h>
#include<math.h>
int prime(int n){
int i;
if (n==2)
return 0;
else if (n<2||n%2==0)
	return 1;
else
i = 3;
while (i<=sqrt(n)){
	if (n%i == 0) return 1;
	i=i+2;
	}
return 0;
}

int main(void)
{
	int a[10000],n, i,count=0;
	scanf("%d",&n);
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for ( =0;i<n;i++)
	{
		if (prime(a[i])==0)count+= 1;
	}
	printf("%d",count);
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:24:15: error: expected expression before '=' token
   24 |         for ( =0;i<n;i++)
      |               ^
Language: C

#include<stdio.h>
#include<math.h>
int prime(int n){
int i;
if(n==2)
return 0;
elseif(n<2 || n%2==0)
	return 1;
else{
i=3;
while (i<=sqrt(n)) {
	if (n%i == 0) return 1;
	i = i + 2;
	}
return 0;}
}

int main(void)
{
	int a[10000],n,i,count=0;
	scanf("%d",&n);
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for (i = 0; i < n; i++)
	{
		if (prime(a[i])==0)count+=1;
	}
	printf("%d",count);
	return 0;
}



Compiler output:
main.c: In function 'prime':
main.c:7:1: error: implicit declaration of function 'elseif' [-Wimplicit-function-declaration]
    7 | elseif(n<2 || n%2==0)
      | ^~~~~~
main.c:7:22: error: expected ';' before 'return'
    7 | elseif(n<2 || n%2==0)
      |                      ^
      |                      ;
    8 |         return 1;
      |         ~~~~~~        
main.c:9:1: error: 'else' without a previous 'if'
    9 | else{
      | ^~~~
Language: C

#include <stdio.h>
#include <math.h>
 
int main(){
    int n,a,cnt=0,N;
    scanf("%d",&n);
 
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a);
        limit=sqrt(a);
        for(int j=2;j<=N;j++){
            if(tmp%j==0){
                cnt++;
                break;
            }
        }
    }
    printf("%d\n",n-cnt);
}


Compiler output:
main.c: In function 'main':
main.c:11:9: error: 'limit' undeclared (first use in this function)
   11 |         limit=sqrt(a);
      |         ^~~~~
main.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:16: error: 'tmp' undeclared (first use in this function)
   13 |             if(tmp%j==0){
      |                ^~~
Language: C

#include <stdio.h>

int main(void)
{
	int i;
	int  n; //入力された自然数
	int prime[10000];
	int j = 0;
	int counter = 0;

	prime[j++] = 2;
	prime[j++] = 3;
	
	scanf("%d"&n);

	for (n = 5; n <= 100000000; n += 2) {
		for (i = 1; i < j; i++) {
			if (n % prime[i] == 0)
				break;
			
		}
		if (j == i)
			prime[j++] = n;
	}
	for (i = 0; i < j; i++)
		counter++;
printf("%d", counter);

	return(0);

}


Compiler output:
main.c: In function 'main':
main.c:14:19: error: invalid operands to binary & (have 'char *' and 'int')
   14 |         scanf("%d"&n);
      |               ~~~~^
      |               |
      |               char *
Language: C

#include <iostream>
using namespace std;

/* 最初に判定に必要な素数の配列を宣言する */
bool primes[100000000];

void Sieve() {
    /* 最初は、全て trueにして素数と仮にする */
    for(int i = 2; i < 100000000; i++) {
      primes[i] = true;
    }
    primes[1] = false;
    /* 素数でない整数を false にしてふるいにかける */;
    for(int i = 2; i < 10000; i++) {

       /* 解説を思い出して頑張る */

    }
}

bool IsPrime(int n) {
    return primes[n];
}

int main(void){
    Sieve();  /* 最初に Sieve() を呼ぶ */

    ...

    return 0;
}





Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void)
{
	int i; //割る
	int n; //入力された自然数
	int prime;
	int j = 0;
	int counter = 0; //素数の個数
	int SINcounter = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {

		scanf("%d", &prime);

		if ((prime % 2 == 0) && (prime != 2)) {
			counter += 2;
		}
		else {
			if (prime <= 2) {
				if (prime == 2) {
					SINcounter++;
					continue;
				}
				continue;
			}
			
			for (j = 3; j <= prime; j += 2) {
				if ((prime % j) == 0) {
					counter++;
				}
			}
		}

			if (counter == 1){
				SINcounter++;				
			}	
			counter = 0;
	}

	printf("%d\n", SINcounter);


	return(0);

}


Compiler output:
main.c:1:1: error: unknown type name 'define'
    1 | define _CRT_SECURE_NO_WARNINGS
      | ^~~~~~
main.c:1:31: error: expected ';' before 'typedef'
    1 | define _CRT_SECURE_NO_WARNINGS
      |                               ^
      |                               ;
Language: C

#include <stdio.h>
#include <math.h>



int main(){
  const int data_num = 100;
  int data[data_num] = {5, 6, 8};

  int n = 10000;
  int flag[n + 1];
  int ans = 0;
  int i, j;
  for (i = 1; i < n + 1; i++)
    flag[i] = 1;
  flag[1] = 0;

  for (i = 1; i < sqrt(n + 1); i++){
    if (flag[i] == 1)
      for (j = 2; i * j < n +1; j++)
        flag[i * j] = 0;
  }

//  for (i = 1; i < 100; i++)
//    printf("%d, %d\n", i, flag[i]);

  for (i = 0; i < data_num; i++)
    if (flag[data[i]] == 1)
      ans++;
  printf("%d\n", ans);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:24: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int data[data_num] = {5, 6, 8};
      |                        ^
Language: C

#include <stdio.h>
int main(void){
	int n,i,j,sosu=0,not_sosu=0;
	int N[10000];
	
	//最初の行読み込み
	scanf("%d",&num);
	
	//続くn個の読み込み
	for(i=1; i<=n; i++){
		scanf("%d",&N[i]);
	}
	//素数判定
	
	for(i=1; i<=n; i++){
		for(j=2; j< N[i]; j++){
			not_sosu = 0
			if(N[i]%j==0){	
				not_sosu=1;
				break;
			}
		}
	}
		//printf("%d番目の%dは%d\n",i,N[i],not_sosu);
		if(not_sosu==0)	sosu++;
	
	
	printf("%d\n", sosu);
	return 0;

}


Compiler output:
main.c: In function 'main':
main.c:7:21: error: 'num' undeclared (first use in this function)
    7 |         scanf("%d",&num);
      |                     ^~~
main.c:7:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:37: error: expected ';' before 'if'
   17 |                         not_sosu = 0
      |                                     ^
      |                                     ;
   18 |                         if(N[i]%j==0){
      |                         ~~
Language: C

#include <stdio.h>
#include <math.h>



int main(){
  const int data_num = 100;
  int data[data_num] = {6,2,3,4,5,6,7};

  int n = 10000;
  int flag[n + 1];
  int ans = 0;
  int i, j;
  for (i = 1; i < n + 1; i++)
    flag[i] = 1;
  flag[1] = 0;

  for (i = 1; i < sqrt(n + 1); i++){
    if (flag[i] == 1)
      for (j = 2; i * j < n +1; j++)
        flag[i * j] = 0;
  }

//  for (i = 1; i < 100; i++)
//    printf("%d, %d\n", i, flag[i]);

  for (i = 0; i < data_num; i++)
    if (flag[data[i]] == 1)
      ans++;
  printf("%d\n", ans);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:24: error: variable-sized object may not be initialized except with an empty initializer
    8 |   int data[data_num] = {6,2,3,4,5,6,7};
      |                        ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>



int main(){
  //const int data_num = 100;
  //int data[data_num] = {5, 6, 8};

  int n = 10000;
  int flag[n + 1];
  int ans = 0;
  int i, j;
  for (i = 1; i < n + 1; i++)
    flag[i] = 1;
  flag[1] = 0;

  for (i = 1; i < sqrt(n + 1); i++){
    if (flag[i] == 1)
      for (j = 2; i * j < n +1; j++)
        flag[i * j] = 0;
  }

//  for (i = 1; i < 100; i++)
//    printf("%d, %d\n", i, flag[i]);

  // データ読み込み
  //for (i = 0; i < data_num; i++)
  int data;
  while(fgets(line, sizeof(line), stdin) != NULL) {
    if (sscanf(line, "%d", &data) != 1) {
      fputs("sscanf: Convert error\n", stderr);
      return EXIT_FAILURE;
    }
    if (flag[data[i]] == 1)
      ans++;
  }
  printf("%d\n", ans);

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:31:15: error: 'line' undeclared (first use in this function)
   31 |   while(fgets(line, sizeof(line), stdin) != NULL) {
      |               ^~~~
main.c:31:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:36:18: error: subscripted value is neither array nor pointer nor vector
   36 |     if (flag[data[i]] == 1)
      |                  ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define LINE_BUF_SIZE 1024
#define N 100000000


bool flag[N + 1] = {0};

int main(){
  //const int data_num = 100;
  //int data[data_num] = {5, 6, 8};

  int ans = 0;
  int i, j;
  for (i = 1; i < N + 1; i++)
    flag[i] = 1;
  flag[1] = 0;

  for (i = 1; i < sqrt(N + 1); i++){
    if (flag[i] == 1)
      for (j = 2; i * j < N +1; j++)
        flag[i * j] = 0;
  }

//  for (i = 1; i < 100; i++)
//    printf("%d, %d\n", i, flag[i]);

  // データ読み込み
  //for (i = 0; i < data_num; i++)
  int data;
  static char line[LINE_BUF_SIZE];
  while(fgets(line, sizeof(line), stdin) != NULL) {
    if (sscanf(line, "%d", &data) != 1) {
      fputs("sscanf: Convert error\n", stderr);
      return EXIT_FAILURE;
    }
    if (flag[data] == 1)
      ans++;
  }
  printf("%d\n", ans);

  return 0;
}


Compiler output:
main.c:9:1: error: unknown type name 'bool'
    9 | bool flag[N + 1] = {0};
      | ^~~~
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 |
Language: C

#include <stdlib.h>
#include <math.h>

#define LINE_BUF_SIZE 1024
#define N 100000000


unsigned char flag[N + 1] = {0};

int main(){
  //const int data_num = 100;
  //int data[data_num] = {5, 6, 8};

  int ans = 0;
  int i, j;
  //for (i = 1; i < N + 1; i++)
  //  flag[i] = 0;
  flag[1] = 1;

  for (i = 1; i < sqrt(N + 1); i++){
    if (flag[i] == 0)
      for (j = 2; i * j < N +1; j++)
        flag[i * j] = 1;
  }

//  for (i = 1; i < 100; i++)
//    printf("%d, %d\n", i, flag[i]);

  // データ読み込み
  //for (i = 0; i < data_num; i++)
  int data;
  static char line[LINE_BUF_SIZE];
  while(fgets(line, sizeof(line), stdin) != NULL) {
    if (sscanf(line, "%d", &data) != 1) {
      fputs("sscanf: Convert error\n", stderr);
      return EXIT_FAILURE;
    }
    if (flag[data] == 0)
      ans++;
  }
  printf("%d\n", ans);

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration]
   33 |   while(fgets(line, sizeof(line), stdin) != NULL) {
      |         ^~~~~
main.c:33:35: error: 'stdin' undeclared (first use in this function)
   33 |   while(fgets(line, sizeof(line), stdin) != NULL) {
      |                                   ^~~~~
main.c:3:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | 
main.c:33:35: note: each undeclared identifier is reported only once for each function it appears in
   33 |   while(fgets(line, sizeof(line), stdin) != NULL) {
      |                                   ^~~~~
main.c:34:9: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
   34 |     if (sscanf(line, "%d", &data) != 1) {
      |         ^~~~~~
main.c:34:9: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:34:9: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:34:9: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:35:7: error: implicit declaration of function 'fputs' [-Wimplicit-function-declaration]
   35 |       fputs("sscanf: Convert error\n", stderr);
      |       ^~~~~
main.c:35:7: note: include '<stdio.h>' or provide a declaration of 'fputs'
main.c:35:40: error: 'stderr' undeclared (first use in this function)
   35 |       fputs("sscanf: Convert error\n", stderr);
      |                                        ^~~~~~
main.c:35:40: note: 'stderr' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:41:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   41 |   printf("%d\n", ans);
      |   ^~~~~~
main.c:41:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:41:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:41:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>
#include<math.h>

int isPrime(int x){
    int i;
    if(x==1)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

int main(void){
    int n,m, cnt=0;
    int i;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scabf("%d",&m);
        if(isPrime(m)==1){
            cnt++;
        }
    }
    printf("%d\n",cnt)
}


Compiler output:
main.c: In function 'main':
main.c:21:9: error: implicit declaration of function 'scabf'; did you mean 'scalbf'? [-Wimplicit-function-declaration]
   21 |         scabf("%d",&m);
      |         ^~~~~
      |         scalbf
main.c:26:23: error: expected ';' before '}' token
   26 |     printf("%d\n",cnt)
      |                       ^
      |                       ;
   27 | }
      | ~
Language: C

#include<stdio.h>
#include<math.h>

int isPrime(int x){
    int i;
    if(x==1)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(i=3;(i*i)<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

int main(void){
    int n,m,cnt=0;
    int i;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&m);
        if(isPrime(m)==1){
            cnt++;
        }
    }
    printf("%d\n",cnt)
}


Compiler output:
main.c: In function 'main':
main.c:26:23: error: expected ';' before '}' token
   26 |     printf("%d\n",cnt)
      |                       ^
      |                       ;
   27 | }
      | ~
Language: C

#include<stdio.h>
#include<vector>
std::vector<int> ps;
void set_prime(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i==0)return ;
	}
	ps.push_back(n);
}
bool is_prime(int n){
	if(n<2)return false;
	for(int i=0;i<ps.size();i++){
		int a=ps[i];
		if(a*a>n)return true;
		if(n%a==0)return false;
	}
	return true;
}

int main(){
	for(int i=2;i<10000;i++){
		set_prime(i);
	}
	int n,ans=0;
	scanf("%d",&n);
	while(n--){
		int a;
		scanf("%d",&a);
		ans+=is_prime(a)?1:0;
	}
	printf("%d\n",ans);
}


Compiler output:
main.c:2:9: fatal error: vector: No such file or directory
    2 | #include<vector>
      |         ^~~~~~~~
compilation terminated.
Language: C



#include<cstdio>
using namespace std;
bool us[1000010]={false};
int p[1000010] = {0};
int main(){
    /*Eratosthenes*/
    p[0] = 2;
    for(int i = 0; i <= 1000010; i+=2){
        us[i] = true;
    }
    int cnt = 1;
    for(int i = 3; i <= 1000010; i+=2){
        int q = 0;
        if(us[i] == true)continue;
        else if(us[i] == false){
            p[cnt] = i;
            cnt++;
            us[i] = true;
            q = i;
            for(int j = q+q; j <= 1000010; j += q){
                us[j] = true;
            }
        }
    }
     
    int n;
    while(~scanf("%d",&n)){
        int x = 0;
        while(1){
            if(p[x] > n)break;
            x++;
        }
        printf("%d\n",x);
    }
    return 0;
}


Compiler output:
main.c:3:9: fatal error: cstdio: No such file or directory
    3 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C


#include<cstdio>
using namespace std;
bool us[1000010]={false};
int p[1000010] = {0};
int main(){
    /*Eratosthenes*/
    p[0] = 2;
    for(int i = 0; i <= 1000010; i+=2){
        us[i] = true;
    }
    int cnt = 1;
    for(int i = 3; i <= 1000010; i+=2){
        int q = 0;
        if(us[i] == true)continue;
        else if(us[i] == false){
            p[cnt] = i;
            cnt++;
            us[i] = true;
            q = i;
            for(int j = q+q; j <= 1000010; j += q){
                us[j] = true;
            }
        }
    }
     
    int n;
    while(~scanf("%d",&n)){
        int x = 0;
        while(1){
            if(p[x] > n)break;
            x++;
        }
        printf("%d\n",x);
    }
    return 0;
}


Compiler output:
main.c:2:9: fatal error: cstdio: No such file or directory
    2 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int isPrime(int x){

  int i;
  if( x < 2 ) return 0;
  else if( x == 2 ) return 1;
  if( x % 2 == 0 ) return 0;
  for( i = 3; i*i <= x; i+=2){
      if( x % i == 0 ) return 0;
  }
  return 1;
}

int mian(){
    int n, x, i;
    int cnt = 0;
    scanf("%d",&n);
    for( i = 0; i < n; i++ ){
        scanf("%d", &x);
        if( isPrime(x) ) cnt++;
    }
    printf("%d\n", cnt);

    return 0;
}




Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<math.h>
using namespace std;
 
bool isPrime(int x){
  if(x==2){
    return true;
  }
  if(x<2 || x%2==0){
    return false;
  }
 
  int i=3;
  while(i<=sqrt(x)){
    if(x%i==0){
      return false;
    }
    i = i+2;
  }
 
  return true;
}
 
int main(){
  int n;
  scanf("%d",&n);
 
  int N[n];
  int c=0;
  for(int i=0;i<n;i++){
    scanf("%d",&N[i]);
    if(isPrime(N[i])){
      c++;
    }
  }
  printf("%d\n",&c);
 
  return 0;
}


Compiler output:
main.c:3:1: error: unknown type name 'using'
    3 | using namespace std;
      | ^~~~~
main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    3 | using namespace std;
      |                 ^~~
main.c:5:1: error: unknown type name 'bool'
    5 | bool isPrime(int x){
      | ^~~~
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 | using namespace std;
main.c: In function 'isPrime':
main.c:7:12: error: 'true' undeclared (first use in this function)
    7 |     return true;
      |            ^~~~
main.c:7:12: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:7:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:12: error: 'false' undeclared (first use in this function)
   10 |     return false;
      |            ^~~~~
main.c:10:12: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include<stdio.h>
#include<math.h>

 
bool isPrime(int x){
  if(x==2){
    return true;
  }
  if(x<2 || x%2==0){
    return false;
  }
 
  int i=3;
  while(i<=sqrt(x)){
    if(x%i==0){
      return false;
    }
    i = i+2;
  }
 
  return true;
}
 
int main(){
  int n;
  scanf("%d",&n);
 
  int N[n];
  int c=0;
  for(int i=0;i<n;i++){
    scanf("%d",&N[i]);
    if(isPrime(N[i])){
      c++;
    }
  }
  printf("%d\n",&c);
 
  return 0;
}


Compiler output:
main.c:5:1: error: unknown type name 'bool'
    5 | bool isPrime(int x){
      | ^~~~
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: In function 'isPrime':
main.c:7:12: error: 'true' undeclared (first use in this function)
    7 |     return true;
      |            ^~~~
main.c:7:12: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:7:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:12: error: 'false' undeclared (first use in this function)
   10 |     return false;
      |            ^~~~~
main.c:10:12: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include<stio.h>
#include<math.h>

int isPrime(int x){
  if(x==2){
    return true;
  }
  if(x<2 || x%2==0){
    return false;
  }

  int i=3;
  while(i<=sqrt(x)){
    if(x%i==0){
      return false;
    }
    i = i+2;
  }

  return true;
}

int main(){
  int n;
  scanf("%d",&n);

  int N[n];
  int c=0;
  for(int i=0;i<n;i++){
    cin >> N[i];
    if(isPrime(N[i])){
      c++;
    }
  }
  printf("%d\n",c);

  return 0;
}



Compiler output:
main.c:1:9: fatal error: stio.h: No such file or directory
    1 | #include<stio.h>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<math.h>

int isPrime(int x){
  if(x==2){
    return true;
  }
  if(x<2 || x%2==0){
    return false;
  }

  int i=3;
  while(i<=sqrt(x)){
    if(x%i==0){
      return false;
    }
    i = i+2;
  }

  return true;
}

int main(){
  int n;
  scanf("%d",&n);

  int N[n];
  int c=0;
  for(int i=0;i<n;i++){
    scanf("%d",&N[i]);
    if(isPrime(N[i])){
      c++;
    }
  }
  printf("%d\n",c);

  return 0;
}



Compiler output:
main.c: In function 'isPrime':
main.c:6:12: error: 'true' undeclared (first use in this function)
    6 |     return true;
      |            ^~~~
main.c:3:1: note: 'true' 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:6:12: note: each undeclared identifier is reported only once for each function it appears in
    6 |     return true;
      |            ^~~~
main.c:9:12: error: 'false' undeclared (first use in this function)
    9 |     return false;
      |            ^~~~~
main.c:9:12: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <iostream>
using namespace std;

bool IsPrime(int n) {
	for (int i = 2; i * i <= n; i++) {
		if(n % i == 0) {
            		return false;
		}
	}
	return true;
}

int main(void) {
	int count = 0, n;
	cin >> n; 
	for (int i = 0; i < n; i++) {
   		int p;
		cin >> p;
		if (IsPrime(p)) {
			count++;
			}
	}
	cout << count << endl;
	return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

long long int i, N, j, flag=0, count=0;
    int n;


    scanf("%d", &n);

    for(i=1; i<=n; i++)
    {
        scanf("%lld", &N);

        flag=0;

        for(j=2; j<=N/2; j++)
        {

            if(N%j==0)
            {
                flag=1;
                break;
            }

        }

        if(flag==0)
            count++;

    }

    printf("%lld\n", count);



Compiler output:
main.c:5:11: error: expected declaration specifiers or '...' before string constant
    5 |     scanf("%d", &n);
      |           ^~~~
main.c:5:17: error: expected declaration specifiers or '...' before '&' token
    5 |     scanf("%d", &n);
      |                 ^
main.c:7:5: error: expected identifier or '(' before 'for'
    7 |     for(i=1; i<=n; i++)
      |     ^~~
main.c:7:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
    7 |     for(i=1; i<=n; i++)
      |               ^~
main.c:7:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    7 |     for(i=1; i<=n; i++)
      |                     ^~
main.c:29:12: error: expected declaration specifiers or '...' before string constant
   29 |     printf("%lld\n", count);
      |            ^~~~~~~~
main.c:29:22: error: expected declaration specifiers or '...' before 'count'
   29 |     printf("%lld\n", count);
      |                      ^~~~~
Language: C

#include <stdio.h>

int Prime(int);

int main(){
  int n,i,x,num = 0;
  scanf("%d",&N);
  for(i = 0 ; i < n ; i++){
    scanf("%d",&x);
    if(Prime(x)){
      ++num;
    }
  }
  printf("%d\n",num);
  return 0;
}

int Prime(int x){
  int i;
  if(x < 2){ return 0; }
  for(i = 2 ; i*i <= x ; i++){
    if(x % i == 0){ return 0; }
  }
  return 1;
}



Compiler output:
main.c: In function 'main':
main.c:7:15: error: 'N' undeclared (first use in this function)
    7 |   scanf("%d",&N);
      |               ^
main.c:7:15: note: each undeclared identifier is reported only once for each function it appears in