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 <stdio.h>

int main(){
	int i,pa,pb,tpa,tpb,count;
	while(1){
		tpa = 0;
		tpb = 0;
		scanf("%d",&count);
		if (count == 0) break;
		for(i=0;i<count;i++){
			scanf("%d %d",&pa,&pb);
			if(pa == pb) {
				tpa += pa;
				tpb += pb;
			}
			else if(pa > pb) tpa += (pa+pb);
			else tpb += (pa+pb);
		}
		printf("%d %d\n",tpa,tpb);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespase 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 <iostream>
using namespace std;

int main() {
	int n;
	int a, b;
	int sumA, sumB;
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		
		sumA = 0;
		sumB = 0;
		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;
			}
		}
		
		cout << sumA << " " << sumB << endl;
	}
	return 0;
}

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

int main(){
  int n;
  int Acard,Bcard;
  int Atotal,Btotal;
  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 n, a, b;
    int sa, sb;
     
    while(1){
        cin >> n;
        if(n==0) break;
        sa=0; sb=0;
         
        for(int i=0;i<n;i++){
            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;
    }
    return 0;
}

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

int main()
{
	int a;
	int r, l;
	int rsum, lsum;
	rsum = 0;
	lsum = 0;
	do{
		cin >> a;
		for (int i = a; i > 0; i--){

			cin >> r;
			cin >> l;
			if (r > l){
				rsum += r + l;
			}
			else if (l > r){
				lsum += r + l;
			}
			else{
				rsum += r;
				lsum += l;
			}
		}
		cout << rsum << ' ' << lsum << endl;
	} while (a != 0);
}

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

struct player{
    int point;
    int card[10000];
    inline player(){point = 0;}
};

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];
            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 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 + 2;
		}
		if(b=c){
			uma = uma + 1;
			ushi = ushi + 1;
		}
		else{
			ushi = ushi + 2;
		}
	}
	cout << uma <<" "<<ushi;

}

C++: #include <stdio.h>
#define loop(num)	for(int a = 0; a < num; a++)

int main(){
	int num;
	__int64 A = 0, B = 0;
	int a_card, b_card;
	scanf("%d", &num);
	loop(num){
		scanf("%d%d", &a_card, &b_card);
		if (a_card < b_card) B += (a_card + b_card);
		if (b_card < a_card) A += (a_card + b_card);
		if (a_card == b_card){
			A += a_card;
			B += b_card;
		}
	}
	printf("%lld %lld\n", A, B);
	return 0;
}

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

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 (d > c) b += c+d;
            else a += c, b += d;
        }

        printf("%d %d\n", a, b);
    }

    return 0;
}

C++: #include <cstdio>
int main(){
	int a, b, c;
	scanf("%d", &a);
	b = 0;
	c = 0;
	int n_a[a];
	int n_b[a];
	for(int i=0; i<a; i++){
		scanf("%d %d", &n_a[i], &n_b[i]);
	}
	for(int i=0; i<a; i++){
		if(n_a[i] > n_b[i]){
			b += n_a[i]+n_b[i];
		}else if(n_a[i] < n_b[i]){
			c += n_a[i]+n_b[i];
		}else if(n_a[i] == n_b[i]){
			b += n_a[i];
			c += n_b[i];
		}
	}
	printf("%d %d", b, c);
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    int data_num;

    while (cin >> data_num) {
        if (data_num == 0) break;

        int player1_ans = 0;
        int player2_ans = 0;
        
        for (int i = 0; i < data_num; ++i) {
            int data1, data2;
            
            cin >> data1 >> data2;
            
            if (data1 > data2) {
                player1_ans += data1 + data2;
            } else if (data1 == data2) {
                player1_ans += data1;
                player2_ans += data2;
            } else {
                player2_ans += data1 + data2;
            }

        }

        cout << player1_ans << " " << player2_ans << endl;

    }
    
    return 0;
}

C++: #include<cstdio>

using namespace std;

int main() {
  int n;
  while (1) {
    scanf("%d", &n);
    if (n==0)
      break;
    
    int tmp1, tmp2, a=0, b=0;
    
    for (int i=n; i>0; i--) {
      scanf("%d %d", &tmp1, &tmp2);
      if (tmp1>tmp2)
	a+=tmp1+tmp2;
      else if (tmp1==tmp2)
	a+=tmp1, b+=tmp2;
      else
	b+=tmp1+tmp2;
    }
    printf("%d %d\n", a, b);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n;
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        int a;
        int b;
        int a_result = 0;
        int b_result = 0;
        for(int i = 0; i < n; i++){
            cin >> a >> b;
            if(a > b){
                a_result += a + b;
            }
            else if(a < b){
                b_result += a + b;
            }
            else{
                a_result += a;
                b_result += b;
            }
        }
        cout << a_result << " " << b_result << endl;
    }
}

C++: #include <stdio.h>

main()
{
	int A,B,a,b,i,n;
	while(1)
	while(scanf("%d",&n)){
	if(n==0) break;
	A=0;
	B=0;
		for(i=1;i<n+1;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);}
}

C++: #include <iostream>
#include <algorithm>

int main(){
    int a, b, lcm, gcd;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			if(_b % _a == 0){
				gcd = _a;
				break;
			}
			_a = _a % _b;
			std::swap(_a, _b);
		}
		lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}