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 a = 0;
	int b;
	int c;
	int d = 0;
	int e = 0;
	cin >> a;
	for (int f = 0; f >= a; f++)
	{
		cin >> b;
		cin >> c;
		if (b > c)
		{
			d += b;
			d += c;
		}
		if (b < c)
		{
			e += b;
			e += c;
		}
		else
		{
			d += b;
			e += c;
		}
	}
	cout << d << " " << e << endl;

	return 0;
}

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

using namespace std;

int main() {

	int n,A[10000],B[10000];
	int ANS[2] = {0};

	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> A[i] >> B[i];
			if (A[i] == B[i]) {
				ANS[0] += A[i];
				ANS[1] += B[i];
			}
			else if (A[i] > B[i])
				ANS[0] += A[i] + B[i];
			else
				ANS[1] += A[i] + B[i];
		}
		cout << ANS[0] << " " << ANS[1] << endl;
		ANS[0] = 0;
		ANS[1] = 0;
	}

	return 0;

}

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

int main() {
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int a[10000], b[10000], A=0, B=0;
		for(int i=0; i<n; i++){
			cin >> a[i] >> b[i];
			int sum = a[i]+b[i];
			if(a[i]>b[i]) A += sum;
			if(a[i]==b[i]){
				A += a[i];
				B += b[i];
			}
			if(a[i]<b[i]) B += sum;
		}
		cout << A << ' ' << B << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <list>
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
 
// #define int ll
 
using namespace std;
 
bool test = 0;
 
/* ?????????????????¬??¨ */
 
int main(){
  int i,j,k,l;
  int n;
  while(scanf("%d",&n) != EOF) {
    if(n == 0) break;
    int score[2] = {0};
    for(i=0;i<n;i++) {
      int num[2];
      cin >> num[0] >> num[1];
      auto sum = num[0]+num[1];
      if(num[0] > num[1]) score[0] += sum;
      else if(num[0] < num[1]) score[1] += sum;
      else {
        for(j=0;j<2;j++) score[j] += num[j];
      }
    }
    printf("%d %d\n",score[0],score[1]);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,pointA,pointB;
  int a[10000],b[10000];
  pointA = 0; pointB = 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;
}

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

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

C++: #include <stdio.h>

const int MAX_N=10000;
int a[MAX_N];
int b[MAX_N];
int n;
int A=0;int B=0;
void solve(){
	for(int i=0;i<n;i++){
		if(a[i]>b[i]){
			A+=a[i]+b[i];
		}
		else if(a[i]<b[i]){
			B+=a[i]+b[i];
		}
		else{
			A+=a[i];
			B+=a[i];
		}
	}
}
int main(){
 while(1){
	scanf("%d",&n);
	if(n==0){
		break;
	}
	for(int i=0;i<n;i++){
	scanf("%d%d",&a[i],&b[i]);
	}
	solve();
	printf("%d %d\n",A,B);
	A=0;
	B=0;
 }
   return 0;
}

C++: #include <iostream>

int main(void)
{
    int n, data_a, data_b;
    int score_a, score_b;


    while(1)
    {
        std::cin >> n;
        if (n == 0) break;
        score_a = 0;
        score_b = 0;
        for(; n > 0 ; n--) {
            std::cin >> data_a;
            std::cin >> data_b;
            if (data_a > data_b) {
                score_a += (data_a + data_b);
            } else if(data_a < data_b) {
                score_b += (data_a + data_b);
            } else {
                score_a += data_a;
                score_b += data_b;
            }
        }
        std::cout << score_a << " " << score_b << std::endl;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
#include<cmath>
typedef long long int ll;
#define VI vector<int>

#define rep(i,a) for(int i=0;i<(a);i++)
#define all(i) i.begin(),i.end()
#define INF 1000000000


using namespace std;


/**/
VI y;
pair<int,int> x[31];


int main(){
	while(1){
		int n;
		int a,b;
		int suma=0,sumb=0;
		cin>>n;
		if(n==0)break;
		rep(i,n){
			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 <iostream>

int main(){
	std::ios::sync_with_stdio(false);
    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 if(a < b)
            b_score += a + b;
        else
            a_score += a, b_score += b;
    }

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

C++: #include<iostream>

using namespace std;
int A=0,B=0,a,b,n;
int main(){
    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;
        B+=b;
    }else if(a>b)A+=a+b;
    else B+=a+b;
}
cout << A <<' '<< B << endl;
    }
return 0;
}

C++: #include <iostream>

using namespace std;
long long scoreA,scoreB;
int main(void)
{
  int cnum;
  long long na,nb;
  cin>>cnum;
  while(cnum!=0)
  {
    scoreA=0;scoreB=0;
    na=0;nb=0;
    for(int i=0;i<cnum;i++)
    {
      cin>>na>>nb;
      if(na==nb)
      {
        scoreA+=na;
        scoreB+=nb;
      }else if(na>nb)
        scoreA+=na+nb;
      else
        scoreB+=na+nb;
    }
    cout<<scoreA<<" "<<scoreB<<endl;
    cin>>cnum;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
while(1){
	int n,A,B,a,b;
	cin>>n;
	if(n == 0)break;
	A=0;
	B=0;
		for(int i =0; i <n;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 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 + b + a;
		}


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

C++: #include <iostream>

using namespace std;

int main()
{
	int n,a,b;
	int suma,sumb;
	while(cin>>n,n){
		suma=sumb=0;
		for(int i=0; i<n; i++){
			cin>>a>>b;
			if      ( a<b ){
				sumb += a+b;
			}else if( a>b ){
				suma += a+b;
			}else{
				suma += a;
				sumb += b;
			}
		}
		printf("%d %d\n",suma,sumb);
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
    int n;
    scanf("%d\n", &n);
    vector<int> a(n), b(n);
    for(int i=0;i<n;++i) scanf("%d %d\n", &a[i],&b[i]);
    int as=0, bs=0;
    for(int i=0;i<n;++i){
        if(a[i]>b[i])as+=a[i]+b[i];
        else if(a[i]<b[i])bs+=a[i]+b[i];
        else {as+=a[i];bs+=b[i];}
    }
    printf("%d %d\n", as,bs);
}