Go: package main

import (
	"bufio"
		"os"
	"strconv"
	"math"
	"fmt"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		m, _ := strconv.Atoi(scanner.Text())
		if m == 0 {
			break
		}
		args1 := make([]float64, m)
		x := 0.0
		for i := 0; i < m-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			x += tmp
			args1[i] = tmp
		}
		args1[m-1] = 360-x
		first_object := 0.0
		for _, v := range args1 {
			first_object+= math.Abs(math.Sin(v))
		}
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		args2 := make([]float64, n)
		y := 0.0
		for i := 0; i < n-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			y += tmp
			args2[i] = tmp
		}
		args2[n-1] = 360-y
		second_object := 0.0
		for _, v := range args2 {
			second_object+= math.Abs(math.Sin(v))
		}
		if first_object < second_object {
			fmt.Println(2)
		} else if first_object == second_object {
			fmt.Println(0)
		} else if first_object > second_object {
			fmt.Println(1)
		}
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

const double PI = acos(-1);

double rad(double x)
{	return x * PI / 180.0;	}

int main()
{
    int n;
	while(cin >> n && n)
	{
		double S = 0;
		double v;
		
		rep(i, n)
		{
			cin >> v; v = rad(v);
			S += abs(sin(v) * cos(v));
		}
		
		cin >> n;
		rep(i, n)
		{
			cin >> v; v = rad(v);
			S -= abs(sin(v) * cos(v));
		}
		
		cout << (abs(S) < EPS ? 0 : (0 < S ? 1 : 2)) << endl;
	}
}

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

using namespace std;

#define PI 3.1415926535

int main() {
	int n, m;
	while(cin >> n) {
		if (n == 0) {
			break;
		}
		int counter = 360;
		int a;
		double men1 = 0.0;
		for (int i = 0; i < n-1; i++) {
			cin >> a;
			men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
			counter -= a;
		}
		men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
		cin >> m;
		counter = 360;
		double men2 = 0.0;
		for (int i = 0; i < m-1; i++) {
			cin >> a;
			men2 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
			counter -= a;
		}
		men2 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
		if (men1 == men2) {
			cout << 0 << endl;
		} else if (men1 > men2){
			cout << 1 << endl;
		} else {
			cout << 2 << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#define pi 3.14159265359

using namespace std;

int main(void){

  double s1,s2;
  int n,m;
  int angle,c;

  while( cin >> n , n ){

    s1 = s2 = 0;
    c = 360;

    for( int i = 0 ; i < n - 1 ; i++ ){
      cin >> angle;
      c -= 360;
      s1 += sin((double)angle*pi/180.0) / 2.0;
    }
    s1 += sin((double)c*pi/180.0) / 2.0;

    c = 360;
    cin >> m;
    for( int i = 0 ; i < m - 1 ; i++ ){
      cin >> angle;
      c -= angle;
      s2 += sin((double)angle*pi/180.0) / 2.0;
    }
    s2 += sin((double)c*pi/180.0) / 2.0;

    //  cout << s1 << "  "  << s2 << endl;

    if( fabs( s1 - s2 ) < 0.0000001 ) cout << 0 << endl;
    else if( s1 > s2 ) cout << 1 << endl;
    else cout << 2 << endl;


  }


  return 0;
}

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

int main(void){
	double r = 10; //ツ板シツ径ツづー10ツづ可シツ津ィ
	int n,m;

	while(cin>>n && n){
		double s1 = 0;
		for(int i=0;i<n-1;i++){
			double v;
			cin>>v;
			double rad = M_PI * v / 180;
			s1 += r * r * sin(rad) / 2;
		}

		cin>>m;
		double s2 = 0;
		for(int i=0;i<m-1;i++){
			double v;
			cin>>v;
			double rad = M_PI * v / 180;
			s2 += r * r * sin(rad) / 2;
		}

		if(s1 > s2) cout<<1<<endl;
		else if(s1 < s2) cout<<2<<endl;
		else cout<<0<<endl;
	}

	return 0;
}

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

#define EPS 1e-6

int main() {
    int m;
    while (cin >> m, m) {
        double a1 = 0;
        int v_sum = 0;
        for (int i = 0; i < m-1; i++) {
            int v;
            cin >> v;
            a1 += sin(M_PI * v / 180.0);
            v_sum += v;
        }
        a1 += sin(M_PI * (360 - v_sum) / 180.0);
        int n;
        cin >> n;
        double a2 = 0;
        v_sum = 0;
        for (int i = 0; i < n-1; i++) {
            int v;
            cin >> v;
            a2 += sin(M_PI * v / 180.0);
            v_sum += v;
        }
        a2 += sin(M_PI * (360 - v_sum) / 180.0);
        int ans;
        if (fabs(a1 - a2) < EPS) {
            ans = 0;
        } else if (a1 > a2) {
            ans = 1;
        } else {
            ans = 2;
        }
        cout << ans << endl;
    }
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define EPS (1e-10)
#define PI 3.14159265358979323846264
using namespace std;


 
double rad(double d)
{
  return d*(PI/180.0);
}

int main()
{
  int m;
  while(cin >> m,m)
    {
      double v,areaA,areaB;
      areaA = areaB = 0;
      double ano = 360;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  areaA += sin(rad(v));
	  ano -= v;
	}
      areaA += sin(rad(ano));
 
      cin >> m;
      ano = 360;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  areaB += sin(rad(v));
	  ano -= v;
	}
      areaB += sin(rad(ano));
            

      if(areaA == areaB)
	cout << 0 << endl;
      else if(areaA > areaB)
	cout << 1 << endl;
      else 
	cout << 2 << endl;
      
    }
  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
#define PI 3.141592653589793238462643L
int K[100000];
long double SIN(long double b) { return sinl(b * PI / 180.0L); }
int main() {
	int N, cnt = 0; long double a, sum, s[2], V;
	while (true) {
		for (int i = 0; i < 2; i++) {
			cin >> N; V = 0.0L; sum = 0.0L; if (N == 0) { break; }
			for (int i = 0; i < N - 1; i++) { cin >> a; sum += SIN(a); V += a; }
			sum += sin(360.0L - V); s[i] = sum;
		}
		if (s[0] == s[1]) { cout << '0' << endl; }
		if (s[0] > s[1]) { cout << '1' << endl; }
		if (s[0] < s[1]) { cout << '2' << endl; }
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-12;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    double m1,m2;
    int m=360;
    rep(i,n-1){
      int tmp;
      cin>>tmp;
      m-=tmp;
      m1+=100.0*sin(PI*tmp/100.0);
    }
    m1+=100.0*sin(PI*m/100.0);
    cin>>n;
    m=360;
    rep(i,n-1){
      int tmp;
      cin>>tmp;
      m-=tmp;
      m2+=100.0*sin(PI*tmp/180.0);
    }
    m2+=100.0*sin(PI*m/180.0);
    if(abs(m1-m2)<ESP)cout<<0<<endl;
    else if(m1>m2)cout<<1<<endl;
    else cout<<2<<endl;
  }

}