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>
#include<vector>
int main() {
	int i = 0;
	std::cin >> i;
	std::vector <int> ha,hb;
	if (i != 0) {
		int A = 0, B = 0;
		std::vector<int> a(10000), b(10000);
		for (int j = 0; j < i; ++j) {
			std::cin >> a[j] >> b[j];
		}
		for (int j = 0; j < i; ++j) {
			if (a[j] > b[j]) {
				A += (a[j] + b[j]);
			}
			else if (a[j] < b[j]) {
				B += (a[j] + b[j]);
			}
			else {
				A += a[j];
				B += b[j];
			}
		}
		ha.push_back(A);
		hb.push_back(B);
	}
	for (int j = 0; j < i; ++j) {
		std::cout << ha[j] << " " << hb[j] << std::endl;
	}
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(void){
	int n,asum,bsum,a,b,i;
	while(1){
		cin>>n;
		if(n==0)break;
		asum=0; bsum=0;
		for(i=0;i<n;i++){
			cin>>a>>b;
			if(a==b)asum+=a,bsum+=b;
			if(a>b)asum+=a+b;
			if(b>a)bsum+=a+b;
		}
		cout<<asum<<' '<<bsum;
	}
	return 0;
}

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


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

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

}

C++: #include <iostream>

int main(){
    int n, a[10], b[10], apt, bpt;
    while(1){
        std::cin >> n;
        if(!n)
            return 0;
        apt = bpt = 0;
        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++: #include <iostream>
#include <stdio.h>
using namespace std;

int main()
{

	int n;
	int a=0,=0;
	int ac,bc;

	cin >> n;

	while(n > 0){
		n--;
		cin >> ac >> bc;
		if(ac > bc)
			a += ac + bc;
		else if(ac < bc)
			b += ac + bc;
		else
			a += ac, b = bc;
	}
	printf("%d %d\n", a,b);


	return 0;
}

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

int main(){
	int i,n,a,b;
	long 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 main(){
	int a,b,n;
	int A=0;
	int B=0;
	while(1){
		A=0;
		B=0;
		cin>>n;
		if(n==0) break;
		for(int i=0; i<n; i++){
			cin>>a>>b;
			if(a>b){
				A+=a;
				A+=b;
			}else if(a<b){
				B+=a;
				B+=b;
			}else if(a==b){
				A+=a;
				B+=b;
			}

			
		}
		cout<<A<<" "<<B<<endl;
	}
}

C++: #include <iostream>

int main(int argc, char const* argv[])
{
  int i, n, a, b, a_score, b_score;

  while (true) {
    a_score = 0;
    b_score = 0;

    std::cin >> n;
    if (n == 0) { break; }

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

      if (a > b) {
        a_score += (a + b);
      } else if (b > a) {
        b_score += (a + b);
      } else {
        a_score += a;
        b_score += b;
      }
    }
    std::cout << a_score << " " << b_score << std::endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
    int n;

    while(cin >> n && n) {
        int a = 0,b = 0;
        rep(i,n) {
            int x,y;
            cin >> x >> y;

            if(x == y) {
                a += x;
                b += y;
            } else if(x > y) {
                a += (x+y);
            } else {
                b += (x+y);
            }
        }

        cout << a << " " << b << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){	
	int n;
	while (cin >> n, n){
		int x[2] = {};
		while (n--){
			int a, b;
			cin >> a >> b;
			if (a == b) x[0] += a, x[1] += a;
			else x[a < b] += a + b;
		}
		cout << x[0] << " " << x[1] << endl;
	}

	return 0;
}

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

int main() {
	int aten = 0,bten = 0,a,b;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a >> b;
		if(a > b){
			aten = aten + a + b;
		}
		else if(a == b){
			aten = aten + a;
			bten = bten + a;
		}
		else{
			bten = bten + a + b;
		}


	}
	cout << aten << " " << bten << endl;
	return 0;
}

C++: #include <iostream>
#include <cstdlib>
#define MAX_SIZE 1001


int main()
{
    bool isRun = true;
    int len;
    int resA, resB;
    int playerA, playerB;
    while(isRun) {
        std::scanf("%d", &len);
        if (len == 0) {
            isRun = false;
        } else {
            resA = resB = 0;
            for (int i = 0; i < len; i++) {
                std::scanf("%d %d", &playerA, &playerB);
                if (playerA > playerB) resA += playerA + playerB;
                else if (playerA < playerB) resB += playerA + playerB;
                else if (playerA == playerB) {
                    resA += playerA; resB += playerB;
                }
            }
            std::printf("%d %d\n", resA, resB);
        }
    }
    return 0;
}

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 n, a, b, pa, pb, i;

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

C++: #include<cstdio>
int main(){
    int ai,bi,as=0,bs=0,n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",ai,bi);
        if(ai>bi) as+=ai+bi;
        else if(ai<bi) bs+=ai+bi;
        else{
            as+=ai;
            bs+=bi;
        }
    }
    printf("%d %d\n",as,bs);
}

C++: #include <cmath>
#include <iostream>

using namespace std;

int main() {

	int n, a=0, b=0, c, d;

	cin >> n;
	while(n!=0) {
		cin >> c >> d;
		if(c>d)
			a+=c+d;
		else if(c<d)
			b+=c+d;
		else {
			a+=c;
			b+=d;
		}

		n--;
	}

	cout << a << " " << b << endl;

	return 0;

}