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>
using namespace std;

int main(void){
  int n;
  int a,b;
  while(1){
    cin>>n;
    int scoreA=0;
    int scoreB=0;
    if(n==0){return 0;}
    for(int i=0;i<n;i++){
      cin>>a>>b;
      if(a>b){
        scoreA+=(a+b);
      }
      else if(a<b){
        scoreB+=(a+b);
      }
      else{
        scoreA+=a;
        scoreB+=b;
      }
    }
    cout<<scoreA<<" "<<scoreB<<endl;
  }
}

C++: #include<iostream>

using namespace std;

int main(){
	int n, stage, stage2, i;

	while (true) {
		int left = 0, right = 0;
		cin >> n;
		if(n == 0) break;
		for(i = 0; i < n; i ++){
			cin >> stage >> stage2;
			if(stage > stage2) left += stage + stage2;
			else if(stage < stage2) right += stage + stage2;
			else{
				left += stage;
				right += stage2;
			}
		}
		cout << left << " " << right << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main () {
    int a, b, n, scorea, scoreb;
    while (1) {
        scanf("%d", &n);
        if (n == 0) break;
        while (n--) {
            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<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int n,asum,bsum,a,b,i;
	while(1){
		cin>>n;
		if(n==0)break;
		asum=0; bsum=0;
		for(i=0;i<n;i++){
			cin>>a>>b;
			if(a==b)asum+=a,bsum+=b;
			if(a>b)asum+=a+b;
			if(b>a)bsum+=a+b;
		}
		cout<<asum<<' '<<bsum<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main() {
	int n;
	int g = 0;
	int s = 0;
	int a, b;
	std::cin >> n;
	for (int i = 0; i<n; ++i) {
		std::cin >> a >> b;
		if (a == b)g += a, s += b;
		if (a>b) g += a + b;
		if (a<b) s += b + a;
	}
	std::cout << g << " " << s << std::endl;
	return 0;
}

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

int main() {
    int N=0;
    while(cin >> N && N!=0) {
        vector<int> A(N), B(N);
        for(int i=0; i<N; ++i) cin >> A[i] >> B[i];

        int ret_a=0, ret_b=0;
        for(int i=0; i<N; ++i) {
            if(A[i] < B[i]) {
                ret_b += A[i]+B[i];
            } else if(A[i] > B[i]) {
                ret_a += A[i]+B[i];
            } else {
                ret_a += A[i]; ret_b += B[i];
            }
        }
        cout << ret_a << " " << ret_b << endl;
    }
}

C++: #include<iostream>

using namespace std;

int main(){

  int n,A,B;

  A=0;
  B=0;

  for( ; ; ){

  cin>> n;

  if(n==0)break;

   for(int i=0;i<n;i++){
 
     int a,b;

     cin>>a>>b;

     if(a>b){
       A=A+a+b;
     }
     if(a<b){
       B=B+a+b;
     }
     if(a==b){
       A=A+a;
       B=B+b;
     }
   }
   cout<<A<<" "<<B<<endl;
  }

  return 0;
}

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

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

C++: #include<iostream>
#include<vector>
int main() {
	int vec=0;
	int n;
	int a=0;
	int b=0;
	int game_a, game_b;
	std::vector<int>veca, vecb;
	while (1) {
		std::cin >> n;
		if (n == 0)break;
		else {
			for (int i = 0; i < n; ++i) {
				std::cin >> game_a>>game_b;
				if (game_a > game_b)a += game_a + game_b;
				else b += game_a + game_b;
			}
			veca.push_back(a); vecb.push_back(b);
		}
	}
	for (int i = 0; i < veca.size(); ++i) {
		std::cout << veca[i] <<" "<<vecb[i]<< std::endl;
	}
	return 0;
}

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

int A = 0, B = 0, j;

int main(){
    cin >> j;
    for(int i = 0; i < j; i++){
        int as, bs;
        cin >> as >> bs;
        if(as > bs){
            A += as + bs;
        }else if(as < bs){
            B += as + bs;
        }else{
            A += as;
            B += bs;
        }
    }
    cout << A << " " << B << endl;
    return 0;
}

C++: #include<iostream>
int A,B;int main(void){using namespace std;int n,C,D;while(1){cin>>n;if(!n)break;A=0;B=0;for(;n>0;n--){cin>>C;cin>>D;if(C>D){A+=(C+D);}else if(C<D){B+=(C+D);}else{A+=C;B+=D;}}cout<<A<<" "<<B<<endl;}return 0;}

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

C++: //Volume5 -> 0501

#include <iostream>
#include <vector>
//#include <math.h>
//#include <string>
#include <cmath>
#include <iomanip>

int main();

int main(){
	std::vector<int> totalAPoint;		//Aの得点
	std::vector<int> totalBPoint;		//Bの得点
	int dataSetCount = 0;				//ゲーム数

	while (1){
		int n = 0;		//1ゲームの入力数

		std::cin >> n;
		//n=0で終了
		if (n == 0){
			break;
		}

		dataSetCount++;

		int aPoint = 0;		//1ゲームにおけるAの得点
		int bPoint = 0;		//1ゲームにおけるBの得点

		for (int i = 0; i < n; i++){
			int tempA;
			int tempB;

			std::cin >> tempA >> tempB;
			if (tempA > tempB){
				aPoint += (tempA + tempB);
			}
			else if (tempA < tempB){
				bPoint += (tempA + tempB);
			}
			//引き分け
			else{
				aPoint += tempA;
				bPoint += tempB;
			}
		}

		totalAPoint.push_back(aPoint);
		totalBPoint.push_back(bPoint);
	}

	//結果出力
	for (int i = 0; i < dataSetCount; i++){
		std::cout << totalAPoint[i] << " " << totalBPoint[i] << std::endl;
	}

	//while (1);
	return 0;
}

C++: #include <iostream>
using namespace std;
 
int main() {
    int n;

    while(1){
    cin >> n;
    if(n == 0) break;
    int num[10000][2] = {};
    int score[2] = {};

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < 2; ++j){
            cin >> num[i][j];
        }
        if (num[i][0] > num[i][1])
        {
            score[0] += num[i][0] + num[i][1];
        } else if (num[i][0] == num[i][1])
        {
            score[0] += num[i][0];
            score[1] += num[i][1];
        } else{
            score[1] += num[i][0] + num[i][1];
        }
    }

    cout << score[0] << " " << score[1] << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,pointA,pointB;
  int a[10000],b[10000];
  for(n = 1;n != 0;){  
 cout << "n";
 cin >> n;
 if(n != 0){
    pointA = 0; pointB = 0;
  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i];
  }
  for(int i = 0;i< n;i++){
    
    if(a[i] < b[i]){
      pointB = pointB + a[i] +b[i];
    } else if(a[i] > b[i]){
      pointA = pointA + a[i] +b[i];
    } else if(a[i] == b[i]){
      pointA = pointA + a[i];
      pointB = pointB + b[i];
    }
  }
 
  cout << pointA << " "<< pointB << endl;
 }
  }
  
  
}

C++: #include<bits\stdc++.h>
using namespace std;
int main(void){
	int n,asum,bsum,a,b,i;
	while(1){
		cin>>n;
		if(n==0)break;
		asum=0; bsum=0;
		for(i=0;i<n;i++){
			cin>>a>>b;
			if(a==b)asum+=a,bsum+=b;
			if(a>b)asum+=a+b;
			if(b>a)bsum+=a+b;
		}
		cout<<asum<<' '<<bsum<<endl;
	}
	return 0;
}