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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;

/**
 * Surf Smelt Fishing Contest II
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		P0099 main = new P0099();

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			int q = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

			Angler[] anglers = new Angler[n + 1];
			for (int i = 1; i <= n; i++) {
				anglers[i] = main.new Angler(i);
			}

			Queue<Angler> pq = new PriorityQueue<>(new Comparator<Angler>() {
				@Override
				public int compare(Angler o1, Angler o2) {
					if (o1.catch_ == o2.catch_) {
						return Integer.compare(o1.id, o2.id);
					} else {
						return Integer.compare(o2.catch_, o1.catch_);
					}
				}
			});

			StringBuilder sb = new StringBuilder();

			for (int i = 0; i < q; i++) {
				line = br.readLine();
				int a, v;
				a = Integer.parseInt(line.substring(0, line.indexOf(' ')));
				v = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

				pq.remove(anglers[a]);
				anglers[a].catch_ += v;
				pq.add(anglers[a]);
				//
				sb.append(pq.peek().id + " " + pq.peek().catch_ + "\n");
			}
			System.out.print(sb.toString());

		} //end while
	} //end main

	class Angler {
		int id;
		int catch_ = 0;

		Angler(int id) {
			this.id = id;
		}
	}
}

Compiler output:
Main.java:18: error: cannot find symbol
		P0099 main = new P0099();
		^
  symbol:   class P0099
  location: class Main
Main.java:18: error: cannot find symbol
		P0099 main = new P0099();
		                 ^
  symbol:   class P0099
  location: class Main
2 errors
Language: Java

//Volume0-0099
import java.util.*;

public class Main_02 {
	public static void main(String[] args) {
	int n,q,a,v,top;
	int[] sum;
	
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sum = new int[n+2];
		top = n+1;
		sum[top] = Integer.MIN_VALUE;
		q = sc.nextInt();
		for(int i=0;i<q;i++){
			a = sc.nextInt();
			v = sc.nextInt();
			sum[a] += v;
			if(v<0&&a==top){
				sum[top] = Integer.MIN_VALUE;;
				top = n+1;
				for(int j=1;j<=n;j++){
					if(sum[j]>sum[top]){
						sum[top] = sum[j];
						top=j;
					} else if (sum[j]==sum[top] && j<top){
						top=j;
					}
				}
			} else {
				if((sum[a] > sum[top]) || (sum[a] == sum[top] && a < top)){
					top = a;
				}
			}
			System.out.println(top+" "+sum[top]);
		}
	}
}

Compiler output:
Main.java:4: error: class Main_02 is public, should be declared in a file named Main_02.java
public class Main_02 {
       ^
1 error
Language: C

#include <stdio.h>

void array_clear(int pep[],int num){
  int i;

  for(i=1;i<=n;i++){
    pep[i]=0;
  }
}

int main(void){
  int pep[1000000];
  int n,q;
  int i;
  int a,v;
  int maxa,maxv;

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

  array_clear(pep,n);

  maxa=0;
  maxv=-1;
  for(i=0;i<q;i++){
    scanf("%d%d",&a,&v);
    pep[a] += v;
    if(maxv < pep[a]){
      maxa=a;
      maxv=v;
    }
    printf("%d %d\n",maxa,maxv);
  }

  return 0;
}

Compiler output:
main.c: In function 'array_clear':
main.c:6:14: error: 'n' undeclared (first use in this function)
    6 |   for(i=1;i<=n;i++){
      |              ^
main.c:6:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

	for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;}
	for(i=0;i<9000;i++)vv[i]=0;
	for(;q>0;q--){
		scanf("%d %d",&a,&v);

		x=f[a];

		if(x>0){
			if(vv[x]==a){
				if(next[a]>0){vv[x]=next[a];}
				else vv[x]=0;
			}
			next[prev[a]]=next[a];
			prev[next[a]]=prev[a];
			prev[0]=0;next[0]=0;
		}

		f[a]+=v;x+=v;
		
		if(x>0){
			if(a<vv[x] || vv[x]==0){
				/*prev[a]=0;
				next[a]=vv[x];
				prev[vv[x]]=a;
				prev[0]=0;
				vv[x]=a;*/
			}
			else{
				/*i=vv[x];
				while(a<next[i] || next[i]>0)i=next[i];
				prev[a]=i;
				next[a]=next[i];
				prev[next[i]]=a;
				next[i]=a;
				prev[0]=0;*/
			}
		}else{prev[a]=0;next[a]=0;}
		
		if(v>0){if(x>vvv || (x==vvv && a<aaa)){vvv=x;aaa=a;}}
		else if(a==aaa){
			/*for(i=vvv;vv[i]<1 && i>0;i--);*/
			if(i==0){vvv=0;aaa=1;}
			else vvv=i;aaa=vv[i];
		}
		printf("%d %d\n",aaa,vvv);
		
	}
	return 0;
}

Compiler output:
main.c:1:9: error: expected identifier or '(' before 'for'
    1 |         for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;}
      |         ^~~
main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
    1 |         for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;}
      |                  ^~
main.c:1:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 |         for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;}
      |                       ^~
main.c:2:9: error: expected identifier or '(' before 'for'
    2 |         for(i=0;i<9000;i++)vv[i]=0;
      |         ^~~
main.c:2:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 |         for(i=0;i<9000;i++)vv[i]=0;
      |                  ^
main.c:2:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    2 |         for(i=0;i<9000;i++)vv[i]=0;
      |                         ^~
main.c:3:9: error: expected identifier or '(' before 'for'
    3 |         for(;q>0;q--){
      |         ^~~
main.c:3:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>' token
    3 |         for(;q>0;q--){
      |               ^
main.c:3:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '--' token
    3 |         for(;q>0;q--){
      |                   ^~
main.c:48:9: error: expected identifier or '(' before 'return'
   48 |         return 0;
      |         ^~~~~~
main.c:49:1: error: expected identifier or '(' before '}' token
   49 | }
      | ^
Language: C

#include <stdio.h>
#include <assert.h>
int main(void){
	int i,x,n,q,a,v,aaa=0,vvv=0,vv[9000],f[1000001],next[1000001],prev[1000001];
	scanf("%d %d",&n,&q);
	for(i=0;i<=1000000;i++){f[i]=0;prev[i]=0;next[i]=0;}assert(false);
	for(i=0;i<9000;i++)vv[i]=0;

	for(i=0;i<=n;i++)printf("%d %d %d\n",f[i],prev[i],next[i]);
	for(i=0;i<9000;i++)printf("%d\n",vv[i]);

	/*
	for(;q>0;q--){
		scanf("%d %d",&a,&v);

		x=f[a];

		if(x>0){
			if(vv[x]==a){
				if(next[a]>0){vv[x]=next[a];}
				else vv[x]=0;
			}
			next[prev[a]]=next[a];
			prev[next[a]]=prev[a];
			prev[0]=0;next[0]=0;
		}

		f[a]+=v;x+=v;
		
		if(x>0){
			if(a<vv[x] || vv[x]==0){
				prev[a]=0;
				next[a]=vv[x];
				prev[vv[x]]=a;
				prev[0]=0;
				vv[x]=a;
			}
			else{
				i=vv[x];
				fprintf(stderr,"%d\n",i);
				while(a>next[i] && next[i]>0){i=next[i];assert(i>0);}
				prev[a]=i;
				next[a]=next[i];
				prev[next[i]]=a;
				next[i]=a;
				prev[0]=0;
				assert(0);
			}
		}else{prev[a]=0;next[a]=0;}

		if(v>0){if(x>vvv || (x==vvv && a<aaa)){vvv=x;aaa=a;}}
		else if(a==aaa){
			for(i=vvv; vv[i]<1 && i>0 ;i--){assert(i>0 && i<9000);}
			vvv=i;
			aaa=vv[i];
		}
		printf("%d %d\n",aaa,vvv);
	}
	*/
	return 0;
}

Compiler output:
In file included from main.c:2:
main.c: In function 'main':
main.c:6:68: error: 'false' undeclared (first use in this function)
    6 |         for(i=0;i<=1000000;i++){f[i]=0;prev[i]=0;next[i]=0;}assert(false);
      |                                                                    ^~~~~
main.c:3:1: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include <assert.h>
  +++ |+#include <stdbool.h>
    3 | int main(void){
main.c:6:68: note: each undeclared identifier is reported only once for each function it appears in
    6 |         for(i=0;i<=1000000;i++){f[i]=0;prev[i]=0;next[i]=0;}assert(false);
      |                                                                    ^~~~~
Language: C

#include <stdio.h>

int main(void)
{
	int n,q,num,fish,i,j,vic=0,max=0,get[100];
	
	scanf("%d %d",&n,&q);
	
	for(i=1;i<=n;i++){
		get[i]=0;
	}
	for(i=0;i<q;i++){
		scanf("%d %d",&num,&fish);
		get[0]+=fish;
		if(fish<0 && num)
		max=0;
		for(j=n;j>0;j--){
			if(max<=get[j]){
				max=get[j];
				vic=j;
			}
		}
		else if(get[num]>max || (get[num]==max && vic>num)){
			max=get[num];
			vic=num;
		}
		printf("%d %d\n",vic,get[vic]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:17: error: 'else' without a previous 'if'
   23 |                 else if(get[num]>max || (get[num]==max && vic>num)){
      |                 ^~~~
Language: C

#include<stdio.h>
int main(){
int n,q,i,j;
scanf("%d %d",&n,&q);
int top=0;
int participant[n];
int x[q];
int y[q];
for(i=0;i<n;i++){
participant[i]=0;
}
for(i=0;i<q;i++){
int a,v;
scanf("%d %d",&a,&v);
participant[a-1]+=v;

if(a-1!=top){
if(participant[top]<participant[a-1]){
top=a-1;
}else{
top=0;
for(j=1;j<n;j++){
if(participant[top]<participant[j]){
top=j;
}
}
x[i]=top;
y[i]=participant[top];
}
for(i=0;i<q;i++){
printf("%d %d\n",x[i]+1,y[i]);
}
return 0;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

long long int n[1000001];
int flag[1000001];
map<int,int> m;

int main()
{
	memset(n,0,sizeof(n));
	memset(flag,0,sizeof(flag));
	int num,_q;
	cin >> num >> _q; 
		
	rep(i,_q)
	{
		int a,v;
		cin >> a >> v;
		
		n[a-1] += v;
		flag[a-1] = 1;
		
		long long int ans = n[0];
		rep(j,1000001)
		{
			if(flag[j] == 1) ans = max(ans,n[j]);
		}

		vector<int> res;
		rep(j,1000001)
		{
			if(n[j] == ans)
			{
				res.push_back(j);
			}
		}
		sort(res.begin(),res.end());
		cout << res[0]+1 << " " << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
   15 |         memset(n,0,sizeof(n));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <map>
  +++ |+#include <cstring>
    5 | #define rep(i,n) for(int i=0;i<n;i++)
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#define MAX_N 1000000
#define MAX_Q 100000
#define INF -1
using namespace std;

struct Human {
    int no;
    int point;
};
typedef struct Human Human;

int compareTo(const Human a, const Human b) {
    return(a.point > b.point);
}

void output(int nowData[], int n) {
    Human nowData_cp[n + 1];
    nowData_cp[0].no = INF;
    nowData_cp[0].point = INF;
    for(int r = 1; r <= n; r++) {
        nowData_cp[r].no = r;
        nowData_cp[r].point = nowData[r];
        //printf("data: %d, %d", nowData_cp[r].no, nowData_cp[r].point);
        //printf("data: %d, %d", r, nowData[r]);
    }
    sort(nowData_cp, nowData_cp+n+1, compareTo);
    printf("%d %d\n", nowData_cp[0].no, nowData_cp[0].point);
}

int main(void) {
    int n, q; cin >> n >> q;
    int nowData[n + 1];
    memset(nowData, 0, sizeof(nowData));
    for(int r = 0; r < q; r++) {
        int no, point; cin >> no >> point;
        nowData[no] += point;
        output(nowData, n);
    }
    
    return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'memset' was not declared in this scope
   36 |     memset(nowData, 0, sizeof(nowData));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | #define MAX_N 1000000
Language: C++

#include <iostream>
using namespace std;

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

	for (; q; --q) {
		int a, v;
		cin >> a >> v;
		fish[a - 1] += v;
		
		int max = 0;
		for (int i = 0; i < n; ++i) {
			if (fish[max] < fish[i]) {
				max = i;
			}
		}
		cout << max + 1 << ' ' << fish[max] << endl;
	}

	delete[] fish;
	return 0;
}

		
		int max = 0;
		for (int i = 0; i < n; ++i) {
			if (fish[max] < fish[i]) {
				max = i;
			}
		}
		cout << max + 1 << ' ' << fish[max] << endl;
	}

	delete[] fish;
	return 0;
}

Compiler output:
a.cc:32:17: error: expected unqualified-id before 'for'
   32 |                 for (int i = 0; i < n; ++i) {
      |                 ^~~
a.cc:32:33: error: 'i' does not name a type
   32 |                 for (int i = 0; i < n; ++i) {
      |                                 ^
a.cc:32:40: error: expected unqualified-id before '++' token
   32 |                 for (int i = 0; i < n; ++i) {
      |                                        ^~
a.cc:37:17: error: 'cout' does not name a type
   37 |                 cout << max + 1 << ' ' << fish[max] << endl;
      |                 ^~~~
a.cc:38:9: error: expected declaration before '}' token
   38 |         }
      |         ^
a.cc:40:9: error: expected unqualified-id before 'delete'
   40 |         delete[] fish;
      |         ^~~~~~
a.cc:41:9: error: expected unqualified-id before 'return'
   41 |         return 0;
      |         ^~~~~~
a.cc:42:1: error: expected declaration before '}' token
   42 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
#define MAX_EVENT 100000
int main() {
    int n, q, a, v, max_id, max_fish = -1;
    cin >> n >> q;
    int* player_id = new int [MAX_EVENT];
    int* player_fish = new int [MAX_EVENT];
    int entry = 0;
    while(q--) {
        cin >> a >> v;
        auto v1 = v;
        for(int i = 0; i < entry; i++) {
            if(player_id[i] == a) {
                v1 = player_fish[i] += v;
                break;

Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: expected '}' at end of input
   16 |                 break;
      |                       ^
a.cc:14:35: note: to match this '{'
   14 |             if(player_id[i] == a) {
      |                                   ^
a.cc:16:23: error: expected '}' at end of input
   16 |                 break;
      |                       ^
a.cc:13:40: note: to match this '{'
   13 |         for(int i = 0; i < entry; i++) {
      |                                        ^
a.cc:16:23: error: expected '}' at end of input
   16 |                 break;
      |                       ^
a.cc:10:16: note: to match this '{'
   10 |     while(q--) {
      |                ^
a.cc:16:23: error: expected '}' at end of input
   16 |                 break;
      |                       ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;
const int MAX_N = 1000010;
const int INF = INT_MAX;
namespace std {
  bool operator > (const P& a, const P& b) {
    return a.first != b.first ? a.first > b.first : a.second < b.second;
  }
}

int N, Q;
P v[2 * MAX_N - 1];

void init(int _n){
  N = 1;
  while(N < _n) N *= 2;
  REP(i, 2 * N - 1) v[i] = P(0, 0);
  REP(i, _n) v[i + N - 1].second = i;
}

void update(int k, int a){
  k += N - 1;
  v[k].first += a;
  while(k > 0){
    k = (k - 1) / 2;
    v[k] = max(v[k * 2 + 1], v[k * 2 + 2]);
  }
}

int main() {
  cin >>N >>Q;
  init(N);
  REP(i, Q){
    int a, b; cin >>a >>b;
    --a;
    update(a, b);
    cout <<v[0].second + 1 <<" " <<v[0].first <<endl;
  }
  return 0;
}

Compiler output:
a.cc:27:17: error: 'INT_MAX' was not declared in this scope
   27 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:20:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   19 | #include <ctime>
  +++ |+#include <climits>
   20 | using namespace std;
Language: C++

#include<stdio.h>
#defin BB 1000001

int main(){

int n[BB][2]={};
int x,y,N,Q;
int M,R;

scanf("%d %d",&N,&Q);

for(int i=0;i<Q;i++){
scanf("%d %d",&x,&y)
n[x][0]+=y;
if(i==0)M=x;R=y;
if(n[x][0]>R){R=n[x][0];M=x;}
else if(n[x][0]==R&&x<M){R=n[x][0];M=x;}

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

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #defin; did you mean #define?
    2 | #defin BB 1000001
      |  ^~~~~
      |  define
a.cc: In function 'int main()':
a.cc:6:7: error: 'BB' was not declared in this scope
    6 | int n[BB][2]={};
      |       ^~
a.cc:13:21: error: expected ';' before 'n'
   13 | scanf("%d %d",&x,&y)
      |                     ^
      |                     ;
   14 | n[x][0]+=y;
      | ~                    
a.cc:16:4: error: 'n' was not declared in this scope
   16 | if(n[x][0]>R){R=n[x][0];M=x;}
      |    ^
Language: C++

#include<stdio.h>
#define BB 1000001

int main(){

int n[BB][2]={};
int x,y,N,Q;
int M,R;

scanf("%d %d",&N,&Q);

for(int i=0;i<Q;i++){
scanf("%d %d",&x,&y)
n[x][0]+=y;
if(i==0)M=x;R=y;
if(n[x][0]>R){R=n[x][0];M=x;}
else if(n[x][0]==R&&x<M){R=n[x][0];M=x;}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: expected ';' before 'n'
   13 | scanf("%d %d",&x,&y)
      |                     ^
      |                     ;
   14 | n[x][0]+=y;
      | ~
Language: C++

#include <iostream>
#include<map>
#include <stdio.h>
#include <tchar.h>
#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

priority_queue<pair<int, int> > q;
int n, m, d[1000001], a, b;

int main(){
    scanf_s("%d%d", &n, &m);
    q.push(make_pair(0, -1));
    for(int i=0;i<m;i++){
        scanf_s("%d%d", &a, &b);
        d[a] += b;
        q.push(make_pair(d[a], -a));

        pair<int, int> p = q.top();
        printf("%d %d\n", -p.second, p.first);
    }
    return 0;
}

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

#include <iostream>
#include<map>
#include <stdio.h>
#include <tchar.h>
#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

priority_queue<pair<int, int> > q;
int n, m, d[1000001], a, b;

main(){
    scanf_s("%d%d", &n, &m);
    q.push(make_pair(0, -1));
    for(int i=0;i<m;i++){
        scanf_s("%d%d", &a, &b);
        d[a] += b;
        q.push(make_pair(d[a], -a));

        pair<int, int> p = q.top();
        printf("%d %d\n", -p.second, p.first);
    }
}

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

#include <iostream>
#include<map>
#include <stdio.h>
#include <tchar.h>
#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

priority_queue<pair<int, int> > q;
int n, m, d[1000001], a, b;

main(){
    scanf("%d%d", &n, &m);
    q.push(make_pair(0, -1));
    for(int i=0;i<m;i++){
        scanf("%d%d", &a, &b);
        d[a] += b;
        q.push(make_pair(d[a], -a));

        pair<int, int> p = q.top();
        printf("%d %d\n", -p.second, p.first);
    }
}

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

#include <sstream>

using namespace std;


int find_max(int* arr, int size) {
    int max = -1;
    for (int i = 0; i < size; i++) {
        if (arr[max] < arr[i]) {
            max = i;
        }
    }
    return max;
}

int main() {
    int n, q;
    cin >> n >> q;
    int* m = (int*)malloc(sizeof(int) * n);

    for (int i = 0; i < n; i++)
        m[i] = 0;

    int max = -1;
    for (int i = 0; i < q; i++) {
        int a, v;
        cin >> a >> v;
        m[a - 1] += v;

        if (v > 0) {
            if (m[max] < m[a - 1]) {
                max = a - 1;
            } else if (m[max] == m[a-1]) {
                for (int j = 0; j < n; j++) {
                    if (m[max] == m[j]) {
                        max = j;
                        break;
                    }
                }
            }
        } else {
            max = find_max(m, n);
        }

        cout << max + 1 << " " << m[max] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin >> n >> q;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <sstream>
  +++ |+#include <iostream>
    2 | 
a.cc:45:9: error: 'cout' was not declared in this scope
   45 |         cout << max + 1 << " " << m[max] << endl;
      |         ^~~~
a.cc:45:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

typedef pair<int, int> P;

void q99() {
	int n, q;

	for (; cin >> n >> q;) {
		//first??§???????????????????????????first??????second??§??????
		auto comp = [](P l, P r) { return l.first != r.first ? l.first < r.first : l.second < r.second; };
		priority_queue<P, vector<P>, decltype(comp) > queue(comp);
		int fish[100000];
		memset(fish, 0, sizeof(fish));

		for (int i = 0; i < q; i++) {
			int a_i, v_i;
			cin >> a_i >> v_i;
			fish[a_i] += v_i;
			queue.push(make_pair(fish[a_i], -a_i));
			for (; !queue.empty();) {
				auto top = queue.top();
				if (top.first == fish[-top.second]) {
					cout << -top.second << " " << top.first << endl;
					break;
				}
				queue.pop();
			}
		}
	}
}

int main() {
	q99();
	return 0;
}

Compiler output:
a.cc: In function 'void q99()':
a.cc:16:17: error: 'memset' was not declared in this scope
   16 |                 memset(fish, 0, sizeof(fish));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <queue>
#include <string>

using namespace std;

typedef pair<int, int> P;
int fish[100000];
//first??§???????????????????????????first??????second??§??????
auto comp = [](P l, P r) { return l.first != r.first ? l.first < r.first : l.second < r.second; };

void q99() {
	int n, q;
	for (; cin >> n >> q;) {

		priority_queue<P, vector<P>, decltype(comp) > queue(comp);
		memset(fish, 0, sizeof(fish));

		for (int i = 0; i < q; i++) {
			int a_i, v_i;
			cin >> a_i >> v_i;
			fish[a_i] += v_i;
			queue.push(make_pair(fish[a_i], -a_i));
			for (; !queue.empty();) {
				P top = queue.top();
				if (top.first == fish[-top.second]) {
					cout << -top.second << " " << top.first << endl;
					break;
				}
				queue.pop();
			}
		}
	}
}

int main() {
	q99();
	return 0;
}

Compiler output:
a.cc: In function 'void q99()':
a.cc:17:17: error: 'memset' was not declared in this scope
   17 |                 memset(fish, 0, sizeof(fish));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <queue>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#define min(a,b) {a > b ? b:a}
using namespace std;

long long int seg[1000000 * 2];
int id[1000000 * 2];

void q99() {
	int n, q;
	cin >> n >> q;

	for (int i = 0; i < N; i++) {
		id[i + N] = i;
	}
	for (int i = 0; i < q; i++) {
		int a, v;
		cin >> a >> v;
		segment[N + a - 1] += v;
		for (int j = (N + a - 1) >> 1; j > 0; j = j >> 1) {
			if (segment[j * 2] == segment[j * 2 + 1]) {
				segment[j] = segment[j * 2];
				id[j] = min(id[j * 2], id[j * 2 + 1]);
			}
			else if (segment[j * 2] > segment[j * 2 + 1]) {
				segment[j] = segment[j * 2];
				id[j] = id[j * 2];
			}
			else {
				segment[j] = segment[j * 2 + 1];
				id[j] = id[j * 2 + 1];
			}
		}
		cout << id[1] + 1 << " " << segment[1] << endl;
	}

}
int main() {
	q99();
	return 0;
}

Compiler output:
a.cc: In function 'void q99()':
a.cc:16:29: error: 'N' was not declared in this scope
   16 |         for (int i = 0; i < N; i++) {
      |                             ^
a.cc:22:17: error: 'segment' was not declared in this scope
   22 |                 segment[N + a - 1] += v;
      |                 ^~~~~~~
a.cc:22:25: error: 'N' was not declared in this scope
   22 |                 segment[N + a - 1] += v;
      |                         ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#define min(a,b) {a > b ? b:a}
using namespace std;

long long int segment[1000000 * 2];
int id[1000000 * 2];

void q99() {
	int n, q;
	cin >> n >> q;

	for (int i = 0; i < N; i++) {
		id[i + N] = i;
	}
	for (int i = 0; i < q; i++) {
		int a, v;
		cin >> a >> v;
		segment[N + a - 1] += v;
		for (int j = (N + a - 1) >> 1; j > 0; j = j >> 1) {
			if (segment[j * 2] == segment[j * 2 + 1]) {
				segment[j] = segment[j * 2];
				id[j] = min(id[j * 2], id[j * 2 + 1]);
			}
			else if (segment[j * 2] > segment[j * 2 + 1]) {
				segment[j] = segment[j * 2];
				id[j] = id[j * 2];
			}
			else {
				segment[j] = segment[j * 2 + 1];
				id[j] = id[j * 2 + 1];
			}
		}
		cout << id[1] + 1 << " " << segment[1] << endl;
	}

}
int main() {
	q99();
	return 0;
}

Compiler output:
a.cc: In function 'void q99()':
a.cc:16:29: error: 'N' was not declared in this scope
   16 |         for (int i = 0; i < N; i++) {
      |                             ^
a.cc:22:25: error: 'N' was not declared in this scope
   22 |                 segment[N + a - 1] += v;
      |                         ^
Language: C++

#include<iostream>
using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}

Compiler output:
a.cc:2:21: error: 'priority_queue' does not name a type
    2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}
      |                     ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:2:109: error: 'p' was not declared in this scope
    2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}
      |                                                                                                             ^
a.cc:2:174: error: 'p' was not declared in this scope
    2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}
      |                                                                                                                                                                              ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  
  int n, q, a, v;
  int cnt[1000001]={}, x, ma;

  cin>>n>>q;
  for(int i=0;i<q;i++){
    cin>>a>>v;
    cnt[a]+=v;
    ma=0;
    x=1;
    for(int j=1;j<=n;j++){
      if(cnt[j]>ma){
	ma=cnt[j];
	x=j;
      }else if(cnt[j]==ma&&x>j) x=j;
    }
    cout<<x<<" "<<ma<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:22:4: error: expected '}' at end of input
   22 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

import sys
def f():
 w=m=0;n,q=map(int,input().split());s=[0]*-~n
 for e in sys.stdin:
  a,v=map(int,e.split());s[a]+=v
  if v<0 and a==w:m=max(s);w=s.index(m)
  elif s[a]>m:w,m=a,s[a]
  elif s[a]==m:w=min(w,a)
  print(w,m)
f()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:8: error: 'n' does not name a type
    3 |  w=m=0;n,q=map(int,input().split());s=[0]*-~n
      |        ^
a.cc:3:37: error: 's' does not name a type
    3 |  w=m=0;n,q=map(int,input().split());s=[0]*-~n
      |                                     ^
a.cc:5:26: error: 's' does not name a type
    5 |   a,v=map(int,e.split());s[a]+=v
      |                          ^
a.cc:6:28: error: 'w' does not name a type
    6 |   if v<0 and a==w:m=max(s);w=s.index(m)
      |                            ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n, q, a, v;
    int maxA, maxV;
    cin>>n>>q;
    vector<int> list(n, 0);
    maxA = maxV = 0;
    while(cin>>a>>v) {
        a--;
        list[a] += v;
        if(v>0) {
            if(maxV < m[a]) {
                maxA = a;
                maxV = m[a];
            } else if(maxV == m[a]) {
                maxA = min(maxA, a);
            }
        }
        if(v<0) {
            if(a == maxA) {
                maxV = -1;
                for(int i=0; i<n; i++) {
                    if(maxV < list[i]) {
                        maxA = i;
                        maxV = list[i];
                    }
                }
            }
        }
        cout<<maxA+1<<" "<<maxV<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: 'm' was not declared in this scope
   15 |             if(maxV < m[a]) {
      |                       ^
Language: C++


int main(){
	int q,num,v,max,maxnum;
	
	
	maxnum = 0;
	cin >> n >> q;
	int wakasagi[10000];
	max = wakasagi[0];
	maxnum=0;
	for(int i=0;i<q;i++){
		 cin >> num >> v;
		 wakasagi[num] += v;
		 
		 if(v < 0){
			if(num == maxnum){
				wsearch(&max,&maxnum,wakasagi);
			}
		 } else if(v > 0){
			if(num != maxnum){
				wsearch(&max,&maxnum,wakasagi);
			}
		 }
		 
		 cout << maxnum << " " << max<< endl;
	}
	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n >> q;
      |         ^~~
a.cc:7:16: error: 'n' was not declared in this scope
    7 |         cin >> n >> q;
      |                ^
a.cc:17:33: error: 'wsearch' was not declared in this scope
   17 |                                 wsearch(&max,&maxnum,wakasagi);
      |                                 ^~~~~~~
a.cc:21:33: error: 'wsearch' was not declared in this scope
   21 |                                 wsearch(&max,&maxnum,wakasagi);
      |                                 ^~~~~~~
a.cc:25:18: error: 'cout' was not declared in this scope
   25 |                  cout << maxnum << " " << max<< endl;
      |                  ^~~~
a.cc:25:49: error: 'endl' was not declared in this scope
   25 |                  cout << maxnum << " " << max<< endl;
      |                                                 ^~~~
Language: C++



      if(f[B] == A) {
	cout << B << " " << A << endl;
	break;
      } else {
	pq.pop();
      }
    }
  }

Compiler output:
a.cc:3:7: error: expected unqualified-id before 'if'
    3 |       if(f[B] == A) {
      |       ^~
a.cc:6:9: error: expected unqualified-id before 'else'
    6 |       } else {
      |         ^~~~
a.cc:9:5: error: expected declaration before '}' token
    9 |     }
      |     ^
a.cc:10:3: error: expected declaration before '}' token
   10 |   }
      |   ^
Language: C++

// AOJ 0099 Surf Smelt Fishing Contest II

#include <iostream>

using namespace std;

const int MAX_N = 1 << 20;
int dat[2 * MAX_N - 1]; // 各節点に最大値を持つセグメント木
int n, n_dat, q;

void dat_init();
void dat_set(int i, int x);
void dat_add(int i, int x);
bool dat_is_leaf(int i);
pair<int, int> dat_max();

int
main()
{
    cin >> n;
    cin >> q;
    cin.ignore();

    dat_init();

    while (q--) {
        int a, v;
        pair<int, int> m;

        cin >> a;
        // 0-indexed にする
        a--;
        cin >> v;
        cin.ignore();

        dat_add(a, v);

        // 獲得数が最も多い参加者の番号とその獲得数を出力する
        m = dat_max();
        cout << m.first + 1 << " " << m.second << endl;
    }

    return 0;
}

// セグメント木の初期化
void
dat_init()
{
    int i;

    // 簡単のため、要素数を 2 の冪乗にする
    n_dat = 1;
    while (n_dat < n) n_dat *= 2;

    // 値の初期化
    for (i = 0; i < 2 * n_dat - 1; i++) dat[i] = INT_MIN;
    for (i = 0; i < n; i++) dat_set(i, 0);
}

// i 番目の値を x にする
void
dat_set(int i, int x)
{
    // 葉の節点
    i += n_dat - 1;
    dat[i] = x;

    // 登りながら更新
    while (i > 0) {
        i = (i - 1) / 2;
        dat[i] = max(dat[2 * i + 1], dat[2 * i + 2]);
    }
}

// i 番目の値に x を加算する
void
dat_add(int i, int x)
{
    // 葉の節点
    i += n_dat - 1;
    dat[i] += x;

    // 登りながら更新
    while (i > 0) {
        i = (i - 1) / 2;
        dat[i] = max(dat[2 * i + 1], dat[2 * i + 2]);
    }
}

// 最大値とそれに対応する番号のペアを返す。
// 複数の i が同じ最大値に対応するならば、最小の i を返す。
pair<int, int>
dat_max()
{
    int i = 1;
    int j = 2;

    for (;;) {
        if (dat[i] >= dat[j]) {
            // 最大値が左に存在するか、左右で同じ
            if (dat_is_leaf(i)) return pair<int, int>(i - n_dat + 1, dat[i]);
            i = 2 * i + 1;
        } else {
            // 最大値が右に存在する
            if (dat_is_leaf(i)) return pair<int, int>(j - n_dat + 1 , dat[j]);
            i = 2 * j + 1;
        }
        j = i + 1;
    }
}

// 要素 i が葉かどうかを返す
bool
dat_is_leaf(int i)
{
    return i >= n_dat - 1;
}

Compiler output:
a.cc: In function 'void dat_init()':
a.cc:57:50: error: 'INT_MIN' was not declared in this scope
   57 |     for (i = 0; i < 2 * n_dat - 1; i++) dat[i] = INT_MIN;
      |                                                  ^~~~~~~
a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <iostream>
  +++ |+#include <climits>
    4 |
Language: C++

#include<iostream>
using namespace std;


void f(int z){
	for(int i=0;i<z;i++){
	if(a[(z+i)*2][1]>=a[(z+i)*2+1][1]){
		a[z+i][0]=a[(z+i)*2][0];
		a[z+i][1]=a[(z+i)*2][1];
	}else{
		a[z+i][0]=a[(z+i)*2+1][0];
		a[z+i][1]=a[(z+i)*2+1][1];
	}
	}
	if(z!=1)f(z/2);
}


int main(){
	int m,x,y,n;
	int a[3000000][2]={};
	int q=0;
	cin>>n>>m;
	for(q=1;q<n;q=q*2){
	}
	for(int i=1;i<=n;i++)a[i+q-1][0]=i;
	for(int i=0;i<m;i++){
		cin>>x>>y;
		a[q+x-1][1]+=y;
		f(q/2);
		cout<<a[1][0]<<' '<<a[1][1]<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void f(int)':
a.cc:7:12: error: 'a' was not declared in this scope
    7 |         if(a[(z+i)*2][1]>=a[(z+i)*2+1][1]){
      |            ^
Language: C++

//J3で１番プログラミングと数学ができない奴のテストプログラム
//aoj0099
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(i = 0;i < n;i++)
#define F first
#define S second
typedef pair<int,int> P;
using namespace std;

class segtree{
	P *a;		//MAX_NUM,MAX_CNT
	int dep;	//Length from root to leaf
public:
	segtree(int depth,int x = 0){
		int i;
		int size = (1 << (depth+1))-1;
		a = new P[size];
		rep(i,size)
			a[i] = P(1,x);
	}
	~segtree(){
		delete[] a;
	}
	void add(int i,int x)
	{
		int index = (1 << dep)-1+i;
		int incnt = a[index].S + x;
		a[index] = P(index,incnt);
		while( index >= 0 )
		{
			if( (a[index].S < incnt) || (a[index].S == incnt && a[index].F > i) )
				a[index] = P( i,incnt );
			index = (index-1) >> 1; 
		}
	}
	P getmax(int i,int j)
	{
		if(i > j)
			swap(i,j);
		int index_l = (1 << dep)-1+i;
		int index_r = (1 << dep)-1+j;
		P ans;
	
		while( index_l < index_r )
		{
			if( (a[index_l].S >= a[index_r].S) )
				ans = a[index_l];
			else
				ans = a[index_r];
			index_l = ( (index_l-1) >> 1) +1;
			index_r = ( (index_r-1) >> 1) -1;
		}
		return ans;
	}
}
int main(){
	segtree seg(20);
	int n,q,a,b;
	int i;
	cin >> n >> q;
	rep(i,q)
	{
		cin >> a >> b;
		seg.add( a,b );
		cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl;
	}
	return 0;
}

Compiler output:
a.cc:9:9: error: 'pair' does not name a type
    9 | typedef pair<int,int> P;
      |         ^~~~
a.cc:13:9: error: 'P' does not name a type
   13 |         P *a;           //MAX_NUM,MAX_CNT
      |         ^
a.cc:38:9: error: 'P' does not name a type
   38 |         P getmax(int i,int j)
      |         ^
a.cc:57:2: error: expected ';' after class definition
   57 | }
      |  ^
      |  ;
a.cc: In constructor 'segtree::segtree(int, int)':
a.cc:19:17: error: 'a' was not declared in this scope
   19 |                 a = new P[size];
      |                 ^
a.cc:19:25: error: 'P' does not name a type
   19 |                 a = new P[size];
      |                         ^
a.cc:21:32: error: 'P' was not declared in this scope
   21 |                         a[i] = P(1,x);
      |                                ^
a.cc: In destructor 'segtree::~segtree()':
a.cc:24:26: error: 'a' was not declared in this scope
   24 |                 delete[] a;
      |                          ^
a.cc: In member function 'void segtree::add(int, int)':
a.cc:29:29: error: 'a' was not declared in this scope
   29 |                 int incnt = a[index].S + x;
      |                             ^
a.cc:30:28: error: 'P' was not declared in this scope
   30 |                 a[index] = P(index,incnt);
      |                            ^
a.cc: In function 'int main()':
a.cc:67:29: error: 'class segtree' has no member named 'getmax'
   67 |                 cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl;
      |                             ^~~~~~
a.cc:67:57: error: 'class segtree' has no member named 'getmax'
   67 |                 cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl;
      |                                                         ^~~~~~
Language: C++

//J3で１番プログラミングと数学ができない奴のテストプログラム
//aoj0099
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(i = 0;i < n;i++)
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;

class segtree{
	P *a;		//MAX_NUM,MAX_CNT
	int dep;	//Length from root to leaf
public:
	segtree(int depth,int x = 0){
		int i;
		int size = (1 << (depth+1))-1;
		a = new P[size];
		rep(i,size)
			a[i] = P(1,x);
	}
	~segtree(){
		delete[] a;
	}
	void add(int i,int x)
	{
		int index = (1 << dep)-1+i;
		int incnt = a[index].S + x;
		a[index] = P(index,incnt);
		while( index >= 0 )
		{
			if( (a[index].S < incnt) || (a[index].S == incnt && a[index].F > i) )
				a[index] = P( i,incnt );
			index = (index-1) >> 1; 
		}
	}
	P getmax(int i,int j)
	{
		if(i > j)
			swap(i,j);
		int index_l = (1 << dep)-1+i;
		int index_r = (1 << dep)-1+j;
		P ans;
	
		while( index_l < index_r )
		{
			if( (a[index_l].S >= a[index_r].S) )
				ans = a[index_l];
			else
				ans = a[index_r];
			index_l = ( (index_l-1) >> 1) +1;
			index_r = ( (index_r-1) >> 1) -1;
		}
		return ans;
	}
}
int main(){
	segtree seg(20);
	int n,q,a,b;
	int i;
	cin >> n >> q;
	rep(i,q)
	{
		cin >> a >> b;
		seg.add( a,b );
		cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl;
	}
	return 0;
}

Compiler output:
a.cc:57:2: error: expected ';' after class definition
   57 | }
      |  ^
      |  ;
Language: C++

#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;


int main(){
  int n,q;
  for(;cin>>n>>q;)
    {
      pair<int,int> tree[n*2-1];
      for(int i=0;i<n*2-1;i++)
	tree[i]=make_pair(0,0);
      for(int i=0;i<q;i++)
	{
	  int a,v;
	  cin>>a>>v;
	  a--;
	  int num=a+(n-1);
	  // cout<<num<<endl;
	  tree[num].first+=v;
	  tree[num].second=a+1;
	  pair<int,int> base;
	  while(true)
	    {
	      num=(num-1)/2;
	      if(tree[num*2+1].first<tree[num*2+2].first|| (tree[num*2+1].first==tree[num*2+2].first &&tree[num*2+1].second>tree[num*2+2].second))
		base=tree[num*2+2];
	      else
		base=tree[num*2+1];
	      tree[num]=base;
	      if(num==0)
		break;
	    }
	  cout<<tree[0].second<<" "<<tree[0].first<<endl;
	  //	  output();
	}
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'cin' was not declared in this scope
    9 |   for(;cin>>n>>q;)
      |        ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<cmath>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:35:11: error: 'cout' was not declared in this scope
   35 |           cout<<tree[0].second<<" "<<tree[0].first<<endl;
      |           ^~~~
a.cc:35:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:53: error: 'endl' was not declared in this scope
   35 |           cout<<tree[0].second<<" "<<tree[0].first<<endl;
      |                                                     ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<cmath>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: Java

# Edit: 2014/09/25
# Lang: Python3
# Time: 0.xxs
#

if __name__ == "__main__":

    while True:
        d = {}
        n = int(input())
        if not n:
            break  # exit at n=0

        for i in range(n):
            s, p, m = map(int, input().strip("\n").split(" "))
            # s:社員番号, p:価格, m:販売戸数
            # print(s, p, m)

            if s in d:
                d[s] = d[s] + p * m
            else:
                d[s] = p * m

        cnt = 0
        for k, v in d.items():
            if v >= 1000000:
                print(k)
                cnt +=1
        if not cnt:
            print("NA")

        #print(d)

Compiler output:
Main.java:1: error: illegal character: '#'
# Edit: 2014/09/25
^
Main.java:1: error: class, interface, enum, or record expected
# Edit: 2014/09/25
      ^
Main.java:2: error: illegal character: '#'
# Lang: Python3
^
Main.java:3: error: illegal character: '#'
# Time: 0.xxs
^
Main.java:4: error: illegal character: '#'
#
^
Main.java:12: error: illegal character: '#'
            break  # exit at n=0
                   ^
Main.java:16: error: illegal character: '#'
            # s:????, p:??, m:????
            ^
Main.java:17: error: illegal character: '#'
            # print(s, p, m)
            ^
Main.java:32: error: illegal character: '#'
        #print(d)
        ^
9 errors
Language: Java

import java.util.*;
public class Saleresult{
    public static void	main(String[] args){
        ArrayList<String> view=new ArrayList<String>();
	while(true){
            Scanner sc =new Scanner(System.in);
            int datanum=sc.nextInt();
            int[][] data=new int[datanum][4];
	    int encounter=0;
            if(datanum==0)break;
            for(int i=0;i<datanum;i++){
		for(int j=0;j<3;j++){
                    data[i][j]=sc.nextInt();
                }
                data[i][3]=data[i][1]*data[i][2];
		for(int e=i-1;e>=0;e--){
                    if(data[i][0]==data[e][0]&&data[e][3]<1000000){
                        data[i][3]+=data[e][3];
                        encounter=1;
                    }
                }
                if(data[i][3]>=1000000){
                    view.add(""+data[i][0]);
                    encounter=1;
                }
	    }
            if(encounter==0)view.add("NA");
        }
        for(int i=0;i<view.size();i++)System.out.println(view.get(i));
    }
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;


public class Sale_Result {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> SL = new ArrayList<String>();
		while(true){
			int num = Integer.parseInt(in.readLine());
			if(num == 0){
				break;
			}
			ArrayList<String> shain = new ArrayList<String>();
			HashSet<String> over = new HashSet<String>();
			HashMap<String,Integer> sale = new HashMap<String,Integer>();
			for(int i = 0;i<num;i++){
				String[] ss = in.readLine().split(" ");
				if(!over.contains(ss[0])){	
					if(!sale.containsKey(ss[0])){	
						sale.put(ss[0],0);
						shain.add(ss[0]);
					}
					int s = sale.get(ss[0])+Integer.parseInt(ss[1])*Integer.parseInt(ss[2]);
					sale.put(ss[0],s);
					if(s > 999999){
						over.add(ss[0]);
					}
				}
			}
			ArrayList<String> SLs = new ArrayList<String>();
			for(String s:shain){
				if(over.contains(s)){
					SLs.add(s);
				}
			}
			if(SLs.size() == 0){
				SLs.add("NA");
			}
			SL.addAll(SLs);
		}
		for(String s : SL){
			System.out.println(s);
		}

	}

}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;

public class Sale_Result {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> SL = new ArrayList<String>();
		while(true){
			int num = Integer.parseInt(in.readLine());
			if(num == 0){
				break;
			}
			HashSet<Integer> over = new HashSet<Integer>();
			HashMap<Integer,Integer> sale = new HashMap<Integer,Integer>();
			for(int i = 0;i<num;i++){
				String[] ss = in.readLine().split(" ");
				int ss0 = Integer.parseInt(ss[0]);
				if(!over.contains(ss0)){	
					if(!sale.containsKey(ss0)){	
						sale.put(ss0,0);
					}
					long s = (long)sale.get(ss0)+Long.parseLong(ss[1])*Long.parseLong(ss[2]);
					
					if(s > 999999){
						over.add(ss0);
					}
					else{
						sale.put(ss0,(int)s);
					}
				}
			}
			ArrayList<Integer> SSS = new ArrayList<Integer>(over);
			Collections.sort(SSS);
			if(SSS.size() == 0){
				SL.add("NA");
			}
			else{
				for(Integer i :SSS){
					SL.add(i.toString());
				}
				
			}
			
		}
		for(String s : SL){
			System.out.println(s);
		}

	}

}

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

{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<Integer>();

        while(true)
        {


            int n = sc.nextInt();
            int count = 0;
            //一つも社員番号が出力されなかった場合に(T)が実行されます.

            if ( n == 0 ) break;

            for ( int i = 0; i < n; i++ )
            {
                int dg = Integer.parseInt(sc.next());
                int tanka = Integer.parseInt(sc.next());
                int num = Integer.parseInt(sc.next());

                int total = tanka * num;

                if ( total >= 1000000 ) {
                    System.out.println(dg);
                    count += 1;
                }

            }

            if ( count == 0 ) System.out.println("NA"); //(T)

        }

    }

}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
{
^
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
    public static void main(String[] args)
                  ^
  (use --enable-preview to enable unnamed classes)
Main.java:38: error: class, interface, enum, or record expected
}
^
3 errors