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<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
using namespace std;
#define all(a) a.begin(),a.end()
double calc(double a,double b,double c)
{
	double s=(a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}

int main()
{
	int m,n;
	
	while(cin>>m&&m)
	{
		double a=0,b=0;
		double r=360;
		for(int i=0;i<m-1;i++)
		{
			double v;cin>>v;
			r-=v;
			a+=calc(sin(v/2)*2,1,1);
		}
		a+=calc(sin(r/2)*2,1,1);
		cin>>n;
		r=360;
		for(int i=0;i<n-1;i++)
		{
			double v;cin>>v;
			r-=v;
			b+=calc(sin(v/2)*2,1,1);
		}
		b+=calc(sin(r/2)*2,1,1);
		if(fabs(a-b)<1e-15)cout<<0<<endl;
		else if(a>b)cout<<1<<endl;
		else cout<<2<<endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <vector>
#include <numeric>
#include <cassert>
using namespace std;
#define EPS 1E-10

// 円に内接する多角形の面積を求める
double get_area(const vector<int>& polygon, double r)
{
	assert(accumulate(polygon.begin(), polygon.end(), 0) == 360);
	double S = 0.0;

	for (int n : polygon) {
		S += sin(n * M_PI / 180.0);
	}

	return S * r * r / 2;
}

int main()
{
	int m, n;

	while (cin >> m && m != 0) {
		vector<int> v1, v2;

		for (int i = 0, j; i < m - 1; i++) {
			cin >> j;
			v1.push_back(j);
		}
		v1.push_back(360 - accumulate(v1.begin(), v1.end(), 0));

		cin >> n;

		for (int i = 0, j; i < n - 1; i++) {
			cin >> j;
			v2.push_back(j);
		}
		v2.push_back(360 - accumulate(v2.begin(), v2.end(), 0));
		
		double S1 = get_area(v1, 1);
		double S2 = get_area(v2, 1);

		if (abs(S1 - S2) < EPS) {
			cout << '0' << endl;
		} else if (S1 > S2) {
			cout << '1' << endl;
		} else {
			cout << '2' << endl;
		}
	}
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
using namespace std;
#define all(a) a.begin(),a.end()
double calc(double a,double b,double c)
{
	double s=(a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}

int main()
{
	int m,n;
	
	while(cin>>m&&m)
	{
		double a=0,b=0;
		double r=2*M_PI;
		for(int i=0;i<m-1;i++)
		{
			double v;cin>>v;
			v*=2.0*M_PI/360;
			r-=v;
			a+=calc(sin(v/2)*2,1,1);
		}
		a+=calc(sin(r/2)*2,1,1);
		cin>>n;
		r=2*M_PI;
		for(int i=0;i<n-1;i++)
		{
			double v;cin>>v;
			v*=2.0*M_PI/360;
			r-=v;
			b+=calc(sin(v/2)*2,1,1);
		}
		b+=calc(sin(r/2)*2,1,1);
		if(fabs(a-b)<1e-15)cout<<0<<endl;
		else if(a>b)cout<<1<<endl;
		else cout<<2<<endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

static const double eps = 1e-8;

int main(){

	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;

		double areaA=0,areaB=0;
		int remain=360;
		for(int i=0;i<n-1;i++){
			double rad;
			int angle;
			scanf("%d",&angle);
			remain-=angle;
			rad = (double)angle / 180 * M_PI;
			areaA += 0.5*sin(rad);
		}

		areaA += 0.5*sin((double)remain / 180 * M_PI);

		remain=360;
		scanf("%d",&n);
		for(int i=0;i<n-1;i++){
			double rad;
			int angle;
			scanf("%d",&angle);
			remain-=angle;
			rad = (double)angle / 180 * M_PI;
			areaB += 0.5*sin(rad);
		}

		areaB += 0.5*sin((double)remain / 180 * M_PI);

		printf("%d\n",areaA == areaB ? 0 :
			areaA > areaB ? 1 : 2);
	}
}

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

int main()
{
	int n, i;
	double d, s1, s2;
	while (cin>>n, n) {
		s1 = s2 = 0;
		for (i = 1; i < n; i++) {
			cin>>d;
			s1 += sin(M_PI * d/180.0);
		}
		cin>>n;
		for (i = 1; i < n; i++) {
			cin>>d;
			s2 += sin(M_PI * d/180.0);
		}
		if (s1>s2) cout<<1<<endl;
		else if (s1==s2) cout<<0<<endl;
		else cout<<2<<endl;
	}
	return 0;
}

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

const double eps = 1.0e-7;
const double pi = 4.0 * atan(1.0);

double getArea(vector<int> v) {
    int last = 360;
    for (int i=0; i<(int)v.size(); ++i) last -= v[i];
    v.push_back(last);
    double ret = 0;
    for (int i=0; i<(int)v.size(); ++i) {
        ret += sin((double)v[i] * pi / 180);
    }
    return ret;
}

int main() {
    int m, n;
    while (cin >> m, m) {
        vector<int> v1(m-1);
        for (int i=0; i<m-1; ++i) {
            cin >> v1[i];
        }
        cin >> n;
        vector<int> v2(n-1);
        for (int i=0; i<n-1; ++i) {
            cin >> v2[i];
        }
        double area1, area2;
        area1 = getArea(v1);
        area2 = getArea(v2);
        if (abs(area1 - area2) < eps) {
            cout << 0 << endl;
        } else if (area2 < area1) {
            cout << 1 << endl;
        } else {
            cout << 2 << endl;
        }
    }
    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] / 360.0);
		}
		for(int i = 0; i < v1.size(); i++) {
			s1 += sin(M_PI * v1[i] / 360.0);
		}

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

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/100.0);
    }
    m2+=100.0*sin(PI*m/100.0);
    if(abs(m1-m2)<ESP)cout<<0<<endl;
    else if(m1>m2)cout<<1<<endl;
    else cout<<2<<endl;
  }

}