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 <string>
#include <iostream>

using namespace std;

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

C++: #include <iostream>
using namespace std;
int main()
{
	int a, e = 0, f = 0;
	cin >> a;
	for (int b = 0; b < a; b++)
	{
		int c;
		cin >> c;
		int d;
		cin >> d;
		if (c > d)
		{
			e += c;
			e += d;
		}
		if (d > c)
		{
			f += c;
			f += d;
		}
		else
		{
			e += c;
			f += d;
		}
	}
	cout << e << " " << f << endl;
	return 0;
}

C++: #include <iostream>

int main() {
  while (true) {
    int n, score_a = 0, score_b = 0;
    std::cin >> n;
    if (n == 0) break;
    
    for (int i = 0; i < n; i++) {
      int a, b;
      std::cin >> a >> b;
      if      (a > b) {score_a += a+b;}
      else if (a < b) {score_b += a+b;}
      else            {score_a += a; score_b += b;}
    }
    
    std::cout << score_a << " " << score_b << std::endl;
  }
  
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int n;
	int A, B;
	int sum_A, sum_B;
	while (cin >> n, n != 0){
		sum_A = 0;
		sum_B = 0;
		for (int i = 0; i < n; i++){
			cin >> A >> B;
			if (A > B) sum_A += A + B;
			else if (A < B) sum_B += A + B;
			else{
				sum_A += A;
				sum_B += B;
			}
		}
		cout << sum_A << " " << sum_B << endl;
	}
}

C++: #include <cstdio>

int main(){
	int a, b, c;
	scanf("%d", a);
	int n_a[a];
	int n_b[a];
	for(int i=0; i<a; i++){
		scanf("%d %d", n_a[i], n_b[i]);
	}
	for(int i=0; i<a; i++){
		if(n_a[i] > n_b[i]){
			b += n_a[i]+n_b[i];
		}else if(n_a[i] < n_b[i]){
			c += n_a[i]+n_b[i];
		}else if(n_a[i] == n_b[i]){
			b += n_a[i];
			c += n_b[i];
		}
	}
	printf("%d %d", b, c);
	return 0;
}

C++: #include<iostream>
using namespace std;
int i, n, pA, pB, tA = 0, tB = 0;
int main () {
    whole(cin >> n) {
       if(n == 0) { break; }
       for (i=1; i<=n; i++) {
           cin >> pA >>pB;
           if (pA >pB) {
               tA += pA + pB;
           } else {
               if (pA <pB) {
                   tB += pA + pB;
               } else {
                   tA += pA;
                   tB +- pB;
               }
           }
       }
       cout << tA << " " << tB << endl;
       tA = 0; tB = 0;
     }
     return 0;
}

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

C++: #include<stdio.h>
int main()
{
	int a=0, b=0, x, y, n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d %d", &x, &y);
		if (x > y){
			a += x + y;
		}
		else if (x == y){
			a += x;
			b += y;
		}
		else
			b += x + y;
	}
	printf("%d %d\n", a, b);
	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;
}

C++: #include<iostream>
using namespace std;
int main(){
   int sam1,sam2,a,b,n;

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

   sam1 = 0;
   sam2 = 0;

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

	if(a>b){
		sam1 += a+b;
	}else if(b>a){
		sam2 += a+b;
	}else if(a == b){
		sam1 += a;
		sam2 += b;
	}
   }

   cout << sam1 << " " << sam2 << endl;

   }

   return 0;
}

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

class Data{
private:
	int a_point, b_point;
public:
	Data(){ a_point=0; b_point=0;}
	void Add(int a, int b);
	void Show();
};

struct DataList{
	Data dataset;
	struct DataList* next;
};

void Data::Add(int a, int b){
	a_point += a;
	b_point += b;
}

void Data::Show(){
	cout << a_point << " " << b_point << endl;
}

int main(){
	int n, a, b;
	struct DataList *datalist, *p;

	datalist = new DataList;
	p = datalist;

	datalist->next = NULL;

	while(1){
		cin >> n;
		if(n == 0) break;

		p->next = new DataList;
		p->next->next = NULL;
		p = p->next;

		while(n > 0){
			cin >> a >> b;
			if(a > b) p->dataset.Add(a+b,0);
			else if(a < b) p->dataset.Add(0,a+b);
			else p->dataset.Add(a,b);
			n -= 1;
		}
	}

	p = datalist;

	while(p->next != NULL){
		p = p->next;
		p->dataset.Show();
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int pa=0, pb=0;

	int n;

	while(cin >> n){
	int a[n], b[n];
	for(int i=0; i<n; i++){
		cin >> a[i] >> b[i];
	}
	for(int i=0; i<n; i++){
		if(a[i]>b[i]) pa+=a[i]+b[i];
		if(a[i]<b[i]) pb+=a[i]+b[i];
	}
	cout << pa << " " << pb << endl;
	}
return 0;
}

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

  return 0;
  
}

C++: #include <iostream>

int main() {
    int n = 100;
    while (n != 0) {
        std::cin >> n;
        int a[n];
        int a_point = 0;
        int b_point = 0;

        if (n == 0) {
            return 0;
        } else {
            for (int i = 0; i < 2 * n; i++) {
                std::cin >> a[i];
            }

            for (int i = 0; i < 2*n; i=i+2) {
                if (a[i] > a[i+1]) {
                    a_point += a[i] + a[i+1];
                } else if (a[i] < a[i+1]) {
                    b_point += a[i] + a[i+1];
                } else {
                    a_point += a[i];
                    b_point += a[i+1];
                }
            }
        }
        std::cout << a_point << " " << b_point << std::endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void)
{
  while (true){
    int n;
    int a_ans = 0, b_ans = 0;
    int a, b;

    cin >> n;
    if (n == 0) break;

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

      if (a > b){
        a_ans += a + b;
      }
      else if (a < b){
        b_ans += a + b;
      }
      else{
        a_ans += a;
        b_ans += b;
      }
    }

    cout << a_ans << " " << b_ans << 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; b += game_b; }
				else if (game_a > game_b)a += game_a + game_b;
				else b += game_a + game_b;
			}
			veca.push_back(a); vecb.push_back(b); a = 0; b = 0;
		}
	}
	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 main(){
while(1){
int n;
cin >> n;
if(n == 0)break;
int a=0,b=0,c=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 c+=x;
}
cout << a+c << " " << b+c << endl;
}
}