criyle/codenet-compile-errors huggingface dataset:
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) {
      |      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int n, w, ans, wt;
int main() {
  vector<P> v(120);
  scanf("%d", &n);
  for(int i = 0; i < n; ++i)  scanf("%d %d", &v[i].second, &v[i].first);
  scanf("%d", &w);
  sort(v.begin(), v.end(), greater<P>());
  for(int i = 0; i < n; ++i) {
    if(wt + v[i].second <= w) {
      ans += v[i].first;
      wt += v[i].second;
    }
  }
  printf("%d\n", ans);
  
  return 0;
}
[rexia@AR prog]$ cat prog-3.cpp
#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;
      }
    }
    if(sn != sm) printf("-1\n");
    sn = 0, sm = 0;
  }
  
  
  return 0;
}

Compiler output:
a.cc:21:7: error: stray '@' in program
   21 | [rexia@AR prog]$ cat prog-3.cpp
      |       ^
a.cc:21:1: error: expected unqualified-id before '[' token
   21 | [rexia@AR prog]$ cat prog-3.cpp
      | ^
a.cc:26:5: error: redefinition of 'int n'
   26 | int n, m;
      |     ^
a.cc:4:5: note: 'int n' previously declared here
    4 | int n, w, ans, wt;
      |     ^
a.cc:35:5: error: redefinition of 'int main()'
   35 | int main() {
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main() {
      |     ^~~~
Language: C++

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

const int INF;
const int MAX;

int x,y;
int sum [2];
int card[2][MAX];

void solve(){
     int n,m;
     int mini = INF;
for(int i=0;i<x;i++){
for(int j=0;j<y;j++){
   if(sum[0] - card[0][i] + card[1][j] ==sum[1] +card[0][i]-card[1][j]){
     if(card[0][i] + card[1][j] < mini){
       n = card[0][i];
       m = card[1][j];
       mini = n + m;
    }
   }
  }
}
if(mini<INF){
  printf("%d %d\n",n,m);
}
else{
printf("-1\n");
}
}

int main(){
    while (scanf("%d %d", &x, &y), x>0){
          in_x(sum,2,0);
    for(int i=0;i<2;++i){
       for(int j=0,1=(i==0 ? n:m);j<1;++j){
       scanf("%d",&card[i][j]);
       sum[i] +=card[i][j];
    }
   }

 solve();

}
return 0;

Compiler output:
a.cc:5:11: error: uninitialized 'const INF' [-fpermissive]
    5 | const int INF;
      |           ^~~
a.cc:6:11: error: uninitialized 'const MAX' [-fpermissive]
    6 | const int MAX;
      |           ^~~
a.cc:10:13: error: size of array 'card' is not an integral constant-expression
   10 | int card[2][MAX];
      |             ^~~
a.cc: In function 'int main()':
a.cc:36:11: error: 'in_x' was not declared in this scope
   36 |           in_x(sum,2,0);
      |           ^~~~
a.cc:38:20: error: expected unqualified-id before numeric constant
   38 |        for(int j=0,1=(i==0 ? n:m);j<1;++j){
      |                    ^
a.cc:38:20: error: expected ';' before numeric constant
   38 |        for(int j=0,1=(i==0 ? n:m);j<1;++j){
      |                    ^
      |                    ;
a.cc:38:30: error: 'n' was not declared in this scope
   38 |        for(int j=0,1=(i==0 ? n:m);j<1;++j){
      |                              ^
a.cc:38:32: error: 'm' was not declared in this scope
   38 |        for(int j=0,1=(i==0 ? n:m);j<1;++j){
      |                                ^
a.cc:38:38: error: expected ')' before ';' token
   38 |        for(int j=0,1=(i==0 ? n:m);j<1;++j){
      |           ~                          ^
      |                                      )
a.cc:38:41: error: 'j' was not declared in this scope
   38 |        for(int j=0,1=(i==0 ? n:m);j<1;++j){
      |                                         ^
a.cc:47:10: error: expected '}' at end of input
   47 | return 0;
      |          ^
a.cc:34:11: note: to match this '{'
   34 | int main(){
      |           ^
Language: C++

#include <cstdio>
#include <algorithm>


const int INF = 1 << 28;
const int MAX   = 100;

int n, m;
int sum[2];
int card[2][MAX];

void solve(){
    int t, h;
    int min_val = INF;
    
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            if(sum[0] - card[0][i] + card[1][j] == sum[1] + card[0][i] - card[1][j]){
                if(card[0][i] + card[1][j] < min_val){
                    t       = card[0][i];
                    h       = card[1][j];
                    min_val = t + h;
                }
            }
        }
    }
    
    if(min_val < INF){
        printf("%d %d\n", t, h);
    }
    
    else {
        printf("-1\n");
    }
}

int main(){
    
    while(scanf("%d %d", &n, &m), n > 0){
        
        fill_n(sum, 2, 0);
        
        for(int i = 0; i < 2; ++i){
            for(int j = 0, l = (i == 0 ? n : m); j < l; ++j){
                scanf("%d", &card[i][j]);
                sum[i] += card[i][j];
            }
        }
        
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'fill_n' was not declared in this scope; did you mean 'std::fill_n'?
   41 |         fill_n(sum, 2, 0);
      |         ^~~~~~
      |         std::fill_n
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:195:1: note: 'std::fill_n' declared here
  195 | fill_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __count, const _Tp& __value);
      | ^~~~~~
Language: C++

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

const int INF = 1 << 100;
const int MAX   = 100;

int n, m;
int sum[2];
int card[2][MAX];

void solve(){
    int x, y;
    int min_val = INF;
    
    for(int i = 0; i < x; ++i){
        for(int j = 0; j < y; ++j){
            if(sum[0] - card[0][i] + card[1][j] == sum[1] + card[0][i] - card[1][j]){
                if(card[0][i] + card[1][j] < min_val){
                    x       = card[0][i];
                    y       = card[1][j];
                    min_val = x + y;
                }
            }
        }
    }
    
    if(min_val < INF){
        printf("%d %d\n", x, y);
    }
    
    else {
        printf("-1\n");
    }
}

int main(){
    
    while(scanf("%d %d", &n, &m), n > 0){
        
        fill_n(sum, 2, 0);
        
        for(int i = 0; i < 2; ++i){
            for(int j = 0, l = (i == 0 ? x: y); j < l; ++j){
                scanf("%d", &card[i][j]);
                sum[i] += card[i][j];
            }
        }
        
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc:5:19: warning: left shift count >= width of type [-Wshift-count-overflow]
    5 | const int INF = 1 << 100;
      |                 ~~^~~~~~
a.cc: In function 'int main()':
a.cc:44:42: error: 'x' was not declared in this scope
   44 |             for(int j = 0, l = (i == 0 ? x: y); j < l; ++j){
      |                                          ^
a.cc:44:45: error: 'y' was not declared in this scope
   44 |             for(int j = 0, l = (i == 0 ? x: y); j < l; ++j){
      |                                             ^
Language: C++

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

const int INF = 1 << 100;
const int MAX   = 100;

int n, m;
int sum[2];
int card[2][MAX];

void solve(){
    int x, y;
    int min_val = INF;
    
    for(int i = 0; i < x; ++i){
        for(int j = 0; j < y; ++j){
            if(sum[0] - card[0][i] + card[1][j] == sum[1] + card[0][i] - card[1][j]){
                if(card[0][i] + card[1][j] < min_val){
                    x       = card[0][i];
                    y       = card[1][j];
                    min_val = x + y;
                }
            }
        }
    }
    
    if(min_val < INF){
        printf("%d %d\n", x, y);
    }
    
    else {
        printf("-1\n");
    }
}

int main(){
    
    while(scanf("%d %d", &n, &m), n > 0){
        
       in_n(sum, 2, 0);
        
        for(int i = 0; i < 2; ++i){
            for(int j = 0, l = (i == 0 ? n: m); j < l; ++j){
                scanf("%d", &card[i][j]);
                sum[i] += card[i][j];
            }
        }
        
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc:5:19: warning: left shift count >= width of type [-Wshift-count-overflow]
    5 | const int INF = 1 << 100;
      |                 ~~^~~~~~
a.cc: In function 'int main()':
a.cc:41:8: error: 'in_n' was not declared in this scope
   41 |        in_n(sum, 2, 0);
      |        ^~~~
Language: C++

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

const int INF = 1 << 50;
const int MAX   = 100;

int n, m;
int sum[2];
int card[2][MAX];

void solve(){
    int x, y;
    int min_val = INF;
    
    for(int i = 0; i < x; ++i){
        for(int j = 0; j < y; ++j){
            if(sum[0] - card[0][i] + card[1][j] == sum[1] + card[0][i] - card[1][j]){
                if(card[0][i] + card[1][j] < min_val){
                    x       = card[0][i];
                    y       = card[1][j];
                    min_val = x + y;
                }
            }
        }
    }
    
    if(min_val < INF){
        printf("%d %d\n", x, y);
    }
    
    else {
        printf("-1\n");
    }
}

int main(){
    
    while(scanf("%d %d", &n, &m), n > 0){
        
       in_n(sum, 2, 0);
        
        for(int i = 0; i < 2; ++i){
            for(int j = 0, l = (i == 0 ? n: m); j < l; ++j){
                scanf("%d", &card[i][j]);
                sum[i] += card[i][j];
            }
        }
        
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc:5:19: warning: left shift count >= width of type [-Wshift-count-overflow]
    5 | const int INF = 1 << 50;
      |                 ~~^~~~~
a.cc: In function 'int main()':
a.cc:41:8: error: 'in_n' was not declared in this scope
   41 |        in_n(sum, 2, 0);
      |        ^~~~
Language: C++

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

const int INF = 1 << 28;
const int MAX   = 100;

int n, m;
int sum[2];
int card[2][MAX];

void solve(){
    int x, y;
    int min_val = INF;
    
    for(int i = 0; i < x; ++i){
        for(int j = 0; j < y; ++j){
            if(sum[0] - card[0][i] + card[1][j] == sum[1] + card[0][i] - card[1][j]){
                if(card[0][i] + card[1][j] < min_val){
                    x       = card[0][i];
                    y       = card[1][j];
                    min_val = x + y;
                }
            }
        }
    }
    
    if(min_val < INF){
        printf("%d %d\n", x, y);
    }
    
    else {
        printf("-1\n");
    }
}

int main(){
    
    while(scanf("%d %d", &n, &m), n > 0){
        
       in_n(sum, 2, 0);
        
        for(int i = 0; i < 2; ++i){
            for(int j = 0, l = (i == 0 ? n: m); j < l; ++j){
                scanf("%d", &card[i][j]);
                sum[i] += card[i][j];
            }
        }
        
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:8: error: 'in_n' was not declared in this scope
   41 |        in_n(sum, 2, 0);
      |        ^~~~
Language: C++

#include <cstdio>
#include <algorithm>

using namespace std;

const int INF = 1 << 28;
const int MAX   = 100;

int taro, hanako;
int sum[2];
int card[2][MAX];

void solve(){
    int x, y;
    int min_val = INF;
    
    for(int i = 0; i < x; ++i){
        for(int j = 0; j < y; ++j){
            if(sum[0] - card[0][i] + card[1][j] == sum[1] + card[0][i] - card[1][j]){
                if(card[0][i] + card[1][j] < min_val){
                    x       = card[0][i];
                    y       = card[1][j];
                    min_val = x + y;
                }
            }
        }
    }
    
    if(min_val < INF){
        printf("%d %d\n", x, y);
    }
    
    else {
        printf("-1\n");
    }
}

int main(){
    
    while(scanf("%d %d", &taro, &hanako), taro > 0){
        
       fill_taro(sum, 2, 0);
        
        for(int i = 0; i < 2; ++i){
            for(int j = 0, su = (i == 0 ? taro: hanako); j < su; ++j){
                scanf("%d", &card[i][j]);
                sum[i] += card[i][j];
            }
        }
        
        solve();
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: 'fill_taro' was not declared in this scope
   42 |        fill_taro(sum, 2, 0);
      |        ^~~~~~~~~
Language: C++

    if(a==0 && b==0)break;
    flag=0;
    sumx=0;
    sumy=0;
    l=0;
    for(i=0;i<a;i++){
      scanf("%d",&c[i]);
      sumx+=c[i];
    }
    for(i=0;i<b;i++){
      scanf("%d",&d[i]);
      sumy+=d[i];
    }
    ans=sumx-sumy;
    if(sumx<=sumy){
      for(i=0;i<a;i++){
	for(j=0;j<b;j++){
	  if((d[j]-c[i])*2==-ans || (d[j]-c[i])*2==ans){
	    lsx[l]=c[i];
	    lsy[l]=d[j];
	    if(lsx[l]+lsy[l]<lsx[l-1]+lsy[l-1] || l==0){
	      dtx[p]=lsx[l];
	      dty[p]=lsy[l];
	      l++;
	    }
	  }
	}
      }
    }
    else{
      for(i=0;i<a;i++){
	for(j=0;j<b;j++){
	  if((c[i]-d[j])*2==-ans || (c[i]-d[j])*2==ans){
	    lsx[l]=c[i];
	    lsy[l]=d[j];
	    if(lsx[l]+lsy[l]<lsx[l-1]+lsy[l-1] || l==0){
	      dtx[p]=lsx[l];
	      dty[p]=lsy[l];
	      l++;
	    }
	  }
	}
      }
    }
    p++;
  }
  for(i=0;i<p;i++){
    if(dtx[i]==-1 && dty[i]==-1)
      printf("-1\n");
    else printf("%d %d\n",dtx[i],dty[i]);
  }
  return 0;
}

Compiler output:
a.cc:1:5: error: expected unqualified-id before 'if'
    1 |     if(a==0 && b==0)break;
      |     ^~
a.cc:2:5: error: 'flag' does not name a type
    2 |     flag=0;
      |     ^~~~
a.cc:3:5: error: 'sumx' does not name a type
    3 |     sumx=0;
      |     ^~~~
a.cc:4:5: error: 'sumy' does not name a type
    4 |     sumy=0;
      |     ^~~~
a.cc:5:5: error: 'l' does not name a type
    5 |     l=0;
      |     ^
a.cc:6:5: error: expected unqualified-id before 'for'
    6 |     for(i=0;i<a;i++){
      |     ^~~
a.cc:6:13: error: 'i' does not name a type
    6 |     for(i=0;i<a;i++){
      |             ^
a.cc:6:17: error: 'i' does not name a type
    6 |     for(i=0;i<a;i++){
      |                 ^
a.cc:10:5: error: expected unqualified-id before 'for'
   10 |     for(i=0;i<b;i++){
      |     ^~~
a.cc:10:13: error: 'i' does not name a type
   10 |     for(i=0;i<b;i++){
      |             ^
a.cc:10:17: error: 'i' does not name a type
   10 |     for(i=0;i<b;i++){
      |                 ^
a.cc:14:5: error: 'ans' does not name a type
   14 |     ans=sumx-sumy;
      |     ^~~
a.cc:15:5: error: expected unqualified-id before 'if'
   15 |     if(sumx<=sumy){
      |     ^~
a.cc:30:5: error: expected unqualified-id before 'else'
   30 |     else{
      |     ^~~~
a.cc:45:5: error: 'p' does not name a type
   45 |     p++;
      |     ^
a.cc:46:3: error: expected declaration before '}' token
   46 |   }
      |   ^
a.cc:47:3: error: expected unqualified-id before 'for'
   47 |   for(i=0;i<p;i++){
      |   ^~~
a.cc:47:11: error: 'i' does not name a type
   47 |   for(i=0;i<p;i++){
      |           ^
a.cc:47:15: error: 'i' does not name a type
   47 |   for(i=0;i<p;i++){
      |               ^
a.cc:52:3: error: expected unqualified-id before 'return'
   52 |   return 0;
      |   ^~~~~~
a.cc:53:1: error: expected declaration before '}' token
   53 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int s[100], t[100];

int main(){

    while(1){

        int n, m;
        cin>> n>> m;
        if(n==0&&m==0) break;
        for(int i=0; i<n; i++) cin>> s[i];
        for(int i=0; i<m; i++) cin>> t[i];

        int mi=300;
        vector<pair<int, int>> ans;
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                swap(s[i], t[j]);
                int s1=accumulate(s, s+n, 0);
                int s2=accumulate(t, t+m, 0);
                if(s1==s2){
                    if(s[i]+t[j]<mi){
                        ans.push_back(make_pair(t[j], s[i]));
                        mi=s[i]+t[j];
                    }
                }
                swap(s[i], t[j]);
            }
        }
        if(ans.size()==0){
            cout<< -1<< endl;
        }else{
            cout<< ans[0].first<< " "<< ans[0].second<< endl;
        }
        
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'vector' was not declared in this scope
   17 |         vector<pair<int, int>> ans;
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:17:29: error: expected primary-expression before '>' token
   17 |         vector<pair<int, int>> ans;
      |                             ^~
a.cc:17:32: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         vector<pair<int, int>> ans;
      |                                ^~~
      |                                abs
a.cc:21:24: error: 'accumulate' was not declared in this scope
   21 |                 int s1=accumulate(s, s+n, 0);
      |                        ^~~~~~~~~~
Language: C++

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

using namespace std;

int main(void){
	int n, m;
	int tmp;
	int sum_tarou, sum_hanako;
	bool frag;

	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0){
			break;
		}

		int t_change = 101, h_change = 101;
		frag = true;
		vector<int> tarou;
		vector<int> hanako;

		for(int i = 0; i < n; i++){
			cin >> tmp;
			tarou.push_back(tmp);
		}
		for(int i = 0; i < m; i++){
			cin >> tmp;
			hanako.push_back(tmp);
		}
		sum_tarou = accumulate(tarou.begin(), tarou.end(), 0);
		sum_hanako = accumulate(hanako.begin(), hanako.end(), 0);

		int diff = sum_tarou - sum_hanako;
		if(diff % 2 != 0){
			cout << "-1" <<endl;
			continue;
		}

		for(auto itr = tarou.begin(); itr != tarou.end(); ++itr){
			vector<int>::iterator citer = find(hanako.begin(), hanako.end(), *itr - diff/2);
			if(citer != hanako.end()){
				frag = false;
				if(*itr + *citer < t_change + h_change){
					t_change = *itr;
					h_change = *citer;
				}
			}
		}
		if(frag){
			cout << "-1" << endl;
		}else{
			cout << t_change << " " << h_change << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:59: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)'
   42 |                         vector<int>::iterator citer = find(hanako.begin(), hanako.end(), *itr - diff/2);
      |                                                       ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:42:59: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   42 |                         vector<int>::iterator citer = find(hanako.begin(), hanako.end(), *itr - diff/2);
      |                                                       ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main(void){
	int n, m;
	int tmp;
	int sum_tarou, sum_hanako;
	bool frag;

	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0){
			break;
		}

		int t_change = 101, h_change = 101;
		frag = true;
		vector<int> tarou;
		vector<int> hanako;

		for(int i = 0; i < n; i++){
			cin >> tmp;
			tarou.push_back(tmp);
		}
		for(int i = 0; i < m; i++){
			cin >> tmp;
			hanako.push_back(tmp);
		}
		sum_tarou = accumulate(tarou.begin(), tarou.end(), 0);
		sum_hanako = accumulate(hanako.begin(), hanako.end(), 0);

		int diff = sum_tarou - sum_hanako;
		if(diff % 2 != 0){
			cout << "-1" <<endl;
			continue;
		}

		for(auto itr = tarou.begin(); itr != tarou.end(); ++itr){
			vector<int>::iterator citer = hanako.find(hanako.begin(), hanako.end(), *itr - diff/2);
			if(citer != hanako.end()){
				frag = false;
				if(*itr + *citer < t_change + h_change){
					t_change = *itr;
					h_change = *citer;
				}
			}
		}
		if(frag){
			cout << "-1" << endl;
		}else{
			cout << t_change << " " << h_change << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:62: error: 'class std::vector<int>' has no member named 'find'
   41 |                         vector<int>::iterator citer = hanako.find(hanako.begin(), hanako.end(), *itr - diff/2);
      |                                                              ^~~~
Language: C++

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

int main(){
  int n, m, t, d, st, sh;
  while (cin >> n >> m, n||m){
    st = 0;
    sh = 0;
    vector<int> ta, ha;
    for (int i = 0; i < n; ++i){
      cin >> t;
      ta.push_back(t);
      st += t;
    }
    for (int i = 0; i < m; ++i){
      cin >> t;
      ha.push_back(t);
      sh += t;
    }
    sort(ta.begin(), ta.end());
    sort(ha.begin(), ha.end());
    if ((st - sh) % 2) cout << -1 << endl;
    else{
      d = (sh - st) / 2;
      int i = 0;
      int j = 0;
      t = 1;
      while ((i < n) && (j < m) && t){
	if (ta[i] + d < ha[j]) ++i;
	else if (ta[i] + d == ha[j]){
	  cout << ta[i] << " " << ha[j] << endl;
	  t = 0;
	}else ++j;
      }
      if (t) cout << -1 << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |     sort(ta.begin(), ta.end());
      |     ^~~~
      |     short
Language: C++

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

int main(){
  int n, m, t, d, st, sh;
  while (cin >> n >> m, n||m){
    st = 0;
    sh = 0;
    vector<int> ta, ha;
    for (int i = 0; i < n; ++i){
      cin >> t;
      ta.push_back(t);
      st += t;
    }
    for (int i = 0; i < m; ++i){
      cin >> t;
      ha.push_back(t);
      sh += t;
    }
    std::sort(ta.begin(), ta.end());
    std::sort(ha.begin(), ha.end());
    if ((st - sh) % 2) cout << -1 << endl;
    else{
      d = (sh - st) / 2;
      int i = 0;
      int j = 0;
      t = 1;
      while ((i < n) && (j < m) && t){
	if (ta[i] + d < ha[j]) ++i;
	else if (ta[i] + d == ha[j]){
	  cout << ta[i] << " " << ha[j] << endl;
	  t = 0;
	}else ++j;
      }
      if (t) cout << -1 << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   21 |     std::sort(ta.begin(), ta.end());
      |          ^~~~
      |          qsort
a.cc:22:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   22 |     std::sort(ha.begin(), ha.end());
      |          ^~~~
      |          qsort
Language: C++

#include<iostream>
using namespace std;

int main(){
	int n,m,i,j,sums,sumt,anss,anst,judge;
	int s[100];
	int t[100];

	while(cin>>n>>m,n||m){
		sums=sumt=0;
		anss=anst=100;
		judge=0;
		for(i=0;i<n;i++){
			cin>>s[i];
			sums+=s[i];
		}
		for(i=0;i<m;i++){
			cin>>t[i];
			sumt+=t[i];
		}

		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				int swaps=sums+t[j]-s[i];
				int swapt=sumt+s[i]-t[j];
				if(swaps==swapt&&anss+anst>s[i]+t[j]){
					anss=s[i];
					anst=t[j];
					judge=1;
				}
			}
		}
		if(judge==1){
			cout<<anss<<' '<<anst<<endl;
		}
		else{
			cout<<-1<<endl;
		}
	}

	return(0);
}#include<iostream>
using namespace std;

int main(){
	int n,m,i,j,sums,sumt,anss,anst,judge;
	int s[100];
	int t[100];

	while(cin>>n>>m,n||m){
		sums=sumt=0;
		anss=anst=100;
		judge=0;
		for(i=0;i<n;i++){
			cin>>s[i];
			sums+=s[i];
		}
		for(i=0;i<m;i++){
			cin>>t[i];
			sumt+=t[i];
		}

		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				int swaps=sums+t[j]-s[i];
				int swapt=sumt+s[i]-t[j];
				if(swaps==swapt&&anss+anst>s[i]+t[j]){
					anss=s[i];
					anst=t[j];
					judge=1;
				}
			}
		}
		if(judge==1){
			cout<<anss<<' '<<anst<<endl;
		}
		else{
			cout<<-1<<endl;
		}
	}

	return(0);
}

Compiler output:
a.cc:42:2: error: stray '#' in program
   42 | }#include<iostream>
      |  ^
a.cc:42:3: error: 'include' does not name a type
   42 | }#include<iostream>
      |   ^~~~~~~
a.cc:45:5: error: redefinition of 'int main()'
   45 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
Language: C++

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

	return 0;
}

Compiler output:
a.cc:6:9: error: expected unqualified-id before 'return'
    6 |         return 0;
      |         ^~~~~~
a.cc:7:1: error: expected declaration before '}' token
    7 | }
      | ^
Language: C++

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

int main(){
  while(true){
    int n, m;
    cin >> n >> m;
    if(n == 0)
      break;

    vector<int> taro(n+1), hana(m+1);
    int sumt = 0, sumh = 0;
    for(int i=0; i<n; i++){
      cin >> taro[i];
      sumt += taro[i];
    }
    taro[n] = 101;
    for(int i=0; i<m; i++){
      cin >> hana[i];
      sumh += hana[i];
    }
    hana[m] = 101;
    sort(taro.begin(), taro.end());
    sort(hana.begin(), hana.end());

    int ansi = n, ansj = m;
    for(int i=0; i<n; i++){
      for(int j=0; j<m; j++){
        if(sumt - taro[i] + hana[j] == sumh - hana[j] + taro[i]){
          if(taro[i] + hana[j] < taro[ansi] + hana[ansj]){
            ansi = i;
            ansj = j;
          }
          break;
        }
      }
    }
    if(ansi == n && ansj == m)
      cout << -1 << endl;
    else
      cout << taro[ansi] << ' ' << hana[ansj] << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(taro.begin(), taro.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int n,m; //number of cards                                     
  int ct[100],ch[100]; //each card                               
  int sub; //substraction                                        
  while(cin >> n >> m && n){
    memset(ct,0,100);
    memset(ch,0,100);
    int x=200+10;
    int tmpt=0,tmph=0; //temporary                               
    int st=0,sh=0; //sum of cards                                
    for(int i=0;i<n;i++){
      cin >> ct[i];
      st+=ct[i];
    }
    for(int i=0;i<m;i++){
      cin >> ch[i];
      sh+=ch[i];
    }
    //for(int i=0;i<n;i++)                                       
    //cout << ct[i] << endl;                                     
    //for(int i=0;i<m;i++)                                       
    //cout << ch[i] << endl;                                     
    //cout << st << endl;                                        
    //cout << sh << endl;                                        
    if(st>=sh){
      if((sh+st)%2==1)
        cout << "-1" << endl;
      else{
        sub=(st-sh)/2; //????????????????????????                        
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if(ct[i]-ch[j]==sub){
              if(ct[i]+ch[j]<x){
                x=ct[i]+ch[j];
                tmpt=ct[i];
                tmph=ch[j];
              }
}
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt << ' ' << tmph << endl;
        else
          cout << "-1" << endl;
      }
    }
    else if(sh>st){
      if((sh+st)%2==1)
        cout << "-1" << endl;
      else{
        sub=(sh-st)/2; //????????????????????????                        
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if(ch[i]-ct[j]==sub){
              if(ct[i]+ch[j]<x){
                x=ct[i]+ch[j];
                tmpt=ct[i];
                tmph=ch[j];
              }
}
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt <<       ' ' << tmph << endl;
        else
          cout << "-1" <<endl;
      }
    }
  }
}

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

}
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt <<       ' ' << tmph << endl;
        else
          cout << "-1" <<endl;
      }
    }
  }
}

Compiler output:
a.cc:1:1: error: expected declaration before '}' token
    1 | }
      | ^
a.cc:2:11: error: expected declaration before '}' token
    2 |           }
      |           ^
a.cc:3:9: error: expected declaration before '}' token
    3 |         }
      |         ^
a.cc:4:9: error: expected unqualified-id before 'if'
    4 |         if(tmpt>0 && tmph>0)
      |         ^~
a.cc:6:9: error: expected unqualified-id before 'else'
    6 |         else
      |         ^~~~
a.cc:8:7: error: expected declaration before '}' token
    8 |       }
      |       ^
a.cc:9:5: error: expected declaration before '}' token
    9 |     }
      |     ^
a.cc:10:3: error: expected declaration before '}' token
   10 |   }
      |   ^
a.cc:11:1: error: expected declaration before '}' token
   11 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int n,m; //number of cards                                     
  int ct[100],ch[100]; //each card                               
  int sub; //substraction                                        
  while(cin >> n >> m && n){
    memset(ct,0,100);
    memset(ch,0,100);
    int x=200+10;
    int tmpt=0,tmph=0; //temporary                               
    int st=0,sh=0; //sum of cards                                
    for(int i=0;i<n;i++){
      cin >> ct[i];
      st+=ct[i];
    }
    for(int i=0;i<m;i++){
      cin >> ch[i];
      sh+=ch[i];
    }
    //for(int i=0;i<n;i++)                                       
    //cout << ct[i] << endl;                                     
    //for(int i=0;i<m;i++)                                       
    //cout << ch[i] << endl;                                     
    //cout << st << endl;                                        
    //cout << sh << endl;                                        
    if(st>=sh){
      if((sh+st)%2==1)
        cout << "-1" << endl;
      else{
        sub=(st-sh)/2; //????????????????????????                        
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if(ct[i]-ch[j]==sub){
              if(ct[i]+ch[j]<x){
                x=ct[i]+ch[j];
                tmpt=ct[i];
                tmph=ch[j];
}
            }
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt << ' ' << tmph << endl;
        else
          cout << "-1" << endl;
      }
    }
    else if(sh>st){
      if((sh+st)%2==1)
        cout << "-1" << endl;
      else{
        sub=(sh-st)/2; //????????????????????????                        
        //cout << sub << endl;                                   
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if(ch[j]-ct[i]==sub){
              //cout << ct[i] << ch[j] << endl;                  
              if(ct[i]+ch[j]<x){
                x=ct[i]+ch[j];
                tmpt=ct[i];
tmph=ch[j];
              }
            }
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt << ' ' << tmph << endl;
        else
          cout << "-1" <<endl;
      }
    }
  }
}

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

while True:
    n, m = map(int, raw_input().split())

    if n == 0 and m == 0:
        break

    taro = sorted([int(raw_input()) for _ in range(n)])
    hanako = sorted([int(raw_input()) for _ in range(m)])

    diff = sum(taro) - sum(hanako)

    flag = False

    def fnc():
        global flag
        for i in taro:
            for j in hanako:
                if (i - j) * 2 == diff:
                    print i, j
                    flag = True
                    return

    fnc()

    if not flag:
        print -1



Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while True:
      | ^~~~~
Language: C++

#include "stdafx.h"
#include"iostream"
using namespace std;
int main() {
	int n, m, t[100], h[100], sumt = 0, sumh = 0, mint = 101, minh = 101;
	while (1) {
		cin >> n >> m;
		if (n == 0 && m == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> t[i];
			sumt += t[i];
		}
		for (int i = 0; i < m; ++) {
			cin >> h[i];a
			sumh += h[i];
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; i++) {
				if (sumt - t[i] + h[j] == sumh - h[j] + t[i]) {
					if (h[j] + t[i] < mint + minh) {
						mint == t[i];
						minh == h[j];
					}
				}
			}
		}
		if (mint == 101 && minh == 101)cout << "-1" << endl;
		else cout << mint << " " << minh << endl;
	}
	return 0;
}



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


#include"iostream"
using namespace std;
int main() {
	int n, m, t[100], h[100], sumt = 0, sumh = 0, mint = 101, minh = 101;
	while (1) {
		cin >> n >> m;
		if (n == 0 && m == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> t[i];
			sumt += t[i];
		}
		for (int i = 0; i < m; ++) {
			cin >> h[i];a
			sumh += h[i];
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; i++) {
				if (sumt - t[i] + h[j] == sumh - h[j] + t[i]) {
					if (h[j] + t[i] < mint + minh) {
						mint == t[i];
						minh == h[j];
					}
				}
			}
		}
		if (mint == 101 && minh == 101)cout << "-1" << endl;
		else cout << mint << " " << minh << endl;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:42: error: expected primary-expression before ')' token
   13 |                 for (int i = 0; i < m; ++) {
      |                                          ^
a.cc:14:37: error: 'a' was not declared in this scope
   14 |                         cin >> h[i];a
      |                                     ^
Language: C++

#include <bits/stdc++.h>

#define ll long long

using namespace std;

int n;
int m;

int s1[105]={};
int s2[105]={};


int main(){
    while(1){
        int sum1=0;
        int sum2=0;
        scanf("%d %d",&n,&m);
        if(n == 0 && m == 0) break;
        for(int i=0;i<n;i++){
            scanf("%d",&s1[i]);
            sum1 += s1[i];
        }
        for(int i=0;i<m;i++){
            scanf("%d",&s2[i]);
            sum2 += s2[i];
        }
    }
        int d = sum2-sum1;
        if(abs(d%2) == 1){
            cout << "-1" << endl;
            continue;
        }
        int t[105] = {};
        int h[105] = {};
        for(int i=0;i<n;i++) t[i] = s1[i];
        for(int i=0;i<m;i++) h[i] = s2[i];
        sort(t,t+n);
        sort(h,h+m);
        for(int i=0;i<n;i++) s1[i] = t[i];
        for(int i=0;i<m;i++) s2[i] = h[i];

        int judge = 0;
        int a,b;

        for(int i=0;i<n;i++){
            a = s1[i];
            b = a + d/2;
            if(b < 0 || 100 < b) continue;
            for(int j=0;j<m;j++){
                if(b == s2[j]){
                    judge = 1;
                    break;
                }
                if(b < s2[j]) break;
            }
            if(judge) break;
        }
        if(judge) cout << a << " " << b << endl;
        else cout << "-1" << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: 'sum2' was not declared in this scope; did you mean 's2'?
   29 |         int d = sum2-sum1;
      |                 ^~~~
      |                 s2
a.cc:29:22: error: 'sum1' was not declared in this scope; did you mean 's1'?
   29 |         int d = sum2-sum1;
      |                      ^~~~
      |                      s1
a.cc:32:13: error: continue statement not within a loop
   32 |             continue;
      |             ^~~~~~~~
a.cc: At global scope:
a.cc:62:1: error: expected declaration before '}' token
   62 | }
      | ^
Language: C++

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,m;
	while(cin>>n>>m,n){
		int cd[200]; int t=0,h=0;
		rep(i,n)cin>>cd[i],t+=cd[i];
		rep(i,m)cin>>cd[i+n],h+=cd[i+n];
		sort(cd,cd+n),sort(cd+n,cd+n+m);
		
		rep(i,n)rep(j,m){
			if(t-cd[i]+cd[j+n]==h-cd[j+n]+cd[i]){
				cout<<cd[i]<<" "<<cd[j+n]<<endl;; goto NEXT;
			}
		}
		cout<<-1<<endl;
		NEXT:;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'cin' was not declared in this scope
    5 |         while(cin>>n>>m,n){
      |               ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i,n) for(int i=0;i<n;i++)
a.cc:9:17: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |                 sort(cd,cd+n),sort(cd+n,cd+n+m);
      |                 ^~~~
      |                 short
a.cc:13:33: error: 'cout' was not declared in this scope
   13 |                                 cout<<cd[i]<<" "<<cd[j+n]<<endl;; goto NEXT;
      |                                 ^~~~
a.cc:13:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:60: error: 'endl' was not declared in this scope
   13 |                                 cout<<cd[i]<<" "<<cd[j+n]<<endl;; goto NEXT;
      |                                                            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i,n) for(int i=0;i<n;i++)
a.cc:16:17: error: 'cout' was not declared in this scope
   16 |                 cout<<-1<<endl;
      |                 ^~~~
a.cc:16:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:27: error: 'endl' was not declared in this scope
   16 |                 cout<<-1<<endl;
      |                           ^~~~
a.cc:16:27: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<iostream>
#include<vector>

using namespace std;

struct DATA{
  int x;
  int y;
};

vector<int> ScanData(int);
int CalcurateSum(vector<int>);
bool Compare(const DATA&, const DATA&);

int main(){
  int i, j, n, m;
  int sum_n1, sum_n2, sum_m1, sum_m2;
  vector<int> data1, data2;
  DATA equal;
  vector<DATA> equals;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;

    data1 = ScanData(n);
    data2 = ScanData(m);
    sum_n1 = CalcurateSum(data1);
    sum_m1 = CalcurateSum(data2);

    for(i=0; i<n; ++i){
      for(j=0; j<m; ++j){
        sum_n2 = sum_n1 - data1[i] + data2[j];
        sum_m2 = sum_m1 + data1[i] - data2[j];

        if(sum_n2 == sum_m2){
          equal.x = data1[i];
          equal.y = data2[j];
          equals.push_back(equal);
        }
      }
    }

    if(equals.size() >= 2)
      sort(equals.begin(), equals.end(), Compare);

    if(equals.size() == 0)
      cout << "-1" << endl;
    else
      cout << equals[0].x << " " << equals[0].y << endl;

    data1.clear();
    data2.clear();
    equals.clear();
  }

  return 0;
}

vector<int> ScanData(int n){
  int i, s;
  vector<int> data;

  for(i=0; i<n; ++i){
    cin >> s;
    data.push_back(s);
  }
  return data;
}

int CalcurateSum(vector<int> data){
  int i, sum=0;

  for(i=0; i<data.size(); ++i)
    sum += data[i];
  return sum;
}


bool Compare(const DATA& a, const DATA& b){
  return (a.x+a.y < b.x+b.y);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   45 |       sort(equals.begin(), equals.end(), Compare);
      |       ^~~~
      |       short
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(void){
	int n,m,hanaSum,taroSum,gap,hana[100],taro[100];
	bool flag;
	
	while(cin>>n>>m,n&&m){
		
		flag=false;
		hanaSum=0;
		taroSum=0;
		memset(taro,0,sizeof(taro));
		memset(hana,0,sizeof(hana));
		
		for(int i=0;i<n;i++){
			cin>>taro[i];
			taroSum=taroSum+taro[i];
		}
		for(int i=0;i<m;i++){
			cim>>hana[i];
			hanaSum=hanaSum+hana[i];
		}
		
		gap=hanaSum-taroSum;
		
		if(gap<0){
			gap=gap*(-1);
		}
		
		for(int i=0;i<n,i++){
			for(int j=0;j<m;j++){
				if(gap==taro[i]+hana[j]){
					cout<<taro[i]<<hana[j]<<endl;
					flag=true;
					break;
				}
			}
			if(flag){
				break;
			}
		}
		if(!flag){
			cout<<-1<<endl;
		}
	}
	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(taro,0,sizeof(taro));
      |                 ^~~~~~
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 | #include<string>
a.cc:23:25: error: 'cim' was not declared in this scope
   23 |                         cim>>hana[i];
      |                         ^~~
a.cc:33:36: error: expected ';' before ')' token
   33 |                 for(int i=0;i<n,i++){
      |                                    ^
      |                                    ;
Language: C++

#include<iostream>
#include<string.h>

using namespace std;

int main(void){
	int n,m,hanaSum,taroSum,hanacr,tarocr,gap,hana[100],taro[100];
	
	while(cin>>n>>m,n&&m){
		
		flag=false;
		hanaSum=0;
		taroSum=0;
		hanacr=0;
		tarocr=0;
		memset(taro,0,sizeof(taro));
		memset(hana,0,sizeof(hana));
		
		for(int i=0;i<n;i++){
			cin>>taro[i];
			taroSum=taroSum+taro[i];
		}
		for(int i=0;i<m;i++){
			cin>>hana[i];
			hanaSum=hanaSum+hana[i];
		}
		
		gap=hanaSum-taroSum;
		
		if(gap<0){
			gap=gap*(-1);
		}
		
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(gap==2*(hana[j]-taro[i])){
					tarocr=taro[i];
					hanacr=hana[j];
					break;
				}
			}
			if(tarocr && hanacr){
				break;
			}
		}
		if(tarocr==0 && hanacr==0){
			cout<<-1<<endl;
		}else{
			cout<<tarocr<<hanacr<<endl;
		}
	}
	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'flag' was not declared in this scope
   11 |                 flag=false;
      |                 ^~~~
Language: C++

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if (n == 0 && m == 0) break;
			int[] a = new int[n];
			int[] b = new int[m];
			int sumA = 0;
			int sumB = 0;
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				sumA += a[i];
			}
			for (int i = 0; i < m; i++) {
				b[i] = sc.nextInt();
				sumB += b[i];
			}
			int resA = 1000;
			int resB = 1000;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					if (sumA - a[i] + b[j] == sumB - b[j] + a[i] && resA + resB > a[i] + b[j]) {
						resA = a[i]; resB = b[j];
					}
				}
			}
			if (resA == 1000 && resB == 1000) {
				System.out.println(-1);
			} else {
				System.out.println(resA + " " + resB);
			}
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class Main {
      | ^~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cassert>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<utility>
using namespace std;

int n,m,ns[200],ms[200];
int nsum,msum;

/*
input data
*/

void init(){
	nsum=msum=0;
}

bool input(){
	cin>>n>>m;
	if(n==0&&m==0){
		return false;
	}
	for(int i=0; i<n; i++){
		cin>>ns[i];
	}
	for(int i=0; i<m; i++){
		cin>>ms[i];
	}
	return true;
}

void make_sum(){
	int i;

	for(i=0; i<n; i++){
		nsum+=ns[i];
	}
	for(i=0; i<m; i++){
		msum+=ms[i];
	}
}

int exchange(int i,int j){
	int a,b;
		
	a=nsum-ns[i]+ms[j];
	b=msum+ns[i]-ms[j];
	if(a==b){
		return ns[i]+ms[j];
	}
	return -1;
}

void search_exchange(){
	int ansi,ansj;
	int min=200;
	int tmp;

	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			tmp=exchange(i,j);
			if(tmp!=-1&&tmp<min){
				ansi=i;
				ansj=j;
				min=tmp;
			}
		}
	}
	if(min==200){
		cout<<"-1"<<endl;
	}else{
		cout<<ns[ansi]<<" "<<ms[ansj]<<endl;
	}
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status