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(;;){
    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{
            sa += a;
            sb += b;
          }
        }
        cout << sa << " " << sb << endl;
      }
    }
  return 0;
}

C++: #include<cstdio>

using namespace std;

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

C++: #include <iostream>

int main(){
    int n, a[10], b[10], apt = 0, bpt = 0;
    std::cin >> n;
    for(int i=0; i<n; i++){
        std::cin >> a[i] >> b[i];
        if(a[i] > b[i])
            apt += a[i] + b[i];
        else if(b[i] > a[i])
            bpt += a[i] + b[i];
        else{
            apt += a[i];
            bpt += b[i];
        }
    }
    std::cout << apt << ' ' << bpt << std::endl;
    return 0;
}

C++: using System;
using System.Linq;

namespace ACTest
{
    class AOJ500
    {
        static void Main(string[] args)
        {
            int num = 1;
            int[] totalScore = new int[2];
            int[] roundScore = new int[2];
            while (num != 0)
            {
                totalScore = Enumerable.Repeat<int>(0, 2).ToArray();
                //int[,] roundScore = new int[num, 2];

                num = int.Parse(Console.ReadLine());
                for (int i = 0; i < num; i++)
                {
                    ///totalScore = Enumerable.Repeat<int>(0, 2).ToArray();
                    string[] input = Console.ReadLine().Split(' ');
                    roundScore[0] = int.Parse(input[0]);
                    roundScore[1] = int.Parse(input[1]);
                    if (roundScore[0] > roundScore[1])
                    {
                        totalScore[0] += roundScore[0] + roundScore[1];
                    }
                    else if (roundScore[0] < roundScore[1])
                    {
                        totalScore[1] += roundScore[0] + roundScore[1];
                    }
                    else
                    {
                        totalScore[0] += roundScore[0];
                        totalScore[1] += roundScore[1];
                    }


                }
                Console.WriteLine(totalScore[0] + " " + totalScore[1]);
            }
            //while (true) ;
        }

    }
}

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

int main()
{
	int n;
	do {
		cin >> n;
		int score_a = 0, score_b = 0;
		for (int i = 0; i < n; i++) {
			int inp_a, inp_b;
			cin >> inp_a >> inp_b;
			if (inp_a == inp_b) {
				score_a += inp_a;
				score_b += inp_b;
			}
			else {
				(inp_a>inp_b ? score_a : score_b) += inp_a + inp_b;
			}
		}
		if (n > 0 && n <= 10000) {
			cout << score_a << ' ' << score_b << '\n';
		}
	} while (n > 0 && n <= 10000);

	return 0;
}

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

int main() {
    
    int n, a, b, i;
    int ap, bp;
    
    cin >> n;
    ap = 0; bp = 0;
    
    for(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;
    
    return 0;

}

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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

//define
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

int main(){
  ios_base::sync_with_stdio(0);
  int n;
  while(cin >> n, n){
    int score_a = 0, score_b = 0;
    int a, b;
    for(int i = 0; i < n; i++){
      cin >> a >> b;
      if(a == b){
        score_a += a;
        score_b += b;
      }else if(a > b){
        score_a += a + b;
      }else{
        score_b += a + b;
      }
    }
    cout << score_a << " " << score_b << endl;
  }
  return 0;
}

C++: #include <iostream>

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

C++: #include <iostream>
using namespace std;
  
int n, a, b, sa, sb;
  
int main(){
  for(;;){
    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{
            sa += a;
            sb += b;
          }
        }
        cout << sa << " " << sb << endl;
      }
    }
  }
  return 0;
}

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

int main(){
	int inputCount;
	int pointSumA = 0, pointSumB = 0;
	
	while(cin >> inputCount){
		if (inputCount) break;
		
		int cnt = 0;
		while (cnt++ < inputCount){
			int tempA, tempB;
			cin >> tempA >> tempB;
			if (tempA > tempB){
				pointSumA += (tempA + tempB);
			} else if (tempA == tempB) {
				pointSumA += tempA;
				pointSumB += tempA;
			} else {
				pointSumB += (tempA + tempB);
			}
		}
		
		cout << pointSumA << " " << pointSumB << endl;
	}
	
	return 0;
}