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

int main()
{
	int n;
	int a, b;
	std::vector<int> ansa;
	std::vector<int> ansb;
	int sa;
	int sb;
	
	do {
		std::cin >> n;
		for (int i = 0; i < n; i++)
		{
			sa = 0;
			sb = 0;
			std::cin >> a >> b;
			if (a > b) {
				sa += a + b;
			}
			else if (a == b) {
				sa += a;
				sb += b;
			}
			else {
				sb += a + b;
			}
		}
		ansa.push_back(sa);
		ansb.push_back(sb);
	} while (n != 0);

	for (int i = 0; i < n; i++)
	{
		std::cout << ansa[i] << " " << ansb[i] << std::endl;
	}

	return 0;
}

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

int main(void)
{
    
    while (1){
        int n;
        scanf("%d", &n);
        if (n == 0) break;
        
        int A, B;
        int A_sum = 0, B_sum = 0;
        
        for (int i = 0; i < n; i++){
            scanf("%d %d", &A, &B);
            
            if (B < A){
                A_sum += A + B;
            }
            else if (A < B){
                B_sum += A + B;
            }
            else {
                A_sum += A;
                B_sum += B;
            }
        }
        
        printf("%d %d\n", A_sum, B_sum);
        
    }
    
    return (0);
}

C++: #include<iostream>

using namespace std;

int main() {
	int p1[10000], p2[10000], n, point1, point2, i;
	while (true) {
		point1 = 0;
		point2 = 0;
		cin >> n;
		if (n == 0) { break; }
		for (i = 0; i < n; i++) {
			cin >> p1[i] >> p2[i];
		}
		for (i = 0; i < n; i++) {
			if (p1[i] == p2[i]) {
				point1 += p1[i];
				point2 += p2[i];
			}
			else if (p1[i] > p2[i]) {
				point1 += p1[i] + p2[i];
			}
			else {
				point2 += p1[i] + p2[i];
			}
		}
		cout << point1 << ' ' << point2 << endl;
	}
	return 0;
}

C++: #include <cstdio>
int main(){
  int n;
  int data[2],sum[2]={0,0};
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d%d",&data[0],&data[1]);
    if(data[0]>data[1])
      sum[0]+=data[0]+data[1];
    else if(data[0]<data[1])
      sum[1]+=data[0]+data[1];
    else{
      sum[0]+=data[0];
      sum[1]+=data[1];
    }
  }
  printf("%d %d\n",sum[0],sum[1]);
  return 0;
}

C++: #include <iostream>                                                  
using namespace std;                                                 
                                                                     
int main() {                                                         
  while (true) {                                                     
    int n;                                                           
    cin >> n;                                                        
    if (n==0) {                                                      
      break;                                                         
    }                                                                
    int A, B;                                                        
    int Ascore = 0, Bscore = 0;                                      
    for (int i=0; i<n; i++) {                                        
      cin >> A >> B;                                                 
      if (A>B) {                                                     
        Ascore += (A+B);                                             
      } else if (B>A) {                                              
        Bscore += (A+B);                                             
      } else {                                                       
        Ascore += A;                                                 
        Bscore += B;                                                 
      }                                                              
    }                                                                
    cout << Ascore << " " << Bscore << endl;                         
  }                                                                  
  return 0;                                                          
}

C++: #include<iostream>
int main(){
int a;
std::cin>>a;
std::cout<<a;
return 0;
}

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

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

int main() {
	int q[10000 - 1], w[10000 - 1];
	int n;
	int a = 0;
	int b = 0;
	int x = 1;
	while (x == 10000) {
		cin >> n;
		if (n == 0) {
			break;
		}

		for (int i = 1; i <= n; ++i) {
			int c, d;
			cin >> c >> d;
			if (c == d) {
				a = a + c;
				b = b + d;
			}
			else if (c > d) {
				a = a + c + d;
			}
			else {
				b = b + c + d;
			}
		}
		q[x] = a;
		w[x] = b;
		x++;
	}
	for (int j = 1; j <= x; ++j) {
		cout << q[j] << " " << w[j] << endl;
	}
}

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

int main() {
	int i, a, b, n, ap, bp;

	while (1) {
		cin >> n;
		if (n == 0)break;
		ap = 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 <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>
using namespace std;
int main(){
	int n,a,b;
	while(cin >> n,n){
		int ta=0,tb=0;
		while(n--){
			cin >> a >> b;
			if(a>b)ta+=(a+b);
			else if(a=b){
				ta+=a;tb+=b;
			}else tb+=(a+b);
		}
		cout << ta <<" "<< tb << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int n, asco, bsco;
	int a[10000], b[10000];

	while (cin >> n, n != 0){

		asco = bsco = 0;

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

		cout << asco << " " << bsco << endl;
	}
	return 0;
}