Go: package main

import (
	"fmt"
)

// Game is one game.
type Game struct {
	pointA, pointB int
}

func main() {
	var n int
	game := &Game{0, 0}
	fmt.Scanf("%d", &n)
	for n != 0 {
		game.initGame()
		game.execGame(n)
		game.printResult()
		fmt.Scanf("%d", &n)
	}
}

func (game *Game) execGame(n int) {
	var a, b int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		fmt.Scanf("%d", &b)
		switch {
		case a == b:
			game.pointA += a
			game.pointB += b
		case a > b:
			game.pointA += a + b
		case b > a:
			game.pointB += a + b
		}
	}
}

func (game *Game) initGame() {
	game.pointA = 0
	game.pointB = 0
}

func (game *Game) printResult() {
	fmt.Println(game.pointA, game.pointB)
}

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

C++: #include <stdio.h>

int n, A[11234], B[11234];
int ans[2];

int main(void) {
	while (true) {
		scanf("%d", &n);
		for (int i = 0; i < n; ++i) { scanf("%d%d", &A[i], &B[i]); }

		for (int i = 0; i < n; ++i) {
			if (A[i] > B[i]) { ans[0] += A[i] + B[i]; }
			else if (A[i] < B[i]) { ans[1] += A[i] + B[i]; }
			else { ans[0] += A[i], ans[1] += B[i]; }
		}

		printf("%d %d\n", ans[0], ans[1]);
	}
	return 0;
}

C++: #include <iostream>
#define N 1000
using namespace std;
int main(){
    int n, scoreA, scoreB;
    while(cin >> n, n != 0){
        scoreA = 0; scoreB = 0;
        int a,b;
        for (int i = 0; i < n; i++){
            cin >> a >> b;
            if (a > b){
                scoreA += (a+b);
            }else if (b > a){
                scoreB += (a+b);
            }else{
                scoreA += a; scoreB += b;
            }
        }
        cout << scoreA << " " << scoreB << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <string>
using namespace std;

int main(void) {
	int a=0,b=0,n=1;
	long ra = 0,rb = 0;
	vector<string> r;
	while (n!=0)
	{
	cin >> n;
	if (n == 0){break;}
	for (int i=0; i<n; i++)
	{
		scanf("%d %d",&a,&b);
		if (a>b)
		{
			ra+=a+b;
		} else if(a<b)
		{
			rb+=a+b;
		} else {
			ra+=a;
			rb+=b;
		}
	}
	ostringstream os;
	os << ra << " " << rb;
	r.push_back(os.str());
	}
	for (int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int n,i,j,k;
int A[1],B[1];
int main(){
  for(;;){
    scanf("%d",&n);
    if(n==0){
      return 0;
    }
      for(i=0;i<n;i++){
      scanf(" %d %d",&j,&k);
      A[0]=0,B[0]=o;
      if(j>k){
        A[0]+=(j+k);
      } else if(j<k){
        B[0]+=(j+k);
      } else if(j==k){
        A[0]+=j;
        B[0]+=k;
      }
      printf("%d %d\n",A[0],B[0]);
    }
  }
}

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

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

int main()
{
    int loop = 1;
    player a, b;
    while(1) {
        cin >> loop;
        if(loop == 0) break;
        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];
                continue;
            }
            if(a.card[c] == b.card[c])
            {
                 a.point += a.card[c];
                 b.point +=b.card[c];
                 continue;
            }
            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;
	do{
		cin >> n;
		if(n != 0)
		{
			int a[n], b[n], aRes = 0, bRes = 0;
		
			for (int i = 0; i < n; ++i)
			{
				cin >> a[i] >> b[i];
				if(a[i] > b[i])
				{
					aRes += (a[i] + b[i]);
				}
				else if(a[i] < b[i])
				{
					bRes += (a[i] + b[i]);
				}
				else{
					aRes += a[i];
					bRes += b[i];
				}
			}
		
			cout << aRes << " " << bRes;
		}
	}while(n != 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;
			}
			else
			{
				A += wk;
				B += tk;
			}
		}

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

C++: #include <cstdio>
using namespace std;
int main()
{
	long long int a=0,b=0,n,x,y;
	scanf("%lld",&n);
	for(long long int i=0;i<n;i++){
		scanf("%lld %lld",&x,&y);
		if(x>y) {a+=(x+y);}
		else if(x<y) {b+=(x+y);}
		else{
			a+=x;
			b+=y;
		}
	}
	printf("%lld %lld\n",a,b);
	return 0;
}

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

int main(){
	int a;
	int uma;
	int ushi;
	int b;
	int c;
	int i;
	while (true){
		cin >> a;
		if (a == 0){ break; }
		else{
			for (i < a; i++){
				cin >> b;
				cin >> c;
				if (b>c){
					uma = uma + b + c;
				}
				if (b == c){
					uma = uma + b;
					ushi = ushi + c;
				}
				else{
					ushi = ushi + b + c;
				}
			}
		}
		cout << uma << " " << ushi << endl;
		uma = 0;
		ushi = 0;
		i = 0;
	}
}

C++: #include<iostream>

using namespace std;

int main(void) {
	int num, a, b;
	int resa, resb;
	int i;

	while(true) {
		cin >> num;
		if(num == 0) { break; }
		resa = resb = 0;
		for(i = 0; i < num; i++) {
			cin >> a >> b;
			if(a > b) { resa += a + b; }
			else if(a < b) { resb += a + b; }
			else { resa += a; resb += b; }
		}
		cout << resa << " " << resb << endl;
	}

	return 0;
}

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

int main(void)
{
	int n;
	int a_sum = 0;
	int b_sum = 0;
	
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		
		if (a == b){
			a_sum += a;
			b_sum += b;
		}
		else if (a > b){
			a_sum = a_sum + a + b;
		}
		else {
			b_sum = b_sum + a + b;
		}
	}
	
	printf("%d %d\n", a_sum, b_sum);
	
	return (0);
}

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

int main(){
  int n;
  while(scanf("%d\n", &n)){
    int asum = 0, bsum = 0, a[10000], b[10000];
    if(n == 0) return 0;

    for(int i = 0;i < n;i++) scanf("%d %d\n", &a[i], &b[i]);
    for(int i = 0;i < n;i++){
      if(a[i] > b[i]) asum += a[i]+b[i];
      else if(a[i] < b[i]) bsum += a[i]+b[i];
      else {
         asum += a[i];
         bsum += b[i];
      }
   }
   printf("%d %d\n", asum, bsum);
  }
}