Go: package main

import "fmt"

func main() {
	for {
		var a, b, n int
		fmt.Scanf("%d", &n)

		if n == 0 {
			return
		}

		for i := 0; i < n; i++ {
			var cardA, cardB int
			fmt.Scanf("%d %d", &cardA, &cardB)

			if cardA > cardB {
				a += cardA + cardB
			} else if cardB > cardA {
				b += cardA + cardB
			} else {
				a += cardA
				b += cardB
			}
		}

		fmt.Println(a, b)
	}
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 2000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  int n,a,b;
  int a_score,b_score;

  while(1){
    scanf("%d",&n);
    if(n==0)break;
    a_score=b_score=0;
    rep(i,n){
      scanf("%d%d",&a,&b);
      if(a==b){
	a_score+=a;
	b_score+=b;
      }else if(a>b){
	a_score+=a+b;
      }else if(a<b){
	b_score+=a+b;
      }
    }
    printf("%d %d\n",a_score,b_score);
  }
}

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

int main ()
{
    int p;
    int a,b;
    int n,m;
    while(1){
        n=m=0;
        cin>>p;
        if(p==0){
            break;
        }
        for(int i=0;i<p;i++){
            cin>>a>>b;
            if(a>b){
                n+=a;
                n+=b;
            }else if(a<b){
                m+=a;
                m+=b;
            }else{
                n+=a;
                m+=b;
            }
        }
        cout<<n<<" "<<m<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){

	int n, a, b, ap = 0, bp = 0;

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

		//?????°?????´??°
		if (a > b)
			ap += a + b;
		else if (a < b)
			bp += a + b;
		else{
			ap += a;
			bp += b;
		}
	}

	cout << ap << ' ' << bp << endl;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(void) {
    int n, a, b;
    while (cin >> n, n) {
        int pa = 0, pb = 0;
        for (int i = 0; i < n; i++) {
            cin >> a >> b;
            if (a > b) pa += a + b;
            else if (a < b) pb += a + b;
            else {
                pa += a;
                pb += b;
            }
        }
        cout << pa << " " << pb << endl;
    }

    return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int num, wk, tk, A, B;

	while( cin >> num )
	{
		if(!num) break;
			
		A = 0; B = 0;

		for(int i = 0; i < num; i++)
		{
			cin >> wk >> tk;
			if(wk > tk) A += wk + tk;
			else if(wk < tk) B += wk + tk;
		}

		printf("%d %d", A, B);
		
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
    int n;

    while (cin >> n, n) {
        int a, b;

        a = b = 0;
        for (int i = 0; i < n; i++) {
            int t1, t2;

            cin >> t1 >> t2;
            if (t1 > t2)
                a += t1 + t2;
            else if (t1 < t2)
                b += t1 + t2;
            else {
                a += t1;
                b += t2;
            }
        }
        cout << a << " " << b << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int main(){
	int n,a,b;
	long suma=0,sumb=0;
	do{
		cin >> n;
		for(int i=0;i<n;i++)
			cin >> a >> b;
			if(a>b) suma+=a+b;
			else if(a<b) sumb+=a+b;
			else{suma+=a;sumb+=b;}
		printf("%ld %ld\n",suma,sumb);
	}while(n!=0);
	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
  int n, a,b, A,B;

  while( cin >> n && n ){
    A=B=0;
    while( n-- ){
      cin >> a >> b;
      if( a>b )
	A += a+b;
      else if( a<b )
	B += a+b;
      else{
	A += a;
	B += b;
      }
    }
    cout << A << " " << B << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

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

int main(void){
	while(true){
		int n;
		int a = 0, b = 0;
		cin >> n;
		if(n == 0) break;
		rep(i, n){
			int x, y;
			cin >> x >> y;
			if(x > y){
				a += x + y;
			}
			if(y > x){
				b += x + y;
			}
			if(y == x){
				a += x;
				b += y;
			}
		}
		cout << a << " " << b << endl;
	}
	return 0;
}

C++: #include<stdio.h>
void judge(int n, int a[], int b[], int *result1, int *result2) {
	while (--n >= 0) {
		if (a[n] > b[n]) {
			*result1 += a[n] + b[n];
		}
		else if (a[n] < b[n]) {
			*result2 += a[n] + b[n];
		}
		else if (a[n] == b[n]) {
			*result1 += a[n];
			* result2 += b[n];
		}
	}
}
int main() {
	int a[1000];
	int b[1000];
	int n, t = 0;
int i;
	int result1 = 0, result2 = 0;
	int result[1000][2];
	do {
		scanf("%d", &n);
		for (i = 0; i < n; i++) {
			scanf("%d %d", &a[i], &b[i]);
		}
		judge(n, a, b, &result1, &result2);
		result[t][0] = result1;
		result[t][1] = result2;
		result1 = 0;
		result2 = 0;
		t++;
	} while (n != 0);

	for (i = 0; i < t-1;i++) {
		printf("%d %d\n", result[i][0], result[i][1]);
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,pointA,pointB;
  int a[10000],b[10000];
  pointA = 0; pointB = 0;
  for(n = 1;n != 0;){  
 cin >> n;
 if(n != 0){
    pointA = 0; pointB = 0;
  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i];
  }
  for(int i = 0;i< n;i++){
    
    if(a[i] < b[i]){
      pointB = pointB + a[i] +b[i];
    } else if(a[i] > b[i]){
      pointA = pointA + a[i] +b[i];
    } else if(a[i] == b[i]){
      pointA = pointA + a[i];
      pointB = pointB + b[i];
    }
  }
 
  cout << pointA << " "<< pointB << endl;
 }
  }
  
  
}

C++: #include<iostream>
using namespace std;

int main(void){
  int a,b;
  a=b=0;
  int n;
  cin>>n;
  while(n--){
    int c,d;
    cin>>c>>d;
    if(c>d)
      a += c + d;
    else
      b += c + d; 
  }
  cout<< a << " " << b << endl;
}

C++: #include<iostream>

int main(){
int n,a,b,pa,pb;
pa=0;pb=0
cin>>n;
for(;;){
for(int i=0;i<n;i++){
cin>>a;
cin>>b;
if(a==b){pa+=a; pb+=a}
if(a>b){pa+=a+b;}
if(a<b){pb+=a+b;}
}
if(n==0){break;}
cout<<pa<<" "<<pb<<endl;
}

return 0;
}

C++: #include <iostream>
#include <cstdlib>
using namespace std;

struct player{
    int point = 0;
    int card[10000];
};

int main()
{
    int loop;
    player a, b;
    cin >> loop;
    for(int c = 0; c < loop; c++)
    {
        cin >> a.card[c];
        cin >> b.card[c];
    }

    for(int c = 0; c < loop; c++)
    {
        if(a.card[c] < b.card[c]) b.point += a.card[c] + b.card[c];
        if(a.card[c] == b.card[c]) a.point += a.card[c], b.point +=b.card[c];
        if(a.card[c] > b.card[c]) a.point += a.card[c] + b.card[c];
    }
    cout << a.point << " " << b.point << endl;
    return EXIT_SUCCESS;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,a,b,x=0,y=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    if(a==b){
      x+=a;
      y+=b;
    }
    if(a>b)x+=(a+b);
    if(b>a)y+=(a+b);
  }
  cout<<x<<" "<<y<<endl;
}