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 count;
	int aSum, bSum;
	int aCard, bCard;

	while(cin >> count, count){
		aSum = bSum = 0;

		for(int i=0; i < count; i++){
			cin >> aCard >> bCard;
			if(aCard > bCard) aSum += aCard + bCard;
			else if(aCard < bCard) bSum += aCard + bCard;
			else aSum += aCard, bSum += bCard;
		}
		cout << aSum << " " << bSum << endl;
	}
}

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

C++: #include<stdio.h>

int main(void){
	int a_point,b_point,i,a_card,b_card,n;
	while(0==0){
		scanf("%d",&n);
		if(n==0) break;
		a_point=0;
		b_point=0;
		for(i=0;i<n;i++){
			scanf("%d %d",&a_card,&b_card);
			if(a_card>b_card) a_point+=(a_card+b_card);
			else if(a_card<b_card) b_point+=(a_card+b_card);
			else {
				a_point+=a_card;
				b_point+=b_card;
			}
		}
		printf("%d %d\n",a_point,b_point);
	}
	return 0;
}

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

int main(){
    
    while(1)
    {
        int num;
        cin>>num;
        
        if(num == 0)
        {
            break;
        }
        
        vector< int > cardA(num);
        vector< int > cardB(num);
        
        for(int i=0;i<num;++i)
        {
            int pA, pB;
            cin>>pA>>pB;
            cardA[i] = pA;
            cardB[i] = pB;
        }
        
        int pointA = 0;
        int pointB = 0;
        
        for(int i=0;i<num;++i)
        {
            if(cardA[i] ==cardB[i])
            {
                pointA += cardA[i];
                pointB += cardA[i];
            }
            else if(cardA[i] > cardB[i])
            {
                pointA += cardA[i] + cardB[i];
            }
            else
            {
                pointB += cardA[i] + cardB[i];
            }
        }
        
        cout<<pointA<<" "<<pointB<<endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
typedef long long int lli;
typedef pair<int,int> P;
#define F first
#define S second
const int INF=1000000000;

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

C++: #include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,a,b,countA=0,countB=0;
    do{
        cin>>n;
        if(n==0)break;
        for(int i=0;i<n;i++){
            cin>>a>>b;
            if(a>b){
                countA+=a+b;
            }else if(a<b){
                countB+=b+b;
            }//a==b
        }
        cout<<countA<<" "<<countB<<"/n";
    }while(1);
    cout<<countA<<" "<<countB<<endl;
}

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

int main(int argc, char const* argv[])
{
  while (true) {
    int n;
    std::cin >> n;
    if (n == 0) {
      break;
    }
    int pt_a = 0, pt_b = 0;
    for (int i = 0; i < n; ++i) {
      int a, b;
      std::cin >> a >> b;
      if (a == b) {
        pt_a += a;
        pt_b += b;
      } else if (a < b) {
        pt_b += a + b;
      } else {
        pt_a += a + b;
      }
    }
    std::cout << pt_a << " " << pt_b << std::endl;
  }
  return 0;
}

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

int main(){
	int a,b,c,m=0;
    while(m==0){
		std::cin>>c;
		if(c==0)break;
		for(int i=0;i<c;i++){
			int ap=0,bp=0;
			std::cin>>a>>b;
			if(a>b)ap+=a,ap+=b;
			else if(b>a){
				bp+=a;bp+=b;
			}else{
				ap+=a,bp+=b;
			}
		}
		std::cout<<ap<<" "<<bp<<std::endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,a,b,countA=0,countB=0;
    cin>>n;
    if(n!=0){
    do{
        for(int i=0;i<n;i++){
            cin>>a>>b;
            if(a>b){
                countA+=(a+b);
            }else if(a<b){
                countB+=(a+b);
            }//a==b
        }
        cout<<countA<<" "<<countB;
        cout<<"\n";
        countA=0,countB=0;
        cin>>n;
        if(n==0)break;
    }while(1);
    }
    cout<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,a=0,b=0,aa,bb;
  cin>>n;
  while(n!=0){
    for(int i=0;i<n;i++){
    cin>>aa>>bb;
    if(aa==bb){
      b+=bb;
      a+=aa;
    }else if(aa>bb){
      a+=aa+bb;
    }else if(aa<bb){
      b+=bb;
    }
  }
    cout<<a<<" "<<b<<endl;
    cin>>n;
    a=0;
    b=0;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
	int n,a=0,b=0;
	int num=0,sum=0;

	while(cin >> n, n){
	for(int i=0; i<n; i++){

		cin >> a >> b;

		if(a > b){
			
			num+=a+=b;
		}
		else if(a < b){
			
			sum+=b+=a;
		}
		else if(a == b){

			num+=a;
			sum+=b;
		}
	}

	cout << num << " " << sum << endl;
}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void) {

	for (int n = 0; (cin >> n) && n != 0;) {
		int aPoint = 0, bPoint = 0;
		for (int i = 0; i < n; i++) {
			int aCardPoint = 0, bCardPoint = 0;
			cin >> aCardPoint >> bCardPoint;
			if (aCardPoint == bCardPoint) {
				aPoint += aCardPoint;
				bPoint += bCardPoint;
			} else if (aCardPoint > bCardPoint) {
				aPoint += aCardPoint + bCardPoint;
			} else if (aCardPoint < bCardPoint) {
				bPoint += aCardPoint + bCardPoint;
			}
		}
		cout << aPoint << " " << bPoint << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int a,b;
	int a1,b1;
	int i;
	a1=0;
	b1=0;
	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n;i++){
			scanf("%d %d",&a,&b);
			if(a>b){
				a1+=a;
				a1+=b;
			}
			else if(a<b){
				b1+=a;
				b1+=b;
			}
			else{
				a1+=1;
				b1+=1;
			}
		}
		printf("%d %d",a1,b1);
		scanf("%d",&n);
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int card[100],i,j,a=0,b=0,c=1,n;
cin>>n;
while(n!=0){
for(i=0;i<2*n;i++){
cin>>card[i];
}
for(i=0;i<2*n;i=i+2){
if(card[i]>card[c]){
a=a+card[i]+card[c];
}
else if (card[i]==card[c]){
a=a+card[i];
b=b+card[c];
}
else{
b=b+card[i]+card[c];
}
c=c+2;
}
cout<<a<<" "<<b<<endl;
c=1;
a=0;
b=0;
cin>>n;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>

using namespace std;

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

C++: #include <stdio.h>

int main()
{
    int		a, b, n;
    int		asum, bsum;

    while(1)
    {
	scanf("%d", &n);
	if (n == 0)
	{
	    break;
	}
	asum = bsum = 0;
	for(int i = 0; i < n; i++)
	{
	    scanf("%d %d\n", &a, &b);
	    if (a > b)
	    {
		asum += a + b;
	    }else if (a < b ){
		bsum += a + b;
	    }else{
		asum += a;
		bsum += b;
	    }
	}
	printf("%d %d\n", asum, bsum);
    }
}