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<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i)
#define repc(i,n) for(int i=0;i<=(n);++i)
#define repcn(i,m,n) for(int i=(m);i<=(n);++i)
#define repcd(i,n) for(int i=(n);i>=0;--i)
#define repcnd(i,m,n) for(int i=(n);i>=(m);--i)
#define repc0(i,n) for(i=0;i<=(n);++i)
#define repcn0(i,m,n) for(i=(m);i<=(n);++i)
#define repcd0(i,n) for(i=(n);i>=0;--i)
#define repcnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,1,-1,-1,0};
const int dy[]={0,0,1,-1,1,-1,1,-1,0};

int sig(double r) { return r < -EPS ? -1 : r > EPS ? 1 : 0; }

int main() {
	int m, n;
	int v1[400], v2[400];
	double m1, m2;
	IL {
		cin >> m;
		if (m == 0) break;
		rep (i, m - 1) cin >> v1[i];
		cin >> n;
		rep (i, n - 1) cin >> v2[i];
		m1 = m2 = 0;
		rep (i, m - 1) m1 += sin(v1[i] * PI / 180);
		rep (i, n - 1) m2 += sin(v2[i] * PI / 180);
		int th1, th2;
		th1 = th2 = 360;
		rep (i, m - 1) th1 -= v1[i];
		m1 += sin(th1 * PI / 180);
		rep (i, n - 1) th2 -= v2[i];
		m2 += sin(th2 * PI / 180);
		//cout << m1 << " " << m2 << endl;
		if (sig(m1 - m2) > 0) cout << 1 << endl;
		if (sig(m1 - m2) < 0) cout << 2 << endl;
		if (sig(m1 - m2) == 0) cout << 0 << endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	while (1) {
		int M; cin >> M;
		if (!M)break;
		ld area1=0, area2=0;
		ld sum1 = 0,sum2=0;
		for (int i = 0; i < M-1; ++i) {
			ld v; cin >> v;
			sum1 += v;
			area1 += sin(v / 180 * acos(-1));
		}
		area1 += sin((360-sum1) / 180 * acos(-1));
		int N; cin >> N;
		for (int i = 0; i < N-1; ++i) {
			ld v; cin >> v;
			sum2 += v;
			area2 += sin(v / 180 * acos(-1));
		}
		area2 += sin((360 - sum2) / 180 * acos(-1));
		if (eps > (abs(area1 - area2))) {
			cout << 0 << endl;
		}
		else if (area1 > area2) {
			cout << 1 << endl;
		}
		else {
			cout << 2 << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


double getArea( double ang ) {
    double rad = ang / 180.0 * M_PI;
    return sin( rad );
}

double calc( VI v ) {
    double res = 0.0;
    int n = v.size();
    double rr = 360.0;
    for ( int i = 0; i < n; ++ i ) {
        res += getArea( v[i] );
        rr -= v[i];
    }
    res += getArea( rr );
    return res;
}

int solve( double s1, double s2 ) {
    if ( fabs( s1 - s2 ) < 1e-9 ) return 0;
    return s1 < s2 ? 2 : 1;
}

int main() {
    int m;
    while ( cin >> m && m ) {
        VI v1(m-1);
        for ( int i = 0; i < m-1; ++ i ) {
            cin >> v1[i];
        }
        int n;
        cin >> n;
        VI v2(n-1);
        for ( int i = 0; i < n-1; ++ i ) {
            cin >> v2[i];
        }
        double s1 = calc( v1 );
        double s2 = calc( v2 );
        cout << solve( s1, s2 ) << endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

const double PI = acos(-1);

typedef complex<double> P;
typedef P Vec;

double solve(int n) {
	vector<int> angle(n, 0);
	
	int in;
	FOR(i, 1, n) {
		scanf("%d", &in);
		angle[i] = angle[i - 1] + in;
	}
	
	double res = 0.0;
	REP(i, n) {
		P p1 = P(cos(angle[i] * PI / 180), sin(angle[i] * PI / 180));
		P p2 = P(cos(angle[(i + 1) % n] * PI / 180), sin(angle[(i + 1) % n] * PI / 180));
		
		double a = abs(p1), b = abs(p2 - p1), c = abs(p2);
		double s = (a + b + c) / 2.0;
		double S = sqrt(s * (s - a) * (s - b) * (s - c));
		res += S;
	}
	return res;
}

int main() {
	int m, n;
	while (cin >> m, m) {
		double s1 = solve(m);
		cin >> n;
		double s2 = solve(n);
		
		if (s1 >= s2 - EPS && s1 <= s2 + EPS)
			puts("0");
		else if (s1 > s2 + EPS)
			puts("1");
		else
			puts("2");
	}
	
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#define EPS 0.0000001
using namespace std;

double getRad(int n){
  return (180*n)/M_PI;
}

int main(){

  int N,thita,thita2;

  while(1){
    double s1=0,s2=0;
    thita2=0;
    cin>>N;
    if(N==0) break;
    for(int i=0;i<N-1;i++){
      cin>>thita;
      thita2+=thita;
      thita=getRad(thita);
      s1+=abs( sin(thita) );
    }
    thita2=getRad(360-thita2);
    s1+=abs( sin(thita2));
    thita2=0;
    cin>>N;
    for(int i=0;i<N-1;i++){
      cin>>thita;
      thita2+=thita;
      thita=getRad(thita);
      s2+=abs( sin(thita) );

    }
    thita2=getRad(360-thita2);
    s2+=abs( sin(thita2));
    if(fabs(s1-s2)<EPS) cout<<0<<endl;
    else if(s1>s2) cout<<1<<endl;
    else cout<<2<<endl;
  }
  return 0;
}