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 <cmath>
#include <iostream>
using namespace std;

#define PI	3.1415926535
#define EPS	0.0000000001

int main()
{
	int n,a;
	int a1,a2;
	double h1,h2;

	while(cin >> n, n)
	{
		a1=a2=0;
		h1=h2=0;
		while(--n)
		{
			cin >> a;
			a1 += a;
			h1 += sin(a*PI/360.0);
		}
		cin >> n;
		while(--n)
		{
			cin >> a;
			a2 += a;
			h2 += sin(a*PI/360.0);
		}

		h1 += sin((360-a1)*PI/360.0);
		h2 += sin((360-a2)*PI/360.0);

		if(h1==h2)
		{
			cout << 0 << endl;
		}
		else if(h1>h2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 2 << endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int m,n;
	double sum1,sum2,degree,rest1,rest2;

	while(true){
		scanf("%d",&m);
		if(m == 0)break;

		sum1 = sum2 = 0;
		rest1 = 0,rest2 = 0;

		for(int i = 0; i < m-1; i++){
			scanf("%lf",&degree);
			sum1 += sin((M_PI*degree)/180);
			rest1 += degree;
		}

		rest1 = 360 - rest1;
		sum1 += sin((M_PI*rest1)/180);

		scanf("%d",&n);

		for(int i = 0; i < n-1; i++){
			scanf("%lf",&degree);
			sum2 += sin((M_PI*degree)/180);
			rest2 += degree;
		}

		rest2 = 360 - rest2;
		sum2 += sin((M_PI*rest2)/180);

		if(sum1 > sum2){
			printf("1\n");
		}else if(fabs(sum1-sum2) < 0.00000001){
			printf("0\n");
		}else{
			printf("2\n");
		}
	}

    return 0;
}

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

double degToRad(double deg){
	return M_PI * deg / 180;
}

int main() {
	int n, m;
	int angle;
	int v;
	double area1, area2;
	double E = 0.0000000000001f;
	
	while(cin >> n, n){
		area1 = area2 = 0;
		
		angle = 0;
		for(int i = 0; i < n - 1; ++i){
			cin >> v;
			area1 += sin(degToRad(v));
			angle += v;
		}
		area1 += sin(degToRad(360 - angle));
		
		cin >> m;
		
		angle = 0;
		for(int i = 0; i < m - 1; ++i){
			cin >> v;
			area2 += sin(degToRad(v));
			angle += v;
		}
		area2 += sin(degToRad(360 - angle));
		
		//cout << area1 << " " << area2 << " ";
		
		if(fabs(area1 - area2) < E){
			cout << 0 << endl;
		}else if(area1 > area2){
			cout << 1 << endl;
		}else{
			cout << 2 << endl;
		}
	}
	return 0;
}

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

int check(){
	if(s[0]>s[1])return 1;
	if(s[1]>s[0])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;
}

C++: #include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){int n;cin>>n;double r,R,a=M_PI/180; double s[2];while(n){s[0]=s[1]=0;rep(j,2){R=0;rep(i,n-1)cin>>r,s[j]+=sin(r*a),R+=r;s[j]+=sin((360-R)*a);cin>>n;}cout<<(s[0]!=s[1]?s[0]>s[1]?1:2:0)<<endl;}return 0;}

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

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;
      s1+=abs( sin(thita) );
    }

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

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

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) REP((i),0,(n))
#define RREP(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rrep(i,n) RREP(i,n,0)
#define each(it,X) for(__typeof((X).begin())  it=(X).begin();it!=(X).end();it++)
#define all(v) ((v).begin(),(v).end())
#define fi first
#define se second
#define pb push_back
typedef pair<int,int>pr;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef set<int>si;
const int INF=1070000000ll;
const int mod=1000000007ll;
const double EPS=1e-9;
const double PI=3.14159265;
double getS(int x){
    int d=360;
    double S=0;
    rep(i,x-1){
        int z;cin>>z;
        d-=z;
        S+=fabs(sin(1.0*z/180*PI));
    }
    S+=fabs(sin(1.0*d/180*PI));
    return S;
}
signed main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    double S[2];

    int x;
    while(cin>>x,x){
        S[0]=getS(x);
        scanf("%d",&x);
        S[1]=getS(x);
        if(fabs(S[0]-S[1])<EPS)cout<<0<<endl;
        else if(S[0]>S[1])cout<<1<<endl;
        else cout<<2<<endl;
    }
    return 0;
}