Go: package main

import "fmt"

func main() {
	for {
		var a, b, n int
		fmt.Scanf("%d", &n)

		if n == 0 {
			return
		}

		for i := 0; i < n; i++ {
			var cardA, cardB int
			fmt.Scanf("%d %d", &cardA, &cardB)

			if cardA > cardB {
				a += cardA + cardB
			} else if cardB > cardA {
				b += cardA + cardB
			} else {
				a += cardA
				b += cardB
			}
		}

		fmt.Println(a, b)
	}
}

C++: #include <cstdio>
int main(){
 long asum,bsum,a,b,n,i;
 asum=bsum=0;
 scanf("%ld",&n);
 for(i=0;i<n;i++){
  scanf("%ld %ld",&a,&b);
  if (a>b) asum += a+b;
  if (a<b) bsum += a+b;
  if (a==b) { asum += a; bsum += b; }
 };
 printf("%ld %ld\n",asum,bsum);
 return 0;
};

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

int main()
{
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    int A = 0, B = 0;
    for (int i = 0; i < n; ++i) {
      int c1, c2;
      cin >> c1 >> c2;
      if (c1 > c2) {
	A += (c1+c2);
      } else if (c1 < c2) {
	B += (c1+c2);
      } else {
	A += c1;
	B += c2;
      }
    }
    cout << A << " " << B << endl;
  }
  return 0;
}

C++: #include <iostream>
using std::cout;
using std::endl;
using std::cin;

int main() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) {
			break;
		}
		int sa = 0,sb = 0;
		while (n--) {
			int a,b;
			cin >> a >> b;
			if (a > b) {
				sa += a + b;
			} else if (a < b) {
				sb += a + b;
			} else {
				sa += a;
				sb += b;
			}
		}
		cout << sa << " " << sb << endl;
	}
}

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

int main(){
	int n,a,b;
	long suma=0,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{suma+=a;sumb+=b;}
	}
	printf("%ld %ld\n",suma,sumb);
}

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

int main(){
	long long n, x, y, sumx=0, sumy=0;
	cin >> n;

	for(int i=0; i<n; i++){
		x=0,y=0;
		cin >> x >> y;
		if(x > y){
			sumx = sumx + x + y;
		}
		else if(x < y){
			sumy = sumy + x + y;
		}
		else if(x == y){
			sumx = sumx + x;
			sumy = sumy + y;
		}
	}
	
	cout << sumx << " " << sumy  << "\n" << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

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

C++: #include<iostream>
#include<vector>
int main() {
	std::vector<int> a, b;
	while (true) {
		int n;
		int as = 0, bs = 0;
		std::cin >> n;
		if (!n) {
			break;
		}
		for (int i = 0; i < n; ++i){
			int n, m;
			std::cin >> n >> m;
			if (n == m) { as += n;
			bs +=  m;
			}
			else if (n > m) {
				 + m;
			}
			else if (m > n) {
				
			}
		}
		a.push_back(as);
		b.push_back(bs);
	}
	for (int i = 0; i < a.size(); ++i) {
		std::cout << a[i] << " " << b[i] << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main() {
	int n;
	int ag = 0, bg = 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]) { ag += a[i]; ag += b[i]; }
		else { bg += a[i]; bg += b[i]; }
	}
	std::cout << ag << " " << bg << std::endl;
	return 0;
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
  int n,pointA,pointB;
  int a[10000],b[10000];
  pointA = 0; pointB = 0;
  for(n = 1;n != 0;cin >> n){  
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 score[1000][2];
int main(){
	int i;
	int N,a,b,scorsole= 0;
	while(1){
		cin >> N;
		if(N == 0)
			break;
		for(i = 0;i < N;i++){
			cin >> a >> b;
			if(a > b)
				score[scorsole][0] += a+b;
			else if(a == b){
				score[scorsole][0] += a;
				score[scorsole][1] += b;
			}
			else
				score[scorsole][1] += a+b;
		}
		scorsole++;
	}
	for(i = 0;i < scorsole;i++){
		cout << score[i][0] << " " << score[i][1] << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int a,b,c,d,e;
	while(true){
		d=0;
		e=0;
		cin>>a;
		if(a==0){
			break;
		}
		for(int i=0;i<a;i++){
			cin>>b>>c;
			if(b>c)
				d=d+b+c;
			else if(c>b)
				e=e+b+c;
			else{
				e=e+c;
				d=d+c;
			}
		}
		cout<<d<<" "<<e<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
typedef long long LL;
using namespace std;

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

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

int main ()
{
    int	N;
    while (cin >> N, N) {
	int n1, n2;
        int a =	0, b = 0;
        for (int i = 0; i < N; i++) {
            cin >> n1 >> n2;
            if (n1 > n2) a += n1 + n2;
            else if (n1 < n2) b	+= n1 +	n2;
            else {
                a += n1;
                b += n2;
            }
        }
        cout <<	a << " " << b << endl;
    }

    return 0;
}

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

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

return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int A,B,a,b,n;
	while(cin>>n,n){
		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 <stdio.h>
#include <iostream>

using namespace std;

int main() {

	int c;
	int a,b;
	int tokuten1 = 0;
	int tokuten2 = 0;
	
	while (cin >> c) {
		tokuten1 = 0;
		tokuten2 = 0;
		if (c == 0) {
			break;
		}
		for (int i = 0; i < c; i++) {
			cin >> a >> b;
			if (a > b) {
				tokuten1 += (a + b);
			} else if (a < b) {
				tokuten2 += (a + b);
			} else {
				tokuten1 += a;
				tokuten2 += b;
			}
		}
		cout << tokuten1 << " " << tokuten2 << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int N, A, B, X, Y;

	while (true)
	{
		cin >> N; A = 0; B = 0;

		if (N == 0) { break; }

		for (int i = 0; i < N; i++)
		{
			cin >> X >> Y;

			if (X > Y) { A += X + Y; }
			if (X < Y) { B += X + Y; }
			if (X == Y) { A += X; B += Y; }
		}

		cout << A << ' ' << B << endl;
	}

	return 0;
}

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

int main(){
  int n;
  int Acard,Bcard;
  int Atotal,Btotal;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>Acard>>Bcard;
    if(Acard>Bcard){
      Atotal+=(Acard+Bcard);
    }else if(Bcard>Acard){
      Btotal+=(Acard+Bcard);
    }else{
      Atotal+=Acard;
      Btotal+=Bcard;
    }
  }

  cout<<Atotal<<' '<<Btotal<<'\n';
  return 0;
}