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<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;
}

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) {
				as += n + m;
			}
			else if (m > n) {
				bs += n+ m;
			}
		}
		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>
using namespace std;

int main(){

	while(true){

		int n;
		cin >> n;

		if(n == 0){
			break;
		}

		int* a = new int[n];
		int* b = new int[n];

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

		int a_total = 0;
		int b_total = 0;

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

		cout << a_total << " " << b_total << endl;

	}
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n,A=0,B=0;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int a,b;
		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;
}

C++: #include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 

using namespace std;

int main()
{
	int n,ca,cb,A,B;

	cin>>n;
	while(n>0){
		ca=cb=A=B=0;
		for(int i=0;i<n;i++){
			cin>>ca>>cb;
			if(ca>cb) A+=ca+cb;
			else if(cb>ca) B+=ca+cb;
			else{A+=ca;B+=cb;}
		}
		cout<<A<<" "<<B<<endl;
		cin>>n;
	}

	return 0;
}

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

int main()
{	
	int n,a[10000]={},b[10000]={},ascore=0,bscore=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		cin>>b[i];
		if(a[i]>b[i]){
			ascore+=a[i]+b[i];
		}else if(a[i]<b[i]){
			bscore+=a[i]+b[i];
		}else if(a[i]==b[i]){
			ascore+=a[i];
			bscore+=b[i];
		}
	}

	cout<<ascore<<" "<<bscore<<endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n;
    a=b=0;
    cin>>n;
    while(n--){
        int x,y;
        cin>>x>>y;
        if(x>y)a+=x+y;
        else if(x<y)b+=x+y;
        else{
            a+=x;
            b+=x;
        }
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}