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;
main(){
  int m;
  while(1){
    int sum=0;
    int r=1;
    double s1=0, s2=0;
    cin >> m;
    if(m==0) break;
    for(int i=0;i<m;i++){
      double a, b;
      int k;
      if(i==m-1){
        k=360-sum;
        s1+=sin(((double)k/180)*M_PI);
      }
      else{
        cin >> k;
        sum+=k;
        s1+=sin(((double)k/180)*M_PI);
      }
    }
    int n;
    cin >> n;
    sum=0;
    for(int i=0;i<n;i++){
      double a, b;
      int k;
      if(i==n-1){
        k=360-sum;
        s2+=sin(((double)k/180)*M_PI);
      }
      else{
        cin >> k;
        sum+=k;
        s2+=sin(((double)k/180)*M_PI);
      }
    }
    if(s1>s2) cout << 1 << endl;
    else if(s1<s2) cout << 2 << endl;
    else cout << 0 << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
#define PI 3.141592653589793238462643L
int K[100000];
long double SIN(long double b) { return sinl(b * PI / 180.0L); }
int main() {
	int N, cnt = 0; long double a, sum, s[2], V;
	while (cin >> N) {
		for (int i = 0; i < 2; i++) {
			if (i == 1) { cin >> N; } V = 0.0L; sum = 0.0L;
			for (int i = 0; i < N; i++) { cin >> a; sum += SIN(a); V += a; }
			sum += sin(360.0L - V); s[i] = sum;
		}
		if (s[0] == s[1]) { cout << '0' << endl; }
		if (s[0] > s[1]) { cout << '1' << endl; }
		if (s[0] < s[1]) { cout << '2' << endl; }
	}
	return 0;
}

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

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( mv > nv ){
			ans = 1;
		}else if( mv < nv ){
			ans = 2;
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double pai = acos(-1.0);
int main(){
  int n;
  while( cin >> n , n){
    double suma = 0,sumb = 0;
    double s = 360;
    for(int i = 0 ; i < n-1 ; i++ ){
      double m;
      cin >> m;
      suma += (0.5)*sin((m/180.0)*pai); 
      s -= m;
    }
    suma += (0.5)*sin((s/180.0)*pai); 
    s = 360;
    cin >> n;
    for(int i = 0 ; i < n-1 ; i++ ){
      double m;
      cin >> m;
      sumb += (0.5)*sin((m/180.0)*pai);
      s -= m; 
    }
    sumb += (0.5)*sin((s/180.0)*pai); 
    if((float)suma > (float)sumb)cout << 1;
    else if((float)suma < (float)sumb)cout << 2;
    else cout << 0;
    cout << endl;
  }
  return 0;
}

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

double calcArea( vector<double> v ) {
  double sum = 0;
  
  for(int i=0; i<v.size(); i++) {
    sum += sin(v[i]/180*M_PI)/2;
  }
  
  return sum;
}

int main() {

  vector<double> in;
  int n;
  while(cin >> n, n) {
    in.clear();
    
    double sum = 0;
    for(int i=0; i<n-1; i++) {
      double x;
      cin >> x;
      in.push_back(x);
      sum += x;
    }
    in.push_back(360-sum);
    
    double A1 = calcArea(in);

    in.clear();
    int m;
    cin >> m;

    sum = 0;
    for(int i=0; i<m-1; i++) {
      double x;
      cin >> x;
      in.push_back(x);
      sum += x;
    }
    in.push_back(360-sum);
    
    double A2 = calcArea(in);
    
    if( A1 < A2 ) cout << 2 << endl;
    else if( A1 == A2 ) cout << 0 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}

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 (abs(a-b)<eps) puts("0");
        else if (a<b-eps) puts("2");
        else puts("1");
    }
}

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

int main()
{
	int n, i;
	double d, dd, s1, s2;
	while (cin>>n, n) {
		s1 = s2 = 0;
		dd = 360.0;
		for (i = 1; i < n; i++) {
			cin>>d;
			dd -= d;
			s1 += sin(d * (M_PI/180.0))/2.0;
		}
		s1 += sin(dd * (M_PI/180.0))/2.0;

		cin>>n;
		dd = 360.0;
		for (i = 1; i < n; i++) {
			cin>>d;
			dd -= d;
			s2 += sin(d * (M_PI/180.0))/2.0;
		}
		s2 += sin(dd * (M_PI/180.0))/2.0;
		if (s1>s2) cout<<1<<endl;
		else if (s1==s2) cout<<0<<endl;
		else cout<<2<<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] += cos(r/180.0*3.1415);
      }
      a[j] += cos(s/180.0*3.1415);
    }
    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>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
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;
    if(Asum>Bsum)cout<<"1"<<endl;
    else if(Bsum>Asum)cout<<"2"<<endl;
    else cout<<0<<endl;
  }
  return 0;
}