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 main(){
  int n,a=0,b=0,aa,bb;
  cin>>n;
  while(n!=0){
    for(int i=0;i<n;i++){
    cin>>aa>>bb;
    if(aa==bb){
      b+=bb;
      a+=aa;
    }else if(aa>bb){
      a+=aa+bb;
    }else if(aa<bb){
      b+=bb;
    }
  }
    cout<<a<<" "<<b<<endl;
    cin>>n;
    a=0;
    b=0;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
	int n,a=0,b=0;
	int num=0,sum=0;

	while(cin >> n, n){
	for(int i=0; i<n; i++){

		cin >> a >> b;

		if(a > b){
			
			num+=a+=b;
		}
		else if(a < b){
			
			sum+=b+=a;
		}
		else if(a == b){

			num+=a;
			sum+=b;
		}
	}

	cout << num << " " << sum << endl;
}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void) {

	for (int n = 0; (cin >> n) && n != 0;) {
		int aPoint = 0, bPoint = 0;
		for (int i = 0; i < n; i++) {
			int aCardPoint = 0, bCardPoint = 0;
			cin >> aCardPoint >> bCardPoint;
			if (aCardPoint == bCardPoint) {
				aPoint += aCardPoint;
				bPoint += bCardPoint;
			} else if (aCardPoint > bCardPoint) {
				aPoint += aCardPoint + bCardPoint;
			} else if (aCardPoint < bCardPoint) {
				bPoint += aCardPoint + bCardPoint;
			}
		}
		cout << aPoint << " " << bPoint << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int a,b;
	int a1,b1;
	int i;
	a1=0;
	b1=0;
	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n;i++){
			scanf("%d %d",&a,&b);
			if(a>b){
				a1+=a;
				a1+=b;
			}
			else if(a<b){
				b1+=a;
				b1+=b;
			}
			else{
				a1+=1;
				b1+=1;
			}
		}
		printf("%d %d",a1,b1);
		scanf("%d",&n);
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int card[100],i,j,a=0,b=0,c=1,n;
cin>>n;
while(n!=0){
for(i=0;i<2*n;i++){
cin>>card[i];
}
for(i=0;i<2*n;i=i+2){
if(card[i]>card[c]){
a=a+card[i]+card[c];
}
else if (card[i]==card[c]){
a=a+card[i];
b=b+card[c];
}
else{
b=b+card[i]+card[c];
}
c=c+2;
}
cout<<a<<" "<<b<<endl;
c=1;
a=0;
b=0;
cin>>n;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>

using namespace std;

int main() {
	int n;
	cin >> n;
	int a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		if (x > y) {
			a += x + y;
		} else if (x < y) {
			b += x + y;
		} else {
			a += x;
			b += y;
		}
	}
	cout << a << ' ' << b << endl;
	return 0;
}

C++: #include <stdio.h>

int main()
{
    int		a, b, n;
    int		asum, bsum;

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

C++: #include <iostream>

int main(){
    int n,a,b,ina,inb;
    
    while(std::cin >> n,n){
        a=0;b=0;
        for(int i=0;i<n;i++){
            std::cin >> ina >> inb;
            if(ina>inb){
                a += ina + inb;
            }else if(ina==inb){
                a += ina;
                b += inb;
            }else{
                b += ina + inb;
            }
        }
        std::cout << a << ' ' << b << std::endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
	int a;
	int uma;
	int ushi;
	int b;
	int c;

	cin >> a;
	for (int i; 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;

}

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

int main(){
	int n, card1, card2, p1, p2;
	while(cin >> n, n != 0){
		p1 = 0;
		p2 = 0;
		for(int i = 0; i < n; i++){
			cin >> card1 >> card2;
			if(card1 < card2){
				p2 += card1+card2;
			}
			else if(card1 > card2){
				p1 += card1+card2;
			}
			else if(card1 == card2){
				p1 += card1;
				p2 += card2;
			}
		}
		
		cout << p1 << ' ' << p2 << endl;
	}
	return 0;
}

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

int main(){
	while(1){
		int n;
		long a=0, b=0;
		
		
		scanf(" %d", &n);
		if(n==0) break;
		for(int i=0; i<n; ++i){
			int x, y;
			scanf(" %d %d", &x, &y);
			
			if(x>y) a+=x+y;
			else if(x<y) b+=x+y;
			else{
				a+=x; b+=y;
			}
		}
	
		printf("%ld %ld\n", a, b); 
	}

	return 0;
}

C++: #include <iostream>

int main(){
    while(true){
    int n, a_score = 0, b_score = 0;
    std::cin >> n;
    
    if(n == 0)
        break;

    for(int i = 0; i < n; ++i){
        int a, b;
        std::cin >> a >> b;
        if(a > b)
            a_score += a + b;
        else
            b_score += a + b;
    }

    std::cout << a_score << " " << b_score << std::endl;
    }
    return 0;
}

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

int main() {
	int num;
	int score_a[5];
	int score_b[5];
	int cnt = 0;
	bool flg = true;
	
	cin >> num;
	while (flg) {
		for (int i = 0; i < num; i++) {
			int a;
			int b;

			cin >> a >> b;
			if (a > b) {
				score_a[cnt] += a + b;
			}else if (b > a) {
				score_b[cnt] += a + b;
			}else {
				score_a[cnt] += a;
				score_b[cnt] += b;
			}
		}
		cnt++;
		cin >> num;
		if ((cnt == 5) || (num == 0)) {
			flg = false;
		}
	}
	for (int i = 0; i < cnt; i++) {
		cout << score_a[i] << " " << score_b << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

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

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	int num=0,sum=0;

	cin >> n;

	int a[10];
	int b[10];
	for(int i=1; i<=n; i++){

		cin >> a[i] >> b[i];

		if(a[i] > b[i]){
			
			num+=a[i]+=b[i];
		}
		else if(a[i] < b[i]){
			
			sum+=b[i]+=a[i];
		}
	}

	cout << num << " " << sum << endl;

	return 0;
}

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

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

C++: #include<iostream>
#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(a<b)y+=(a+b);
  }
  cout<<x<<" "<<y<<endl;
}