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

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

C++: #include <stdio.h>

int i;
int a, b;
int n;

int main() {
    while (1) { 
        a = 0;
        b = 0;

        scanf("%d", &n);
        if (n == 0) return 0;

        for (i=0; i<n; i++) {
            int l, r;
    
            scanf("%d %d", &l, &r);
            if (l > r) {
                a += l + r;
            } else if (l < r) {
                b += l + r;
            } else {
                a += l;
                b += r;
            }
        }
    
        printf("%d %d\n", a, b);
   }
}

C++: #include <iostream>
using namespace std;
       
int main()
{
  while(1){ 
  int i, n, x, y;
  cin >>n;
     
  if(n==0){break;}
  else
  {
  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>
using namespace std;

int main()
{
 int a,b,n,x=0,y=0;
 cin>>n;
 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<<" "<<b<<endl;
 return 0;
}

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

	while (true){
		cin >> a;
		if (a == 0){ break; }
		else{
			for (int i; i < a; i++){
				cin >> b;
				cin >> c;
				if (b>c){
					uma = uma + b + c;
				}
				if (b == c){
					uma = uma + b;
					ushi = ushi + c;
				}
				else{
					ushi = ushi + b + c;
				}
			}
		}
		cout << uma << " " << ushi;
	}
}

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

int main()
{
	int n;
	int a[10000];
	int b[10000];
	while (cin >> n, n)
	{
		for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
		int A = 0;
		int B = 0;
		for (int i = 0; i < n; i++)
		{
			if (a[i] > b[i])
			{
				A += a[i] + b[i];
			}
			else if (a[i] < b[i])
			{
				B += a[i] + b[i];
			}
			else
			{
				A += a[i];
				B += b[i];
			}
		}
		cout << A << ' ' << B << endl;
	}

	return 0;
}

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

	int n, a, b, ap = 0, bp = 0, i;

	cin >> n;
	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;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

int n,a,b,asum,bsum;

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

C++: #include<iostream>
#include<vector>
int main() {
	int i = 0;
	std::cin >> i;
	int A = 0, B = 0;
	std::vector<int> a(10000), b(10000);
	for (int j = 0; j < i; ++j) {
		std::cin >> a[j] >> b[j];
	}
	for (int j = 0; j < i; ++j) {
		if (a[j] > b[j]) {
			A += (a[j] + b[j]);
		}
		else if (a[j] < b[j]) {
			B += (a[j] + b[j]);
		}
		else {
			A += a[j];
			B += b[j];
		}
	}
	std::cout << A << " " << B << std::endl;
}

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

return 0;
}

C++: #include<stdio.h>

int main(){
	int i=0,w=0,x,a[10000],b[10000],aP[10000],bP[10000];
	while(i<10000){
		aP[i]=bP[i]=0;
	++i;
	}
	i=0;
	while(1){
	scanf("%d",&x);
	if(x==0){
	goto hata;
	}
	while(i<x){
scanf("%d%d",&a[i],&b[i]);
	++i;
	}
	i=0;
	while(i<x){
		if(a[i]==b[i]){
			aP[w]=aP[w]+a[i];
			bP[w]=bP[w]+b[i];
		}else if(a[i]>b[i]){
		aP[w]=aP[w]+a[i]+b[i];
		}else{
		bP[w]=bP[w]+a[i]+b[i];
		}
		++i;
	}
	++w;
	}
hata:
	i=0;
	while(i<w){
	printf("%d %d\n",aP[w],bP[w]);
	}
}

C++: #include<iostream>
using namespace std;
int main(void)
{
    int n,A,B,card1,card2;
    while(1){
            A=0;B=0;
        cin>>n;
        if(n==0)break;
        for(int i=0;i<n;i++){
            cin>>card1>>card2;
            if(card1>card2)A+=card1+card2;
            else if(card2>card1)B+=card1+card2;
            else{
                A+=card1;
                B+=card2;
            }
        }
        cout<<A<<" "<<B<<"\n";
    }
}

C++: #include <iostream>

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

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

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

C++: #include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int p[80000],q[80000],ptop;
bool s[1000000];
int main(){
	rep(i,1000000)s[i]=1;
	for(int i=2;i<1000;i++)for(int j=i*i;j<1000000;j+=i)s[j]=0;
	for(int i=2;i<1000000;i++)if(s[i])p[ptop]=i,ptop++;
	int n;
	long long x;
	scanf("%d",&n);
	rep(z,n){
		scanf("%lld",&x);
		rep(i,ptop)q[i]=1;
		rep(i,ptop){while(!(x%p[i]))x/=p[i],q[i]++;if(!(x-1))break;}
		int ans=1;
		if(x-1)ans++;
		rep(i,ptop)ans*=q[i];
		printf("%d\n",ans);
	}
	return 0;
}