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<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,a,b,x=0,y=0;
  cin>>n;
  rep(i,n){
    cin>>a>>b;
    if(a==b){
      x+=a;
      y+=b;
    }
    else if(a>b)x+=a+b;
    else if(b>a)y+=a+b;
  }
  cout<<x<<" "<<y<<endl;
}

C++: #include <stdio.h>

void main()
{
	int n;
	int A, B;
	int playerA = 0, playerB = 0;
	int i = 0;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		while (i < n){
			scanf("%d %d", &A, &B);
			if (A == B){
				playerA += A;
				playerB += B;
			}
			else if (A > B){
				playerA += A + B;
			}
			else {
				playerB += A + B;
			}
			i++;
		}
		printf("%d %d\n", playerA, playerB);
		i = 0;
		playerA = 0;
		playerB = 0;
	}
}

C++: #include <cstdio>
int n,a,b,c,d,i;
int main(void){
  scanf("%d",&n);
  while(n){
    c=0;d=0;
    for(i=0;i<n;i++){
      scanf("%d%d",&a,&b);
      if(a>b)c+=a+b;
      else if(a<b)d+=a+b;
      else{
        c+=a;d+=b;
      }
    }
    printf("%d %d\n",c,d);
    scanf("%d",&n);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int n;
  int sa,sb;
  cin>>n;
  sa = sb = 0;
  while(n--){
    int a,b;
    cin>>a>>b;
    if(a>b){
      sa += a + b;
    }else{
      sb += a + b;
    }
  }

  cout<< sa << " " << sb << endl;
}

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

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

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
int n;
int a;
int b;
int c;
int d;
int e;
while(cin >>n){
c=0;
d=0;
e=0;
if(n!=0){while(e<n){
cin >>a;
cin >>b;
if(a>b){c=c+a+b;}
if(a==b){c=c+a; d=d+b;}
if(a<b){d=d+a+b;}
e=e+1;}
cout << c <<" "<<d<<endl;
}
}

}

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

int main(){
	int n, aa, bb;
	vector<pair<int, int> > v;
	while(1){
		aa = 0;
		bb = 0;
		scanf("%d", &n);
		if(n == 0){
			break;
		}
		int a, b;
		for(int i = 0; i < n; i++){
			scanf("%d %d", &a, &b);
			if(a > b){
				aa += a + b;
			}else if(b > a){
				bb += a + b;
			}else{
				aa += a;
				bb += b;
			}
		}
		v.push_back(make_pair(aa, bb));
	}
	for(int i = 0; i < v.size(); i++){
		printf("%d", v[i].first);
		printf(" ");
		printf("%d\n", v[i].second);
	}
	return 0;
}

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;
}