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>
#include<string>
using namespace std;
int N, S, i, cnt, R, num;
string str, s;
string ring[101];
int main(){
    cin >> str >> N;
    S = str.size();
    for (i=0; i<N; i++){
        cin >> s;
        ring[i] = s + s;
    }
    cnt = 0;
    for (i=0; i<N; i++){
        R = ring[i].size();
        for (num = 0; num < R-S+1; num++){
            if( ring[i].substr(num,S) == str ){
                cnt++; break;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

C++: #include <stdio.h>

int main () {
    int a, b, n, scorea, scoreb;
    scanf("%d", &n);
    while (~scanf("%d %d", &a, &b)) {
        if (a == b) {
            scorea += a;
            scoreb += b;
        }
        else if (a > b) {
            scorea += a + b;
        } else {
            scoreb += a + b;
        }
    }

    printf("%d %d\n", scorea, scoreb);
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1e7
int main(){
    int n;
    while(cin >> n,n){
        vi v(n+1,0);
        vi v2(n+1,0);
        int ans1 = 0; int ans2 =0;
        rep(i,n){
            cin >> v[i] >> v2[i];
            if(v[i]>v2[i])
                ans1+=v[i]+v2[i];
            else if(v[i] < v2[i])
                    ans2 += v[i]+v2[i];
            else{
                ans1+=v[i]; ans2= v2[i];}
        }
        cout << ans1 << " " << ans2 << endl;
    }
}

C++: #include <cstdio>

int n;
int a,b;
int A,B;

int main()
{
  scanf("%d", &n);

  if(!n)return 0;
  
  A=B=0;

  for(int i=0;i<n;i++){
    scanf("%d%d",&a,&b);
    if (a>b) {
      A+=a+b;
    } else if (a<b) {
      B+=a+b;
    } else {
      A+=a;
      B+=b;
    }
  }

  printf("%d %d\n", A,B);

  main();
}

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

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

int main(){
	int a[4];
	int b[4];
	int i=0;
	int s=0;
	int t=0;
	
	for(i=0;i<4;i++){
		cin>>a[i];
		s=s+a[i];
	}
	
	for(i=0;i<4;i++){  
		cin>>b[i];
		t=t+b[i];
	}
	
	if(s<t){
		cout<<t<<endl;
	}else{
		cout<<s<<endl;
	}
}

C++: #include <stdio.h>

int main(void) {
	int n, i, po[2] = {0}, ca[2];
	
	scanf("%d", &n);
	for(i = 0; n > i; i++){
		scanf("%d%d", &ca[0], &ca[1]);
		if(ca[0] > ca[1]) po[0] += ca[0]+ca[1];
		else if(ca[0] < ca[1]) po[1] += ca[0]+ca[1];
		else{ po[0] += ca[0]; po[1] += ca[1];}
	}
	printf("%d %d\n",po[0],po[1]);
	return 0;
}

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

int main(void) {
	int i, n, a, b, as = 0, bs = 0;
	cin >> n;

	for(i=0 ; i<n ; i++) {
		cin >> a >> b;
		if(a > b)		{ as += a + b; }
		else if(a < b)	{ bs += a + b; }
		else 			{ as += a; bs += b; }
	}
	printf("%d %d\n", as, bs);
	return 0;
}

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

int main(void)
{
	int a,b,n;
	int as, bs;

	while(cin >> n, n){
		as = bs = 0;
		for(int i = 0; i < n; i++){
			cin >> a >> b;
			if(a > b)
				as += a + b;
			else if(b > a)
				bs += a + b;
			else{
				as += a;
				bs += b;
			}
		}

		cout << as << ' ' << bs << endl;
	}


	return 0;
}

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

int main() {
    int AsPoint, BsPoint, AsCard, BsCard;
    int key;
    while(true){
        cin >> key;
        AsPoint = BsPoint = 0;
        if(key == 0) return 0;
        while(key != 0) {
            cin >> AsCard;
            cin >> BsCard;
            if(AsCard == BsCard) {
                AsPoint += AsCard;
                BsPoint += BsCard;
            } else {
                AsPoint += (AsCard > BsCard) ? AsCard + BsCard : 0;
                BsPoint += (BsCard > AsCard) ? AsCard + BsCard : 0;
            }
            --key;
        }
        cout << AsPoint << " " << BsPoint << endl;
    }
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	int N; cin >> N;
	int as, bs;
	for (int i = 0; i < N; ++i) {
		int a, b; cin >> a >> b;
		if (a > b) {
			as += a + b;

		}
		else if (b > a) {
			bs += a + b;
		}
		else {
			as += a;
			bs += b;
		}

	}
	cout << as <<" "<< bs << 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;
}

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

int main()
{
    int n;
    int sum_A[5];
    int sum_B[5];
    int A, B;
    int j = 0;

    while (n != 0){
        cin >> n;
        
        for (int i = 0; i < n; i++){
            cin >> A;
            cin >> B;
            if (A > B){
                sum_A[j] += A + B;
            }
            else {
                sum_B[j] += A + B;
            }
            A = 0;
            B = 0;
        }
        for (int l = 0; l <= j; l++){
            cout << sum_A << " " << sum_B << endl;
        }
        j++;
    }
    return (0);
}

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

typedef long long ll;

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

C++: #include <iostream>

using namespace std;

int main() {
	int n;
	while (cin >> n && n != 0) {
		int A=0, B=0, a, b;
		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;
	}
}