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 <iostream>

int main(){
    int n, a[10], b[10], apt = 0, bpt = 0;
    std::cin >> n;
    for(int i=0; i<n; i++){
        std::cin >> a[i] >> b[i];
        if(a[i] > b[i])
            apt += a[i] + b[i];
        else if(b[i] > a[i])
            bpt += a[i] + b[i];
        else{
            apt += a[i];
            bpt += b[i];
        }
    }
    std::cout << apt << ' ' << bpt << std::endl;
    return 0;
}

C++: using System;
using System.Linq;

namespace ACTest
{
    class AOJ500
    {
        static void Main(string[] args)
        {
            int num = 1;
            int[] totalScore = new int[2];
            int[] roundScore = new int[2];
            while (num != 0)
            {
                totalScore = Enumerable.Repeat<int>(0, 2).ToArray();
                //int[,] roundScore = new int[num, 2];

                num = int.Parse(Console.ReadLine());
                for (int i = 0; i < num; i++)
                {
                    ///totalScore = Enumerable.Repeat<int>(0, 2).ToArray();
                    string[] input = Console.ReadLine().Split(' ');
                    roundScore[0] = int.Parse(input[0]);
                    roundScore[1] = int.Parse(input[1]);
                    if (roundScore[0] > roundScore[1])
                    {
                        totalScore[0] += roundScore[0] + roundScore[1];
                    }
                    else if (roundScore[0] < roundScore[1])
                    {
                        totalScore[1] += roundScore[0] + roundScore[1];
                    }
                    else
                    {
                        totalScore[0] += roundScore[0];
                        totalScore[1] += roundScore[1];
                    }


                }
                Console.WriteLine(totalScore[0] + " " + totalScore[1]);
            }
            //while (true) ;
        }

    }
}

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

int main()
{
	int n;
	do {
		cin >> n;
		int score_a = 0, score_b = 0;
		for (int i = 0; i < n; i++) {
			int inp_a, inp_b;
			cin >> inp_a >> inp_b;
			if (inp_a == inp_b) {
				score_a += inp_a;
				score_b += inp_b;
			}
			else {
				(inp_a>inp_b ? score_a : score_b) += inp_a + inp_b;
			}
		}
		if (n > 0 && n <= 10000) {
			cout << score_a << ' ' << score_b << '\n';
		}
	} while (n > 0 && n <= 10000);

	return 0;
}

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

int main() {
    
    int n, a, b, i;
    int ap, bp;
    
    cin >> n;
    ap = 0; bp = 0;
    
    for(i = 0; i < n; i++) {
        cin >> a >> b;
        if(a > b) {
            ap += a + b;
        } else if(a < b) {
            bp += a + b;
        } else {
            ap += a;
            bp += b;
        }
    }
    
    cout << ap << " " << bp << endl;
    
    return 0;

}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
	long long int a,b,n,x,y;
	a=0;
	b=0;
	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\n",a,b);
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

//define
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

int main(){
  ios_base::sync_with_stdio(0);
  int n;
  while(cin >> n, n){
    int score_a = 0, score_b = 0;
    int a, b;
    for(int i = 0; i < n; i++){
      cin >> a >> b;
      if(a == b){
        score_a += a;
        score_b += b;
      }else if(a > b){
        score_a += a + b;
      }else{
        score_b += a + b;
      }
    }
    cout << score_a << " " << score_b << endl;
  }
  return 0;
}

C++: #include <iostream>

int main(){
	int i,n,a,b,apoint=0,bpoint=0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a;
		cin >> b;
		if(a>b){apoint+=a;apoint+=b;}
		else if(b>a){bpoint+=a;bpoint+=b;}
		else {apoint+=a;bpoint+=b;}
	}
	cout << apoint <<' ' << bpoint << endl;
	return 0;
}

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 << sa << " " << sb << endl;
      }
    }
  }
  return 0;
}

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

int main(){
	int inputCount;
	int pointSumA = 0, pointSumB = 0;
	
	while(cin >> inputCount){
		if (inputCount) break;
		
		int cnt = 0;
		while (cnt++ < inputCount){
			int tempA, tempB;
			cin >> tempA >> tempB;
			if (tempA > tempB){
				pointSumA += (tempA + tempB);
			} else if (tempA == tempB) {
				pointSumA += tempA;
				pointSumB += tempA;
			} else {
				pointSumB += (tempA + tempB);
			}
		}
		
		cout << pointSumA << " " << pointSumB << endl;
	}
	
	return 0;
}

C++: #include "../bits/stdc++.h"

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (unsigned i = (a); i <= (b); ++i)
#define per(i, a, b) for (unsigned i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

int main(int argc, char const *argv[]) {
  while (1) {
    L n;
    L ans1 = 0;
    L ans2 = 0;
    scanf("%ld", &n);
    if (n == 0) { break; }
    for (unsigned i = 0; i < n; i++) {
      L a, b;
      cin >> a >> b;
      if (a > b) {
        ans1 += a + b;
      } else if (a < b) {
        ans2 += a + b;
      } else {
        ans1 += a;
        ans2 += b;
      }
    }
    printf("%ld %ld\n", ans1, ans2);
  }

  return 0;
}

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

using namespace std;

int main(void){
  int n;
  int a, b;
  int suma = 0, sumb = 0;
  while(1){
    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;
}