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 <stdio.h>
#include <string.h>
#include <functional>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <valarray>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	long n,a[10000],b[10000],A,B;

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

		if (n == 0)
		{
			break;
		}

		for ( int j = 0; j < n; j++)
		{
			cin >> a[j] >> b[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];
			}

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

		A = B = 0;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int n, a, b;
int main() {
	while(cin >> n, n) {
		int p = 0, q = 0;
		while(n--) {
			cin >> a >> b;
			if(a > b) p += a + b;
			else if(a < b) q += a + b;
			else p += a, q += b;
		}
		cout << p << ' ' << q << endl;
	}
	return 0;
}

C++: #include <iostream>

int main() {
	int n, a_s, b_s, *a, *b;
	std::cin >> n;
	while (n) {
		a_s = b_s = 0;
		a = new int[n];
		b = new int[n];
		for (int i=0; i<n; i++) {
			std::cin >> a[i] >> b[i];
		}
		for (int i=0; i<n; i++) {
			if (a[i] > b[i]) {
				a_s += a[i] + b[i];
			} else if (a[i] < b[i]) {
				b_s += a[i] + b[i];
			} else {
				a_s += a[i], b_s += b[i];
			}
		}
		std::cout << a_s << " " << b_s << std::endl;
		delete[] a;
		delete[] b;
		std::cin >> n;
	}
}

C++: #include <iostream>
using namespace std;
 
int main() {
  int n, a, b, pointA, pointB;

  cin >> n;
  while(n != 0) {
    

    pointA = 0;
    pointB = 0;

    for(int i = 0; i < n; i++) {
      cin >> a >> b;
 
      if(a > b) {
        pointA += (a + b);
      } else if(a > b) {
        pointB += (a + b);
      } else {
        pointA += a;
        pointB += b;
      }
    }

    cout << a << ' ' << b << endl;
    cin >> n;
  }   
 
  return 0;
}

C++: #include<iostream>

int main(){
	while(1){
		int i=0,n,a=0,b=0;
		std::cin>>n;
		if(n==0)break;
		while(i<n){
			int ca,cb;
			std::cin>>ca>>cb;
			if(ca>cb)a+=ca+cb;
			else if(cb>ca)b+=ca+cb;
			else if(ca==cb)a+=ca,b+=cb;
			i++;
		}
		std::cout<<a<<" "<<b<<std::endl;
	}
	return 0;
}

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

class game{
	int length;
	int cur;
	int *r,*l;
	int r_score,l_score;
public:
	game(int _l){
		length = _l;
		r = new int [length];
		l = new int [length];
		r_score = 0;
		l_score = 0;
		cur = 0;
	}
	~game(){
		delete [] r;
		delete [] l;
	}
	void run();
	void insert(int,int);
};

void game::run(){
	for(int i = 0;i < length;i++){
		if(r[i] < l[i]){
			l_score += r[i] + l[i];
		}else if(r[i] > l[i]){
			r_score += r[i] + l[i];
		}else{
			l_score += l[i];
			r_score += r[i];
		}
	}
	cout<<l_score<<" "<<r_score<<endl;
}

void game::insert(int l_card,int r_card){
	r[cur] = r_card;
	l[cur] = l_card;
	cur++;
}

int main(){
	list<game*> lst;
	while(1){
		int read;
		cin>>read;
		if(read == 0){
			break;
		}
		game *g = new game(read);
		for(int i = 0; i < read;i++){
			int r_card,l_card;
			cin>>l_card>>r_card;
			//cout<<l_card<<","<<r_card<<endl;
			g->insert(l_card,r_card);
		}
		lst.push_back(g);
	}

	for(auto it = lst.begin();it != lst.end();it++){
		(*it)->run();
		delete (*it);
	}
	return 0;
}

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];
		}
		else if(a[i] == b[i]){

			num+=a[i];
			sum+=b[i];
		}
	}

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

	return 0;
}

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

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

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

int main(){
  int a, b, n;
  int suma = 0;
  int sumb = 0;
  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 if(a == b){
      suma += a;
      sumb += b;
    }
  }
  cout << suma << " " << sumb << endl;

  return 0;
}

C++: #include <stdio.h>
int main(){
  for(;;){
    int n,i,j,k;
    int A={0},B={0};
    scanf("%d",&n);
    if(n==0){
      return 0;
    }
      for(i=0;i<n;i++){
      scanf(" %d %d",&j,&k);
      if(j>k){
        A+=(j+k);
      } else if(j<k){
        B+=(j+k);
      } else if(j==k){
        A+=j;
        B+=k;
      }
      printf("%d %d\n",A,B);
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,pointA,pointB;
  int a[10000],b[10000];
  n = 1;  pointA = 0; pointB = 0;
  while(n != 0){  
 cin >> n;

  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i];
  }
  for(int i = 0;i< n;i++){
    if(a[i] < b[i]){
      pointB = pointB + a[i] +b[i];
    } else if(a[i] > b[i]){
      pointA = pointA + a[i] +b[i];
    } else if(a[i] == b[i]){
      pointA = pointA + a[i];
      pointB = pointB + b[i];
    }
  }
    
  cout << pointA << " "<< pointB << endl;
  cin >> n;
  }
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

int main(void){
  int n;
  int a, b;
  int suma = 0, sumb = 0;
  while(1){
    suma = 0;
    sumb = 0;
    scanf("%d", &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 {
	suma += a;
	sumb += b;
      }
    }
    printf("%d %d\n",suma,sumb);
  }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int maisuu, a[15000], b[15000];
	long long int a_p = 0, b_p = 0;
	int anser[2][10];
	int hasi;
	for (int i = 0; i < 5; i++){
		cin >> maisuu;
		if (maisuu == 0){
			break;
		}
		for (int i2 = 0; i2 < maisuu; i2++){
			cin >> a[i2];
			cin >> b[i2];
		}
		for (int i2 = 0; i2 < maisuu; i2++){
			if (a[i2] < b[i2]){
				b_p += a[i2] + b[i2];
			}
			else if (a[i2]>b[i2]){
				a_p += a[i2] + b[i2];
			}
			else if (a[i2] == b[i2]){
				a_p += a[i2];
				b_p += b[i2];
			}
		}
		anser[0][i] = a_p;
		anser[1][i] = b_p;
		maisuu = 0;
		a_p = 0;
		b_p = 0;
		hasi = i;
	}
	for (int i = 0; i <= hasi; i++){
		cout << anser[0][i] << " " << anser[1][i] << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,a,b,count;
     int  A[10],B[10];
     count=0;
     for(int j=0;;j++){
       A[j]=0;
       B[j]=0;
    cin >> n;
    if(n==0)break;
    
    for(int i=0;i<n;i++){
      
      cin >> a >> b;
      if(a>b){
	A[j]+=a+b;
      }
      else if(a<b){
	B[j]+=a+b;
      }
      else if(a==b){
	A[j]+=a;
	B[j]+=b;
      }
      
    }cout << A[j] << " " << B[j] << endl;
    }
      for(int i=0;i<n;i++){
    cout << A[i] << " " << B[i] << endl;
    }
  return 0;
}