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

#include<iostream>
#include<cmath>
 
#define size 1000;
 
using namespace std;
 
bool isprime (int x) {
 
    int = i;
 
    if (x == 2) {
 
        return true;
 
    }
 
    if (x < 2 || x % 2 == 0) {
 
        return false;
 
    }
 
    for (i = 3; i <= sqrt(x); i += 2) {
 
        if (n % i == 0) {
 
            return false;
 
        }
 
        return true;
 
    }
 
}
 
int main () {
 
    int n, list[size];
    int count = 0;
 
    cin >> n;
 
    for (i = 0; i < n; i++) {
 
        cin >> list[i];
 
    }
 
    for (i = 0; i < n; i++) {
 
        if (isprime (list[i])) {
 
            count += 1;
 
        }
 
    }
 
    cout << count << endl;
 
    return 0;
 
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:10:9: error: expected unqualified-id before '=' token
   10 |     int = i;
      |         ^
a.cc:24:10: error: 'i' was not declared in this scope
   24 |     for (i = 3; i <= sqrt(x); i += 2) {
      |          ^
a.cc:26:13: error: 'n' was not declared in this scope
   26 |         if (n % i == 0) {
      |             ^
a.cc: In function 'int main()':
a.cc:4:18: error: expected ']' before ';' token
    4 | #define size 1000;
      |                  ^
a.cc:40:17: note: in expansion of macro 'size'
   40 |     int n, list[size];
      |                 ^~~~
a.cc:40:21: error: expected primary-expression before ']' token
   40 |     int n, list[size];
      |                     ^
a.cc:45:10: error: 'i' was not declared in this scope
   45 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:47:16: error: 'list' was not declared in this scope
   47 |         cin >> list[i];
      |                ^~~~
a.cc:3:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
    2 | #include<cmath>
  +++ |+#include <list>
    3 | 
a.cc:51:10: error: 'i' was not declared in this scope
   51 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:53:22: error: 'list' was not declared in this scope
   53 |         if (isprime (list[i])) {
      |                      ^~~~
a.cc:53:22: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
a.cc: In function 'bool isprime(int)':
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
Language: C++

#include<iostream>
#include<cmath>
 
#define size 1000;
 
using namespace std;
 
bool isprime (int x) {
 
    int = i;
 
    if (x == 2) {
 
        return true;
 
    }
 
    if (x < 2 || x % 2 == 0) {
 
        return false;
 
    }
 
    for (i = 3; i * i <= x; i += 2) {
 
        if (n % i == 0) {
 
            return false;
 
        }
 
        return true;
 
    }
 
}
 
int main () {
 
    int n, x;
    int count = 0;
 
    cin >> n;
  
    for (i = 0; i < n; i++) {

        cin >> x;
 
        if (isprime (x)) {
 
            count += 1;
 
        }
 
    }
 
    cout << count << endl;
 
    return 0;
 
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:10:9: error: expected unqualified-id before '=' token
   10 |     int = i;
      |         ^
a.cc:24:10: error: 'i' was not declared in this scope
   24 |     for (i = 3; i * i <= x; i += 2) {
      |          ^
a.cc:26:13: error: 'n' was not declared in this scope
   26 |         if (n % i == 0) {
      |             ^
a.cc: In function 'int main()':
a.cc:45:10: error: 'i' was not declared in this scope
   45 |     for (i = 0; i < n; i++) {
      |          ^
a.cc: In function 'bool isprime(int)':
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
Language: C++

#include<iostream>
 
using namespace std;
 
bool isprime (int x) {
 
    int = i;
 
    if (x == 2) {
 
        return true;
 
    }
 
    if (x < 2 || x % 2 == 0) {
 
        return false;
 
    }
 
    for (i = 3; i * i <= x; i += 2) {
 
        if (n % i == 0) {
 
            return false;
 
        }
 
        return true;
 
    }
 
}
 
int main () {
 
    int n, x;
    int count = 0;
 
    cin >> n;
  
    for (i = 0; i < n; i++) {

        cin >> x;
 
        if (isprime (x)) {
 
            count += 1;
 
        }
 
    }
 
    cout << count << endl;
 
    return 0;
 
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:7:9: error: expected unqualified-id before '=' token
    7 |     int = i;
      |         ^
a.cc:21:10: error: 'i' was not declared in this scope
   21 |     for (i = 3; i * i <= x; i += 2) {
      |          ^
a.cc:23:13: error: 'n' was not declared in this scope
   23 |         if (n % i == 0) {
      |             ^
a.cc: In function 'int main()':
a.cc:42:10: error: 'i' was not declared in this scope
   42 |     for (i = 0; i < n; i++) {
      |          ^
a.cc: In function 'bool isprime(int)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
Language: C++

#include<iostream>
 
using namespace std;
 
bool isprime (int x) {
 
    int = i;
 
    if (x == 2) {
 
        return true;
 
    }
 
    if (x < 2 || x % 2 == 0) {
 
        return false;
 
    }
 
    for (i = 3; i * i <= x; i += 2) {
 
        if (x % i == 0) {
 
            return false;
 
        }
 
        return true;
 
    }
 
}
 
int main () {
 
    int n, x;
    int count = 0;
 
    cin >> n;
  
    for (i = 0; i < n; i++) {

        cin >> x;
 
        if (isprime (x)) {
 
            count += 1;
 
        }
 
    }
 
    cout << count << endl;
 
    return 0;
 
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:7:9: error: expected unqualified-id before '=' token
    7 |     int = i;
      |         ^
a.cc:21:10: error: 'i' was not declared in this scope
   21 |     for (i = 3; i * i <= x; i += 2) {
      |          ^
a.cc: In function 'int main()':
a.cc:42:10: error: 'i' was not declared in this scope
   42 |     for (i = 0; i < n; i++) {
      |          ^
a.cc: In function 'bool isprime(int)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
Language: C++

#include<iostream>
 
using namespace std;
 
bool isprime (int x) {
 
    int i;
 
    if (x == 2) {
 
        return true;
 
    }
 
    if (x < 2 || x % 2 == 0) {
 
        return false;
 
    }
 
    for (i = 3; i * i <= x; i += 2) {
 
        if (x % i == 0) {
 
            return false;
 
        }
 
        return true;
 
    }
 
}
 
int main () {
 
    int n, x;
    int count = 0;
 
    cin >> n;
  
    for (i = 0; i < n; i++) {

        cin >> x;
 
        if (isprime (x)) {
 
            count += 1;
 
        }
 
    }
 
    cout << count << endl;
 
    return 0;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: 'i' was not declared in this scope
   42 |     for (i = 0; i < n; i++) {
      |          ^
a.cc: In function 'bool isprime(int)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
Language: C++

//
// ALDS1_1 - C Prime Numbers
// A prime number is a natural number which has exactly two distinct natural number divisors: 
// 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
//
// Write a program which reads a list of N integers and prints the number of prime numbers in the list.
//
#include <iostream>
using namespace std;

void read(int& size, int **ppArray);
void checkPrimeNumbers(size_t size, const int* pArray, int& count);
void write(const int count);

int main()
{
    int size = 0, ret = 0;
    int* pArray = NULL;

    read(size, &pArray);
    checkPrimeNumbers(size, pArray, ret);
    write(ret);

    delete pArray;
}

void read(int& size, int **ppArray)
{
    if (NULL == ppArray || NULL != *ppArray)
        return;

    cin >> size;
    if (10000 < size)
        return;

    *ppArray = new int[size];
    for (int i = 0; i < size; i++) {
        cin >> *(*ppArray + i);
    }
}

void checkPrimeNumbers(size_t size, const int* pArray, int& count)
{
    if (NULL == pArray)
        return;

    for (int i = 0; i < size; i++) {
        bool flag = true;
        int value = *(pArray + i);
        if (2 > value)
            continue;
        if (2 == value) {
            count++;
            continue;
        }
        if (0 == value % 2)
            continue;
        for (int j = 3; j <= (int)sqrt(value); j += 2) {
            if (0 == value % j) {
                flag = false;
                break;
            }
        }
        if (true == flag)
            count++;
    }
}

void write(const int count)
{
    cout << count << endl;
}

Compiler output:
a.cc: In function 'void checkPrimeNumbers(size_t, const int*, int&)':
a.cc:58:35: error: 'sqrt' was not declared in this scope
   58 |         for (int j = 3; j <= (int)sqrt(value); j += 2) {
      |                                   ^~~~
Language: C++

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

uint64_t get_size(uint64_t n) {
  return n % 6 % 5 == 0 ? (n - 1) / 3 : (n / 6) * 2;
}

std::vector<int> generate_primes(uint64_t upperbound) {
  uint64_t sieve_size = get_size(upperbound);
  std::vector<bool> sieve(sieve_size, true);
  uint64_t limit = get_size(sqrt(upperbound));

  for(uint64_t i = 0; i != limit; ++i) {
    int p = i * 3 - (i & 1) + 5;
    uint64_t j;
    for(j = p * 2; j < sieve_size - i; j += p * 2) {
      sieve.at(j + i) = false;
      sieve.at(j - i - 3) = false;
    }

    if(j < sieve_size + i + 3) {
      sieve.at(j - i - 3) = false;
    }
  }

  std::vector<int> ret;
  ret.push_back(2);
  ret.push_back(3);

  for(uint64_t i = 0; i < sieve_size; ++i) {
    if(sieve.at(i))
      ret.push_back(i * 3 - (i & 1) + 5);
  }

  return ret;
}

int main(void) {
  int n;
  std::cin >> n;

  int x;
  std::vector<int> xs;
  for(int i = 0; i < n; ++i) {
    std::cin >> x;
    xs.push_back(x);
  }

  std::sort(xs.begin(), xs.end());
  auto primes = generate_primes(xs.back());

  int count =
    std::count_if(xs.begin(), xs.end(), [&](auto x) { return std::binary_search(primes.begin(), primes.end(), x); });

  std::cout << count << std::endl;

  return 0;
}

Compiler output:
a.cc:6:1: error: 'uint64_t' does not name a type
    6 | uint64_t get_size(uint64_t n) {
      | ^~~~~~~~
a.cc:5:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    4 | #include <vector>
  +++ |+#include <cstdint>
    5 | 
a.cc:10:34: error: 'uint64_t' was not declared in this scope
   10 | std::vector<int> generate_primes(uint64_t upperbound) {
      |                                  ^~~~~~~~
a.cc:10:34: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:10:55: error: expected ',' or ';' before '{' token
   10 | std::vector<int> generate_primes(uint64_t upperbound) {
      |                                                       ^
a.cc: In function 'int main()':
a.cc:52:32: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   52 |   auto primes = generate_primes(xs.back());
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~
Language: C++

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

int get_size(int n) {
  return n % 6 % 5 == 0 ? (n - 1) / 3 : (n / 6) * 2;
}

std::vector<int> generate_primes(int upperbound) {
  int sieve_size = get_size(upperbound);
  std::vector<bool> sieve(sieve_size, true);
  uint64_t limit = get_size(sqrt(upperbound));

  for(int i = 0; i != limit; ++i) {
    int p = i * 3 - (i & 1) + 5;
    int j;
    for(j = p * 2; j < sieve_size - i; j += p * 2) {
      sieve.at(j + i) = false;
      sieve.at(j - i - 3) = false;
    }

    if(j < sieve_size + i + 3) {
      sieve.at(j - i - 3) = false;
    }
  }

  std::vector<int> ret;
  ret.push_back(2);
  ret.push_back(3);

  for(uint64_t i = 0; i < sieve_size; ++i) {
    if(sieve.at(i))
      ret.push_back(i * 3 - (i & 1) + 5);
  }

  return ret;
}

int main(void) {
  int n;
  std::cin >> n;

  int x;
  std::vector<int> xs;
  for(int i = 0; i < n; ++i) {
    std::cin >> x;
    xs.push_back(x);
  }

  std::sort(xs.begin(), xs.end());
  auto primes = generate_primes(xs.back());

  int count =
    std::count_if(xs.begin(), xs.end(), [&](auto x) { return std::binary_search(primes.begin(), primes.end(), x); });

  std::cout << count << std::endl;

  return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> generate_primes(int)':
a.cc:13:3: error: 'uint64_t' was not declared in this scope
   13 |   uint64_t limit = get_size(sqrt(upperbound));
      |   ^~~~~~~~
a.cc:5:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    4 | #include <vector>
  +++ |+#include <cstdint>
    5 | 
a.cc:15:23: error: 'limit' was not declared in this scope
   15 |   for(int i = 0; i != limit; ++i) {
      |                       ^~~~~
a.cc:32:15: error: expected ';' before 'i'
   32 |   for(uint64_t i = 0; i < sieve_size; ++i) {
      |               ^~
      |               ;
a.cc:32:23: error: 'i' was not declared in this scope
   32 |   for(uint64_t i = 0; i < sieve_size; ++i) {
      |                       ^
Language: C++

#include<iostream>
using namespace std;
bool prime(int n)
{
	for(int i=2;i<=sqrt(double(n));i++)
		if(n%i==0)
		{
			return false;
			break;
		}


}
int gcd(int x,int y)//??????y????????°????????????x?°?
{
	if(x%y==0)
		return y;
	if(x>y)
		return gcd(y,x%y);
	if(x<y)
		return gcd(x,y%x);


}
int main()
{
	int n,a[10005];
	int k=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(prime(a[i]))
			k++;


	}
	cout<<k<<endl;

}

Compiler output:
a.cc: In function 'bool prime(int)':
a.cc:5:24: error: 'sqrt' was not declared in this scope
    5 |         for(int i=2;i<=sqrt(double(n));i++)
      |                        ^~~~
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^
a.cc: In function 'int gcd(int, int)':
a.cc:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
Language: C++


#include <stdio.h>
int main(){
  int i,j,n,x=0;
  int sosu[10000];
  int count=0;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&sosu[i]);
    if (sosu[i]!=2 && (sosu[i]%2)==0) {
    }
    else{
      sosu[x]=sosu[i];
      x++;
    }
  }


  
  // printf("%d\n",x);
  
  
  for(i=0;i<x;i++){
    if(sosu[i]==1) continue;
    int flag = 0;
    for(j=2;j<sosu[i];j++){
      if((sosu[i]%j)==0){
        flag = 1
        break;
      }
    }
    if(flag==0)count++;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: expected ';' before 'break'
   30 |         flag = 1
      |                 ^
      |                 ;
   31 |         break;
      |         ~~~~~
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

bool f(int x){
	if(x == 1) return false;
	bool res = true;
	for(int i = 2; i <= sqrt(x); ++i){
		if(x % i == 0){
			res = false;
			break;
		}
	}
	return res;
}
int main () {
	
	int n, x, k = 0;
	cin >> n;
	
    while (cin>>x){	
		if (f(x) == true) 
		k++;
		
	}
	cout<<k;
	a
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'a' was not declared in this scope
   27 |         a
      |         ^
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

bool isPrime(int a){
	for(int i=2; i<=sqrt(a); ++i){

	if(a%i==0) return false;

	}
	return true;
}

int main(){
	int a,b;
	set<int>q;
	cin>>a;
	for(int i=0; i<a; ++i){
		cin>>b;
		if(isPrime(b))
			q.insert(b);

	}
	cout<<q.size()<<endl;
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'set' was not declared in this scope
   17 |         set<int>q;
      |         ^~~
a.cc:3:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    2 | #include <cmath>
  +++ |+#include <set>
    3 | 
a.cc:17:13: error: expected primary-expression before 'int'
   17 |         set<int>q;
      |             ^~~
a.cc:22:25: error: 'q' was not declared in this scope
   22 |                         q.insert(b);
      |                         ^
a.cc:25:15: error: 'q' was not declared in this scope
   25 |         cout<<q.size()<<endl;
      |               ^
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;

int isPrime(int n);

int main()
{
	int a;	//?´???°??????????????°???????????°
	int b;	//?´???°??????????????°???
	int pcnt;	//?´???°?????°
	
	cin >> a;// ?´???°?????????????????°???????????°?????\???
	for(int i=0; i < a; i++)// ??°????????? ?????¶ ??\?????° < ??°???????????°
	{
		cin >> b;		// ?´???°??????????????°???(b)?????\?????????
		if(isPrime(b) == 1);	// ?´???°??????(True or False)
		{
			pcnt++;		// ?´???°????????§?????????????????????
		}
	}
	
	cout << pcnt << endl;	// ?´???°?????°???????????????

}

//?´???°????????¢??°

int isPrime(int n)
{
	int j;
	int k;
	
	if(n == 2)
	{
		return 0;	//	input???2?????????????????¨??§false
	}
	else if((n < 2) || (n%2 == 0))
	{
		return 1;	//	input???2?????????????????¶??°??????false
	}
	else
	{
		j = 3;
		heiho = sqrt(n)
		while(n <= k)
		{
			if(n % j == 0)
			{
				return 0;
			}
			
			j += 2;
		}
		
		return 1;
	} 

}

Compiler output:
a.cc: In function 'int isPrime(int)':
a.cc:45:17: error: 'heiho' was not declared in this scope
   45 |                 heiho = sqrt(n)
      |                 ^~~~~
a.cc:45:25: error: 'sqrt' was not declared in this scope
   45 |                 heiho = sqrt(n)
      |                         ^~~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;

int isPrime(int n);

int main()
{
	int a;	//?´???°??????????????°???????????°
	int b;	//?´???°??????????????°???
	int pcnt;	//?´???°?????°
	
	cin >> a;// ?´???°?????????????????°???????????°?????\???
	for(int i=0; i < a; i++)// ??°????????? ?????¶ ??\?????° < ??°???????????°
	{
		cin >> b;		// ?´???°??????????????°???(b)?????\?????????
		if(isPrime(b) == 1);	// ?´???°??????(True or False)
		{
			pcnt++;		// ?´???°????????§?????????????????????
		}
	}
	
	cout << pcnt << endl;	// ?´???°?????°???????????????

}

//?´???°????????¢??°

int isPrime(int n)
{
	int j;
	int k;
	
	if(n == 2)
	{
		return 0;	//	input???2?????????????????¨??§false
	}
	else if((n < 2) || (n%2 == 0))
	{
		return 1;	//	input???2?????????????????¶??°??????false
	}
	else
	{
		j = 3;
		k = sqrt(n)
		while(n <= k)
		{
			if(n % j == 0)
			{
				return 0;
			}
			
			j += 2;
		}
		
		return 1;
	} 

}

Compiler output:
a.cc: In function 'int isPrime(int)':
a.cc:45:21: error: 'sqrt' was not declared in this scope
   45 |                 k = sqrt(n)
      |                     ^~~~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

int isPrime(int n);

int main()
{
	int a;	//?´???°??????????????°???????????°
	int b;	//?´???°??????????????°???
	int pcnt;	//?´???°?????°
	
	cin >> a;// ?´???°?????????????????°???????????°?????\???
	for(int i=0; i < a; i++)// ??°????????? ?????¶ ??\?????° < ??°???????????°
	{
		cin >> b;		// ?´???°??????????????°???(b)?????\?????????
		if(isPrime(b) == 1);	// ?´???°??????(True or False)
		{
			pcnt++;		// ?´???°????????§?????????????????????
		}
	}
	
	cout << pcnt << endl;	// ?´???°?????°???????????????

}

//?´???°????????¢??°

int isPrime(int n)
{
	int j;
	int k;
	
	if(n == 2)
	{
		return 0;	//	input???2?????????????????¨??§false
	}
	else if((n < 2) || (n%2 == 0))
	{
		return 1;	//	input???2?????????????????¶??°??????false
	}
	else
	{
		j = 3;
		k = sqrt(n * 1.0);
		while(n <= k)
		{
			if(n % j == 0)
			{
				return 0;
			}
			
			j += 2;
		}
		
		return 1;
	} 

}

Compiler output:
a.cc: In function 'int isPrime(int)':
a.cc:46:21: error: 'sqrt' was not declared in this scope
   46 |                 k = sqrt(n * 1.0);
      |                     ^~~~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int a;					//?´???°??????????????°???????????°
	int b;					//?´???°??????????????°???
	int pcnt = 0;			//?´???°?????°
	
	cin >> a;				// ?´???°?????????????????°???????????°?????\???
	for(int i=0; i < a; i++)// ??°????????? ?????¶ ??\?????° < ??°???????????°
	{
		cin >> b;			// ?´???°??????????????°???(b)?????\?????????
		if(isPrime(b) == 1);// ?´???°??????(True or False)
		{
			pcnt++;			// ?´???°????????§?????????????????????
		}
	}
	
	cout << pcnt << endl;	// ?´???°?????°???????????????

}

//?´???°????????¢??°

int isPrime(int n)
{
	int i;
  
	if (n < 2)			// ??\??????2??????????????°???????????¨??§false
		return 0;
	else if (n == 2)	// ??\??????2????????°???????????¨??§True
		return 1;
  
	if (n % 2 == 0)		//??\??????2??§???????????????????????°True
		return 0;
  
	for (i = 3; i <= n / i; i += 2)	//????????\???????´???°??????
		if (n % i == 0)
			return 0;
	return 1;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'isPrime' was not declared in this scope
   16 |                 if(isPrime(b) == 1);// ?´???°??????(True or False)
      |                    ^~~~~~~
Language: C++

#include <iostream>
using namespace std;

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 main() {
  int n, x;
  int cnt = 0;
  cin >> n;
  for(int i; i<N;i++){
    cin >> x;
    if(isPrime(x)) cnt++;
  }
  cout << cnt << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: 'N' was not declared in this scope
   19 |   for(int i; i<N;i++){
      |                ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int x) {
    if (k == 2) {
        return 2;
    }if (k %2 == 0) {
        return false;
    }
    for (int w = 3; w < sqrt(x); w+=2) {
        if (x % w == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int i, p;
    int count = 0;
    cin >> i;
    for (int j = 0; j < i; j++) {
        cin >> p;
        if (isPrime(p)){
            count++;
        }
    }
    cout << count << endl;
}


Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:6:9: error: 'k' was not declared in this scope
    6 |     if (k == 2) {
      |         ^
a.cc:8:10: error: 'k' was not declared in this scope
    8 |     }if (k %2 == 0) {
      |          ^
Language: C++

#include <iostream>
using namespace std;

bool isPrime(int a){
	int x = (int)sqrt(a);
	int val = 1;
	for (int i = 2; i <= x; i++) val *= (a % i != 0);
	return (val == 1);
}

int main(){
	int n, count, a;
	cin >> n;
	count = 0;
	for (int i = 0; i != n; i++){
		cin >> a;
		count += isPrime(a);
	}
	cout << count << endl;
}


Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:5:22: error: 'sqrt' was not declared in this scope
    5 |         int x = (int)sqrt(a);
      |                      ^~~~
Language: C++

#include <iostream>
using namespace std;

bool isPrime(int n) {
	if( n==2)
		return true;
	if( n<2 || n%2 == 0)
		return false;
	int i = 3;
	while( i<= sqrt(n/1.0) )
	{
		if(n%i == 0)
			return false;
		i += 2;
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	int suuti;
	int counter = 0;
	for(int i =0; i<n; i++) {
		cin >> suuti;
		if(isPrime(suuti))
			counter++;
	}
	cout << counter << endl;

}



Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:10:20: error: 'sqrt' was not declared in this scope
   10 |         while( i<= sqrt(n/1.0) )
      |                    ^~~~
Language: C++

#include <iostream>
using namespace std;

bool isPrime(int n) {
	if( n==2)
		return true;
	if( n<2 || n%2 == 0)
		return false;
	int i = 3;
	while( i<= sqrt(n/1.0) )
	{
		if(n%i == 0)
			return false;
		i += 2;
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	int suuti;
	int counter = 0;
	for(int i =0; i<n; i++) {
		cin >> suuti;
		if(isPrime(suuti))
			counter++;
	}
	cout << counter << endl;

}


Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:10:20: error: 'sqrt' was not declared in this scope
   10 |         while( i<= sqrt(n/1.0) )
      |                    ^~~~
Language: C++

#include <iostream>
using namespace std;

bool isPrime(int n) {
	if( n==2)
		return true;
	if( n<2 || n%2 == 0)
		return false;
	int i = 3;
	while( i<= sqrt(static_cast<double>(n)) )
	{
		if(n%i == 0)
			return false;
		i += 2;
	}
	return true;
}

int main() {
	int n;
	cin >> n;
	int suuti;
	int counter = 0;
	for(int i =0; i<n; i++) {
		cin >> suuti;
		if(isPrime(suuti))
			counter++;
	}
	cout << counter << endl;

}


Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:10:20: error: 'sqrt' was not declared in this scope
   10 |         while( i<= sqrt(static_cast<double>(n)) )
      |                    ^~~~
Language: C++

#include <stdio.h>
#include <boolean.h>
#include <stdlib.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n, a) for(int i = a; i < n; ++i)
#define num 100000010

int main(void) {
  int n, i, j, ans = 0, a;
  bool *f;
  f = (bool*)malloc(sizeof(bool) * num);
  rep(i, num) f[i] = true;
  repi(i, sqrt(num), 2) if(f[i]) for(j = 2; i * j <= num) f[i * j] = false;
  scanf("%d", &n);
  rep(i, n) {
    scanf("%d", &a);
    if(f[i]) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}


Compiler output:
a.cc:2:10: fatal error: boolean.h: No such file or directory
    2 | #include <boolean.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n, a) for(int i = a; i < n; ++i)
#define num 100000010

int main(void) {
  int n, i, j, ans = 0, a;
  bool *f;
  f = (bool*)malloc(sizeof(bool) * num);
  rep(i, num) f[i] = true;
  repi(i, sqrt(num), 2) if(f[i]) for(j = 2; i * j <= num) f[i * j] = false;
  scanf("%d", &n);
  rep(i, n) {
    scanf("%d", &a);
    if(f[i]) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:57: error: expected ';' before ')' token
   14 |   repi(i, sqrt(num), 2) if(f[i]) for(j = 2; i * j <= num) f[i * j] = false;
      |                                                         ^
Language: C++

#include <iostram>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ull powmod(ull  a,ull b) {
  ull res=1;
  for(; b; b >>= 1){
    if(b & 1){
      res = res * a % mod;
    }
    a = a * a % mod;
  }
  return res;
}

bool MillerRabin(ull n, ull k){
  if (n == 2){
    return true;
  }
  if (n == 1 || n & 1 == 0){
    return false;
  }

  random_device rd;
  mt19937 rand_src(rd());
  uniform_int_distribution<ull> rand_dist(1, n - 1);

  ull d = n - 1;
  while (d & 1 == 0){
    d >>= 1
  }
  while(k--){
    ull a = rand_dist(rand_src);
    ull t = d;
    ull y = powmod(a, t, n);
    while (t != n - 1 && y != 1 && y != n - 1){
      y = (y * y) % n;
      t <<= 1;
    }
    if (y != n - 1 && t & 1 == 0){
      return false;
    }
  }
  return true;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  vector<ull> vc;
  int c = 0;
  cin >> n;
  while(n--){
    ull x;
    cin >> x;
    vc.push_back(x);
  }

  for (int i = 0; i <= vc.size(); i++){
    if (MillerRabin(vc[i], 20)){
        c ++;
    }
  }
  cout << c << "\n";
}



Compiler output:
a.cc:1:10: fatal error: iostram: No such file or directory
    1 | #include <iostram>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include<iostream> 

using namespace std;

int prime(int arr[], int num) {
    int count = 0;
    bool isPrime = true;
    for(int i = 0; i < num; i++) {
        if(a[i] != 1 && a[i] != 2) {
            for(int j = 3; j < arr[i]; j += 2) {
                if(arr[i] % j == 0) {
                    isPrime = false;
                    break;
                }
            }    
        }

        if(isPrime)   
            count++;

        isPrime = true;
    }
    return count;
}

int main(){ 
    int num, *arr;
    cin >> num;
    arr = new int[num];
    for(int i = 0; i < num; i++) {
        cin >> arr[i];
    }

    cout << prime(arr, num) << endl;
    return 0; 
}


Compiler output:
a.cc: In function 'int prime(int*, int)':
a.cc:9:12: error: 'a' was not declared in this scope
    9 |         if(a[i] != 1 && a[i] != 2) {
      |            ^
Language: C++

#include<iostream> 

using namespace std;

int prime(int arr[], int num) {
    int count = 0;
    bool isPrime = true;
    for(int i = 0; i < num; i++) {
        if(arr[i] <= 2)
           count++:
        else if(arr[i] % 2 != 0) {
            for(int j = 3; j < arr[i] && isPrime; j += 2) {
                if(arr[j] % i == 0)
                    isPrime = false;
            }
            if(isPrime)
                count++;
            isPrime = true;
        }
    }
    return count;
}

int main(){ 
    int num, *arr;
    cin >> num;
    arr = new int[num];
    for(int i = 0; i < num; i++) {
        cin >> arr[i];
    }

    cout << prime(arr, num) << endl;
    return 0; 
}


Compiler output:
a.cc: In function 'int prime(int*, int)':
a.cc:10:19: error: expected ';' before ':' token
   10 |            count++:
      |                   ^
      |                   ;
Language: C++

#include "cmath"
#include "vector"

#define FOR(i, n) for ((i) = 0; (i) < (n); ++(i))

std::vector<bool> eratos(int upper) {
  std::vector<bool> v(upper + 1, true);
  int i, j;
  v[0] = false;
  v[1] = false;
  for (i = 2; i < upper + 1; ++i) {
    if (v[i] == true) {
      for (j = 2; j <= int(upper / i); ++j) {
        v[i * j] = false;
      }
    }
  }
  return v;
}

bool is_prime(int n) {
  if (n != 2 && n % 2 == 0) {
    return false;
  } else if (n == 2) {
    return true;
  } else if (n == 1) {
    return false;
  }
  int i;
  for (i = 3; i <= int(std::sqrt(n)) + 1; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}

template <typename type> void print_array_horizon(type d1_arr) {
  int i;
  FOR(i, d1_arr.size() - 1) { printf("%d ", d1_arr[i]); }
  printf("%d\n", d1_arr.back());
  fflush(stdout);
}

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



Compiler output:
a.cc: In function 'void print_array_horizon(type)':
a.cc:42:10: error: 'stdout' was not declared in this scope
   42 |   fflush(stdout);
      |          ^~~~~~
a.cc:3:1: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include "vector"
  +++ |+#include <cstdio>
    3 | 
a.cc:42:3: error: there are no arguments to 'fflush' that depend on a template parameter, so a declaration of 'fflush' must be available [-fpermissive]
   42 |   fflush(stdout);
      |   ^~~~~~
a.cc:42:3: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In function 'int main()':
a.cc:49:3: error: 'scanf' was not declared in this scope
   49 |   scanf("%d\n", &n);
      |   ^~~~~
a.cc:56:3: error: 'printf' was not declared in this scope
   56 |   printf("%d\n", out);
      |   ^~~~~~
a.cc:56:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include "cmath"
#include "vector"

std::vector<bool> eratos(int upper) {
  std::vector<bool> v(upper + 1, true);
  int i, j;
  v[0] = false;
  v[1] = false;
  for (i = 2; i < upper + 1; ++i) {
    if (v[i] == true) {
      for (j = 2; j <= int(upper / i); ++j) {
        v[i * j] = false;
      }
    }
  }
  return v;
}

bool is_prime(int n) {
  if (n != 2 && n % 2 == 0) {
    return false;
  } else if (n == 2) {
    return true;
  } else if (n == 1) {
    return false;
  }
  int i;
  for (i = 3; i <= int(std::sqrt(n)) + 1; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}

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



Compiler output:
a.cc: In function 'int main()':
a.cc:40:3: error: 'scanf' was not declared in this scope
   40 |   scanf("%d\n", &n);
      |   ^~~~~
a.cc:47:3: error: 'printf' was not declared in this scope
   47 |   printf("%d\n", out);
      |   ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include "vector"
  +++ |+#include <cstdio>
    3 |
Language: C++

#include <iostream>
using namespace std;


bool primeNum(int num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

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

}

int main(void) {

	int n;
	int count = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (primeNum(a)) count++;
	}
	cout << count;

	return 0;
}


Compiler output:
a.cc: In function 'bool primeNum(int)':
a.cc:10:30: error: 'sqrt' was not declared in this scope
   10 |         for (int i = 3; i <= sqrt(num); i += 2) {
      |                              ^~~~
a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
Language: C++

#include <iostream>
#include <math.h>

using namespace std;

bool is_prime[10000000];
int primes[100000000];
int prime_count = 0;


void set_prime() {
  int j, end_point;
  bool flag;
  for (int i = 5; i < 100000000; i += 2) {
    flag = false;
    end_point = (int)sqrt((double)i);

    for (j = 0; j < prime_count && primes[j] <= end_point; j ++) {
      if (i % primes[j] == 0) {flag = true; break; }
    }
    if (!flag) {
      is_prime[i] = true;
      primes[prime_count++] = i;
    }
  }
}

int main() {
  for (int i = 2; i <= 3; i ++) {
    is_prime[i] = true;
    primes[prime_count++] = i;
  }
  set_prime();
  int N, num, count;

  count = 0;
  cin >> N;
  for (int i = 0; i < N; i ++) {
    cin >> num;
    if (is_prime[num]) count ++;

  }
  cout << count << endl;



Compiler output:
a.cc: In function 'int main()':
a.cc:43:25: error: expected '}' at end of input
   43 |   cout << count << endl;
      |                         ^
a.cc:28:12: note: to match this '{'
   28 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#define Lens 10005

using namespace std;
int a[Lens];
int prime(int i)
{
	if (i == 2 || i == 3)
		return 1;
	if (!(i % 6 == 1 || i % 6 == 5))
		return 0;
	int m = sqrt(i);
	for (int s = 5; s <= m; s+=6)
	{
		if (i%s == 0 || i % (s + 2) == 0)
		{
			return 0;
		}
	}
	return 1;
}

int main()
{
	int N;
	int sum = 0;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
		if (prime(a[i]))
			sum++;
	}
	cout << sum << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int prime(int)':
a.cc:14:17: error: 'sqrt' was not declared in this scope
   14 |         int m = sqrt(i);
      |                 ^~~~
Language: C++


int main(){
  int n,x;
  int cnt=0;
  int flag=0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x;
if(x==2){
  flag=0;
}
else if(x%2==0) flag=1;
else{
    for(int j=2;j<sqrt(x);j++){
      if(x%j==0){
        flag=1;
        break;
      }
    }
  }
      if(flag==0) cnt++;
      flag = 0;
    }
  cout << cnt << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> n;
      |   ^~~
a.cc:14:19: error: 'sqrt' was not declared in this scope
   14 |     for(int j=2;j<sqrt(x);j++){
      |                   ^~~~
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << cnt << endl;
      |   ^~~~
a.cc:24:18: error: 'endl' was not declared in this scope
   24 |   cout << cnt << endl;
      |                  ^~~~
Language: C++

---wrapperクラスを利用---
byte min:-128,max127
short min-32768,max32767
int min-2147483648,max2147483647
long min-9223372036854775808,max9223372036854775807
float min1.4E-45,max3.4028235E38
double min4.9E-324,max1.7976931348623157E308
---シフト演算子を利用---
byte min:-128,max127
short min-32768,max32767
int min-2147483648,max2147483647
long min-9223372036854775808,max9223372036854775807



Compiler output:
a.cc:5:10: warning: integer constant is so large that it is unsigned
    5 | long min-9223372036854775808,max9223372036854775807
      |          ^~~~~~~~~~~~~~~~~~~
a.cc:7:1: warning: floating constant truncated to zero [-Woverflow]
    7 | double min4.9E-324,max1.7976931348623157E308
      | ^~~~~~
a.cc:12:10: warning: integer constant is so large that it is unsigned
   12 | long min-9223372036854775808,max9223372036854775807
      |          ^~~~~~~~~~~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before '--' token
    1 | ---wrapperクラスを利用---
      | ^~
Language: C++


#include<iostream>
#include<math.h>
using namespace std;


int main(void){
  int n;
  vector<int> v(10000) = 0;
  int flg=0;
  int count=0;
  cin >> n;
for(int k = 0;k<n;k++)
 {
      cin >> v[k];
  for(int i = 2;i<=v[k];i++){
    for(int j= 2;j<=sqrt(v[k])+1;j++){
	  if(i%j==0&&i!=j)
	    {
	      flg=1;
	    }
	}
      if(flg==0)
	{
	  count=count+1;
	}
      flg=0;
  }
 }
  cout << count << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<int> v(10000) = 0;
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<math.h>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> v(10000) = 0;
      |          ^~~
a.cc:15:14: error: 'v' was not declared in this scope
   15 |       cin >> v[k];
      |              ^
Language: C++


#include<iostream>
#include<math.h>
#include<vector>
using namespace std;


int main(void){
  int n;
  vector<int> v(10000) = 0;
  int flg=0;
  int count=0;
  cin >> n;
for(int k = 0;k<n;k++)
 {
      cin >> v[k];
  for(int i = 2;i<=v[k];i++){
    for(int j= 2;j<=sqrt(v[k])+1;j++){
	  if(i%j==0&&i!=j)
	    {
	      flg=1;
	    }
	}
      if(flg==0)
	{
	  count=count+1;
	}
      flg=0;
  }
 }
  cout << count << endl;
  return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: expected ',' or ';' before '=' token
   10 |   vector<int> v(10000) = 0;
      |                        ^
Language: C++

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

bool is_prime(int a,std::vector<int>& p);
void make_p_vector(int n,std::vector<int>& p);

int main(){
    int n;
    int cnt = 0;
    std::cin >> n;
    std::vector<int> a(n);
    std::vector<int> p(0);
    for(int i=0;i<n;i++){
        std::cin >> a[i];
    }
    int max = std::max_element(a.begin(),a.end());
    make_p_vector(max,p);
    for(int i=0;i<n;i++){
        bool flag = is_prime(a[i],p);
        if(flag) cnt++; 
    }
    std::cout << cnt << '\n';
    return 0;
}

bool is_prime(int a,std::vector<int>& p){
    int size = p.size();
    for(int i=0;i<size;i++){
        if(a == p[i]) return true;
    }
    return false;
}

void make_p_vector(int n,std::vector<int>& p){
    bool flag;
    double lim2;
    for(int i=2;i<=n;i++){
        flag = true;
        lim2 = std::sqrt(i);
        for(int j=2;j<=lim2;j++){
            if(i==2){
                break;
            }else if(i%j==0){
                flag = false;
                break;
            }
        }
        if(flag){
            p.push_back(i);
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:31: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   18 |     int max = std::max_element(a.begin(),a.end());
      |               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                               |
      |                               __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include<iostream>
#include<vector>
#include<cmath>

bool is_prime(int a,std::vector<int>& p);

int main(){
    int n;
    int cnt = 0;
    std::cin >> n;
    std::vector<int> a(n);
    for(int i=0;i<n;i++){
        std::cin >> a[i];
    }
    for(int i=0;i<n;i++){
        bool flag = is_prime(a[i]);
        if(flag) cnt++; 
    }
    std::cout << cnt << '\n';
    return 0;
}

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




Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: too few arguments to function 'bool is_prime(int, std::vector<int>&)'
   16 |         bool flag = is_prime(a[i]);
      |                     ~~~~~~~~^~~~~~
a.cc:5:6: note: declared here
    5 | bool is_prime(int a,std::vector<int>& p);
      |      ^~~~~~~~
Language: C++


import math

a=int(input())

sum=0

for i in range(n):
	b=1
	n=int(input())
	if n==2 or n==3:
		sum+=1
	if n>3:
		for j in range(2,int(math.sqrt(n))+1):
			if n%j==0:
				b=0
				break
		sum+=b
			
print(sum)


Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import math
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
int main void(){
    int n;
    int cnt=0;
    std::cin>>n;
    int A[n];
    for(int i=0;i<n;i+;){
        std::cin>>A[i];
    }
    int judge=0;
    for(int i=0;i<n;i++){
        for(int j=2;j<sqrt(A[i]);j++){
            if(A[i]%j==0){
                judge=1;
                break;
            }
        }
        if(judge=1){
            cnt+=1;
            judge=0;
        }
    }
    std::cout>>n-cnt;
    
    return 0;
}


Compiler output:
a.cc:2:10: error: expected initializer before 'void'
    2 | int main void(){
      |          ^~~~
Language: C++

#include<iostream>
int main void()
{
    int n;
    int cnt=0;
    std::cin>>n;
    int A[n];
    for(int i=0;i<n;i+;){
        std::cin>>A[i];
    }
    int judge=0;
    for(int i=0;i<n;i++){
        for(int j=2;j<sqrt(A[i]);j++){
            if(A[i]%j==0){
                judge=1;
                break;
            }
        }
        if(judge=1){
            cnt+=1;
            judge=0;
        }
    }
    std::cout>>n-cnt;
    
    return 0;
}


Compiler output:
a.cc:2:10: error: expected initializer before 'void'
    2 | int main void()
      |          ^~~~
Language: C++

#include<iostream>
#include<math.h>
int main()
{
    int n;
    int cnt=0;
    std::cin>>n;
    int A[n];
    for(int i=0;i<n;i+;){
        std::cin>>A[i];
    }
    int judge=0;
    for(int i=0;sqrt(A[i])>=2){
            for(int j=2;j<=sqrt(A[i]);j++){
                if(A[i]%j==0){
                    judge=1;
                    break;
                }
            }
            if(judge=1){
                cnt+=1;
            }    judge=0;
        }
    }
    std::cout>>(n-cnt);
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected primary-expression before ';' token
    9 |     for(int i=0;i<n;i+;){
      |                       ^
a.cc:9:23: error: expected ')' before ';' token
    9 |     for(int i=0;i<n;i+;){
      |        ~              ^
      |                       )
a.cc:9:24: error: expected primary-expression before ')' token
    9 |     for(int i=0;i<n;i+;){
      |                        ^
a.cc:13:30: error: expected ';' before ')' token
   13 |     for(int i=0;sqrt(A[i])>=2){
      |                              ^
      |                              ;
a.cc: At global scope:
a.cc:25:10: error: 'cout' in namespace 'std' does not name a type
   25 |     std::cout>>(n-cnt);
      |          ^~~~
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:5: error: expected unqualified-id before 'return'
   27 |     return 0;
      |     ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

#include<iostream>
#include<math.h>
int main()
{
    int n;
    int cnt=0;
    std::cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        std::cin>>A[i];
    }
    int judge=0;
    for(int i=0;i<n;i++){
        if(sqrt(A[i])>=2){
            for(int j=2;j<=sqrt(A[i]);j++){
                if(A[i]%j==0){
                    judge=1;
                    break;
                }
            }
            if(judge=1){
                cnt+=1;
               judge=0;
            }
        }
    }
    ans=n-cnt;
    std::cout>>ans;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |     ans=n-cnt;
      |     ^~~
      |     abs
Language: C++

#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

int main()
{int ans=0;
int n;
vector<bool>isprime(10004);
for(int i=0;i<isprime.size();++i){
isprime[i]=true;
}
isprime[0]=isprime[1]=false;
//.  
for(int i=0;i<10004;i++){
cout<<i;
cout<<” ”;
cout<<(isprime[i]?”YES”:”NO”)<<endl;
} 
//.  

for(int i=2;i<10004;i++)
{
 if(!isprime[i]){continue;}
 for(int j=i*2;j<10004;j+=i){
   isprime[j]=false;
 }
}

cin>>n;
rep(i,n){
int u;
cin>>u;
if(isprime[u]){++ans;}
}
cout<<ans<<endl;
return 0;

}


Compiler output:
a.cc:20:7: error: extended character ” is not valid in an identifier
   20 | cout<<” ”;
      |       ^
a.cc:20:9: error: extended character ” is not valid in an identifier
   20 | cout<<” ”;
      |         ^
a.cc:21:19: error: extended character ” is not valid in an identifier
   21 | cout<<(isprime[i]?”YES”:”NO”)<<endl;
      |                   ^
a.cc:21:19: error: extended character ” is not valid in an identifier
a.cc:21:25: error: extended character ” is not valid in an identifier
   21 | cout<<(isprime[i]?”YES”:”NO”)<<endl;
      |                         ^
a.cc:21:25: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:20:7: error: '\U0000201d' was not declared in this scope
   20 | cout<<” ”;
      |       ^
a.cc:21:19: error: '\U0000201dYES\U0000201d' was not declared in this scope
   21 | cout<<(isprime[i]?”YES”:”NO”)<<endl;
      |                   ^~~~~
a.cc:21:25: error: '\U0000201dNO\U0000201d' was not declared in this scope
   21 | cout<<(isprime[i]?”YES”:”NO”)<<endl;
      |                         ^~~~
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:
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    6 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
using namespace std;
bool primes[100000000]={true};
bool IsPrime(p)
{
    return primes[p];
}
int main(void)
{
    int count=0;
    int 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:
a.cc:4:14: error: 'p' was not declared in this scope
    4 | bool IsPrime(p)
      |              ^
a.cc: In function 'int main()':
a.cc:17:19: error: 'IsPrime' cannot be used as a function
   17 |         if(IsPrime(p))
      |            ~~~~~~~^~~
Language: C++

#include <iostream>using namespace std;
// エラトステネスの篩// 
bool primes[100000000] = {true};bool IsPrime(int n) {
	int count = 0;  for(int i=1;i<=n;i++){
		if(n % i == 0) {
			count++;
			}
			if(count > 2){
				return false;
				}
				} 
				return (count == 2);
	
}
int main(void){
	int count = 0;
	int 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:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <iostream>using namespace std;
      |                          ^~~~~~~~~
a.cc:1:10: fatal error: iostream>usin: No such file or directory
    1 | #include <iostream>using namespace std;
      |          ^~~~~~~~~~~~~~~
compilation terminated.