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>
using namespace std;
int main(){
	int n;
	int a,b;
	int A,B;
	cin>>n;
	while(true){
        if(n==0){break;}
	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;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  int c1,c2,p1 = 0,p2 = 0;
  while(scanf("%d",&n)){
    if(n == 0)break;
    p1 = p2 = 0;
    while(n--){
      scanf("%d %d",&c1,&c2);
      if(c1 > c2)p1 += c1+c2;
      else if(c1 < c2)p2 += c1+c2;
      else{
	p1 += c1;
	p2 += c2;
      }
    }
    printf("%d %d\n",p1,p2);
  }
}

C++: main(){int n,a,b,x,y,i;for(;x=y=0,scanf("%d",&n),n;printf("%d %d\n",x,y))for(i=n;scanf("%d%d",&a,&b),i;--i)(a-b)?x+=a,y+=b:(a>b?x:y)+=a+b;}

C++: #include<stdio.h>
int main (void) {
  int a[]={0}, b[]={0};
  int c,i,asum=0,bsum=0;
  scanf("%d",&c);
  for(i=0;i<c;i++) {
    scanf("%d %d",&a[i], &b[i]);
    if(a[i]>b[i])  asum=asum+a[i]+b[i];
    else if(a[i]<b[i])  bsum=bsum+a[i]+b[i];
    else {
      asum=asum+a[i];
      bsum=bsum+b[i];
    }
  }

  printf("%d %d\n",asum ,bsum);
  return 0;
}

C++: 
    #include<iostream>
using namespace std;
int main(){
  int n, a, b;
  int as =0, bs =0;
  cin >> n;
  if (n!= 0){
    for(int 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;}
    }
    cout<<as <<" "<<bs <<endl;
  }
  return 0;
}

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

using namespace std;
int main(void){
  int n,j = 0,i,c,a[10000],b[10000];
  /* vector <int> a;
     vector <int> b;*/
  vector <int> d;
  vector <int> sa(10000,0);
  vector <int> sb(10000,0);
  while(cin >> n,n != 0){
    for(i=0;i<n;i++){
      cin >> a[i];
      cin >> b[i];
    }
    
    i=0;
    for(i=0;i<n;i++){
      c = a[i] + b[i];
      if(a[i] > b[i]) sa[j] = sa[j] + c;
      else if(a[i] < b[i]) sb[j] = sb[j] + c;
      else{
	sa[j] = sa[j] + c/2;
	sb[j] = sb[j] + c/2;
      }
    }
    j++;

    cout << sa[j-1] << " " << sb[j-1] << endl;
  }
}

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

int main(){
  int n;
  int Acard,Bcard;
  int Atotal,Btotal;
while(true){
  cin>>n;
  if(n==0){
    break;
  }
  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';
  Atotal=0;
  Btotal=0;
}
  return 0;
}

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

int main(){
	int n, x, y, sumx=0, sumy=0;
	cin >> n;

	for(int i=0; i<n; i++){
		x=0,y=0;
		cin >> x >> y;
		if(x > y){
			sumx = sumx + x + y;
		}
		else if(x < y){
			sumy = sumy + x + y;
		}
		else if(x == y){
			sumx = sumx + x;
			sumy = sumy + y;
		}
	}
	
	cout << sumx << " " << sumy  <<  endl;
	return 0;
}

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

using namespace std;

int main()
{
    int N, a, b;
    while (cin >> N, N) {
        int p1 = 0, p2 = 0;
        for (int i = 0; i < N; i++) {
            cin >> a >> b;
            if (a > b) {
                p1 += a + b;
            } else if (a < b) {
                p2 += a + b;
            } else {
                p1 += a;
                p2 += b;
            }
        }
        cout << p1 << " " << p2 << endl;
    }
    return 0;
}

C++: 
#include <cstdio>

using namespace std;

#define FOR( i, n ) for( int i = 0; i < n; ++i )

int main( void )
{
	int point_a = 0;
	int point_b = 0;

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

	FOR( i, n )
	{
		int a, b;
		scanf( "%d %d", &a, &b );

		if( a > b )
		{
			// AÌ¿
			point_a += a+b;
		}
		else
		{
			if( a == b )
			{
				// ø«ª¯
				point_a += a;
				point_b += b;
			}
			else
			{
				// BÌ¿
				point_b += a+b;
			}
		}

	}

	// Ê
	printf( "%d %d\n", point_a, point_b );

	return 0;
}

C++: #include<stdio.h>
int main(void){
    int loop,a,b,c,d;
    scanf("%d",&loop);
    for(;loop--;){
        scanf("%d %d",&a,&b);
        if(a-b){
            if(a>b){
                c+=a+b;
            }else{
                d+=a+b;
            }
        }else{
            c+=a;
            d+=b;
        }
    }
    printf("%d %d",c,d);
    return 0;
}

C++: #include <iostream>
using namespace std;
  
int main()
{
  while(1){ 
  int i, n, x, y;
  cin >>n;

  if(n=0){break;}
  x=0; 
  y=0;
  
  int a[n], b[n];
    
  for(i=1;i<=n;i++)
  {
    cin >>a[i]>>b[i];
    if(a[i]>b[i])
    {
      x += a[i]+b[i];
    }
    else if(a[i]<b[i])
    {
      y += a[i]+b[i];
    }
    else
    {
      x += a[i];
      y += b[i];
    }
  }}
  
  cout <<x<<" "<<y<<"\n";
  
  return 0;
}

C++: #include <iostream>



int main () {
  int n, i;
  int left, right;
  int sum_a, sum_b;
  while (std::cin >> n) {
    if (n == 0) {
      break;
    }
    sum_a = 0;
    sum_b = 0;
    for (i = 0; i < n; i ++) {
      std::cin >> left >> right;

      if (left > right) sum_a += (left + right); 
      else if (left < right) sum_b += (left + right);
      else {
        sum_a += left;
        sum_b += right;
      }
    }
    std::cout << sum_a << " " << sum_b << std::endl;
  }
  return 0;
}

C++: // cardgame.cpp
#include <iostream>
using namespace std;

int main(){
	for(;;){
		int n=0;	// nを0でリセット
		int i,j;
		int a[10000], b[10000];
		int a_point=0, b_point=0;
		cin >> n;	// nを取得
		if(n==0)
			break;;
		for(i=0;i<n;++i){	// カードを配る
				cin >> a[i];
				cin >> b[i];
		}
		for(j=0;j<n;++j){
			if(a[j]>b[j])
				a_point+=(a[j]+b[j]);
	        else if(a[j]<b[j])
				b_point+=(a[j]+b[j]);
			else if(a[j]==b[j]){
				a_point+=a[j];
				b_point+=b[j];
			}
		}
		cout << a_point << " " << b_point << endl;
	}
	return 0;	
}

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

int main(void){
  int n;
  while(cin >> n, n != 0){
    int a = 0;
    int b = 0;    
    for(int i = 0; i < n; i++){
      int ta,tb;
      cin >> ta >> tb;
      int sum = ta + tb;
      if(ta > tb) a += sum;
      if(ta < tb) b += sum;
      if(ta == tb){
	a += ta; b += tb;
      }
    }
    cout << a << " " << b << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
	int a;
	int b[];
	int c[];
	int uma;
	int ushi;

	cin >> a;
	for (int i; i < a; i++){
		cin >> b[i];
		cin >> c[i];
	}
	for (int j; j < a; j++){
		if (b[j]>c[j]){
			uma = uma + 2;
		}
		if(b[j]=c[j]){
			uma = uma + 1;
			ushi = ushi + 1;
		}
		else{
			ushi = ushi + 2;
		}
	}
	cout << uma << ushi;

}

C++: #include <iostream>

using namespace std;

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

C++: #include<iostream>
int main() {
	int vec=0;
	int n;
	int a=0;
	int b=0;
	int game_a, game_b;
	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; b += game_b; }
				else if (game_a > game_b)a += game_a + game_b;
				else b += game_a + game_b;
			}
			std::cout << a << " " << b << std::endl; a = ; b = 0;
		}
	}
	return 0;
}

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

int main()
{
 int a,b,n;
 while(cin>>n, n)
 {
  int x=0, y=0;
 while(n--)
 {
   cin>>a>>b;
   if(a<b) {y+=a+b;}
   else if(a>b) {x+=a+b;}
   else {x+=a; y+=b;}
  }
 cout<<x<<" "<<y<<endl;
}