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

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

using namespace std;

int solve(int m){

	if (m == 2){
		p++;
		return 1;
	}
	if (m < 2 || m % 2 == 0) return 0;
	int e = 0;
	for (int j = 3; j<sqrt(m); j++){
		if (m%j == 0){
			return 0;
		}
	}

	if (e == 0)return 1;

}


int main(){

int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
	int m;
	cin>>m;

	int j = solve(m);
	if (j == 1)p++;
}

cout << p << endl;
return 0;

}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:10:17: error: 'p' was not declared in this scope
   10 |                 p++;
      |                 ^
a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
Language: C++

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

using namespace std;

int solve(int m){

	if (m == 2){
		p++;
		return 1;
	}
	if (m < 2 || m % 2 == 0) return 0;
	int e = 0;
	for (int j = 3; j<sqrt(m); j++){
		if (m%j == 0){
			return 0;
		}
	}

	return 1;

}


int main(){

int n;
int p=0;
cin>>n;
for(int i=0;i<n;i++){
	int m;
	cin>>m;

	int j = solve(m);
	if (j == 1)p++;
}

cout << p << endl;
return 0;

}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:10:17: error: 'p' was not declared in this scope
   10 |                 p++;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define D 100000000
int main(){
  int a[N]={},m[100000]={},n,count=0;
  a[0]=a[1]=1;
  for(int i=2;i*i<=N;i++)
    if(a[i]==0)
      for(int j=2;j*i<N;j++)a[i*j]=1;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>m[i];
  if(a[m[i]]==0)count++;
  }
  cout<<count<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'N' was not declared in this scope
    5 |   int a[N]={},m[100000]={},n,count=0;
      |         ^
a.cc:6:3: error: 'a' was not declared in this scope
    6 |   a[0]=a[1]=1;
      |   ^
Language: C++

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

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

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

Compiler output:
a.cc: In function 'bool Judge(int)':
a.cc:7:40: error: expected primary-expression before ')' token
    7 |         for(int i = 2; i <= sqrt(a); i+){
      |                                        ^
a.cc: In function 'int main()':
a.cc:19:17: error: expected initializer before 'cin'
   19 |                 cin >> a;
      |                 ^~~
a.cc:20:26: error: 'a' was not declared in this scope
   20 |                 if(Judge(a) == true) Count++
      |                          ^
a.cc:20:45: error: expected ';' before '}' token
   20 |                 if(Judge(a) == true) Count++
      |                                             ^
      |                                             ;
   21 |         }
      |         ~
Language: C++

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

using namespace std;

bool Judge(int A)
{	
	for(int j=2;j<=fioor(sqrt((double)A));j++){
		if(A%j==0)return false;
	}
	return true;
}

int PrimeNumbers(vector<int> A)
{
	int count = 0;
	for(int i=0;i<A.size();i++){
		if(Judge(A[i]))count++;
	}
	return count;
}

int main()
{	
	int n;
	cin >> n;
	
	vector<int> A;
	A.resize(n);

	for(int i=0;i<n;i++)cin >> A[i];
	
	cout << PrimeNumbers(A) << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'bool Judge(int)':
a.cc:9:24: error: 'fioor' was not declared in this scope; did you mean 'floor'?
    9 |         for(int j=2;j<=fioor(sqrt((double)A));j++){
      |                        ^~~~~
      |                        floor
Language: C++

#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
using namespace std;
int i = 0;
int k;
bool prime(int n) {
	if (n == 1) {
		return false;
	}
	i = (int)sqrt(n) + 1;
	for (k = 2; k < i; k++) {
		if (n%k == 0) return false;
	}
}

int main() {
	int count = 0;
	bool matched[99] = { true };
	int a[99];
	int n, l;
	cin >> n;
	for (l = 0; l < n; l++) {
		scanf_s("%d", &a[l]);
	}
	for (l = 0; l < n; l++) {
		matched[l] = prime(a[l]);
		if (matched[l]) count++;
	}
	cout << count << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   25 |                 scanf_s("%d", &a[l]);
      |                 ^~~~~~~
      |                 scanf
a.cc: In function 'bool prime(int)':
a.cc:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
bool isprime(int x){
    if(x == 2) 
      return true;
    if(x % 2 == 0 || x < 2) 
      return false;
    int j = 3;
    while(j <= sqrt(x)){
      if(x % j == 0) 
        return false;
      j += 2;
    }
    return true;
    
}

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    int x, cnt;
    cin >> x;
    if(isprime(x)) cnt++;
  }
  cout << cnt << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |   cout << cnt << "\n";
      |           ^~~
      |           int
Language: C++

int main(){
  int x,n[10000],d,s=0;
  cin >> x;
  for(int i=0;i<x;i++) cin >> n[i];
    
  for(int i=0;i<x;i++){
	  d=1;
	  for(int j=2;j*j<=n[i];j++){
		  if(n[i]%j==0){
			  d=0;
			  break;
		  }
	  }
	  if(d==1) s++;
  }
  cout << s << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> x;
      |   ^~~
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout << s << "\n";
      |   ^~~~
Language: C++

#include <bits/stdc++.h>
#define MAX 100000000
int eratos[MAX];

void Eratos() {
	eratos[0] = 1;
	for (int i = 1; i * i <= MAX; i++) {
		if (eratos[i - 1] == 0) {
			for (int j = i * 2; j <= MAX; j += i) {
				eratos[j] = 1;
			}
		}
	}
}

int main()
{
	int n, res;
	Eratos();
	cin >> n;
	for (int i = 0, tmp; i < n; i++) {
		cin >> tmp;
		if (eratos[tmp - 1] == 0) res++;
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   20 |         cin >> n;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:25:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 |         cout << res << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:25:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   25 |         cout << res << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<stdio.h>
#include<math.h>
int prime(int a){
	int i,c=0;
	for(i=1;i<=sqrt(a);i++){
		if(a%i==0 && i!=1){
			c=1;
		}
	}
	if(c==1){
		return 0;
	}else{
		return 1;
	}
}
int main(void){
	int n,co=0;
	while(scanf("%d",&n)==1){
		if(prime(n)==1){
			co++
		}
	}
	printf("%d\n"co);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:29: error: expected ';' before '}' token
   20 |                         co++
      |                             ^
      |                             ;
   21 |                 }
      |                 ~            
a.cc:23:16: error: unable to find string literal operator 'operator""co' with 'const char [4]', 'long unsigned int' arguments
   23 |         printf("%d\n"co);
      |                ^~~~~~~~
Language: C++

#include<stdio.h>
#include<math.h>
int prime(int a){
	int i,c=0;
	for(i=1;i<=sqrt(a);i++){
		if(a%i==0 && i!=1){
			c=1;
		}
	}
	if(c==1){
		return 0;
	}else{
		return 1;
	}
}
int main(void){
	int n,co=0;
	while(scanf("%d",&n)==1){
		if(prime(n)==1){
			co++;
		}
	}
	printf("%d\n"co);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: unable to find string literal operator 'operator""co' with 'const char [4]', 'long unsigned int' arguments
   23 |         printf("%d\n"co);
      |                ^~~~~~~~
Language: C++

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


int main(){
	int n,a[10010],t,A=0;
	double s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		s=sqrt(a[i]);
		t=(int)s;
		for(int j=2;j<=t;j++){
			if(j==t)A++;
			if(a[i]%j==0)break;
		}
	}
	cout<<A<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'sqrt' was not declared in this scope
   14 |                 s=sqrt(a[i]);
      |                   ^~~~
Language: C++

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

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>????
      |                    ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:22:1: error: expected unqualified-id before '?' token
   22 | ??
      | ^
Language: C++

#include<iostream>
using namespace std;
int main(){
int p[10000]={0},k=0,b[10000];
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
if(p[i]==0){
	for(int j=i*i;j<10000;j+=i)p[j]=1;
        b[k++]=i;
}	
}
int cnt=0,a;
cin >> n;
for(int i=0;i<n;i++){
 cin >> a;
 for(int j=0;j<k;j++){
if(a%b[j]==0){cnt++;break;}
}
}
cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'n' was not declared in this scope
   13 | cin >> n;
      |        ^
Language: C++

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

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

int main()
{
	int n, temp, ans = 0;;
	cin >> n;
	while(n--)
	{
		cin >> temp;
		if(isPrime(temp))
		{
			++ans;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:8:23: error: 'sqrt' was not declared in this scope
    8 |         for(int i=2;i<sqrt(n)+0.5;++i)
      |                       ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <cstdlib>
#define _USE_MATH_DEFINES

using namespace std;

bool isPrime(int n) {

	int i = 3;

	if (n == 2)
		return true;
	if (n <= 1 || n %2 == 0)
		return false;

	while (i <= sqrt(n)) {
		if (n % i == 0) 
			return false;
		i = i + 2;
	}
	return true;
}

int main() {

	int n, cnt=0,x;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (isPrime(x))
			cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}

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

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

bool isPrimenumber(const int n);

int main()
{
	int n;
	std::cin >> n;
	std::vector<int> numbers(n);

	int numPrimeNumber = 0;
	int inputNumber = 0;

	for (int i = 0; i < n; i++)
	{
		std::cin >> inputNumber;
		if (isPrimenumber(inputNumber))
		{
			numPrimeNumber++;
		}
	}
	std::cout << numPrimeNumber << std::endl;
	return 0;
}

bool isPrimenumber(const int n)
{
	int loopLimit = (int)std::sqrt(n);
	for (int i = 2; i <= loopLimit; i++)
	{
		if (n % i == 0)
		{
			return false;
		}
	}
	return true;
}

Compiler output:
a.cc: In function 'bool isPrimenumber(int)':
a.cc:30:35: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   30 |         int loopLimit = (int)std::sqrt(n);
      |                                   ^~~~
      |                                   sort
Language: C++

#include <iostream>

#define INPUT_FROM_FILE (0)

#if INPUT_FROM_FILE
#include <fstream>
#endif

#if INPUT_FROM_FILE
#define IS ifs
#else
#define IS std::cin
#endif

bool is_prime(int num){
	bool ret = true;
	int max = int(sqrt(num));

	if(num == 2){
	}
	else if(num % 2 == 0){
		ret = false;
	}
	else{
		for(int i = 3; i < max; i+=2){
			if(num % i == 0){
				ret = false;
				break;
			}
		}
	}

	return ret;
}

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;
	int num_primes = 0;

	IS >> n;

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

		IS >> num;
		if(is_prime(num)){
			num_primes++;
		}
	}

	std::cout << num_primes << std::endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool is_prime(int)':
a.cc:17:23: error: 'sqrt' was not declared in this scope
   17 |         int max = int(sqrt(num));
      |                       ^~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int getprime(int x) {
	int i = sqrt(x);
	while (i > 1) {
		if (x % i == 0) return 0;
		else i--;
	}
	return 1;
}
int main() {
	int n;
	cin >> n;
	int x;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		cin >> x;
		cnt += getprime(x);
	}
	cout << cnt << endl;
	return 0;

}

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

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int getprime(int x) {
	int i = sqrt(x);
	while (i > 1) {
		if (x % i == 0) return 0;
		else i--;
	}
	return 1;
}
int main() {
	int n;
	cin >> n;
	int x;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		cin >> x;
		cnt += getprime(x);
	}
	cout << cnt << endl;
	return 0;

}

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

#include<iostream>
using namespace std;
unsigned int x, y;
int pisprime(int x)
{
	int n;

	if (x == 2) return 1;
	if (x < 2 || x % 2 == 0) return 0;
	for (n = 3; n <= sqrt((double)x); n += 2)
		if (x % n == 0) return 0;
	return 1;
}
int main() {
	int temp=0, a, n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (pisprime(a) ==1) {
			temp++;
		}
	}
	cout << temp << endl;
}

Compiler output:
a.cc: In function 'int pisprime(int)':
a.cc:10:26: error: 'sqrt' was not declared in this scope
   10 |         for (n = 3; n <= sqrt((double)x); n += 2)
      |                          ^~~~
Language: C++

#include<iostream>
using namespace std;
unsigned int x, y;
int pisprime(int x)
{
	int n;

	if (x == 2) return 1;
	if (x < 2 || x % 2 == 0) return 0;
	for (n = 3; n <= sqrt((double)x); n += 2)
		if (x % n == 0) return 0;
	return 1;
}
int main() {
	int temp=0, a, n,flag=0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		for (int i = 2; i < a; i++) {
			if (a%i == 0) {
				flag = 1;
				break;
			}
		}
		if (flag == 0)temp++;
		flag = 0;
	}
	cout << temp << endl;
}

Compiler output:
a.cc: In function 'int pisprime(int)':
a.cc:10:26: error: 'sqrt' was not declared in this scope
   10 |         for (n = 3; n <= sqrt((double)x); n += 2)
      |                          ^~~~
Language: C++

<?php
$n=trim(fgets(STDIN));
$c=0;
for($i=0;$i<$n;$i++){
  if(trim(fgets(STDIN))) ++$c;
}
print $c;

function isPn($n){
  if($n<2) return 0;
  if($n==2) return 1;
  if($n%2==0) return 0;
  $max=floor(sqrt($n));
  for($i=3;$i<=$max;$i++) if($n%$i==0) return 0;
  return 1;
}
?>

Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:1: error: '$c' does not name a type
    3 | $c=0;
      | ^~
a.cc:4:1: error: expected unqualified-id before 'for'
    4 | for($i=0;$i<$n;$i++){
      | ^~~
a.cc:4:10: error: '$i' does not name a type
    4 | for($i=0;$i<$n;$i++){
      |          ^~
a.cc:4:16: error: '$i' does not name a type
    4 | for($i=0;$i<$n;$i++){
      |                ^~
a.cc:7:1: error: 'print' does not name a type; did you mean 'int'?
    7 | print $c;
      | ^~~~~
      | int
a.cc:9:1: error: 'function' does not name a type; did you mean 'union'?
    9 | function isPn($n){
      | ^~~~~~~~
      | union
a.cc:17:1: error: expected unqualified-id before '?' token
   17 | ?>
      | ^
Language: C++

#include<iostream>
using namespace std;
int prime?(long int n); 

int main(){
        long int n;
        long int num;
        long int count=0;
        cin>>n;
        for(i=0;i<n;i++){
                cin>>num;
                if(prime?(num)==1){
                        count++;
                }
        }
        cout<<count<<endl;
        return 0;
     
}

int prime?(long int n){ 
        long int i;
        long int sqrt;
        for(i=1;i<n;i++){
                if(n<i*i){
                        sqrt=i;
                        break;
                }
        }
        for(i=2;i<=sqrt;i++){
                if(n%i==0){
                        return 0;
                }
        }
        return 1;
}

Compiler output:
a.cc:3:10: error: expected initializer before '?' token
    3 | int prime?(long int n);
      |          ^
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         for(i=0;i<n;i++){
      |             ^
a.cc:12:20: error: 'prime' was not declared in this scope
   12 |                 if(prime?(num)==1){
      |                    ^~~~~
a.cc:12:34: error: expected ':' before ')' token
   12 |                 if(prime?(num)==1){
      |                                  ^
      |                                  :
a.cc:12:34: error: expected primary-expression before ')' token
a.cc: At global scope:
a.cc:21:10: error: expected initializer before '?' token
   21 | int prime?(long int n){
      |          ^
Language: C++

#include<iostream>
using namespace std;
int prime(long int n);

int main(){
        long int n;
        long int num;
        long int count=0;
        cin>>n;
        for(i=0;i<n;i++){
                cin>>num;
                if(prime(num)==1){
                        count++;
                }
        }
        cout<<count<<endl;
        return 0;
     
}

int prime(long int n){
        long int i;
        long int sqrt;
        for(i=1;i<n;i++){
                if(n<i*i){
                        sqrt=i;
                        break;
                }
        }
        for(i=2;i<=sqrt;i++){
                if(n%i==0){
                        return 0;
                }
        }
        return 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         for(i=0;i<n;i++){
      |             ^
Language: C++

#include<stdio.h>
int prime(int x){
    int i;
    int answer = 0;
    for(i=2; i<x; i+){
        if(x%i == 0){
            answer = 1;
            break;
        }
    }
    return (answer==1) ? 1 : 0;
}
int main(){
    int n;
    int i;
    int num[100];
    int count = 0;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &num[i]);
        if(prime(num[i])==1){
            count += 1;
        }
    }
    printf("%d", count);
    return 0;
}

Compiler output:
a.cc: In function 'int prime(int)':
a.cc:5:21: error: expected primary-expression before ')' token
    5 |     for(i=2; i<x; i+){
      |                     ^
Language: C++

#include<stdio.h>
#include<math.h>
int prime(double x){
    int i;
    int answer = 0;
    for(i=2; i<sqrt(x); i++){
        if(x%i == 0){
            answer = 1;
            break;
        }
    }
    return (answer!=0) ? 1 : 0;
}
int main(){
    int n;
    int i;
    double num[20000];
    int count = 0;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%lf", &num[i]);
        if(prime(num[i])==1){
            count += 1;
        }
    }
    printf("%d\n", count);
    return 0;
}

Compiler output:
a.cc: In function 'int prime(double)':
a.cc:7:13: error: invalid operands of types 'double' and 'int' to binary 'operator%'
    7 |         if(x%i == 0){
      |            ~^~
      |            | |
      |            | int
      |            double
Language: C++

#include<stdio.h>
#include<math.h>
int prime(double x){
    double i;
    int answer = 0;
    for(i=2; i<sqrt(x); i++){
        if(x%i == 0){
            answer = 1;
            break;
        }
    }
    return (answer!=0) ? 1 : 0;
}
int main(){
    int n;
    int i;
    double num[20000];
    int count = 0;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%lf", &num[i]);
        if(prime(num[i])==1){
            count += 1;
        }
    }
    printf("%d\n", count);
    return 0;
}

Compiler output:
a.cc: In function 'int prime(double)':
a.cc:7:13: error: invalid operands of types 'double' and 'double' to binary 'operator%'
    7 |         if(x%i == 0){
      |            ~^~
      |            | |
      |            | double
      |            double
Language: C++

#include <iostream>

using namespace std;

int couent = 0;
int keisann(int a) {
	if (a == 2) { couent++; }
	if (a % 2 == 0) { return 0; }
	int v = sqrt(a);
	for (int i = 3; i < v; i+=2)
	{
		if (a%i == 0) {
			return 0;
		}
	}
	couent++;
}
int main()
{
	int dataset;
	cin >> dataset;
	for (size_t i = 0; i < dataset; i++)
	{
		int a;
		cin >> a;
		keisann(a);
	}
	cout << couent << endl;
}

Compiler output:
a.cc: In function 'int keisann(int)':
a.cc:9:17: error: 'sqrt' was not declared in this scope
    9 |         int v = sqrt(a);
      |                 ^~~~
a.cc:16:15: warning: control reaches end of non-void function [-Wreturn-type]
   16 |         couent++;
      |         ~~~~~~^~
Language: C++

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

#define N 10000
#define TRUE 1
#define FALSE 0

int isprime(int);

int main(){
  int i,j,num,A[N],count=0;

  while(1){
    scanf("%d",&num);
    if(1 <= num && num <= N) break;
  }
  for(i = 0;i < num;i++) scanf("%d",&A[i]);
  for(i = 0;i < num;i++) if(isprime(A[i]) == TRUE) count++;
  printf("%d\n",count);

  return 0;
}

int isprime(int a){
  int i;
  if(a == 2) return TRUE;
  if(a < 2 || a%2 == 0) return FALSE;
  i = 3;
  while(i <= sqrt(a)){
    if(a%i == 0) return FALSE;
    i = i + 2;
  }
  return TRUE;

Compiler output:
a.cc: In function 'int isprime(int)':
a.cc:33:15: error: expected '}' at end of input
   33 |   return TRUE;
      |               ^
a.cc:24:19: note: to match this '{'
   24 | int isprime(int a){
      |                   ^
Language: C++

#include<iostream>
using namespace std;

int main(){
	bool* isPrime = new bool[50000000];
	isPrime[0] = true;
	isPrime[1] = true;
	for(int i = 2; i < 50000000; i++){
		if(!isPrime[i]){
			for(int j = i * 2; j < 50000000; j+= i){
				isPrime[j] = true;
			}
		}
	}
	int n;
	cin >> n;
	int count = 0;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		if(x < 50000000){
			if(!isPrime[x]){
				count++;
			}
		}else{
			bool out = false;
			for(int j = 0; j < 50000000; j++){
				if(!isPrime[j]){
					if(x % j == 0){
						out = true;
						break;
					}
				}
			}
			if(!out){
				count++;
			}
		}
	}
	cout << count << endl;#include<iostream>
using namespace std;

int main(){
	long int limit = 60000000;
	bool* isPrime = new bool[limit];
	isPrime[0] = true;
	isPrime[1] = true;
	for(int i = 2; i < limit; i++){
		if(!isPrime[i]){
			for(int j = i * 2; j < limit; j+= i){
				isPrime[j] = true;
			}
		}
	}
	int n;
	cin >> n;
	int count = 0;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		if(x < limit){
			if(!isPrime[x]){
				count++;
			}
		}else{
			bool out = false;
			for(int j = 0; j < limit; j++){
				if(!isPrime[j]){
					if(x % j == 0){
						out = true;
						break;
					}
				}
			}
			if(!out){
				count++;
			}
		}
	}
	cout << count << endl;
	delete[] isPrime;
	return 0;
}
	delete[] isPrime;
	return 0;
}

Compiler output:
a.cc:40:31: error: stray '#' in program
   40 |         cout << count << endl;#include<iostream>
      |                               ^
a.cc: In function 'int main()':
a.cc:40:32: error: 'include' was not declared in this scope
   40 |         cout << count << endl;#include<iostream>
      |                                ^~~~~~~
a.cc:40:48: error: expected primary-expression before '>' token
   40 |         cout << count << endl;#include<iostream>
      |                                                ^
a.cc:41:1: error: expected primary-expression before 'using'
   41 | using namespace std;
      | ^~~~~
a.cc:43:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   43 | int main(){
      |         ^~
a.cc:43:9: note: remove parentheses to default-initialize a variable
   43 | int main(){
      |         ^~
      |         --
a.cc:43:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:43:11: error: a function-definition is not allowed here before '{' token
   43 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
bool snt(long a){
    if(a==2 || a==3 || a==5 || a==7)
        return true;
    if(a<8)
        return false;
    long n=sqrt(a);
    for(int i=7;i<n;i++)
        if(n%i==0)
            return false;
    return true;
}

int main(){
    int n,d=0;
    long b;
    cin >>n;
    while(n-->0)
    {
        cin >>b;
        if(snt(b))
            d++;
    }
    cout <<d<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'bool snt(long int)':
a.cc:8:12: error: 'sqrt' was not declared in this scope
    8 |     long n=sqrt(a);
      |            ^~~~
Language: C++

#include <cstdio>
using namespace std;

bool prime(int num){
    for(int i = 1; i < n; i++){
        if(i*i >= n){
            int max = i*i;
            break;
        }
    }
    for(int i = 2; i < max; i++){
        if(num%i == 0){
            return true;
        }
    }
    return false;
}

int main(){
    int n;
    scanf("%d",&n);
    int A[n];
    for(int i = 0; i < n; i++){
        scanf("%d",&A[i]);
    }
    int count = 0;
    for(int i = 0; i < n; i++){
        if(prime(A[i])){
            count++;
        }
    }
    printf("%d\n",count);
}

Compiler output:
a.cc: In function 'bool prime(int)':
a.cc:5:24: error: 'n' was not declared in this scope
    5 |     for(int i = 1; i < n; i++){
      |                        ^
a.cc:11:24: error: 'max' was not declared in this scope
   11 |     for(int i = 2; i < max; i++){
      |                        ^~~
Language: C++

#include<iostream>
using namespace std;

bool isprime(int x)
{
	if(x==2)
		return true;
	
	if(x<2||x%==2)
		return false;

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

	return true;
}

int mai()
{
	int n;
	cin>>n;
	
	int cnt=0;
	
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		
		if(isprime(x)){
			cnt++;
		}
	}

	cout<<cnt<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:9:20: error: expected primary-expression before '=' token
    9 |         if(x<2||x%==2)
      |                    ^
a.cc: At global scope:
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return true;
      |         ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
a.cc: In function 'bool isprime(int)':
a.cc:15:9: warning: control reaches end of non-void function [-Wreturn-type]
   15 |         }
      |         ^
Language: C++

#include<iostream>
using namespace std;

bool isprime(int x)
{
	if(x==2)
		return true;
	
	if(x<2||x%==2)
		return false;

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

	return true;
}

int main()
{
	int n;
	cin>>n;
	
	int cnt=0;
	
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		
		if(isprime(x)){
			cnt++;
		}
	}

	cout<<cnt<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:9:20: error: expected primary-expression before '=' token
    9 |         if(x<2||x%==2)
      |                    ^
a.cc: At global scope:
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return true;
      |         ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
a.cc: In function 'bool isprime(int)':
a.cc:15:9: warning: control reaches end of non-void function [-Wreturn-type]
   15 |         }
      |         ^
Language: C++

#include<iostream>
using namespace std;

bool isprime(int x)
{
	if(x==2)
		return true;
	
	if(x<2||x%2==)
		return false;

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

	return true;
}

int main()
{
	int n;
	cin>>n;
	
	int cnt=0;
	
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		
		if(isprime(x)){
			cnt++;
		}
	}

	cout<<cnt<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:9:22: error: expected primary-expression before ')' token
    9 |         if(x<2||x%2==)
      |                      ^
a.cc: At global scope:
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return true;
      |         ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
a.cc: In function 'bool isprime(int)':
a.cc:15:9: warning: control reaches end of non-void function [-Wreturn-type]
   15 |         }
      |         ^
Language: C++

#include<iostream>
using namespace std;

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

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

	return true;
}

int main()
{
	int n;
	cin>>n;
	
	int cnt=0;
	
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		
		if(isprime(x)){
			cnt++;
		}
	}

	cout<<cnt<<endl;

	return 0;
}

Compiler output:
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return true;
      |         ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
a.cc: In function 'bool isprime(int)':
a.cc:15:9: warning: control reaches end of non-void function [-Wreturn-type]
   15 |         }
      |         ^
Language: C++

#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
#include<map>
#include<set>
#include<list>
using namespace std;

signed main() {
	int a; cin >> a;
	int sum = 0;
	for (int i = 0; i < a; i++) {
		int b : cin >> b;
		for (int c = 2; c*c <= b; c++) {
			if (b%c == 0) { sum--; break; }
		}
		sum++;
	}
	cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: found ':' in nested-name-specifier, expected '::'
   20 |                 int b : cin >> b;
      |                       ^
      |                       ::
a.cc:20:21: error: 'b' has not been declared
   20 |                 int b : cin >> b;
      |                     ^
a.cc:20:29: error: qualified-id in declaration before '>>' token
   20 |                 int b : cin >> b;
      |                             ^~
a.cc:21:40: error: 'b' was not declared in this scope
   21 |                 for (int c = 2; c*c <= b; c++) {
      |                                        ^
Language: C++

#include <iostream>
using namespace std;
static const int N = 100;
int a[N];
int i;
int main(){
    cin>>n;
    for (i=0,i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for (i=0;i<n;i++){
        int j = floor(sqrt(a[i]));
        for (int k=2;k<=j;k++){
            if (a[i]%k == 0){
                break;
            }
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'n' was not declared in this scope
    7 |     cin>>n;
      |          ^
a.cc:8:21: error: expected ';' before ')' token
    8 |     for (i=0,i<n;i++){
      |                     ^
      |                     ;
a.cc:13:23: error: 'sqrt' was not declared in this scope
   13 |         int j = floor(sqrt(a[i]));
      |                       ^~~~
a.cc:13:17: error: 'floor' was not declared in this scope
   13 |         int j = floor(sqrt(a[i]));
      |                 ^~~~~
Language: C++

#include <iostream>
using namespace std;
static const int N = 100;
int a[N];
int i,n;
int main(){
    cin>>n;
    for (i=0,i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for (i=0;i<n;i++){
        int j = floor(sqrt(a[i]));
        for (int k=2;k<=j;k++){
            if (a[i]%k == 0){
                break;
            }
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: expected ';' before ')' token
    8 |     for (i=0,i<n;i++){
      |                     ^
      |                     ;
a.cc:13:23: error: 'sqrt' was not declared in this scope
   13 |         int j = floor(sqrt(a[i]));
      |                       ^~~~
a.cc:13:17: error: 'floor' was not declared in this scope
   13 |         int j = floor(sqrt(a[i]));
      |                 ^~~~~
Language: C++

#include <iostream>
using namespace std;
static const int N = 100;
int a[N];
int i,n;
int main(){
    cin>>n;
    for (i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for (i=0;i<n;i++){
        int j = floor(sqrt(a[i]));
        for (int k=2;k<=j;k++){
            if (a[i]%k == 0){
                break;
            }
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: 'sqrt' was not declared in this scope
   13 |         int j = floor(sqrt(a[i]));
      |                       ^~~~
a.cc:13:17: error: 'floor' was not declared in this scope
   13 |         int j = floor(sqrt(a[i]));
      |                 ^~~~~
Language: C++

int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    for (i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    for (i=0;i<n;i++){
        flag=1;
        for (int k=2;k*k<=a[i];k++){
            if (a[i]%k == 0){
                flag=0;
                break;
            }
            
        }
        if (flag==1){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'ios' has not been declared
    2 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>n;
      |     ^~~
a.cc:3:10: error: 'n' was not declared in this scope
    3 |     cin>>n;
      |          ^
a.cc:4:10: error: 'i' was not declared in this scope
    4 |     for (i=0;i<n;i++){
      |          ^
a.cc:5:14: error: 'a' was not declared in this scope
    5 |         cin>>a[i];
      |              ^
a.cc:8:10: error: 'i' was not declared in this scope
    8 |     for (i=0;i<n;i++){
      |          ^
a.cc:9:9: error: 'flag' was not declared in this scope
    9 |         flag=1;
      |         ^~~~
a.cc:10:27: error: 'a' was not declared in this scope
   10 |         for (int k=2;k*k<=a[i];k++){
      |                           ^
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout<<ans<<endl;
      |     ^~~~
a.cc:21:16: error: 'endl' was not declared in this scope
   21 |     cout<<ans<<endl;
      |                ^~~~
Language: C++

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

int countPrimeNumbers(int nums[], int n);

int main(void)
{
	int n, nums[10000];
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	
	int count = countPrimeNumbers(nums, n);
	
	cout << count << endl;
	
	return 0;
}

int countPrimeNumbers(int nums[], int n)
{
	int count = 0;
	
	for (int i = 0; i < n; i++) {
		for (int j = 3; j <= nums[i]; j+=2) {
			if (nums[i] % j == 0) break;
		}
		if(j == nums[i]) count++;
	}
	
	return count;
}

Compiler output:
a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:20: error: 'j' was not declared in this scope
   31 |                 if(j == nums[i]) count++;
      |                    ^
Language: C++

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

int countPrimeNumbers(int nums[], int n);

int main(void)
{
	int n, nums[10000];
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	
	int count = countPrimeNumbers(nums, n);
	
	cout << count << endl;
	
	return 0;
}

int countPrimeNumbers(int nums[], int n)
{
	int count = 0;
	
	for (int i = 0; i < n; i++) {
		for (int j = 3; j <= nums[i]; j+=2) {
			if (nums[i] % j == 0) break;
		}
		if (j == nums[i]) count++;
	}
	
	return count;
}

Compiler output:
a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:21: error: 'j' was not declared in this scope
   31 |                 if (j == nums[i]) count++;
      |                     ^
Language: C++

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

int countPrimeNumbers(int nums[], int n);

int main(void)
{
	int n, nums[10000];
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	
	int count = countPrimeNumbers(nums, n);
	
	cout << count << endl;
	
	return 0;
}

int countPrimeNumbers(int nums[], int n)
{
	int count = 0;
	
	for (int i = 0; i < n; i++) {
		for (j = 2; j <= nums[i]; j++) {
			if (nums[i] % j == 0) break;
		}
		if (j == nums[i]) count++;
	}
	
	return count;
}

Compiler output:
a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:28:22: error: 'j' was not declared in this scope
   28 |                 for (j = 2; j <= nums[i]; j++) {
      |                      ^
a.cc:31:21: error: 'j' was not declared in this scope
   31 |                 if (j == nums[i]) count++;
      |                     ^
Language: C++

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

int countPrimeNumbers(int nums[], int n);

int main(void)
{
	int n, nums[10000];
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	
	int count = countPrimeNumbers(nums, n);
	
	cout << count << endl;
	
	return 0;
}

int countPrimeNumbers(int nums[], int n)
{
	int count = 0;
	
	for (int i = 0; i < n; i++) {
		for (j = 2; j * j <= nums[i]; j++) {
			if (nums[i] % j == 0) break;
		}
		if (j * j > nums[i]) count++;
	}
	
	return count;
}

Compiler output:
a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:28:22: error: 'j' was not declared in this scope
   28 |                 for (j = 2; j * j <= nums[i]; j++) {
      |                      ^
a.cc:31:21: error: 'j' was not declared in this scope
   31 |                 if (j * j > nums[i]) count++;
      |                     ^
Language: C++

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

int countPrimeNumbers(int nums[], int n);

int main(void)
{
	int n, nums[10000];
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	
	int count = countPrimeNumbers(nums, n);
	
	cout << count << endl;
	
	return 0;
}

int countPrimeNumbers(int nums[], int n)
{
	int count = 0;
	
	for (int i = 0; i < n; i++) {
		for (int j = 2; j * j <= nums[i]; j++) {
			if (nums[i] % j == 0) break;
		}
		if (j * j > nums[i]) count++;
	}
	
	return count;
}

Compiler output:
a.cc: In function 'int countPrimeNumbers(int*, int)':
a.cc:31:21: error: 'j' was not declared in this scope
   31 |                 if (j * j > nums[i]) count++;
      |                     ^
Language: C++

#include <stdio.h>
#include <math.h>
??
int isPrime(int);
??
int main(){
??
????int n,data[100000],i,c=0;
??
????scanf("%d",&n);
??
????for(i=0 ; i<n ; i++){
????????scanf("%d",&data[i]);
????????if(isPrime(data[i])==0) c++;
????}
??
printf("%d\n",c);
??
return 0;
??
}
??
??
int isPrime(int x){
??
????int i,a;
??
????a=(int)sqrt(x);
??
????if(x==2) return 0;
????else if(x<2) return 1;
????else if(x%2==0) return 1;
??
????else{
????????i=a
????????while(i<=a){
????????????if(x%i==0) return 1;
????????????i+=2;
????????}
????}
??
????return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ??
      | ^
a.cc:5:1: error: expected unqualified-id before '?' token
    5 | ??
      | ^
a.cc:22:1: error: expected unqualified-id before '?' token
   22 | ??
      | ^
Language: C++

{
  int n, x, i, 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:
a.cc:1:1: error: expected unqualified-id before '{' token
    1 | {
      | ^
Language: C++

#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;

    deque<int> d;
    vector<bool> v(1000000);
    constexpr auto size = 123456 * 2;
    d.resize(size - 1);
    iota(begin(d), end(d), 2);
    const int cut = sqrt(size);
    while (d[0] < cut) {
        v[d[0]] = true;
        d.erase(remove_if(begin(d),
                          end(d), [n = d[0]](int x) { return x % n == 0; }),
                end(d));
    }
    for (auto&& i : d) {
        v[i] = true;
    }

    int count{0};
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (v[x]) {
            count += 1;
        }
    }
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 'remove_if' was not declared in this scope; did you mean 'remove'?
   22 |         d.erase(remove_if(begin(d),
      |                 ^~~~~~~~~
      |                 remove
Language: C++

#include<iostream>
using namespace std;

int main(){
int n, a;
cin >> n;

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

}

int prime(int a){

    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int 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:11:7: error: 'prime' was not declared in this scope
   11 |    if(prime(a) == 1){count++}
      |       ^~~~~
a.cc:11:29: error: expected ';' before '}' token
   11 |    if(prime(a) == 1){count++}
      |                             ^
      |                             ;
a.cc: In function 'int prime(int)':
a.cc:19:9: error: 'n' was not declared in this scope
   19 |     if (n < 2){
      |         ^
a.cc:26:9: error: 'n' was not declared in this scope
   26 |     if (n % 2 == 0){
      |         ^
a.cc:30:26: error: 'n' was not declared in this scope
   30 |     for (int i = 3; i <= n / i; i += 2){
      |                          ^
Language: C++

#include<iostream>
using namespace std;

int main(){
int n, a;
cin >> n;

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

}

int prime(int a){
    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int 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:11:7: error: 'prime' was not declared in this scope
   11 |    if(prime(a) == 1){count++}
      |       ^~~~~
a.cc:11:29: error: expected ';' before '}' token
   11 |    if(prime(a) == 1){count++}
      |                             ^
      |                             ;
a.cc: In function 'int prime(int)':
a.cc:18:9: error: 'n' was not declared in this scope
   18 |     if (n < 2){
      |         ^
a.cc:25:9: error: 'n' was not declared in this scope
   25 |     if (n % 2 == 0){
      |         ^
a.cc:29:26: error: 'n' was not declared in this scope
   29 |     for (int i = 3; i <= n / i; i += 2){
      |                          ^
Language: C++

#include<iostream>
using namespace std;

int main(){
int n, a;
cin >> n;

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

}

int prime(int n){
    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int 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:11:7: error: 'prime' was not declared in this scope
   11 |    if(prime(a) == 1){count++}
      |       ^~~~~
a.cc:11:29: error: expected ';' before '}' token
   11 |    if(prime(a) == 1){count++}
      |                             ^
      |                             ;
Language: C++

#include<iostream>
using namespace std;

int main(){
int n, a;
cin >> n;

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

}

int prime(int n){
    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int 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:11:7: error: 'prime' was not declared in this scope
   11 |    if(prime(a) == 1){count++;}
      |       ^~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int n, a;
cin >> n;

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

}

public static int prime(int n){
    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int 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:11:7: error: 'prime' was not declared in this scope
   11 |    if(prime(a) == 1){count++;}
      |       ^~~~~
a.cc: At global scope:
a.cc:17:1: error: expected unqualified-id before 'public'
   17 | public static int prime(int n){
      | ^~~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
int n, a;
cin >> n;

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

}
static int prime(int n){
    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int 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:11:7: error: 'prime' was not declared in this scope
   11 |    if(prime(a) == 1){count++;}
      |       ^~~~~
Language: C++

#include<iostream>
using namespace std;
class Main{
int main(){
int n, a;
cin >> n;

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

}
int prime(int n){
    if (n < 2){
        return 0;
    }
    else if (n == 2){
        return 1;
    } 

    if (n % 2 == 0){
        return 0;
     }

    for (int i = 3; i <= n / i; i += 2){
         if (n % i == 0){
            return 0;
          }
    }
    return 1;

}
}

Compiler output:
a.cc:36:2: error: expected ';' after class definition
   36 | }
      |  ^
      |  ;
a.cc: In member function 'int Main::main()':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^