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

import java.io.*;
import java.util.*;
import java.math.*;

public class A {
	public void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt();
			int m = sc.nextInt();
			
			int taro []= new int[n];
			int hana [] = new int [m];
			int tsum = 0;
			int hsum = 0;
			for(int i = 0 ; i < n ; i++)
			{
				taro[i] = sc.nextInt();
				tsum += taro[i];
			}
			for(int i = 0 ; i < m ; i++){
				hana[i] = sc.nextInt();
				hsum += hana[i];
			}
			
			int T=0;
			int H=0;
			int minTH=-1;
			for(int i = 0 ; i < n ; i++){
				for(int j = 0; j < m; j++){
					if(tsum - hsum == (taro[i] - hana[j])*2){
						if(minTH == -1 || minTH > taro[i]+hana[j]){
							T = taro[i];
							H = hana[j];
							minTH = T+H;
						}
					}
				}				
			}
			System.out.println(minTH==-1?-1:(T + " " + H));
		}
		
	}
	public static void main(String[] Aregs){
		A a = new A();
		a.run();
	}
}

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

import java.*;
import java.io.*;
import java.util.*; 
 
public class Myon
{
	public static void main(String args[]) throws Exception{
		new Myon().run();
	}
	
	
	public void run()
	{
		Scanner cin=new Scanner(System.in);
		while(true){
			int a,b;
			a = cin.nextInt();
			b = cin.nextInt();
			if(a==0 && b==0) return;
			int[] taro = new int[a];
			int[] hanako = new int[b];
			int sumt = 0, sumh = 0;
			int i,j;
			for(i=0;i<a;i++){
				sumt += taro[i] = cin.nextInt();
			}
			for(i=0;i<b;i++){
				sumh += hanako[i] = cin.nextInt();
			}
			boolean flag = false;
			for(i=0;i<a;i++){
				for(j=0;j<b;j++){
					if(sumt-sumh==(taro[i]-hanako[j])*2){
						if(!flag){
							flag = true;
							System.out.println(taro[i] + " " + hanako[j]);
						}
					}
				}
			}
			if(!flag) System.out.println(-1);
		}
	}
	
}

Compiler output:
Main.java:5: error: class Myon is public, should be declared in a file named Myon.java
public class Myon
       ^
Main.java:1: error: package java does not exist
import java.*;
^
2 errors
Language: Java

import java.util.*;

public class AOJ_1153{
    void run(){
        Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            int m = sc.nextInt();
            if( n == 0 && m == 0){
                break;
            }
            int[] taro = new int[n];
            int[] hana = new int[m];
            for(int i = 0; i < n; i++){
                taro[i] = sc.nextInt();
            }
            for(int i = 0; i < m; i++){
                hana[i] = sc.nextInt();
            }
            int sum_t = 0;
            for(int t: taro){
                sum_t += t;
            }
            int sum_h = 0;
            for(int h: hana){
                sum_h += h;
            }
            int diff = sum_t - sum_h;            
            String ans = "-1";
            for(int i = 0; i < n; i++){
                for(int ii = 0; ii < m; ii++){
                    if((taro[i] - hana[ii]) * 2 == diff){
                        ans = taro[i] + " " + hana[ii];
                        break;
                    }
                }
                if(ans != "-1"){
                    break;
                }
            }
            System.out.println(ans);
        }
    }
    public static void main(String[] args){
        new AOJ_1153().run();
    }
}

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

import java.util.Scanner;

public class EqualTotaolScore {
	public static void main(String[] args) {

		Scanner s = new Scanner(System.in);
		while (true) {
			int n = s.nextInt();
			int m = s.nextInt();

			if (n == 0 && m == 0)
				break;

			int[] taro = new int[n];
			int[] hana = new int[m];

			int sumt = 0;
			int sumh = 0;

			for (int i = 0; i < n; i++) {
				taro[i] = s.nextInt();
				sumt += taro[i];
			}

			for (int i = 0; i < m; i++) {
				hana[i] = s.nextInt();
				sumh += hana[i];
			}

			int t = 0, h = 0;

			if ((sumt + sumh) % 2 == 1)
				System.out.println("-1");

			else {
				// int ave = (sumt + sumh) / 2;

				if (sumt >= sumh) {
					int dif = (sumt - sumh) / 2;

					outer1: for (int count = 0; count < 100; count++) {
						t = count + dif;
						h = count;

						for (int x = 0; x < n; x++) {
							if (taro[x] == t) {
								// t = taro[x];
								for (int y = 0; y < m; y++) {
									if (hana[y] == h) {
										// h = hana[y];
										// System.out.println(t + " " + h);
										break outer1;
									}
								}
							}
						}
					}

				} else if (sumh > sumt) {
					int dif = (sumh - sumt) / 2;

					outer2: for (int count = 0; count < 100; count++) {
						t = count;
						h = count + dif;

						for (int y = 0; y < m; y++) {
							if (hana[y] == h) {
								// h = hana[y];
								for (int x = 0; x < n; x++) {
									if (taro[x] == t) {
										// t = taro[x];
										break outer2;
									}
								}
							}
						}
					}

				}

				if (t != 0 && h != 0 && t <= 100 && h <= 100)
					System.out.println(t + " " + h);
				else
					System.out.println(-1);

			}
		}
		s.close();
	}
}

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

2 2
1
5
3
7
6 5
3
9
5
2
3
3
12
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
3
2 3
1
1
2
2
2
0 0

Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 2 2
      | ^
Language: C

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

int main(void)
{
	int n,m;
	int i,j;
	int tarou[100];
	int hanako[100];
	int tarou_sum = 0,hanako_sum = 0;
	int sa;
	int ok = 0;
	int min_tarou = 999,min_hanako = 999;
	int min = 999;
	int hen = 0;
	while(1){
		scanf("%d %d",&m,&n);
		ok = 0;min_tarou =999;min_hanako = 999;
		min = 999;
		hanako_sum = 0;tarou_sum = 0;
		if(m == 0)break;
		
		for(i = 0;i < m;i++){
			scanf("%d",&tarou[i]);
			tarou_sum += tarou[i];
		}
		for(i = 0;i < n;i++){
			scanf("%d",&hanako[i]);
			hanako_sum += hanako[i];
		}
		
		if(abs(hanako_sum - tarou_sum) % 2){
			printf("-1\n");
			continue;
		}
		sa = abs(hanako_sum - tarou_sum) / 2;
		
		
		for(i = 0;i < m;i++){
			for(j = 0;j < n;j++){
				if(abs(tarou[i] - hanako[j]) == sa && min = tarou[i] + hanako[j] < min){
					min_tarou = tarou[i];
					min_hanako = hanako[j];
					
				}
			}
			
		}
		if(min_tarou == 999){
			printf("-1\n");
		}else{
			printf("%d %d\n",min_tarou,min_hanako);
		}
	}//while
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:41:75: error: lvalue required as left operand of assignment
   41 |                                 if(abs(tarou[i] - hanako[j]) == sa && min = tarou[i] + hanako[j] < min){
      |                                                                           ^
Language: C

#include<stdio.h>
int main()
{
  int n,x[400],y[400],i,m,j,x1,y1,l,t;
  char d,N,E,S,W;
  while(1){
    x1=10;
    y1=10;
    t=0;
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      scanf("%d%d",&x[i],&y[i]);
    }
    scanf("%d",m);
    for(j=0;j<m;j++){
      scanf("%c %d",&d,&l);
      if(d==N){y1=y1+l;}
      else if(d==E){x1=x1+l;}
      else if(d==S){y1=y1-l;}
      else if(d==W){x1=x1-l;}
      for(i=0;i<n;i++){
	if(y[i]==y1&&x[i]==x1){
	  t=t+1;}
      }
    }
    if(t==n){printf("yes");}
    else{printf("No");}
  }
  return 0;

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

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

int main(void)
{
int n,m,i,sum,sum1,sum2,d;
int ansa,ansb;
int a[100];
int b[100];

while(scanf("%d%d",&n,&m),n+m){

sum=0;
min=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
sum1+=a[i];
}
for(i=0;i<m;i++){
scanf("%d",&b[i]);
sum2+=b[i];
}

sum=sum1+sum2;

if(sum%2){
printf("-1\n");
} else {
d=abs(sum1-sum2)/2;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(d==abs(a[i]-b[j])){
if(min>a[i]+b[j]){
ansa=a[i];
ansb=b[j];
min=a[i]+b[j];
}
}
}
}
printf("%d %d\n",ansa,ansb);
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:1: error: 'min' undeclared (first use in this function); did you mean 'main'?
   14 | min=0;
      | ^~~
      | main
main.c:14:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:5: error: 'j' undeclared (first use in this function)
   31 | for(j=0;j<m;j++){
      |     ^
Language: C

#include<stdio.h>
int main(void)
{
  int n,m;
  int a[100];
  int b[100];
  int c[100];
  int i,j,k=0;
  int sum1=0,sum2=0;
  int x,y;
  int dec;
  int u1[100];
  int u2[100];
  int u3[100];
  int min,mini;
  int l=0;

  while(1){
    scanf("%d %d", &n, &m);
    if(n==0 && m==0)break;
    for(i=0;i<n,i++){
      scanf("%d", a[i]);
      sum1=sum1+a[i];
    }
    for(j=0;j<m;j++){
      scanf("%d", b[j]);
      sum2=sum2+b[j];
    }
    u=0;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if(dec/2=a[i]-b[j]){
	  u1[u]=a[i];
	  u2[u]=b[j];
	  u3[u]=a[i]+b[j];
	  u++;
	}
      }
    } 

    if(u>0){//????????????????????????????????´???
      min=u3[0];
      for(i=0;i<u;i++)
	if(u3[i]<min){
	  min=u3[i];
	  mini=i;
	}
      c[l++]=u1[mini]*1000+u2[mini];

     }else{  //????????´???
      c[l++]=-1;
     
    }

  }
  for(i=0;i<j;i++)
    if(c[i]!=-1)
      printf("%d %d\n", c[i]/1000, c[i]%1000);
    else 
      printf("%d\n", c[i]
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:20: error: expected ';' before ')' token
   21 |     for(i=0;i<n,i++){
      |                    ^
      |                    ;
main.c:29:5: error: 'u' undeclared (first use in this function)
   29 |     u=0;
      |     ^
main.c:29:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:32:17: error: lvalue required as left operand of assignment
   32 |         if(dec/2=a[i]-b[j]){
      |                 ^
main.c:60:26: error: expected ')' before 'return'
   60 |       printf("%d\n", c[i]
      |             ~            ^
      |                          )
   61 |   return 0;
      |   ~~~~~~                  
main.c:61:12: error: expected ';' before '}' token
   61 |   return 0;
      |            ^
      |            ;
   62 | }
      | ~
Language: C

 #include <stdio.h>
   
   int main(void){
           while(1){
                   int n,m;
                   scanf("%d%d",&n,&m);
                   if(n==0&&m==0)
                           break;
                   int Taro[100]={0},hanako[100]={0};
                  int sum[3]={200,200,200},sumtaro=0,sumhanako=0,i,o,p=0;
                  for(i=0;i<n;i++){
                          scanf("%d",&Taro[i]);sumtaro+=Taro[i];}
                  for(i=0;i<m;i++){
                          scanf("%d",&hanako[i]);sumhanako+=hanako[i];}
                  for(i=0;i<n;i++){
                          for(o=0;o<m;o++){
                                  if(sumtaro-Taro[i]+hanako[o]==sumhanako+Taro[i]-hanako[o]) 18                                 {
                                          if(sum[2]>Taro[i]+hanako[o]){
                                          sum[0]=Taro[i];
                                         sum[1]=hanako[o];
                                          sum[2]=Taro[i]+hanako[o];p++;}
                                  }       
                          }       
                  }       
                 
                  
         if(p==0)                printf("-1\n");
          else
                         printf("%d %d\n",sum[0],sum[1]);
         }               
          return 0;       
  }       

Compiler output:
main.c: In function 'main':
main.c:17:96: error: expected ';' before '{' token
   17 |                                   if(sumtaro-Taro[i]+hanako[o]==sumhanako+Taro[i]-hanako[o]) 18                                 {
      |                                                                                                ^                                ~
      |                                                                                                ;
Language: C

#include<iostream>

using namespace std;

int sum(int[] ,int );

int main(void){

  int n,m,sub,flag,cnum1,cnum2,i,j;
  scanf("%d%d",&n,&m);
  int a[n],b[m];

  while( (n==0&&m==0) != 1 ){ 

    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(j=0;j<m;j++) scanf("%d",&b[j]);

    sub = sum(a,n) - sum(b,m);


    flag=0;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if( (a[i] - b[j])*2 == sub ){
	  if(flag==0){
	    cnum1 = a[i];
	    cnum2 = b[j];
	    flag++;
	  }else{
	    if(a[i] + b[j] < cnum1 + cnum2){
	      cnum1 = a[i];
	      cnum2 = b[j];
	    }
	  }
	}
      }
    }


    if(flag==0){
      printf("-1\n");
    }else{
      printf("%d %d\n",cnum1,cnum2);
    }


    /*

sub = 2
1,3,4,8,3,1
3,1,4,5,3,2



     */

    scanf("%d%d",&n,&m);
  }
  
  return 0;
}

int sum(int a[],int n){
  int s=0;
  for(int i=0;i<n;i++) s+=a[i];
  return s;
}
  

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

#include<iostream.h>

using namespace std;

int sum(int[] ,int );

int main(void){

  int n,m,sub,flag,cnum1,cnum2,i,j;
  scanf("%d%d",&n,&m);
  int a[n],b[m];

  while( (n==0&&m==0) != 1 ){ 

    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(j=0;j<m;j++) scanf("%d",&b[j]);

    sub = sum(a,n) - sum(b,m);


    flag=0;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if( (a[i] - b[j])*2 == sub ){
	  if(flag==0){
	    cnum1 = a[i];
	    cnum2 = b[j];
	    flag++;
	  }else{
	    if(a[i] + b[j] < cnum1 + cnum2){
	      cnum1 = a[i];
	      cnum2 = b[j];
	    }
	  }
	}
      }
    }


    if(flag==0){
      printf("-1\n");
    }else{
      printf("%d %d\n",cnum1,cnum2);
    }


    /*

sub = 2
1,3,4,8,3,1
3,1,4,5,3,2



     */

    scanf("%d%d",&n,&m);
  }
  
  return 0;
}

int sum(int a[],int n){
  int s=0;
  for(int i=0;i<n;i++) s+=a[i];
  return s;
}
  

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

#include<iostream>

using namespace std;

int sum(int[] ,int );

int main(void){

  int n,m,sub,flag,cnum1,cnum2,i,j;
  scanf("%d%d",&n,&m);
  int a[n],b[m];

  while( (n==0&&m==0) != 1 ){ 

    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(j=0;j<m;j++) scanf("%d",&b[j]);

    sub = sum(a,n) - sum(b,m);


    flag=0;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if( (a[i] - b[j])*2 == sub ){
	  if(flag==0){
	    cnum1 = a[i];
	    cnum2 = b[j];
	    flag++;
	  }else{
	    if(a[i] + b[j] < cnum1 + cnum2){
	      cnum1 = a[i];
	      cnum2 = b[j];
	    }
	  }
	}
      }
    }


    if(flag==0){
      printf("-1\n");
    }else{
      printf("%d %d\n",cnum1,cnum2);
    }


    /*

sub = 2
1,3,4,8,3,1
3,1,4,5,3,2



     */

    scanf("%d%d",&n,&m);
  }
  
  return 0;
}

int sum(int a[],int n){
  int s=0,i;
  for(i=0;i<n;i++) s+=a[i];
  return s;
}
  

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

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

using namespace std;

int main(void){

  int n,m,in,sumt,sumh;
  vector<int>taro,hanako;

  while(cin >> n >> m,n|m){
    taro.clear();
    hanako.clear();

    sumt=0;
    sumh=0;

    for(int i=0;i<n;i++){
      cin >> in;
      sumt+=in;
      taro.push_back(in);
    }
    
    for(int i=0;i<m;i++){
      cin >> in;
      sumh+=in;
      hanako.push_back(in);
    }

    int Min=10000000,anst,ansh;
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
	if(sumt-taro[i]+hanako[j]==sumh+taro[i]-hanako[j]){
	  if(Min>taro[i]+hanako[j]){
	    Min=taro[i]+hanako[j];
	    anst=taro[i];
	    ansh=hanako[j];
	  }
	}
      }
    }
    
    if(Min==10000000)cout << -1 << endl;
    else cout << anst << " " << ansh << endl;
  }

  return 0;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
	int N,M;
	int Ntotal,Mtotal;
	int n[100],m[100];
	int min;
	
	while(true){
		Ntotal=0;
		Mtotal=0;
		min =INF;
		cin >> N >> M;
		if (N == M && N == 0)
			break;
		rep(i,N){
			cin >> n[i];
			Ntotal+=n[i];
		}
		rep(i,M){
			cin >> m[i];
			Mtotal+=m[i];
		}
		if(Mtotal== Ntotal){
			rep(i,N){
				rep(j,M){
					if(n[i] == m[j] && min > n[i])
						min = n[i];
				}
			}
			if(min == INF)
				cout << -1 << endl;
			else
				cout << min << ' ' << min << endl;
		}else{
			int tem1=INF,tem2=INF;
			min = Ntotal-Mtotal;
			rep(i,N){
				rep(j,M){
					if((n[i]-m[j])*2 == min && tem1+tem2 >n[i]+m[j]){
						tem1=n[i];
						tem2=m[j];
					}
				}
			}
			if(tem1==tem2)
				cout << -1 << endl;
			else
				cout <<tem1 << ' ' << tem2 <<  endl;
		}
 	}   
    return 0;
}

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

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

int main(){
	
	int a[100]={} , b[100]={} ;
	int n , m , rem ;
	int x , y , max ;
	
	while(1){
		cin >> n >> m ;
		if( n==0 && m==0 ) break;
		
		int sum[2] = {} ;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> a[i] ;
			sum[0] += a[i] ;
		}
		for( int i=0 ; i<m ; i++ ){
			cin >> b[i] ;
			sum[1] += b[i] ;
		}
		
		if( ( sum[0] + sum[1] ) % 2 == 1 ) cout << -1 << endl ;
		else {
			rem = abs( sum[0] - sum[1] ) / 2 ;
			x = -1 ;
			y = -1 ;
			max = 1000 ;
			
			for( int i=0 ; i<n ; i++ ){
				for( int j=0 ; j<m ; j++ ){
					if( rem == abs( a[i] - b[j] ) ){
						if( max >= a[i] + b[j] ){
							x = a[i] ;
							y = b[j] ;
							max = a[i] + b[j] ;
						}
					}
				}
			}
			
			if( x==-1 && y==-1 ) cout << -1 << endl ;
			else cout << x << ' ' << y <<endl ;
		}
		
	}
	
return 0;
}

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

2 2
1
5
3
7
6 5
3
9
5
2
3
3
12
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
3
2 3
1
1
2
2
2
0 0


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2 2
      | ^
Language: C++

#include<iostream>
#include<cstdlib>

using namespace std;

int main(){
	int t_num, h_num, sw_taro = 101, sw_hana = 101;
	int t_tot = 0, h_tot = 0, tmp, taro[100], hana[100];
	bool found = false;
	while (true){
		memset(taro, 0, sizeof(taro));
		memset(hana, 0, sizeof(hana));
		cin >> t_num >> h_num;
		if (t_num == 0)
			break;
		for (int i = 0; i < t_num; i++){
			cin >> taro[i];
			t_tot += taro[i];
		}
		for (int i = 0; i < h_num; i++){
			cin >> hana[i];
			h_tot += hana[i];
		}
		for (int i = 0; i < t_num; i++){
			tmp = taro[i];
			for (int j = 0; j < h_num; j++){
				if ((t_tot - tmp+hana[j]) == (h_tot - hana[j] + tmp))
				if ((taro[i] + hana[j]) < (sw_taro + sw_hana)){
					found = true;
					sw_taro = taro[i];
					sw_hana = hana[j];
				}
			}
		}
		if (found){
			cout << sw_taro << " " << sw_hana << endl;
		}
		else
			cout << "-1\n";
		found = false;
		sw_taro = 101;
		sw_hana = 101;
		h_tot = 0;
		t_tot = 0;
	}
	return 0;
}

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

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

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

int main()
{
    int n, m;
    while (cin >> n >> m, n | m) {
        vector<int> taro(n);
        REP(i, n) {
            cin >> taro[i];
        }
        vector<int> hanako(n);
        REP(i, m) {
            cin >> hanako[i];
        }


        pair<int, int> ans(INT_MAX, INT_MAX);
        int taroSum = accumulate(ALL(taro), 0);
        int hanakoSum = accumulate(ALL(hanako), 0);
        REP(i, n) {
            REP(j, m) {
                if (taroSum - taro[i] + hanako[j] == hanakoSum - hanako[j] + taro[i]) {
                    ans = min(ans, {taro[i], hanako[j]});
                }
            }
        }
        if (ans.first == INT_MAX) {
            ans.first = ans.second = -1;
        }
        cout << ans.first << " " << ans.second << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:28: error: 'INT_MAX' was not declared in this scope
   27 |         pair<int, int> ans(INT_MAX, INT_MAX);
      |                            ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 |
Language: C++

2 2
1
5
3
7
6 5
3
9
5
2
3
3
12
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
3
2 3
1
1
2
2
2
0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2 2
      | ^
Language: C++

#include <iostream>
#include <vector>
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
using namespace std;

int main(void){
	int T,H;
	whiele(cin>>T>>H){
		vector<int> taro(T),hanako(H);
		int tsum,hsum;
		rep(i,T){
			cin>>taro[i];
			tsum+=taro[i];
		}
		rep(i,H){
			cin>>hanako[i];
			hsum+=hanako[i];
		}
		
		int ttrade=-1,htrade=-1;
		rep(t1,T){
			rep(h1,H){
				if(tsum - taro[t1] + hanako[h1] == hsum - hanako[h1] + taro[t1]){
					ttrade = t1;
					htrade = h1;
					t1 = T;h1 = H; 
				}
			}
		}
		
		if(ttrade != -1)
			cout<< taro[trade]<<" "<<hanako[htrade]<<endl;
		else{
			cout<<-1<<endl;
		}
		
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'whiele' was not declared in this scope
    8 |         whiele(cin>>T>>H){
      |         ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin>>n>>m,n){
    int a[n],b[m];

    for(int &i:int *a)cin>>i;
    for(int &i:b)cin>>i;

    int sumA,sumB;
    sumA = sumB = 0;
    for( int i : a)sumA += i;
    for( int i : b)sumB += i;
    int diff = sumA - sumB;
    sort(a,a+n);
    sort(b,b+m);
    bool flag=true;
    for( int i : a){
      for(int j=m-1;j>=0;j--){
	if(2*abs(i-b[j])==abs(diff)){
	  cout << i << " " << b[j] << endl;
	  flag=false;
	  break;
	}
      }
      if(flag==false)break;
    }
    if(flag!=false)
      cout << -1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: expected primary-expression before 'int'
    9 |     for(int &i:int *a)cin>>i;
      |                ^~~
a.cc:9:16: error: expected ')' before 'int'
    9 |     for(int &i:int *a)cin>>i;
      |        ~       ^~~
      |                )
a.cc:9:22: error: expected initializer before ')' token
    9 |     for(int &i:int *a)cin>>i;
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin>>n>>m,n){
    int a[n],b[m];

    for(int &i:int *a)cin>>i;
    for(int &i:int *b)cin>>i;

    int sumA,sumB;
    sumA = sumB = 0;
    for( int i : int *a)sumA += i;
    for( int i : int *b)sumB += i;
    int diff = sumA - sumB;
    sort(a,a+n);
    sort(b,b+m);
    bool flag=true;
    for( int i : int *a){
      for(int j=m-1;j>=0;j--){
	if(2*abs(i-b[j])==abs(diff)){
	  cout << i << " " << b[j] << endl;
	  flag=false;
	  break;
	}
      }
      if(flag==false)break;
    }
    if(flag!=false)
      cout << -1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: expected primary-expression before 'int'
    9 |     for(int &i:int *a)cin>>i;
      |                ^~~
a.cc:9:16: error: expected ')' before 'int'
    9 |     for(int &i:int *a)cin>>i;
      |        ~       ^~~
      |                )
a.cc:9:22: error: expected initializer before ')' token
    9 |     for(int &i:int *a)cin>>i;
      |                      ^
a.cc:10:16: error: expected primary-expression before 'int'
   10 |     for(int &i:int *b)cin>>i;
      |                ^~~
a.cc:10:16: error: expected ')' before 'int'
   10 |     for(int &i:int *b)cin>>i;
      |        ~       ^~~
      |                )
a.cc:10:22: error: expected initializer before ')' token
   10 |     for(int &i:int *b)cin>>i;
      |                      ^
a.cc:14:18: error: expected primary-expression before 'int'
   14 |     for( int i : int *a)sumA += i;
      |                  ^~~
a.cc:14:17: error: expected ')' before 'int'
   14 |     for( int i : int *a)sumA += i;
      |        ~        ^~~~
      |                 )
a.cc:14:24: error: expected initializer before ')' token
   14 |     for( int i : int *a)sumA += i;
      |                        ^
a.cc:15:18: error: expected primary-expression before 'int'
   15 |     for( int i : int *b)sumB += i;
      |                  ^~~
a.cc:15:17: error: expected ')' before 'int'
   15 |     for( int i : int *b)sumB += i;
      |        ~        ^~~~
      |                 )
a.cc:15:24: error: expected initializer before ')' token
   15 |     for( int i : int *b)sumB += i;
      |                        ^
a.cc:20:18: error: expected primary-expression before 'int'
   20 |     for( int i : int *a){
      |                  ^~~
a.cc:20:17: error: expected ')' before 'int'
   20 |     for( int i : int *a){
      |        ~        ^~~~
      |                 )
a.cc:20:24: error: expected initializer before ')' token
   20 |     for( int i : int *a){
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin>>n>>m,n){
    int a[n],b[m];

    for(int &i:int *a)cin>>i;
    for(int &i:int *b)cin>>i;

    int sumA,sumB;
    sumA = sumB = 0;
    for( int i : int a)sumA += i;
    for( int i : int b)sumB += i;
    int diff = sumA - sumB;
    sort(a,a+n);
    sort(b,b+m);
    bool flag=true;
    for( int i : int a){
      for(int j=m-1;j>=0;j--){
	if(2*abs(i-b[j])==abs(diff)){
	  cout << i << " " << b[j] << endl;
	  flag=false;
	  break;
	}
      }
      if(flag==false)break;
    }
    if(flag!=false)
      cout << -1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: expected primary-expression before 'int'
    9 |     for(int &i:int *a)cin>>i;
      |                ^~~
a.cc:9:16: error: expected ')' before 'int'
    9 |     for(int &i:int *a)cin>>i;
      |        ~       ^~~
      |                )
a.cc:9:22: error: expected initializer before ')' token
    9 |     for(int &i:int *a)cin>>i;
      |                      ^
a.cc:10:16: error: expected primary-expression before 'int'
   10 |     for(int &i:int *b)cin>>i;
      |                ^~~
a.cc:10:16: error: expected ')' before 'int'
   10 |     for(int &i:int *b)cin>>i;
      |        ~       ^~~
      |                )
a.cc:10:22: error: expected initializer before ')' token
   10 |     for(int &i:int *b)cin>>i;
      |                      ^
a.cc:14:18: error: expected primary-expression before 'int'
   14 |     for( int i : int a)sumA += i;
      |                  ^~~
a.cc:14:17: error: expected ')' before 'int'
   14 |     for( int i : int a)sumA += i;
      |        ~        ^~~~
      |                 )
a.cc:14:23: error: expected initializer before ')' token
   14 |     for( int i : int a)sumA += i;
      |                       ^
a.cc:15:18: error: expected primary-expression before 'int'
   15 |     for( int i : int b)sumB += i;
      |                  ^~~
a.cc:15:17: error: expected ')' before 'int'
   15 |     for( int i : int b)sumB += i;
      |        ~        ^~~~
      |                 )
a.cc:15:23: error: expected initializer before ')' token
   15 |     for( int i : int b)sumB += i;
      |                       ^
a.cc:20:18: error: expected primary-expression before 'int'
   20 |     for( int i : int a){
      |                  ^~~
a.cc:20:17: error: expected ')' before 'int'
   20 |     for( int i : int a){
      |        ~        ^~~~
      |                 )
a.cc:20:23: error: expected initializer before ')' token
   20 |     for( int i : int a){
      |                       ^
Language: C++

#include<bis/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin>>n>>m,n){
    int a[n],b[m];

    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    for(int i=0;i<m;i++){
      cin>>b[i];
    }

    int sumA,sumB;
    sumA = sumB = 0;
    for( int i=0;i<n;i++)sumA += a[i];
    for( int i=0;i<m;i++)sumB += b[i];
    int diff = sumA - sumB;
    sort(a,a+n);
    sort(b,b+m);
    bool flag=true;
    for( int i=0;i<n;i++){
      for(int j=m-1;j>=0;j--){
	if(2*(a[i]-b[j])==diff){
	  cout << a[i] << " " << b[j] << endl;
	  flag=false;
	  break;
	}
      }
      if(flag==false)break;
    }
    if(flag!=false)
      cout << -1 << endl;
  }
  return 0;
}

Compiler output:
a.cc:1:9: fatal error: bis/stdc++.h: No such file or directory
    1 | #include<bis/stdc++.h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

// ConsoleApplication3.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	return 0;
}

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

using namespace std;

int main(){
	int n, m,o;
	list<int> A,B;
	while (cin >> n >> m){
		if (n == 0 && m == 0){
			break;
		}
		for (size_t i = 0; i < n; i++)
		{
			cin >> o;
			A.push_back(o);
		}
		for (size_t i = 0; i < m; i++)
		{
			cin >> o;
			B.push_back(o);
		}
		A.sort();
		B.sort();
		int A_sum = 0, B_sum = 0;
		for (auto e : A){
			A_sum += e;
		}
		for (auto e : B){
			B_sum += e;
		}
		//cout << A_sum << " " << B_sum << endl;
		A_sum -= B_sum;
		int x=A.front(), y=B.front();
		A.pop_front();
		B.pop_front();
		bool f = 1;
		while (1){
			if ((x - y)*2 == A_sum){
				cout << x << " " << y << endl;
				f = 0;
				break;
			}
			else if ((x - y)*2 < A_sum ){
				if (A.empty()){
					break;
				}
				x = A.front();
				A.pop_front();
			}
			else if ((x - y)*2 > A_sum){
				if (B.empty()){
					break;
				}
				y = B.front();
				B.pop_front();
			}
			//cout << x << " " << y << endl;

		}
		if (f){
			cout << "-1" << endl;
		}
		A.clear();
		B.clear();
	}
}

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

// AOJ 1153
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

const int NMAX = 108;

int sum(vector<int> v) {
  int s = 0;
  for (int x : v) {
    s += x;
  }
  return s;
}

int main() {
  int n, m;
  while (cin >> n >> m and n) {
    vector<int> S(n), T(m);
    REP(i, n) { cin >> S[i]; }
    REP(i, m) { cin >> T[i]; }

    sort(S.begin(), S.end());
    sort(T.begin(), T.end());

    int sums = sum(S), sumt = sum(T);
    int diff = sums - sumt;

    if (diff % 2 == 0) {
      diff /= 2;
      bool flag = true;
      for (int s : S) {
        if (find(T.begin(), T.end(), s - diff) != T.end()) {
          cout << s << " " << s - diff << endl;
          flag = false;
          break;
        }
      }
      if (flag) {
        cout << -1 << endl;
      }
    } else {
      cout << -1 << endl;
    }
  }
}

Compiler output:
a.cc:9:9: error: 'vector' was not declared in this scope
    9 | int sum(vector<int> v) {
      |         ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:9:16: error: expected primary-expression before 'int'
    9 | int sum(vector<int> v) {
      |                ^~~
a.cc: In function 'int main()':
a.cc:20:5: error: 'vector' was not declared in this scope
   20 |     vector<int> S(n), T(m);
      |     ^~~~~~
a.cc:20:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:20:12: error: expected primary-expression before 'int'
   20 |     vector<int> S(n), T(m);
      |            ^~~
a.cc:21:24: error: 'S' was not declared in this scope
   21 |     REP(i, n) { cin >> S[i]; }
      |                        ^
a.cc:22:24: error: 'T' was not declared in this scope
   22 |     REP(i, m) { cin >> T[i]; }
      |                        ^
a.cc:24:10: error: 'S' was not declared in this scope
   24 |     sort(S.begin(), S.end());
      |          ^
a.cc:25:10: error: 'T' was not declared in this scope
   25 |     sort(T.begin(), T.end());
      |          ^
a.cc:27:19: error: 'sum' cannot be used as a function
   27 |     int sums = sum(S), sumt = sum(T);
      |                ~~~^~~
a.cc:28:23: error: 'sumt' was not declared in this scope; did you mean 'sums'?
   28 |     int diff = sums - sumt;
      |                       ^~~~
      |                       sums
Language: C++

    for (int i=0; i < n; i++){
      cin >> sn[i];
      sumn += sn[i];
    }
    for (int i=0; i < m; i++){
      cin >> sm[i];
      summ += sm[i];
    }
    for (int i=0; i < n; i++){
      for (int j=0; j < m; j++){
	int a = sumn - sn[i] + sm[j];
	int b = summ - sm[j] + sn[i];
	if (a==b && sn[i]+sm[j] < min){
	  min = sn[i]+sm[j];
	  x = i;
	  y = j;
	}
      }
    }
    if (x==200)
      cout << "-1" << endl;
    else{
      cout << sn[x] << " " << sm[y] << endl;
    }
    cin >> n;
    cin >> m;
  }
}

Compiler output:
a.cc:1:5: error: expected unqualified-id before 'for'
    1 |     for (int i=0; i < n; i++){
      |     ^~~
a.cc:1:19: error: 'i' does not name a type
    1 |     for (int i=0; i < n; i++){
      |                   ^
a.cc:1:26: error: 'i' does not name a type
    1 |     for (int i=0; i < n; i++){
      |                          ^
a.cc:5:5: error: expected unqualified-id before 'for'
    5 |     for (int i=0; i < m; i++){
      |     ^~~
a.cc:5:19: error: 'i' does not name a type
    5 |     for (int i=0; i < m; i++){
      |                   ^
a.cc:5:26: error: 'i' does not name a type
    5 |     for (int i=0; i < m; i++){
      |                          ^
a.cc:9:5: error: expected unqualified-id before 'for'
    9 |     for (int i=0; i < n; i++){
      |     ^~~
a.cc:9:19: error: 'i' does not name a type
    9 |     for (int i=0; i < n; i++){
      |                   ^
a.cc:9:26: error: 'i' does not name a type
    9 |     for (int i=0; i < n; i++){
      |                          ^
a.cc:20:5: error: expected unqualified-id before 'if'
   20 |     if (x==200)
      |     ^~
a.cc:22:5: error: expected unqualified-id before 'else'
   22 |     else{
      |     ^~~~
a.cc:25:5: error: 'cin' does not name a type
   25 |     cin >> n;
      |     ^~~
a.cc:26:5: error: 'cin' does not name a type
   26 |     cin >> m;
      |     ^~~
a.cc:27:3: error: expected declaration before '}' token
   27 |   }
      |   ^
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

#include <iostream>
#include <utility>
#include <string>
#include <vector>

using namespace std;

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

int main()
{
  int n, m;
  while(cin >> n >> m, (n|m)) {
    int t[n];
    int ts = 0;
    int h[m];
    int hs = 0;

    rep(i, n) {
      cin >> t[i];
      ts += t[i];
    }
    rep(i, m) {
      cin >> h[i];
      hs += h[i];
    }

    int min = 1 << 29;
    int ta = 0;
    int ha = 0;
    rep(i, n) {
      rep(j, m) {
        if( ts - t[i] + h[j] == hs - h[j] + t[i] ) {
          if( min > t[i] + h[j] ) {
            min = t[i] + h[j];
            ta = t[i];
            ha = h[j];
          }
        }
      }
    }

    if( min == 1 << 29 ) {
      cout << "-1" << endl;
    } else {
      cout << ta << " " << ha << endl;
    }
  }

  return 0;
}
#include <iostream>
#include <utility>
#include <string>
#include <vector>

using namespace std;

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

int main()
{
  int n, m;
  while(cin >> n >> m, (n|m)) {
    int t[n];
    int ts = 0;
    int h[m];
    int hs = 0;

    rep(i, n) {
      cin >> t[i];
      ts += t[i];
    }
    rep(i, m) {
      cin >> h[i];
      hs += h[i];
    }

    int min = 1 << 29;
    int ta = 0;
    int ha = 0;
    rep(i, n) {
      rep(j, m) {
        if( ts - t[i] + h[j] == hs - h[j] + t[i] ) {
          if( min > t[i] + h[j] ) {
            min = t[i] + h[j];
            ta = t[i];
            ha = h[j];
          }
        }
      }
    }

    if( min == 1 << 29 ) {
      cout << "-1" << endl;
    } else {
      cout << ta << " " << ha << endl;
    }
  }

  return 0;
}

Compiler output:
a.cc:61:5: error: redefinition of 'int main()'
   61 | int main()
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main()
      |     ^~~~
Language: C++

#include<iostream>

using namespace std;

int main(void){
  int n,m;
  int i,j;
  int sn[101],sm[101];
  int s;
  while(true){
    cin >> n >> m;
    if(n == 0) break;
    memset(sn,0,sizeof(sn));
    memset(sm,0,sizeof(sm));
    s = 0;
    for(i = 0;i < n;i++){
      cin >> j;
      s += j;
      sn[j]++;
    }
    for(i = 0;i < m;i++){
      cin >> j;
      s -= j;
      sm[j]++;
    }    s /= 2;
    for(i = 0;i < 101;i++){
      if(sn[i] && i-s >= 0 && i-s <= 100){
	if(sm[i-s]){
	  cout << i << " " << i-s << endl;
	  break;
	}
      }
      if(i == 100) cout << -1 << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'memset' was not declared in this scope
   13 |     memset(sn,0,sizeof(sn));
      |     ^~~~~~
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 |
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
#include<stdint.h>

using namespace std;
int main()
{
    int n,m;
    int ansn,ansm;
    while(cin>>n>>m,n)
    {
        bool b=false;
        vector<int> nn;
        vector<int> mm;
        for(int i=0;i<n;i++)
        {
            int num;
            cin>>num;
            nn.push_back(num);
        }
        for(int i=0;i<m;i++)
        {
            int num;
            cin>>num;
            mm.push_back(num);
        }
        sort(nn.begin(),nn.end());
        sort(mm.begin(),mm.end());
        int numn=0;
        int numm=0;
        for(int i=0;i<n;i++)
        {
            numn+=nn[i];
        }
        for(int i=0;i<m;i++)
        {
            numm+=mm[i];
        }
        int minmn=INT_MAX;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                int a,b;
                a=numn;
                b=numm;
                numn-=nn[i];
                numm-=mm[j];
                numn+=mm[j];
                numm+=nn[i];
                if((minmn>=nn[i]+mm[j])&&numm==numn)
                {
                    ansn=nn[i];
                    ansm=mm[j];
                    minmn=(nn[i]+mm[j]);
                }
                numn=a;
                numm=b;
            }
        }
        if(minmn!=1000)cout<<ansn<<" "<<ansm<<endl;
        else cout<<"-1"<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:19: error: 'INT_MAX' was not declared in this scope
   42 |         int minmn=INT_MAX;
      |                   ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<stdint.h>
  +++ |+#include <climits>
    7 |
Language: C++

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

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define vec vector

int main(void)
{
	while(1) {
		int n, m;
		cin >> n >> m;
		if (n == 0 || m == 0) break;
		vec<int> a(n), b(m);
		int sum = 0;
		int suma = 0, sumb = 0;
		rep(i, n) {
			cin >> a[i];
			sum += a[i];
			suma += a[i];
		}
		rep(i, m) {
			cin >> b[i];
			sum += b[i];
			sumb += b[i]
		}

		sort(a.begin(), a.end());
		sort(b.begin(), b.end());

		if (sum % 2) {
			cout << -1 << endl;
			continue;
		}
		int aa = sum / 2 - suma;
		int bb = sum / 2 - sumb;

		int oka = - 1, okb = - 1;
		rep(i, n) if (aa == a[i]) oka = i;
		rep(i, m) if (bb == b[i]) okb = i;

		if (oka == 0 || okb == 0) cout << -1 << endl;
		else cout << a[oka] << " " << b[okb] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:37: error: expected ';' before '}' token
   27 |                         sumb += b[i]
      |                                     ^
      |                                     ;
   28 |                 }
      |                 ~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
int main() {
    int n,m,t,h,p,q,tmp,x;
    int a[102];
    int b[102];
    while(cin>>n>>m&&n!=0){t=0;h=0;
        for(int i=0;i<n;i++){
            cin>>a[i];t+=a[i];}
        for(int i=0;i<m;i++)
        {        cin>>b[i];h+=b[i];}
        x=t-h;tmp=INT_MAX;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if((a[i]-b[j])*2==x){
                    if(a[i]<tmp){tmp=a[i];
                        p=a[i];q=b[j];}
                }
            }
        }
        if(tmp!=INT_MAX)cout<<p<<" "<<q<<endl;
        else cout<<-1<<endl;}
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'INT_MAX' was not declared in this scope
   16 |         x=t-h;tmp=INT_MAX;
      |                   ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <queue>
  +++ |+#include <climits>
    5 | #include <vector>
Language: C++

include<stdio.h>

int main(){
  int i,j;
  int n,m;
  int s[300];
  int rel1=0;
  int rel2=0;
  int flag=0;
  int ans1=1000,ans2,ans3;

while(1){
    rel1=0;
    rel2=0;
    flag=0;
    ans1=1000;

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

    if(n==0&&m==0) break;

    for(i=0;i<n;i++){
      scanf("%d",&s[i]);
      rel1+=s[i];
    }
    for(j=n;j<m+n;j++){
      scanf("%d",&s[j]);
      rel2+=s[j];
    }

for(i=0;i<n;i++){
      rel1-=s[i];
      for(j=n;j<m+n;j++){
        rel2-=s[j];
        rel1+=s[j];
        rel2+=s[i];
        if(rel1==rel2){
          if(ans1>rel1){
            ans1=rel1;
            ans2=s[i];
            ans3=s[j];
          }
          flag=1;
        }else{
          rel2+=s[j];
          rel2-=s[i];
          rel1-=s[j];
        }
      }
      rel1+=s[i];
    }
    if(ans1!=1000) printf("%d %d\n",ans2,ans3);
    if(flag==0) printf("-1\n");
  }

  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
int n,m;
while (cin >> n,m, n|m) {
vi taro(n), hana(m);
REP(i, n) cin >> taro[i];
REP(i, m) cin >> hana[i];
int a = -1, b = -1;
REP(i, n) {
REP(j, m) {
swap(taro[i],hana[j]);
if (accumulate(ALL(taro), 0) == accumulate(ALL(hana), 0)) {
if (a == -1){
a = hana[i];
b = taro[i];
} else {
if (a + b > hana[i] + taro[i]) {
a = hana[i];
b = taro[i];
}
}
swap(taro[i],hana[j]);
}
if (a == -1) {
cout << a << endl;
} else {
cout << a << " " << b << endl;
}
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:2: error: expected '}' at end of input
   62 | }
      |  ^
a.cc:36:25: note: to match this '{'
   36 | while (cin >> n,m, n|m) {
      |                         ^
a.cc:62:2: error: expected '}' at end of input
   62 | }
      |  ^
a.cc:34:12: note: to match this '{'
   34 | int main() {
      |            ^
Language: C++

#include <iostream>
using namespace std;

int T[100];
int H[100];
int main(){
	int n, m;
	int Half,Tsum, Hsum;
	int Tn, Hn,Tans,Hans;
	while (1){
		cin >> n >> m;
		if (n == 0 && m == 0) break;
		Tsum = Hsum = 0;

		for (int i = 0; i < n; i++){
			cin >> T[i];
			Tsum += T[i];
		}
		for (int i = 0; i < m; i++){
			cin >> H[i];
			Hsum += H[i];
		}
		int flg = 0;
		if ((Hsum + Tsum) % 2 == 0){
			Half = (Hsum + Tsum) / 2;
			for (int i = 0; i < n; i++){
				Tn = Half - (Tsum - T[i]);
				for (int j = 0; j < m; j++){
					if (Tn == H[j]){
						Hn = Half - (Hsum - H[j]);
						if (Hn == T[i]){
							Tans = T[i];
							Hans = H[j];
							flg = 1;
							break;
						}
					}
				}
				if (flg == 1) break;
			}
		}
		if (flg == 1){
			cout << Tans << " " << Hans << endl;
		}
		else {
			cout << -1 << endl;
		}
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:49:18: error: expected '}' at end of input
   49 |         return 0;
      |                  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; ++i)
typedef vector<int> V;
int n, m;
int sn, sm;
int temp;
void swapsum(int i, int j, V &taro, V &hanako) {
  sn += hanako[j] - taro[i];
  sm += taro[i] - hanako[j];
  swap(taro[i], hanako[j]);
}

int main() {
  for(;;) {
    scanf("%d %d", &n, &m);
    if(n == 0 && m == 0) break;
    vector<int> taro(n);
    vector<int> hanako(m);
    REP(i, n) {scanf("%d", &taro[i]); sn += taro[i];}
    REP(i, m) {scanf("%d", &hanako[i]); sm += hanako[i];}
    sort(taro.begin(), taro.end());
    sort(hanako.begin(), hanako.end());
    if(sn < sm) {
      for(int i = 0; i < n; ++i) {
        for(int j = m - 1; j >= 0; --j) {
          swapsum(i, j, taro, hanako);
          if(sn == sm) {printf("%d %d\n", hanako[j], taro[i]); break;}
          else swapsum(i, j, taro, hanako);
        }
        if(sn == sm) break;
      }
    }else if(sn > sm) {
      for(int i = n - 1; i >= 0; --i) {
	for(int j = 0; j < m; ++j) {
          swapsum(i, j, taro, hanako);
          if(sn == sm) {printf("%d %d\n", hanako[j], taro[i]); break;}
          else swapsum(i, j, taro, hanako);
	}
        if(sn == sm) break;
      }
    }else {
      for(int i = 0; i < n; ++i) {
	int j;
	for(j = 0; j < m; ++j) {
          if(taro[i] == hanako[j]) {printf("%d %d\n", taro[i], hanako[j]);break;}
        }
        if(j != m) break;
      }
    }else if(sn > sm) {
      for(int i = n - 1; i >= 0; --i) {
        for(int j = 0; j < m; ++j) {
          swapsum(i, j, taro, hanako);
          if(sn == sm) {printf("%d %d\n", hanako[j], taro[i]); break;}
          else swapsum(i, j, taro, hanako);
        }
        if(sn == sm) break;
      }
    }else {
      for(int i = 0; i < n; ++i) {
        int j;
        for(j = 0; j < m; ++j) {
          if(taro[i] == hanako[j]) {printf("%d %d\n", taro[i], hanako[j]);break;}
        }
        if(j != m) break;
      }
    }
    if(sn != sm) printf("-1\n");
    sn = 0, sm = 0;
  }


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:6: error: 'else' without a previous 'if'
   50 |     }else if(sn > sm) {
      |      ^~~~