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


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class PrimeNumber2_0044
{
  public static void main(String[] args)
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    ArrayList<Integer> inputList = new ArrayList<>(50);

    try
    {
      while (input.ready())
      {
        inputList.add(Integer.valueOf(input.readLine()));
      }
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }

    for (int num : inputList)
    {
      System.out.println(getLowerPrimeNumber(num) + " " + getHigherPrimeNumber(num));
    }
  }

  private static int getLowerPrimeNumber(int number)
  {
    for (int i = number - 1; i > 3; i--)
    {
      if (isPrimeNumber(i))
      {
        return i;
      }
    }
    return 2;
  }

  private static int getHigherPrimeNumber(int number)
  {
    for (int i = number + 1; i < Integer.MAX_VALUE; i++)
    {
      if (isPrimeNumber(i))
      {
        return i;
      }
    }
    return 2;
  }

  public static ArrayList<Integer> getPrimeNumberList(int maxNumber)
  {
    ArrayList<Integer> primeNumberList = new ArrayList<>();
    primeNumberList.add(2);
    primeNumberList.add(3);
    primeNumberList.add(5);
    primeNumberList.add(7);

    int[] oneDigitList =
    { 1, 3, 7, 9 };

    int tmp;
    int sqrtTmp;
    boolean addFlag;
    for (int i = 10; i <= maxNumber; i += 10)
    {
      for (int oneDigit : oneDigitList)
      {
        addFlag = true;
        tmp = i + oneDigit;
        sqrtTmp = (int) Math.sqrt(tmp);
        for (int primeNumber : primeNumberList)
        {
          if (tmp % primeNumber == 0)
          {
            addFlag = false;
            break;
          }
          if (sqrtTmp < primeNumber)
          {
            break;
          }
        }
        if (addFlag)
        {
          primeNumberList.add(tmp);
        }
      }
    }
    return primeNumberList;
  }

  private static boolean isPrimeNumber(int number)
  {
    if (number % 2 == 0)
    {
      return false;
    }

    final int limit = (int) Math.sqrt(number);
    for (int i = 3; i <= limit; i++)
    {
      if (number % i == 0)
        return false;

    }

    return true;
  }
}

Compiler output:
Main.java:7: error: class PrimeNumber2_0044 is public, should be declared in a file named PrimeNumber2_0044.java
public class PrimeNumber2_0044
       ^
1 error
Language: Java

import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class Main {
 void run(){
  Scanner sc = new Scanner(System.in);
  while(sc.hasNext()) {
   int n =sc.nextInt();
   int min, max;
   for(max=p-1;!isP(max);max--);
   for(min=p+1;!isP(min);min++);
   System.out.println(max + " " + min);
  }
 }
 boolean isP(int p) {
  for(int i=2;i*i<=p;i++) if(p%i == 0)
   return false;
  return true;
 }
 public static void main (String[] args ) {
  new Main().run();
 }
}

Compiler output:
Main.java:11: error: cannot find symbol
   for(max=p-1;!isP(max);max--);
           ^
  symbol:   variable p
  location: class Main
Main.java:12: error: cannot find symbol
   for(min=p+1;!isP(min);min++);
           ^
  symbol:   variable p
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Proc{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int[] v = new int[25025];
		for(int i = 0;i < 25025;i++){
			v[i] = 1;
		}
		int p = 3;
		while(true){
			if(p*p > 50050){
				break;
			}else{
				if(v[(p-1)/2] == 0){
					p += 2;
				}else{
					int t = p*p;
					while(t < 50050){
						v[(t-1)/2] = 0;
						t += 2*p;
					}
					p += 2;
				}
			}
		}
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 3){
				System.out.println(2 + " " + 5);
				continue;
			}
			int prev = 0;
			boolean sw = false;
			for(int i = 1;i < 25025;i++){
				if(v[i] != 1){
					continue;
				}
				if((2*i + 1) == n && !sw){
					sw = true;
					continue;
				}
				if(sw || (2*i + 1) > n){
					System.out.println(2*prev+1 + " " + (2*i+1));
					break;
				}
				prev = i;
			}
		}
	}
}

Compiler output:
Main.java:3: error: class Proc is public, should be declared in a file named Proc.java
public class Proc{
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

class Main {

        static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        public static void main(String[] args) throws Exception{
            int N = 50022;
            int[] primes = new int[N];
            for (int i=0; i<N; i++) {
                if (i == 0 || i == 1)
                    primes[i] = 0;
                else
                    primes[i] = 1;
            }

            for (int i=2; i<N/2; i++) {
                if (primes[i] == 0) continue;
                for (int j=i*2; j<N; j+=i) {
                    primes[j] = 0;
                } 
            }

            HashMap<Integer, Integer> iidx = new HashMap<Integer, Integer>(); 
            int[] prime_seq = new int[N]; 
            int j = 0;
            for (int i=0; i<N; i++) {
                if (primes[i] == 1) {
                    prime_seq[j] = i;
                    iidx.put(i, j);
                    j++;
                }
            }

            String row = "";
            while ((row = reader.readLine()) != null) {
                if(row.isEmpty()) return;
                int n = Integer.parseInt(row);
                int in = iidx.get(n);
                System.out.println(prime_seq[in-1] + " " + prime_seq[in+1])

Compiler output:
Main.java:42: error: reached end of file while parsing
                System.out.println(prime_seq[in-1] + " " + prime_seq[in+1])
                                                                           ^
1 error
Language: C

#include<stdio.h>
#define M 51000
int main(){
  int i,j,p[M]={1,1};
  for(i=2;i*i<M;i++){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  while(~scanf("%d",&i)){
    for(j=i-1;p[j];j--x);
    printf("%d ",j);
    for(j=i+1;p[j];j++);
    printf("%d\n",j);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:23: error: expected ')' before 'x'
   10 |     for(j=i-1;p[j];j--x);
      |        ~              ^
      |                       )
Language: C

#include<stdio.h>
int main(void){
   int n, i, k, key1, key2, s[100000], l;
   for ( i = 1; i <= 100000; i++ ) {
      s[i] = 0;
   }
   for ( k = 2; k <= 100000; k++ ){
      if (s[k] == 0) {
         for ( l = 2; l <= 100000 / k; l++ ) {
            s[k * l] = 1;
         }
      }
   }
    while ( scanf("%d", &n) != EOF ) {
      for ( i = n - 1; i > 2; i-- ) {
         if( s[i] == 0 ){
            key1 = i;
            break;
         }
      }
      for ( i = n + 1; i < 100000; i++){
         if( s[i] == 0 ){
            key2 = i;
            break;
         }
      }
      printf("%d %d\n", key1, key2);
   }
   return 0;

Compiler output:
main.c: In function 'main':
main.c:29:4: error: expected declaration or statement at end of input
   29 |    return 0;
      |    ^~~~~~
Language: C

#include <stdio.h>int j,i,n,x=0;int main(){while(scanf("%d",&n)!=EOF){for(i=n-1;;i--){for(j=2;j*j<=i;j++){ if(j!=i){if(i%j==0){x=1;}}}if(x==0) {printf("%d ",i); goto q;} x=0;}q:for(i=n+1;;i++){for(j=2;j*j<=i;j++){  if(j!=i){if(i%j==0){x=1;}}}if(x==0) {printf("%d\n",i); goto r;} x=0;} r:; }return 0;}

Compiler output:
main.c:1:19: warning: extra tokens at end of #include directive
    1 | #include <stdio.h>int j,i,n,x=0;int main(){while(scanf("%d",&n)!=EOF){for(i=n-1;;i--){for(j=2;j*j<=i;j++){ if(j!=i){if(i%j==0){x=1;}}}if(x==0) {printf("%d ",i); goto q;} x=0;}q:for(i=n+1;;i++){for(j=2;j*j<=i;j++){  if(j!=i){if(i%j==0){x=1;}}}if(x==0) {printf("%d\n",i); goto r;} x=0;} r:; }return 0;}
      |                   ^~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#define DATANUM 60000

int maxarray(int va[], int std1);
int minarray(int vb[], int std2);

int main(void) {
    int num[DATANUM] = {0};
    int i, j, std;
    
    num[0] = 1;
    num[1] = 1;
    
    for(i = 2; i < DATANUM; i++) {
        if(i != 2 && i % 2 == 0) num[i] = 1;
        if(i != 3 && i % 3 == 0) num[i] = 1;
        if(i != 5 && i % 5 == 0) num[i] = 1;
        if(i != 7 && i % 7 == 0) num[i] = 1;
        for(j = 2; j < i; j++) {
            if(!(i % j)) {
                num[i] = 1;
                break;
            }
        }
    }
    
    while(scanf("%d", &std) != EOF) {
        printf("%d %d\n", maxarray(num, std), minarray(num, std));
    }

    return(0);
    
}

int maxarray(int va[], int std1) {
    int max, i;
    
    max = 2;
    
    for(i = 2; i < std1; i++) {
        if(i > max && va[i] != 1) {
            max = i;
        }
    }
    
    return(max);
}

int minarray(int vb[], int std2) {
    int min, i, count = 0;
    
    for(i = std2 + 1; i < DATANUM; i++) {
        if(vb[i] != 1 && count == 0) {
            min = i;
            count++;
        }
    }
    
    return(min);
}
; i < DATANUM; i++) {
        if(vb[i] != 1 && count == 0) {
            min = i;
            count++;
        }
    }
    
    return(min);
}

Compiler output:
main.c:61:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   61 | ; i < DATANUM; i++) {
      |     ^
main.c:61:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   61 | ; i < DATANUM; i++) {
      |                 ^~
main.c:68:5: error: expected identifier or '(' before 'return'
   68 |     return(min);
      |     ^~~~~~
main.c:69:1: error: expected identifier or '(' before '}' token
   69 | }
      | ^
Language: C

#include<iostream>
#include<cstdio>

int main()
{
	int a[50001]={0};
	int i,j;
	int n,c;

	a[2]=1;
	for(i=3;i<=50001;i+=2){
		if(a[i]==2)
			continue;
		else if(a[i]==0){
			a[i]=1;
			for(j=i*2;j<=50001;j+=i)
				a[j]=2;
		}
	}
	while(scanf("%d",&n)!=EOF){
		for(i=n-1;i>1;i--){
			if(a[i]==1){
				printf("%d ",i);
				break;
			}
		}
		for(i=n+1;i<=50001;i++)
			if(a[i]==1){
				printf("%d\n",i);
				break;
			}
	}
	return 0;
}

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

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323
//void quick(int *,long long,long long);

int main(){
     
	int a,i,j,flag;
	char s[60000];

	for(i=2;i<60000;i++)
		s[i]=1;
	i=2;
	while(i*i<60000){
		j=i;
		while(i*j<60000){
			s[i*j]=0;
			j++;
		}
		i++;
		while(s[i]==0)
			i++;
	}
	while(scanf("%d",&a)!=EOF){
		for(i=a-1;s[i]==0;i--);
		printf("%d ",i);
		for(i=a+1;s[i]==0;i++);
		printf("%d\n",i);
	}	
}
/*void qu

Compiler output:
main.c:32:1: error: unterminated comment
   32 | /*void qu
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int table[80000]={};
  for(int i=2; i*i80000; ++i){
    if(!table[i]){
      for(int j=i*2; j<=80000; j+=i){
        table[j]=1;
      }
    }
  }
  
  int n;
  while(cin >> n,n){
    int i;
    for(i=n-1; table[i]; --i);
    cout << i << " ";
    for(i=n+1; table[i]; ++i);
    cout << i << endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: 'i80000' was not declared in this scope
    6 |   for(int i=2; i*i80000; ++i){
      |                  ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;

  while(cin>>n){
    int ans_ma;
    int ma_n = n + 1;
    int c_ma = 0;

    if(ma_n % 2 == 0){
      ++ma_n;
    }

    for(int i = ma_n; ;i = i + 2){
      int q = sqrt(i);

      if(q < 3){
        ans_ma = q;
        break;
      }
        
      else{
        c_ma = 1;
        for(int j = 3;j <= q;j = j + 2){
          if(i % j == 0){
            c_ma = 0;
            break;
          }
        }
        if(c_ma == 1){
          ans_ma = i;
          break;
        }
      }
    }

    int ans_mi;
    int mi_n = n - 1;
    int c_mi = 0;

    if(mi_n == 2){
      ans_mi = 2;
    }
    else{
      if(mi_n % 2 == 0){
        --mi_n;
      }
      for(int i = mi_n;i => 3;i = i - 2){
        int q = sqrt(i);

        if(q < 3){
          ans_mi = q;
          break;
        }
        else{
          c_mi = 1;
          for(int j = 3;j <= q;j = j + 2){
            if(i % j == 0){
              c_mi = 0;
              break;
            }
          }
          if(c_mi == 1){
            ans_mi = i;
            break;
          }
        }
      }
    }
    cout<<ans_mi<<" "<<ans_ma<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:51:27: error: expected primary-expression before '>' token
   51 |       for(int i = mi_n;i => 3;i = i - 2){
      |                           ^
Language: C++

const int MAX_NUM = 100000000;
bool prime_number[MAX_NUM];
 
void prime_create() {
    fill(prime_number, prime_number + MAX_NUM, true);
    prime_number[0] = prime_number[1] = false;
 
    for(int i = 2; i < MAX_NUM; i++) {
        if(prime_number[i])
        for(int j = 2; i*j < MAX_NUM; j++) {
            prime_number[i*j] = false;
        }
    }
}

Compiler output:
a.cc: In function 'void prime_create()':
a.cc:5:5: error: 'fill' was not declared in this scope
    5 |     fill(prime_number, prime_number + MAX_NUM, true);
      |     ^~~~
Language: C++

def create_prime(n):
    prime = [1] * (n + 1)
    prime[:2] = [0, 0]
    for i in range(len(prime)):
        if prime[i]:
            for j in range(2 * i, len(prime), i):
                prime[j] = 0
    return prime

def under(prime, n):
    for i in range(n - 1, -1, -1):
        if prime[i]:
            return i
def over(prime, n):
    for i in range(n + 1, len(prime)):
        if prime[i]:
            return i
        

import sys

n = [int(line) for line in sys.stdin]

prime = create_prime(max(n) + 100)

for ni in n:
    print(under(prime, ni), over(prime, ni))

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def create_prime(n):
      | ^~~
Language: C++

require 'prime'
while str=gets
    s=str.to_i
    low = -((1-s)..(-3)).find{|i| (i).prime? }
    high = ((s+1)..50000).find{|i| i.prime? }
    puts "#{low} #{high}"
end

Compiler output:
a.cc:1:9: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    1 | require 'prime'
      |         ^~~~~~~
a.cc:1:1: error: 'require' does not name a type
    1 | require 'prime'
      | ^~~~~~~
a.cc:5:5: error: 'high' does not name a type
    5 |     high = ((s+1)..50000).find{|i| i.prime? }
      |     ^~~~
a.cc:6:5: error: 'puts' does not name a type
    6 |     puts "#{low} #{high}"
      |     ^~~~
Language: C++

#include <iostream>

using namespace std;

/*テァツエツ?ヲツ閉ーテ・ツ按、テ・ツョツ?/
const int MAX = 1000100;
bool prime[MAX];

void sieve(){
	fill(prime, prime+MAX, true);
	prime[0] = prime[1] = false;

	for(int i=2; i*i < MAX; i++){
		if(!prime[i]) continue;
		for(int j=i*i; j < MAX; j += i) prime[j] = false;

	}

}


int main(){
	int n;
	sieve();
	while(cin >> n){
		for(int i=1; ; i++) if(prime[n-i]){ cout << n-i << " "; break;}
		for(int i=1; ; i++) if(prime[n+i]){ cout << n-i << endl; break;}
	}
}

Compiler output:
a.cc:5:1: error: unterminated comment
    5 | /*テァツエツ?ヲツ閉ーテ・ツ按、テ・ツョツ?/
      | ^
Language: C++

#include <iostream>

using namespace std;

/*テァツエツ?ヲツ閉ーテ・ツ按、テ・ツョツ?/
const int MAX = 1000100;
bool prime[MAX];

void sieve(){
	fill(prime, prime+MAX, true);
	prime[0] = prime[1] = false;

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


int main(){
	int n;
	sieve();
	while(cin >> n){
		for(int i=1; ; i++) if(prime[n-i]){ cout << n-i << " "; break;}
		for(int i=1; ; i++) if(prime[n+i]){ cout << n+i << endl; break;}
	}
}

Compiler output:
a.cc:5:1: error: unterminated comment
    5 | /*テァツエツ?ヲツ閉ーテ・ツ按、テ・ツョツ?/
      | ^
Language: C++


#include<vector>
#include<cmath>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a; i ++)
#define loop(i,b,a) for(int i = b ; i < a; i ++)
const int MAX = 50000;
bool p[MAX];
void isPrime(){
  fill(p,p + MAX,true);
  p[0] = p[1] = false;
  rep(i,MAX){
    if(p[i]){
      for(int j = i + i ; j < MAX ; j += i)
	p[j] = false;
    }
  }
} 

int main(void){
  isPrime();
  int n;
  while(cin>>n){

    int i;
 
    for(i = n-1 ; !p[i] ; i --);
    cout<<i<<" ";
    for(i = n+1 ; !p[i] ; i ++);
    cout<<i<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'cin' was not declared in this scope
   25 |   while(cin>>n){
      |         ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include<cstdio>
  +++ |+#include <iostream>
    6 | using namespace std;
a.cc:30:5: error: 'cout' was not declared in this scope
   30 |     cout<<i<<" ";
      |     ^~~~
a.cc:30:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:14: error: 'endl' was not declared in this scope
   32 |     cout<<i<<endl;
      |              ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #include<cstdio>
  +++ |+#include <ostream>
    6 | using namespace std;
Language: C++

#include<iostream>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
const int M = (1e6);
int p[M];
void isPrime(){
  rep(i,M)p[i] = true;
  p[0] = p[1] = false;
  loop(i,2,M){
    if(p[i])
      for(int j = i + i ; j < M ; j += i)
	p[j] = false;
  }
}
int main(void){
  isPrime();
  int n;
  while(cin>>n){
    int i = n - 1;
    while(!prime[i]);cout<<i<<" ";
    i = n + 1;
    while(!prime[i]);cout<<i<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: 'prime' was not declared in this scope
   21 |     while(!prime[i]);cout<<i<<" ";
      |            ^~~~~
a.cc:23:12: error: 'prime' was not declared in this scope
   23 |     while(!prime[i]);cout<<i<<endl;
      |            ^~~~~
Language: C++

#include<iostream>
using namespace std;

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (scanf_s("%d",&n) != EOF) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int m) {
	int result = 0;
		while (true) {
		for (int i = m; ; i--) {
			for (int j = sqrt(i)+1;; j--) {
				if ((i%j)==0)break;
				if (j == 2) { result = i; return result; }
			}
		}
	}
}


int primemin(int m) {
	int result = 0;
		while (1) {
			for (int i = m; ; i++) {
				for (int j = sqrt(i)+1; ; j--) {
					if ((i%j)==0)break;
					if (j == 2) { result = i; return result; }
				}
			}
		}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |         while (scanf_s("%d",&n) != EOF) {
      |                ^~~~~~~
      |                scanf
a.cc: In function 'int primemax(int)':
a.cc:18:38: error: 'sqrt' was not declared in this scope
   18 |                         for (int j = sqrt(i)+1;; j--) {
      |                                      ^~~~
a.cc: In function 'int primemin(int)':
a.cc:31:46: error: 'sqrt' was not declared in this scope
   31 |                                 for (int j = sqrt(i)+1; ; j--) {
      |                                              ^~~~
Language: C++

#include<iostream>
using namespace std;

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (scanf("%d",&n) != EOF) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int m) {
	int result = 0;
		while (true) {
		for (int i = m; ; i--) {
			for (int j = sqrt(i)+1;; j--) {
				if ((i%j)==0)break;
				if (j == 2) { result = i; return result; }
			}
		}
	}
}


int primemin(int m) {
	int result = 0;
		while (1) {
			for (int i = m; ; i++) {
				for (int j = sqrt(i)+1; ; j--) {
					if ((i%j)==0)break;
					if (j == 2) { result = i; return result; }
				}
			}
		}
}

Compiler output:
a.cc: In function 'int primemax(int)':
a.cc:18:38: error: 'sqrt' was not declared in this scope
   18 |                         for (int j = sqrt(i)+1;; j--) {
      |                                      ^~~~
a.cc: In function 'int primemin(int)':
a.cc:31:46: error: 'sqrt' was not declared in this scope
   31 |                                 for (int j = sqrt(i)+1; ; j--) {
      |                                              ^~~~
Language: C++

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

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (scanf("%d",&n) != EOF) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int m) {
	int result = 0;
		while (true) {
		for (int i = m; ; i--) {
			for (int j = sqrt(i)+1;; j--) {
				if ((i%j)==0)break;
				if (j == 2) { result = i; return result; }
			}
		}
	}
}


int primemin(int m) {
	int result = 0;
		while (1) {
			for (int i = m; ; i++) {
				for (int j = sqrt(i)+1; ; j--) {
					if ((i%j)==0)break;
					if (j == 2) { result = i; return result; }
				}
			}
		}
}

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

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

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (cin >> n) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int m) {
	int result = 0;
		while (true) {
		for (int i = m; ; i--) {
			for (int j = sqrt(i)+1;; j--) {
				if ((i%j)==0)break;
				if (j == 2) { result = i; return result; }
			}
		}
	}
}


int primemin(int m) {
	int result = 0;
		while (1) {
			for (int i = m; ; i++) {
				for (int j = sqrt(i)+1; ; j--) {
					if ((i%j)==0)break;
					if (j == 2) { result = i; return result; }
				}
			}
		}
}

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

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

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (scanf("%d",&n) != EOF) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int m) {
	int result = 0;
		while (true) {
		for (int i = m; ; i--) {
			for (int j = sqrt(i)+1;; j--) {
				if ((i%j)==0)break;
				if (j == 2) { result = i; return result; }
			}
		}
	}
}


int primemin(int m) {
	int result = 0;
		while (1) {
			for (int i = m; ; i++) {
				for (int j = sqrt(i)+1; ; j--) {
					if ((i%j)==0)break;
					if (j == 2) { result = i; return result; }
				}
			}
		}
}

Compiler output:
a.cc: In function 'int primemax(int)':
a.cc:19:38: error: 'sqrt' was not declared in this scope
   19 |                         for (int j = sqrt(i)+1;; j--) {
      |                                      ^~~~
a.cc: In function 'int primemin(int)':
a.cc:32:46: error: 'sqrt' was not declared in this scope
   32 |                                 for (int j = sqrt(i)+1; ; j--) {
      |                                              ^~~~
Language: C++

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

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (scanf_s("%d",&n) != EOF) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int n)
{
	int t;
	for (n;; n--)
	{
		for (t = 2; t <= n; t++)
		{
			if (t == n)
			{
				return n;
			}
			else if (n%t == 0)
			{
				break;
			}
		}
	}
}
int primemin(int n)
{
	int t;
	for (n;; n++)
	{
		for (t = 2; t <= n; t++)
		{
			if (t == n)
			{
				return t;
			}
			else if (n%t == 0)
			{
				break;
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         while (scanf_s("%d",&n) != EOF) {
      |                ^~~~~~~
      |                scanf
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>

using namespace std;

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

int main() {
    int N;
    while (cin >> N) {
        for (int p1=N-1; ; p1--) {
            if (is_prime(p1)) break;
        }
        for (int p2=N+1; ; p2++) {
            if (is_prime(p2)) break;
        }
        cout << p1 << " " << p2 << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'p1' was not declared in this scope
   27 |         cout << p1 << " " << p2 << endl;
      |                 ^~
a.cc:27:30: error: 'p2' was not declared in this scope
   27 |         cout << p1 << " " << p2 << endl;
      |                              ^~
Language: C++

from itertools import takewhile, dropwhile
pn, tmp = [], [i for i in range(2, 50000)]
while tmp[0] < 224:
    v = tmp.pop(0)
    pn.append(v)
    tmp = list(filter(lambda x: x%v!=0, tmp))
for t in tmp: pn.append(t)
while True:
    try:
        n = int(input())
    except:
        break
    print(list(takewhile(lambda x: x<n, pn))[-1], list(dropwhile(lambda x: x<=n, pn))[0])

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import takewhile, dropwhile
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
bool isprime(int n) {
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
	return true;
}
int main() {
	int n;
	while (cin >> n){
		for (int i = n - 1; ; i--){
			if (isprime(i)) {
				cout << i << ' ';
				break;
			}
		}
		for (int i = n + 1;; i++) {
			if (isprime(i)) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:6:30: error: 'sqrt' was not declared in this scope
    6 |         for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
      |                              ^~~~
Language: C++

#include <iostream>;
using namespace std;

int a[100000];

void sosuu() {
	a[0] = 2;
	int k, z = 1;
	for (int i = 3; i<100000; i++) {
		k = 0;
		for (int j = 0; a[j] <= sqrt(i); j++) {
			if (i%a[j] == 0) {
				k++;
				break;
			}
		}
		if (k == 0) {
			a[z] = i;
			z++;
		}
	}
}

int nibun(int n, int s, int e){
	if (s >= e) return s;
	if(a[(s + e)/2] < n){
		if(a[(s+e)/2 + 1]>n ){
			return (s + e) / 2;
		}
		return nibun(n, (s + e) / 2 + 1, e);
	}
	else if(a[(s + e) / 2] > n){
		return nibun(n, s, (s + e) / 2 - 1);
	}
	else return (s + e) / 2;
}


int main(){
	sosuu();
	int n, k;
	while(cin >> n){
		int ret = nibun(n, 0, 10000);
		if(n == a[ret]){
			cout << a[ret - 1] << " " << a[ret + 1] << endl;
		}

		else cout << a[ret] << " " << a[ret + 1] << endl;
	}
	return 0;
}

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>;
      |                    ^
a.cc: In function 'void sosuu()':
a.cc:11:41: error: 'sqrt' was not declared in this scope
   11 |                 for (int j = 0; a[j] <= sqrt(i); j++) {
      |                                         ^~~~
Language: C++

#include <iostream>;
using namespace std;

int a[100000];

void sosuu() {
	a[0] = 2;
	int k, z = 1;
	for (int i = 3; i<100000; i++) {
		k = 0;
		for (int j = 0; a[j] <= sqrt(i); j++) {
			if (i%a[j] == 0) {
				k++;
				break;
			}
		}
		if (k == 0) {
			a[z] = i;
			z++;
		}
	}
	return;
}

int nibun(int n, int s, int e){
	if (s >= e) return s;
	if(a[(s + e)/2] < n){
		if(a[(s+e)/2 + 1]>n ){
			return (s + e) / 2;
		}
		return nibun(n, (s + e) / 2 + 1, e);
	}
	else if(a[(s + e) / 2] > n){
		return nibun(n, s, (s + e) / 2 - 1);
	}
	else return (s + e) / 2;
}


int main(){
	sosuu();
	int n, k;
	while(cin >> n){
		int ret = nibun(n, 0, 10000);
		if(n == a[ret]){
			cout << a[ret - 1] << " " << a[ret + 1] << endl;
		}

		else cout << a[ret] << " " << a[ret + 1] << endl;
	}
	return 0;
}

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>;
      |                    ^
a.cc: In function 'void sosuu()':
a.cc:11:41: error: 'sqrt' was not declared in this scope
   11 |                 for (int j = 0; a[j] <= sqrt(i); j++) {
      |                                         ^~~~
Language: C++

#include <iostream>
using namespace std;


int prime[60000];


void sieve(){
	memset(prime, 1, sizeof prime);
	int i;
	for(i = 2;i*i <= 60000;i++){
		if(prime[i]){
			for(int j = 2;i*j <= 60000;j++){
				prime[i*j] = 0;
			}
		}
	}
}


int main(){
	int n;
	sieve();
	while (cin >> n){
		for(int i = n-1;;i--){
			if(prime[i]){
				cout << i << ' ' << prime[i] << endl;
				break;
			}
		}
		for(int i = n+1;;i++){
			if(prime[i]){
				cout << i << ' ' << prime[i] << endl;
				break;
			}
		}
		cout << prime[n] << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'void sieve()':
a.cc:9:9: error: 'memset' was not declared in this scope
    9 |         memset(prime, 1, sizeof prime);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

MAX = 60000
lst = [i for i in range(MAX)]
lst[0] = lst[1] = 0
for i in range(MAX):
  if lst[i] != 0:
    for j in range(i * 2, MAX, i):
      lst[j] = 0
while 0 == 0:
  try:
    n = int(input())
    i = n - 1
    j = n + 1
    while lst[i] == 0:
      i -= 1
    while lst[j] == 0:
      j += 1
    print(lst[i],lst[j])
  except EOFError:
    break


Compiler output:
a.cc:1:1: error: 'MAX' does not name a type
    1 | MAX = 60000
      | ^~~
Language: C++

#include<iostream>
using namespace std;

int main() {
	bool prime[55001] = { false };
	for (int i = 2; i <= sqrt(55000); i++) {
		if (!prime[i]) {
			for (int j = 2; i*j <= 55000; j++) {
				prime[i*j] = true;
			}
		}
	}
	int n;
	while (cin >> n) {
		for (int i = n-1;; i--) {
			if (!prime[i]) {
				cout << i << " ";
				break;
			}
		}
		for (int i = n+1;; i++) {
			if (!prime[i]) {
				cout << i << endl;
				break;
				}
			}
		}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:30: error: 'sqrt' was not declared in this scope
    6 |         for (int i = 2; i <= sqrt(55000); i++) {
      |                              ^~~~
Language: C++

#include<iostream>
#include<vector>
#define MAX 1000000
using namespace std;
int main(){
    vector<bool> v(MAX);
    for(int i = 0;i<MAX;i++)
      v[i]=true;

      v[0]=v[1]=false;
    for(int i = 2;i<1000;i++){
      if(v[i]){
        for(int j=i*i;j<MAX;j+=i){
         v[j]=false;
       }
      }
    }
    while(true){
      int a;
      cin >> a;
      if(cin.eof())return 0;
      while(i=n-1){
        if(v[i]){
          cout >>i>>' ';
          break;
      }
      i--;
    }
    while(i=n+1){
      if(v[i]){
        cout >>i>>endl;
        break;
    }
    i++;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: 'i' was not declared in this scope
   22 |       while(i=n-1){
      |             ^
a.cc:22:15: error: 'n' was not declared in this scope
   22 |       while(i=n-1){
      |               ^
a.cc:29:11: error: 'i' was not declared in this scope
   29 |     while(i=n+1){
      |           ^
a.cc:29:13: error: 'n' was not declared in this scope
   29 |     while(i=n+1){
      |             ^
a.cc:36:2: error: expected '}' at end of input
   36 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;


#define N 50000

int main(){
    int n;

    bool is_prime[N];
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<N;i++){
      is_prime[i] = true;
    }
    for(int i=2; i*i<N; i++){
      if(is_prime[i]){
        for(int j=i*i;j<N; j+=i){
          is_prime[j] = false;
        }
      }
    }


    while(1){
      int counter = 0;
      cin >> n;
      if(n == 0)
        break;
      if(cin.eof())
        break;
      int i=0;
      while(i <= n/2){
        if(is_prime[n-i] && is_prime[n])
          counter++;
        i++;
        }
        cout << counter << endl;
      }
      retrurn 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:39:7: error: 'retrurn' was not declared in this scope
   39 |       retrurn 0;
      |       ^~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  bool is_prime[50001];

  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<50001;i++){
    is_prime[i] = true;
  }

  for(int i=2;i*i<50001;i++){
    if(is_prime[i]){
      for(int j=i*i;j<50001;j=j+i){
        is_prime[j] = false;
      }
    }
  }

  int n_prime[50001];

  int cnt = 0;
  for(int i=0;i<50001;i++){<50001
    if(is_prime[i]){
      cnt++;
    }
    n_prime[i] = cnt;
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
        break;

    int high,low;
    for(int i=0;i<50001;i++){
      if((is_prime[i]) && (n_prime[i] == n_prime[n]-1)){
        low = i;
      }
      if((is_prime[i]) && (n_prime[i] == n_prime[n]+1)){
        high = i;
      }
    }

    cout << low << " " << high << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:28: error: expected primary-expression before '<' token
   23 |   for(int i=0;i<50001;i++){<50001
      |                            ^
Language: C++

#include<iostream>
#include<vector>
int main()
{
	std::vector<bool>is_prime(50020, true);
	const int root = static_cast<int>(floor(sqrt(50021)));
	for (int i = 0; i <= root - 2; i++)
	{
		if (is_prime[i])
		{
			for (int j = i + 2; (i + 2) * j < 50021; j++)
			{
				is_prime[(i + 2) * j - 2] = false;
			}
		}
	}
	for (int n; std::cin >> n;)
	{
		for (int i = n - 2 - 1;; i--)
		{
			if (is_prime[i])
			{
				std::cout << i + 2 << ' ';
				break;
			}
		}
		for (int i = n - 2 + 1;; i++)
		{
			if (is_prime[i])
			{
				std::cout << i + 2 << std::endl;
				break;
			}
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:49: error: 'sqrt' was not declared in this scope
    6 |         const int root = static_cast<int>(floor(sqrt(50021)));
      |                                                 ^~~~
a.cc:6:43: error: 'floor' was not declared in this scope
    6 |         const int root = static_cast<int>(floor(sqrt(50021)));
      |                                           ^~~~~
Language: C++

#include <iostream>
using namespace std;
#define MAX 1000000

int prime[MAX];

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

int main(void){
  int n;

  is_prime();

  while(cin >> n){
    for(int i = n-1 ; prime[i] == 0 ; i--);
    cout << i << ' ';

    for(int i = n+1 ; prime[i] == 0 ; i++);
    cout << i << endl;
  }

  return 0;
}

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

#include <iostream>
using namespace std;
#define MAX 1000000

int prime[MAX];

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

int main(void){
  int n;

  is_prime();

  while(cin >> n){
    for(int i = n - 1 ; prime[i] == 0 ; i--);
    cout << i << ' ';

    for(int j = n + 1 ; prime[j] == 0 ; j++);
    cout << j << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'i' was not declared in this scope
   27 |     cout << i << ' ';
      |             ^
a.cc:30:13: error: 'j' was not declared in this scope
   30 |     cout << j << endl;
      |             ^
Language: C++

#include <iostream>
using namespace std;
#define MAX 50100

int main(void){
  bool prime[MAX] = false;

  prime[0] = prime[1] = true;
  for(int i = 2 ; i*i <= MAX-1 ; i++){
    if(!prime[i]){
      for(int j = i*2 ; j <= MAX - 1 ; j += i){
        prime[j] = true;
      }
    }
  }

  int n;
  while(cin >> n){
    for(int i = n-1 ; ; i--){
      if(!prime[i]){
        cout << i << ' ';
        break;
      }
    }
    for(int i = n+1 ; ; i++){
      if(!prime[i]){
        cout << i << endl;
        break;
      }
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:21: error: array must be initialized with a brace-enclosed initializer
    6 |   bool prime[MAX] = false;
      |                     ^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
#define REP1(i,n1,n2) for (int i=n1; i<n2; i++)
vi primes;

int get_primes(int m){
    int n = (m+1)/2, root = (int)(pow(n, 0.5));
    vector <bool> N(n, true);
    N[0]=false;

    if (m>1) primes.push_back(2);
    REP1(i,1,root){
        int tmp = i*2+1;
        if (N[i]){
            primes.push_back(tmp);
            for (int j=i+tmp; j<n+1; j+=tmp)
				N[j]=false;
        }
    }
    REP1(i,root,n+1)
        if(N[i]) primes.push_back(2*i+1);
    return 0;
}

int main(){
	get_primes(50100);
	while (true){
		int n,a,b;
		cin>>n;
		if (cin.eof()) break;
		REP1(i,0,(int)primes.size()){
			a=primes[i];
			if (a<n) b=a;
			else if (a>n) break;
		}
		cout<<b<<" "<<a<<endl;
	}
}

Compiler output:
a.cc: In function 'int get_primes(int)':
a.cc:9:35: error: 'pow' was not declared in this scope
    9 |     int n = (m+1)/2, root = (int)(pow(n, 0.5));
      |                                   ^~~
Language: Java

import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
int sum=0;
int amount=0;
int p=0;
int q=0;
int count=0;
while((line=br.readLine())!=null){
String[] values=line.split(",");
p=Integer.parseInt(values[0]);
q=Integer.parseInt(values[1]);
sum+=p*q;
amount+=q;
count++;
}
System.out.println(sum);
System.out.println(Math.round((flaot)amount/count));
}
}

Compiler output:
Main.java:21: error: cannot find symbol
System.out.println(Math.round((flaot)amount/count));
                               ^
  symbol:   class flaot
  location: class Main
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class AOJ_0045
{
  public static void main(String[] args) throws NumberFormatException, IOException
  {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    ArrayList<Integer[]> inputList = new ArrayList<>();

    while (input.ready())
    {
      final String[] inputStrArray = input.readLine().split(",");
      final Integer[] inputIntArray =
      { Integer.parseInt(inputStrArray[0]), Integer.parseInt(inputStrArray[1]) };

      inputList.add(inputIntArray);
    }
    final int[] ans = solver(inputList);
    System.out.println(ans[0]);
    System.out.println(ans[1]);

  }

  private static int[] solver(ArrayList<Integer[]> list)
  {
    int prodSum = 0;
    double sum = 0;
    for (Integer[] each : list)
    {
      prodSum += each[0] * each[1];
      sum += each[1];
    }
    final int[] ret =
    { prodSum, (int) Math.round(sum / list.size()) };
    return ret;
  }

}

Compiler output:
Main.java:6: error: class AOJ_0045 is public, should be declared in a file named AOJ_0045.java
public class AOJ_0045
       ^
1 error
Language: Java

public class Main {
	public static void main(String[] args) {
		int price;
		int n;
		int all = 0;
		int allN = 0;
		int rCount = 0;
		for (Scanner in = new Scanner(System.in); in.hasNext();) {
			String[] r = in.next().split(",");
			price = Integer.parseInt(r[0]);
			n = Integer.parseInt(r[1]);
			all += price * n;
			allN += n;
			rCount++;
		}
		System.out.println(all);
		System.out.println(Math.round((float) allN / rCount));
	}
}

Compiler output:
Main.java:8: error: cannot find symbol
		for (Scanner in = new Scanner(System.in); in.hasNext();) {
		     ^
  symbol:   class Scanner
  location: class Main
Main.java:8: error: cannot find symbol
		for (Scanner in = new Scanner(System.in); in.hasNext();) {
		                      ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	String str;
	int sum=0;
	float n=0,ave,j=1f;

	while((str=input.readLine())!=null)
	    {
		String str_ary[]=str.split(",");
		int a[]=new int[2];
		
		for(int i=0;i<2;i++)
		    {
			a[i]=Integer.parseInt(str_ary[i]);
		    }
		sum+=a[0]*a[1];
		n+=a[1];
		ave=n/j;
		if(ave%1>0.4)ave++;
		
		j++;
	    }
	System.out.println(sum+"\n"+(int)(ave));
    }
}

Compiler output:
Main.java:27: error: variable ave might not have been initialized
	System.out.println(sum+"\n"+(int)(ave));
	                                  ^
1 error
Language: C

#include <stdio.h>

int main(void)
{
	int a, b, sum_a = 0, sum_b = 0, c = 0;
	int syousuu = 0;
	
	while (scanf("%d,%d", &a, &b) != EOF){
		sum_a += a * b;
		sum_b += b;
		c++;
	}
	if (sum_b % c != 0 && 2 * (sum_b % c) >= c){
		syousuu = 1;
	}
	
	printf("%d\n%d\n", sum_a, syousuu + sum_b / c;);
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:17:54: error: expected ')' before ';' token
   17 |         printf("%d\n%d\n", sum_a, syousuu + sum_b / c;);
      |               ~                                      ^
      |                                                      )
Language: C

#include<stdio.h>
int main(void){
   int a, b, c, sum, i, n, ave2;
   double ave;
   while(scanf("%d, %d", &a, &b) = EOF){
      sum = sum + a * b;
      n = n + b;
   }
   ave = su / n;
   ave = ave * 2;
   ave2 = ave / 2;
   printf("%d\n%d\n", sum, ave2);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:34: error: lvalue required as left operand of assignment
    5 |    while(scanf("%d, %d", &a, &b) = EOF){
      |                                  ^
main.c:9:10: error: 'su' undeclared (first use in this function); did you mean 'sum'?
    9 |    ave = su / n;
      |          ^~
      |          sum
main.c:9:10: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(void){
   int a, b, sum, n, ave2;
   double ave;
   sum = 0;
   n = 0;
   while ( scanf("%d, %d", &a, &b) != EOF ){
      sum = sum + a * b;
      n = n + b;
      k++;
   }
   ave = n / k;
   ave = ave + 0.5;
   ave2 = ave;
   printf("%d\n%d\n", sum, ave2);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:7: error: 'k' undeclared (first use in this function)
   10 |       k++;
      |       ^
main.c:10:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(void){

??????int a, b, sum, n, ave, k;

??????sum = 0;

??????n = 0;

??????k = 0;

??????while ( scanf("%d,%d", &a, &b) != EOF ){

????????????sum = sum + a * b;

????????????n = n + b;

????????????k++;

??????}

??????ave = n / k * 10 + 5 / 2;

??????printf("%d\n%d\n", sum, ave);

??????return 0;

}

Compiler output:
main.c: In function 'main':
main.c:5:1: error: expected expression before '?' token
    5 | ??????int a, b, sum, n, ave, k;
      | ^
main.c:7:1: error: expected expression before '?' token
    7 | ??????sum = 0;
      | ^
main.c:7:7: error: 'sum' undeclared (first use in this function)
    7 | ??????sum = 0;
      |       ^~~
main.c:7:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:1: error: expected expression before '?' token
    9 | ??????n = 0;
      | ^
main.c:9:7: error: 'n' undeclared (first use in this function)
    9 | ??????n = 0;
      |       ^
main.c:11:1: error: expected expression before '?' token
   11 | ??????k = 0;
      | ^
main.c:11:7: error: 'k' undeclared (first use in this function)
   11 | ??????k = 0;
      |       ^
main.c:13:1: error: expected expression before '?' token
   13 | ??????while ( scanf("%d,%d", &a, &b) != EOF ){
      | ^
main.c:25:1: error: expected expression before '?' token
   25 | ??????printf("%d\n%d\n", sum, ave);
      | ^
main.c:25:31: error: 'ave' undeclared (first use in this function)
   25 | ??????printf("%d\n%d\n", sum, ave);
      |                               ^~~
main.c:27:1: error: expected expression before '?' token
   27 | ??????return 0;
      | ^
Language: C

#include<stdio.h>
int main(void){
   int a, b, sum, n, ave, k;
   sum = 0;
   n = 0;
   k = 0;
   while ( scanf("%d,%d", &a, &b) != EOF ){
      sum = sum + a * b;
      n = n + b;
      k++;
   }
   ave = ( n / k * 10 + 5 ) / 10;
   printf("%d\n%d\n", sum, ave2);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:28: error: 'ave2' undeclared (first use in this function); did you mean 'ave'?
   13 |    printf("%d\n%d\n", sum, ave2);
      |                            ^~~~
      |                            ave
main.c:13:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
   int a, b, sum, n, ave, k;
   sum = 0;
   n = 0;
   k = 0;
   while ( scanf("%d,%d", &a, &b) != EOF ){
      sum = sum + a * b;
      n = n + b;
      k++;
   }
   ave = ( n / k * 10 + 5 ) / 10;
   printf("%d\n%d\n", sum, ave2);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:28: error: 'ave2' undeclared (first use in this function); did you mean 'ave'?
   13 |    printf("%d\n%d\n", sum, ave2);
      |                            ^~~~
      |                            ave
main.c:13:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(void){
  int price=0;
  int number=0;
  int psum=0,nsum=0,count=0;
  while(scanf("%d,%d",&price,&number)!=EOF){
    psum += price*number;
    nsum += number;
    count++;
  }
  printf("%d\n",psum);
  double = nsum/count;
  if((nsum*10%)5>=5){nsum++;}
  printf("%d\n",nsum);
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:12:10: error: expected identifier or '(' before '=' token
   12 |   double = nsum/count;
      |          ^
main.c:13:15: error: expected expression before ')' token
   13 |   if((nsum*10%)5>=5){nsum++;}
      |               ^
Language: C

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

int main(){
int mono=0,kane=0,tmono,tkane,t=0;

while(0<=scanf("%d,%d",&tkane,&tmono)){
mono+=tmono;
kane+=(tmono*tkane);
if(tmono!=0)
t++;
}

printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:14:24: error: expected expression before 'int'
   14 | printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); return 0;
      |                        ^~~
Language: C

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

int main(){
int mono=0,kane=0,tmono,tkane,t=0;

while(0<=scanf("%d,%d",&tkane,&tmono)){
mono+=tmono;
kane+=(tmono*tkane);
if(tmono!=0)
t++;
}

printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5)); 
return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:14:24: error: expected expression before 'int'
   14 | printf("%d\n%d\n",kane,int(((double)mono)/((double)t)+0.5));
      |                        ^~~
Language: C

#include<stdio.h>

int main() {
	int sum = 0 , ave = 0 , count;
	while ( scanf("%d,%d",&m,&n),m != EOF ) {
		sum += m * n;
		count++;
	}
	ave = (int)(( sum / count ) +0.5);
	printf("%d\n%d\n",sum,ave);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:32: error: 'm' undeclared (first use in this function)
    5 |         while ( scanf("%d,%d",&m,&n),m != EOF ) {
      |                                ^
main.c:5:32: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:35: error: 'n' undeclared (first use in this function)
    5 |         while ( scanf("%d,%d",&m,&n),m != EOF ) {
      |                                   ^