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

int main(){
  int m,n,v,tmp;
  double s1,s2;

  while(1){
    cin >> m;
    if(!m)break;

    s1 = 0.0;
    tmp = 360;
    for(int i=1;i<m;i++){
      cin >> v;
      tmp -= v;
      s1 += sin(M_PI*v/180);
    }
    s1 += sin(M_PI*tmp/180);

    cin >> n;
    s2 = 0.0;
    tmp = 360;
    for(int i=1;i<n;i++){
      cin >> v;
      tmp -= v;
      s2 += sin(M_PI*v/180);
    }
    s2 += sin(M_PI*tmp/180);

    if(abs(s1-s2)<1e-10)cout << 0 << endl;
    else if(s1<s2)cout << 2 << endl;
    else cout << 1 << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double EPS = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll m,n;
  while(cin >> m && m){
    vector<double> v(m);
    ll sum = 0;
    rep(i,m-1){
      cin >> v[i];
      sum += v[i];
    }
    v[m-1] = 360 - sum;
    cin >> n;
    vector<double> v2(n);
    sum = 0;
    rep(i,n-1){
      cin >> v2[i];
      sum += v2[i];
    }
    v2[n-1] = 360 - sum;
    double s1 = 0,s2 =0;
    rep(i,m){
      s1 += sin(v[i]/180 * PI);
    }
    rep(j,n){
      s2 += sin(v2[j]/180 * PI);
    }
    if(s2 - s1 > EPS){
      cout << 2 << endl;
    }
    else if(s1 - s2 > EPS){
      cout << 1 << endl;
    }
    else{
      cout << 0 << endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#define EPS 1e-9
int m,n;
double v[1000];
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]+=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]+=sin(v[i]);
		}
		printf("%d\n",check());
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI 3.141592653589793238462643383279
#define EPS 10e-8

using namespace std;

int main()
{
	int m, n;
	int sum;
	vector <double> sa, sb;

	for (;; ){
		cin >> m;
		if (!m )
			break; 
		vector <int> a (m, 0 );
		sum = 0;
		rep (i, m - 1 ){
			cin >> a[i];
			sum += a[i];
		} // end rep
		a[m-1] = 360 - sum;
		cin >> n;
		vector <int> b (n, 0 );
		sum = 0;
		rep (j, n-1 ){
			cin >> b[j];
			sum += b[j];
		} // end rep
		b[n-1] = 360 - sum;
		double s = 0.0, t = 0.0;
		rep (i, m )
			s += sin ((double)a[i]*PI/180. );
		sa.push_back (s );
		rep (j, n )
			t += sin ((double)b[j]*PI/180. );
		sb.push_back (t );
	} // end for

	int size = sa.size();
	rep (i, size ){
//		sa[i] = fabs (sa[i] ); sb[i] = fabs (sb[i] );
		if (sa[i] > sb[i]+EPS ){
			cout << '1' << endl;
		}else if (sa[i]+EPS < sb[i] ){
			cout << '2' << endl;
		}else{
			cout << '0' << endl;
		} // end if 
	} // end for

	return 0;
}

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

using namespace std;


int main(void){
  int n,m;
  
  while(cin >> n,n){
    int sum1=0,sum2=0;
    double s1=0,s2=0;
   
    for(int i=0;i<n-1;i++){
      int v;
      cin >> v;
      sum1+=v;
      s1+=sin(v*M_PI/180);
    }
    s1+=sin((360-sum1)*M_PI/180);
    cin >> m;
    for(int j=0;j<m-1;j++){
      int v;
      cin >> v;
      sum2+=v;
      s2+=sin(v*M_PI/180);
    }
    s2+=sin((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 <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);
		rep(i, a-1) cin >> n[i];
		cin >> b;
		vector<int> m(b);
		rep(i, b-1) cin >> m[i];

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

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

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

int main(void){
  int m,n;
  double v;
  double area1=0;
  double area2=0;
  double angle1,angle2;
  while(1){
    area1=0;
    area2=0;
    angle1=360;
    angle2=360;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n-1;i++){
      cin>>v;
      angle1-=v;
      v=2*v*M_PI/360;
      area1+=sin(v)/2;
    }
    area1+=sin(2*angle1*M_PI/360)/2;
    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>v;
      angle2-=v;
      v=2*v*M_PI/360;
      area2+=sin(v)/2;
    }
    area2+=sin(2*angle2*M_PI/360)/2;
    if(abs(area1-area2)<0.00000001){
      cout<<0<<endl;
    }
    else if(area1>area2){
      cout<<1<<endl;
    }
    else{
      cout<<2<<endl;
    }
  }
  return 0;

}