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.Sin(v*math.Pi/180)
		}
		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.Sin(v*math.Pi/180)
		}
		if first_object > second_object+ 0.0000001 {
			fmt.Println(1)
		} else if second_object > first_object +0.0000001 {
			fmt.Println(2)
		} else {
			fmt.Println(0)
		}
	}
}

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

using namespace std;

int ScanningData(int&, vector<int>&);
double CalculateArea(vector<int>);

int main(){
  int i, m, n;
  vector<int> degree1, degree2;
  double result1, result2;

  while(1){
    if(ScanningData(m, degree1) == 0) break;
    if(ScanningData(n, degree2) == 0) break;

    result1 = CalculateArea(degree1);
    result2 = CalculateArea(degree2);

    if(result1 == result2)
      cout << "0" << endl;
    else if(result1 > result2)
      cout << "1" << endl;
    else
      cout << "2" << endl;

    degree1.clear();
    degree2.clear();
  }

  return 0;
}

int ScanningData(int& n, vector<int>& data){
  int i, x, sum=0;

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

  for(i=0; i<n-1; ++i){
    cin >> x;
    sum += x;
    data.push_back(x);
  }

  data.push_back(360-sum);
  return 1;
}

double CalculateArea(vector<int> data){
  int i;
  double radian, s, sum=0;

  for(i=0; i<data.size(); ++i){
    radian = data[i] * M_PI / 180;
    s = sin(radian)/2;
    sum += s;
  }

  return sum;
}

C++: #include <iostream>
#include <complex>
#include <math.h>
using namespace std;

typedef complex<double> xy_t;

int M, N, VM[500], VN[500];


double area( int V[], int L ) {

	double suma = 0, sumv = 0;

	for ( int i = 0; i < L - 1; i++ ) {
	
		suma += sin( V[i] * atan( 1 ) / 45 );
		sumv += V[i];
	
	}
	
	suma += sin( ( 360 - sumv ) * atan( 1 ) / 45 );
	
	return suma;

}

int main() {
	
	while ( cin >> M && M ) {
	
		for ( int i = 0; i < M - 1; i++ ) { cin >> VM[i]; }
		cin >> N;
		for ( int i = 0; i < N - 1; i++ ) { cin >> VN[i]; }
		
		double am = area( VM, M );
		double an = area( VN, N );
		
		if ( abs( am - an ) < 1e-8 ) { cout << 0 << endl; }
		else if (am > an) { cout << 1 << endl; }
		else { cout << 2 << endl; }
	
	}
	
}

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    double pi = acos(-1);
    while(cin >> n, n){
        vector<int> v(n-1);
        int s = 360;
        for (auto &&i : v) scanf("%d", &i), s -= i;
        v.emplace_back(s);
        int m;
        cin >> m;
        vector<int> u(m-1);
        s = 360;
        for (auto &&j : u) scanf("%d", &j), s -= j;
        u.emplace_back(s);
        double ans1 = 0, ans2 = 0;
        for (auto &&i : v) {
            ans1 += sin(pi*i/180);
        }
        for (auto &&k : u) {
            ans2 += sin(pi*k/180);
        }
        if(abs(ans1-ans2) < 1e-10) puts("0");
        else if(ans1 < ans2) puts("2");
        else puts("1");
    }

    return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
	double PI=3.14159265359;
	int a;
	while(scanf("%d",&a),a){
		double sa=0;
		int c;
		int now=360;
		for(int i=0;i<a-1;i++){
			scanf("%d",&c);
			now-=c;
			sa+=sin((double)c*PI/180);
		}
		sa+=sin((double)now*PI/180);
		double sb=0;
		int b;
		scanf("%d",&b);
		now=360;
		for(int i=0;i<b-1;i++){
			scanf("%d",&c);
			now-=c;
			sb+=sin((double)c*PI/180);
		}
		sb+=sin((double)now*PI/180);
		if(sa>sb+0.0000001)printf("1\n");
		else if(sb>sa+0.0000001)printf("2\n");
		else printf("0\n");
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int a, b;
	while(cin >> a, a){
		vector<int> n(a);
		int suma = 0, sumb = 0;
		rep(i, a-1){cin >> n[i]; suma += n[i];}
		cin >> b;
		vector<int> m(b);
		rep(i, b-1){cin >> m[i]; sumb += m[i];}

		double p=0., q = 0.;
		rep(i, a-1) p += sin(n[i] * M_PI / 180);
		p += sin(360-suma * M_PI / 180);
		rep(i, b-1) q += sin(m[i] * M_PI / 180);
		q += sin(360-sumb * M_PI / 180);


		if(abs(p-q) < eps) cout << 0 << endl;
		else if(p > q) cout << 1 << endl;
		else cout << 2 << endl;
	}
}

C++: #define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z)
a;g(){scanf("%d",&a);a?a:exit();}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}}

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

using namespace std;

int main()
{
	int n;

	vector <double> s;
	while (cin >> n && n ){
		vector <int> arg (n, 0 );
		int sum = 0;
		bool sub = false;
		for (int i = 0; i < n-1; i++ ){
			cin >> arg[i];
			sum += arg[i];
		} // end for
		if (sum > 180 ){
			arg[n-1] = 380 - sum;
		}else if (sum <= 180 ){
			arg[n-1] = 0;
			if (sum < 180 )
				sub = true;
		} // end if

		double curr = 0.0;
		if (n >= 3 ){
			for (int i = 0; i < n; i++ ){
				curr += sin((double)arg[i]*M_PI/180. );
			} // end for
			if (sub ){
				curr -= sin((double)sum*M_PI/180. );
			} // end if
		} // end if
		s.push_back (curr );
	} // end while

	int size = s.size();
	for (int i = 0; i < size; i += 2 ){
		if (fabs (s[i] - s[i+1] ) < 1e-2 ){
			cout << '0' << endl;
		}else
		if (s[i] > s[i+1] ){
			cout << '1' << endl;
		}else{
			cout << '2' << endl;
		} // end if 
	} // end for

	return 0;
}

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

const double EPS = 1e-9;

int main() {
	int m;
	while(cin >> m, m) {
		vector<int> v0, v1;
		int n;

		int sum = 0;
		for(int i = 0; i < m - 1; i++) {
			int tmp;
			cin >> tmp;
			v0.push_back(tmp);
			sum += tmp;
		}
		v0.push_back(360 - sum);

		cin >> n;
		sum = 0;
		for(int i = 0; i < n - 1; i++) {
			int tmp;
			cin >> tmp;
			v1.push_back(tmp);
			sum += tmp;
		}
		v1.push_back(360 - sum);

		double s0 = 0, s1 = 0;
		for(int i = 0; i < v0.size(); i++) {
			s0 += sin(M_PI * v0[i] / 180.0);
		}
		for(int i = 0; i < v1.size(); i++) {
			s1 += sin(M_PI * v1[i] / 180.0);
		}

		if(fabs(s0 - s1) < EPS)
			cout << 0 << endl;
		else if(s0 > s1)
			cout << 1 << endl;
		else
			cout << 2 << endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#define EPS 1e-10
int m,n;
double v[400];
double s[2];

int check(){
	if(s[0]>s[1]+EPS)return 1;
	if(s[1]>s[0]+EPS)return 2;
	return 0;
}

int main(void){
	while(1){
		scanf("%d",&m);
		if(m==0)break;
		s[0]=s[1]=0.0;
		for(int i=0;i<m-1;i++){
			scanf("%lf",&v[i]);
			v[i]=v[i]/360.0*M_PI;
			s[0]+=cos(v[i])*sin(v[i]);
		}
		scanf("%d",&n);
		for(int i=0;i<n-1;i++){
			scanf("%lf",&v[i]);
			v[i]=v[i]/360.0*M_PI;
			s[1]+=cos(v[i])*sin(v[i]);
		}
		printf("%d\n",check());
	}
	return 0;
}