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<vector>
#include<algorithm>
#include<string>
using namespace std;

int main(){

  std::vector<std::pair<int,int> > data;

  char buf[100];
  int n;

  std::cin >> buf;
  n = atoi(buf);

  char a[100];
  char b[100];

  for (int i=0; i<n ; i++){
    std::cin >> a;
    std::cin >> b;
    data.push_back(std::pair<int,int>(atoi(a),atoi(b)));
  }

  int you = 0;
  int opp = 0;

  for (std::vector<std::pair<int,int> >::iterator it = data.begin(); it != data.end(); it++){
    int yv = (*it).first;
    int ov = (*it).second;
    if (yv > ov ){
      you += yv+ov;
    }else if (yv < ov){
      opp += yv+ov;
    }else{
      you += yv;
      opp += ov;
    }
  }

  std::cout << you << " " << opp << std::endl;

  return 0;
}

C++: #include<iostream>

using namespace std;

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

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

C++: #include<iostream>
int score_a,score_b;
void main(void)
{
using namespace std;
int n,data_a,data_b;
while(1)
{
cin>>n;
if(!n)break;
score_a=0;
score_b=0;
for(;n>0;n--){
cin>>data_a;
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;
}
}
cout<<score_a<<" "<<score_b<<endl;
}
}

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

int main() {
    int t;
    cin >> t;
    for(int i = 0;i < t;i++){
        int n;
        cin >> n;
        int a,b,sum1 = 0,sum2 = 0;
        for(int j = 0;j < n;j++){
            cin >> a >> b;
            sum1 += a;
            sum2 += b;
        }
        cout << sum1 << " " << sum2 << endl;
    }
	return 0;
}

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

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

C++: #include<iostream>
using namespace std;
 
int main(){
	int a;
	int uma;
	int ushi;
	int b;
	int c;

	cin >> a;
	for (int i; i < a; i++){
		cin >> b;
		cin >> c;
		if (b>c){
			uma = uma + b + c;
		}
		if(b=c){
			uma = uma + b;
			ushi = ushi + c;
		}
		else{
			ushi = ushi + b + c;
		}
	}
	cout << uma <<" "<<ushi<<endl;

}

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

C++: #include <cstdio>
using namespace std;
int main()
{
	long long int a=0,b=0,n,x,y;
	scanf("%lld",&n);
	for(long long int i=0;i<n;i++){
		scanf("%lld %lld",&x,&y);
		if(x>y) {a+=x+y;}
		if(x<y) {b+=x+y;}
		if(x==y){
			a+=x;
			b+=y;
		}
	}
	printf("%lld %lld\n",a,b);
	return 0;
}

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

struct player{
    int point = 0;
    int card[10000];
private:


};

int main()
{
    int loop;
    player a, b;
    cin >> loop;
    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];
        if(a.card[c] == b.card[c]) a.point += a.card[c], b.point +=b.card[c];
        if(a.card[c] > b.card[c]) 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 argc, char **argv)
{
	int n, s, t, a, b;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		a = b = 0;
		for(int i = 0; i < n; i++){
			cin >> s >> t;
			if(s > t){
				a += (s+t);
			} else if(s < t){
				b += (s+t);
			} else {
				a += s;
				b += t;
			}
		}
		
		cout << a << " " << b << endl;
	}
	
	return 0;
}

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

return 0;
}

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


int main(){
	int n;
	int ary1[10100];
	int ary2[10100];

	while (cin >> n, n != 0) {
		int sum1 = 0, sum2 = 0;
		for (int i = 0; i < n; i++) {
			cin >> ary1[i] >> ary2[i];
		}

		for (int i = 0; i < n; i++) {
			if (ary1[i] > ary2[i]) {
				sum1 += (ary1[i] + ary2[i]);
			}
			else if (ary1[i] < ary2[i]) {
				sum2 += (ary1[i] + ary2[i]);
			}
			else {
				sum1 += ary1[i];
				sum2 += ary2[i];
			}
		}

		cout << sum1 << " " << sum2 << endl;
	}

	return 0;
}

C++: #include "stdafx.h"
#include <iostream>

int A[10000], B[10000];

int main()
{
	int n, a, b;
	std::cin >> n;
	while (n != 0)
	{
		a = 0; 
		b = 0;
		for (int i = 0; i < n; i++)
		{
			std::cin >> A[i] >> B[i];
			if (A[i] > B[i])
			{
				a += A[i] + B[i];
			}
			if (A[i] == B[i])
			{
				a += A[i];
				b += B[i];
			}
			if (A[i] < B[i])
			{
				b += B[i];
			}
		}
		std::cout << a << " " << b << std::endl;
		std::cin >> n;
	}
    return 0;
}

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

using namespace std;

int main(){
    
   return 0;

}

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

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

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	while(n!=0){
		int point[2];
		enum {
			A,
			B,
		};
		int sum[2] = {};
		for (int i = 0; i < n; i++) {
			cin>>point[A]>>point[B];
			if (point[A]>point[B]) {
				for (auto j : point) {
					sum[A]+=j;
				}
			} else if(point[A] == point[B]) {
				for (auto j : sum) {
					j+=point[A];
				}
			} else {
				for (auto j : point) {
					sum[B]+=j;
				}
			}
		}
		cout<<sum[A]<<" "<<sum[B]<<endl;
		cin>>n;
	}
	return 0;
}