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 <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
const double EPS = 1e-12;
#define EQ(a,b) (abs((a)-(b)) < EPS)
typedef complex<double> P;
typedef vector<P> G;
 
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
 
double area2(const G &P) {
  double A = 0.0;
  for (int i = 0; i < P.size(); ++i)
    A += cross(curr(P, i), next(P, i));
  return A / 2.0;
}
 
P rotation(P v, double r){
  return P(v.real() * cos(r) - v.imag() * sin(r), v.real() * sin(r) + v.imag() * cos(r));
}
 
double calc(int N){
  G a(N);
  a[0] = P(1, 0);
  double r = 0.0;
  FOR(i, 1, N){
    int d; cin >>d;
    r += d * M_PI / 180.0;
    a[i] = rotation(P(1, 0), r);
  }
  return area2(a);
}
 
int main() {
  int N;
  while(cin >>N && N){
    double a = calc(N);
    cin >>N;
    double b = calc(N);
    cout <<(EQ(a, b) ? 0 : (a > b ? 1 : 2)) <<endl;
  }
  return 0;
}

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

using namespace std;


int main(void){
  int n,m;
  
  while(cin >> n,n){
    double sum1=0,sum2=0,s1=0,s2=0;
    int v;
    for(int i=0;i<n-1;i++){
      cin >> v;
      sum1+=v;
      s1+=sin((double)(v*M_PI)/180);
    }
    s1+=sin((double)((360-sum1)*M_PI)/180);
    cin >> m;
    for(int j=0;j<m-1;j++){
      cin >> v;
      sum2+=v;
      s2+=sin((double)(v*M_PI)/180);
    }
    s2+=sin((double)((360-sum2)*M_PI)/180);
    if(s1>s2) cout << 1 << endl;
    else if(s1<s2) cout << 2 << endl;
    else cout << 0 << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
const double EPS = 1e-10;
#define eq(a,b) fabs(a - b) < EPS

int main()
{
  int m;
  for(;cin>>m,m;)
    {
      int a=0;
      int sum=360;
      for(int i=0;i<m-1;i++)
	{
	  int t;
	  cin>>t;
	  sum-=t;
	  a+=90-abs(t-90);
	}
      a+=90-abs(sum-90);
      sum=360;
      int n;
      cin>>n;
      int b=0;
      for(int i=0;i<n-1;i++)
	{
	  int t;
	  cin>>t;
	  sum-=t;
	  b+=90-abs(t-90);
	}
      b+=90-abs(sum-90);      
      if(a==b)
	cout<<"0"<<endl;
      else if(a>b)
	cout<<"1"<<endl;
      else
	cout<<"2"<<endl;
    }
}

C++: #define _USE_MATH_DEFINES
#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( i * M_PI / 180.0 );
	}

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

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

using namespace std;

double pi=3.1415926535;

double calc(int x) {
  return sin((double)x/180.0*pi);
}
 

int main(void){
  int n,m;
  
  while(cin >> n,n){
    double sum1=0,sum2=0,s1=0,s2=0,v;
   
    for(int i=0;i<n-1;i++){
      cin >> v;
      sum1+=v;
      s1+=calc(v);
    }
    s1+=calc(360.0-sum1);
    cin >> m;
    for(int j=0;j<m-1;j++){
      int v;
      cin >> v;
      sum2+=v;
      s2+=calc(v);
    }
    s2+=calc(360.0-sum2);
    if(s1>s2) cout << 1 << endl;
    else if(s1<s2) cout << 2 << endl;
    else cout << 0 << endl;
  }

  return 0;
}

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

using namespace std;

int main()
{
  int n;
  double r, s, t, a[2];
  bool f = false;

  while(1){
    a[0] = a[1] = 0;
    for(int j = 0; j <= 1; j++){
      cin >> n;
      if(n == 0){
	f = true;
	break;
      }
      s = 360.0;
      for(int i = 0; i < n-1; i++){
	cin >> r;
	s -= r;
	a[j] += sin(r/180.0*M_PI);
      }
      a[j] += sin(s/180.0*M_PI);
    }
    if(f){
      break;
    }
    if(a[0] == a[1]){
      t = 0;
    } else if(a[0] > a[1]){
      t = 1;
    } else {
      t = 2;
    }
    cout << t << endl;
  }


  return 0;
}

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

using namespace std;

#define EPS (1e-5)

double conv(double dosu) {
  return dosu*M_PI/180.0;
}

int main() {
  int M;
  
  while(cin >> M && M) {
    double sum = 0.0;
    double S = 0.0;
    for(int i=0; i<M-1; i++) {
      double arg; cin >> arg;
      S += sin(conv(arg));
      sum += arg;
    }
    S += sin(conv(360-sum));
    
    int N; cin >> N;
    sum = 0;
    double T = 0.0;
    for(int i=0; i<N-1; i++) {
      double arg; cin >> arg;
      T += sin(conv(arg));
      sum += arg;
    }
    T += sin(conv(360-sum));
    
    if(fabs(S-T) < EPS) cout << 0 << endl;
    else if(S > T+EPS) cout << 1 << endl;
    else if(S < T+EPS) cout << 2 << endl;
  }
  
  return 0;
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define min 0.000001
using namespace std;

int main(){
  while(1){
    int m;
    cin>>m;
    if(!m)break;
    double Asum=0;
    double cnt;
    int sum=0;
    rep(i,m-1){
      cin>>cnt;
      Asum+=sin(cnt*M_PI/180.0)/2;
      sum+=cnt;
    }
    Asum+=sin((360-sum)*M_PI/180.0)/2;
    double Bsum=0;
    int n;
    cin>>n;
    sum=0;
    rep(i,n-1){
      cin>>cnt;
      Bsum+=sin(cnt*M_PI/180.0)/2;
      sum+=cnt;
    }
    Bsum+=sin((360-sum)*M_PI/180.0)/2;
    double rest=abs(Asum-Bsum);
    if(rest<min)cout<<0<<endl;
    if(rest>=min && Asum>Bsum)cout<<1<<endl;
    else if(rest>=min && Bsum>Asum)cout<<2<<endl;
  }
  return 0;
}

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/(2*M_PI));
      sum += arg;
    }
    
    S += sin(sum/(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/(2*M_PI));
      sum += arg;
    }
    
    T += sin(sum/(2*M_PI));
    
    if(abs(S-T) == 0) cout << 0 << endl;
    else if(S < T) cout << 2 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}