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

C++: #include <iostream>
using namespace std;
int main(){

	int n, a, b, ap = 0, bp = 0;

	cin >> n;

	while (n != 0){

		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;

		cin >> n;

	}
}

C++: #include <cstdio>

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

C++: #include <cstdio>

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

C++: #include<iostream>
#include<vector>
int main(){
int n;
int s=0;
int g=0;
std::cin>>n;
std::vector<int> a(n),b(n);
for(int i=0;i<n;++i){
std::cin>>a[i]>>b[i];
if(a[i]>b[i]) g+=a[i];
else s+=b[i];
}
std::cout<<g<<" "<<s<<std::endl;
}

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

int main(){
 int n;
 int Acard,Bcard,Apoint,Bpoint;
 while(true){
  cin>>n;
  if(n==0){
   break;
  }else{
    for(int i=0;i<n;i++){
     cin>>Acard>>Bcard;
     if(Acard>Bcard){
      Apoint+=Acard+Bcard;
     }else if(Acard<Bcard){
      Bpoint+=Acard+Bcard;
     }else{
      Apoint+=Acard;
      Bpoint+=Bcard;
     }
    }
   cout<<Apoint<<' '<<Bpoint<<'\n';
   Apoint=0;
   Bpoint=0;
  }
 }
 return 0;
}

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

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

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	int N; cin >> N;
	int as=0, bs=0;
	for (int i = 0; i < N; ++i) {
		int a, b; cin >> a >> b;
		if (a > b) {
			as += a + b;

		}
		else if (b > a) {
			bs += a + b;
		}
		else {
			as += a;
			bs += b;
		}

	}
	cout << as <<" "<< bs << endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include<stdio.h>
int main(void){
    int loop,a,b,c=0,d=0;
    scanf("%d",&loop);
    for(;loop--;){
        scanf("%d %d",&a,&b);
        if(a!=b){
            if(a>b){
                c+=a+b;
            }else{
                d+=a+b;
            }
        }else{
            c+=a;
            d+=b;
        }
    }
    printf("%d %d\n",c,d);
    return 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 m,a,b;int x=0,y=0;
	cin>>m;
	
	for(int i=0;i<m;i++){
	cin>>a>>b;
	
	if(a>b){
	x+=+a+b;
	}
	else if(a<b){
	y+=a+b;
	}
	else{
	x+=a;y+=b;
	}
	}
	cout<<x<<" "<<y<<endl;

return 0;
}

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

int main(void) {
	int n;

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

			if(A == B) {
				ptA += A;
				ptB += B;
			}
			else if(A > B)
				ptA += A + B;
			else
				ptB += A + B;
		}

		cout << ptA << " " << ptB << endl;
	}
}

C++: #include<iostream>

using namespace std;

int main() {
  int n;
  int a[10000];
  int b[10000];
  
  while(cin >> n) {
    if(n == 0) {
      break;
    }

    for(int i = 0; i < n; i++ ){
      cin >> a[i] >> b[i];
    }

    int ans_a = 0;
    int ans_b = 0;
    for(int i = 0; i < n; i++) {
      if(a[i] < b[i]) {
        ans_b += a[i] + b[i];
      }else if(a[i] > b[i]) {
        ans_a += a[i] + b[i];
      }else {
        ans_a += a[i];
        ans_b += b[i];
      }
    }

    cout << ans_a << " " << ans_b << endl;
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	int a,b;
	int sa=0,sb=0;//score
	
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		if(a<b){sb+=a+b;}
		else if(a>b){sa+=a+b;}
		else
		{
			sa+=a;
			sb+=b;
		}
	}
	cout<<sa<<" "<<sb<<"\n";
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
        int a[1000] = {0};
        int b[1000] = {0};
        int n, i, pa, pb;
        while(true){
                pa = pb = 0;
                scanf("%d", &n);
                if(n == 0)
                        break;
                for(i = 0; i < n; i++){
                        scanf("%d%d", &a[i], &b[i]);
                        if(a[i] > b[i])
                                pa += a[i] + b[i];
                        else if(b[i] > a[i])
                                pb += a[i] + b[i];
                        else if(a[i] = b[i]){
                                pa += a[i];
                                pb += b[i];
                        }
                }
                printf("%d %d\n", pa, pb);
        }
        return 0;
}