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

const double EPS = 1e-9;

double calc( double* sinv, int x )
{
	double xv = 0.0;
	int angle = 360;
	for( int i = 0; i < x - 1; ++i ){
		int a;
		cin >> a;
		xv += sinv[ a ];
		angle -= a;
	}
	xv += sinv[ angle ];
	return xv;
}

int main()
{
	double sinv[ 180 ] = {0.0};
	for( int i = 1; i <= 90; ++i ){
		sinv[ i ] = sinv[ 180 - i ] = sin( static_cast<double>( i ) );
	}

	int m, n;
	while( cin >> m && m ){
		double mv = calc( sinv, m );
		cin >> n;
		double nv = calc( sinv, n );
		int ans = 0;
		if( mv + EPS > nv ){
			ans = 1;
		}else if( mv < nv + EPS ){
			ans = 2;
		}
		cout << ans << endl;
	}
	return 0;
}

C++: // 0166
#include <iostream>
#include <math.h>
#define  PI   3.14159265
using namespace std;

void area_com(int m, double &s){
	int d, deg = 0;

	for(int i=1;i<m;i++){
		cin>>d;
		s += sin(d*PI/180);
		deg += d;
	}
	s += sin((360-deg)*PI/180);
}

int main(){
	while(1){
		int m, n;
		double s1 = 0, s2 = 0;

		cin>>m;
		if(m == 0)
			break;
		
		area_com(m, s1);
		
		cin>>n;
		area_com(n, s2);

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

C++: #include<stdio.h>
#include<math.h>
double PI=atan(1.)*4;
double F(int n,double*x,double*y)
{
	double res=0;
	for(int i=1;i+1<n;++i)
		res+=((x[i]-x[0])*(y[i+1]-y[0])-(y[i]-y[0])*(x[i+1]-x[0]))/2;
	return res;
}
void I(int n,double*x,double*y)
{
	int a,i,t;
	for(i=a=0;i<n;)
	{
		x[i]=cos(a*PI/180);
		y[i]=sin(a*PI/180);
		if(++i<n)scanf("%d",&t),a+=t;
	}
}
int main()
{
	int n;
	double s,t,x[360],y[360];;
	while(scanf("%d",&n),n)
	{
		I(n,x,y);
		s=F(n,x,y);
		scanf("%d",&n);
		I(n,x,y);
		t=F(n,x,y);
		puts(fabs(s-t)<1e-9?"0":s>t?"1":"2");
	}
}

C++: #include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

const double EPS = 1e-10;

int main()
{
	int m;
	while(scanf("%d", &m), m){
		double sm1 = 0.0;
		rep(i, m-1){
			int deg;
			scanf("%d", &deg);
			sm1 += sin(deg*M_PI/180.0);
		}
		
		int n;
		scanf("%d", &n);
		
		double sm2 = 0.0; 
		rep(i, n-1){
			int deg;
			scanf("%d", &deg);
			sm2 += sin(deg*M_PI/180.0);
		}
		
		if(fabs(sm1 - sm2) < EPS)
			puts("0");
		else
			puts(sm1>sm2 ? "1" : "2");
	}
}

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 = 10e-8;

int main(){

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

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

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

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

C++: #include<iostream>
#include<cmath>
using namespace std;
int n,m,T,U;
int t[1000],u[1000];
double at,au;
double EPS=0.000000001;
double calc_area(double);

bool eq(double x,double y){return (-EPS<x-y&&x-y<EPS);}
int main(){
  while(cin>>n&&n!=0){
    at=au=0.0;
    T=U=360;
    for(int i=0;i<n-1;i++){
      cin>>t[i];
      T-=t[i];
      at+=calc_area((double)t[i]*M_PI/180.0);
    }
    at+=calc_area((double)T*M_PI/180.0);

    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>u[i];
      U-=u[i];
      au+=calc_area((double)u[i]*M_PI/180.0);
    }
    au+=calc_area((double)U*M_PI/180.0);

    if(eq(au,at))cout<<"0"<<endl;
    else if(au<at)cout<<"1"<<endl;
    else cout<<"2"<<endl;
    
  }
  return 0;
}

double calc_area(double x){
  return sin(x);
}

C++: #include <cstdio>
#include <cmath>
#include <algorithm>
#define eps 1e-10
using namespace std;
int main() {
    int m, n;
    while (scanf("%d",&m)) {
        if (m==0) break;
        double a=0.0, b=0.0;
        double arg=360.0;
        for (int i=0; i<m-1; i++) {
            int v; scanf("%d",&v);
            a+=sin((double)v/180.0);
            arg-=v;
        }
        a+=sin(arg/180.0);
        arg=360.0;
        scanf("%d",&n);
        for (int i=0; i<n-1; i++) {
            int v; scanf("%d",&v);
            b+=sin((double)v/180.0);
            arg-=v;
        }
        b+=sin(arg/180.0);
        if (a==b) puts("0");
        else if (a>b) puts("1");
        else puts("2");
    }
}

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

using namespace std;

int main() {
  int M;
  
  while(cin >> M && M) {
    int sum = 0;
    double S = 0.0;
    for(int i=0; i<M-1; i++) {
      int arg; cin >> arg;
      S += sin(arg/360.0*(2*M_PI));
      sum += arg;
    }
    
    S += sin((360-sum)/360.0*(2*M_PI));
    cin >> M;
    sum = 0;
    double T = 0.0;
    for(int i=0; i<M-1; i++) {
      int arg; cin >> arg;
      T += sin(arg/360.0*(2*M_PI));
      sum += arg;
    }
    
    T += sin((360-sum)/360.0*(2*M_PI));
    
    if(abs(S-T) < 1e-5) cout << 0 << endl;
    else if(S < T) cout << 2 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}

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

const double EBS=1e-8;

int main(){
	while(1){
		int m, v[400];
		int arg=360;
		double a=0, b=0;
		
		scanf(" %d", &m);
		if(m==0) break;
		for(int i=0; i<m-1; ++i){
			scanf(" %d", &v[i]);
			arg-=v[i];
			a+=sin(v[i]*M_PI/180.0);
		}
		a+=sin(arg*M_PI/180.0);
		
		arg=360;
		scanf(" %d", &m);
		for(int i=0; i<m-1; ++i){
			scanf(" %d", &v[i]);
			arg-=v[i];
			b+=sin(v[i]*M_PI/180.0);
		}
		b+=sin(arg*M_PI/180.0);
		
		//printf(" a=%lf, b=%lf\n", a, b);
			
		if(fabs(a-b) < EBS) printf("0\n");
		else if(a>b) printf("1\n");
		else if(a<b) printf("2\n");
	}
}

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

int m;
double *v;
double a[2];
double tmp;

int main(){
	while(true){
		for(int k=0; k<2; k++){
			cin >> m;
			if(!m)
				return 0;

			a[k] = 0;
			tmp = 0;

			v = new double[m];
			for(int i=0; i<m-1; i++){
				cin >> v[i];
				tmp += v[i];
			}
			v[m-1] = 360-tmp;

			for(int i=0; i<m; i++)
				a[k] += sin(v[i]*M_PI/360)*cos(v[i]*M_PI/360);
			delete[] v;
		}

		if(a[0] == a[1])
			cout << 0 << endl;
		else if(a[0] > a[1])
			cout << 1 << endl;
		else
			cout << 2 << endl;
	}
}