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>

#define PI (acos(-1.0))
#define RAD(v) ((v)*(PI/180.0))
#define RADIUS 16
#define EPS 1.0e-10

using namespace std;

int main(){
	while(true){
		int m1,m2;
		int sumv1=0, sumv2=0;
		double area1 = 0, area2 = 0;

		scanf("%d", &m1);
		if( m1 == 0 )
			break;
		for(int i = 0; i < m1 - 1; ++i){
			int v;
			scanf("%d", &v);
			sumv1+=v;
			area1 += 0.5 * RADIUS * RADIUS * sin( RAD(v) );
		}
		area1 += 0.5 * RADIUS * RADIUS * sin( RAD(360-sumv1) );
		
		scanf("%d", &m2);
		for(int i = 0; i < m2 - 1; ++i){
			int v;
			scanf("%d", &v);
			sumv2+=v;
			area2 += 0.5 * RADIUS * RADIUS * sin( RAD(v) );
		}
		area2 += 0.5 * RADIUS * RADIUS * sin( RAD(360-sumv2) );
		
		if( std::abs( area1 - area2 ) < EPS )
			cout << "0\n";
		else if( area1 > area2 )
			cout << "1\n";
		else
			cout << "2\n";
	}
	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;
   
    for(int i=0;i<n-1;i++){
      int v;
      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++){
      int v;
      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<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*M_PI/360;
			r-=v;
			cout<<sin(v/2)<<endl;
			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;
			v*=2*M_PI/360;
			r-=v;
			b+=calc(sin(v/2)*2,1,1);
		}
		b+=calc(sin(r/2)*2,1,1);
		cout<<a<<" "<<b<<endl;
		if(fabs(a-b)<1e-8)cout<<0<<endl;
		else if(a>b)cout<<1<<endl;
		else cout<<2<<endl;
	}
}

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(s1>s2)cout << 1 << endl;
    else if(s1<s2)cout << 2 << endl;
    else cout << 0 << endl;
  }
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

// àÏ
double dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
// OÏ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
// _cª¼üabãÉ é©È¢©
int is_point_on_line(P a, P b, P c) {
  return EQ( cross(b-a, c-a), 0.0 );
}
// 2¼üÌ¼s»è
int is_orthogonal(P a1, P a2, P b1, P b2) {
  return EQ( dot(a1-a2, b1-b2), 0.0 );
}
// 2¼üÌ½s»è
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}
// _a,bðÊé¼üÆ_cÌÔÌ£
double distance_l_p(P a, P b, P c) {
  return abs(cross(b-a, c-a)) / abs(b-a);
}
// _a,bð[_Æ·éüªÆ_cÆÌ£
double distance_ls_p(P a, P b, P c) {
  if ( dot(b-a, c-a) < EPS ) return abs(c-a);
  if ( dot(a-b, c-b) < EPS ) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð·»è
int is_intersected_ls(P a1, P a2, P b1, P b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð_vZ
P intersection_ls(P a1, P a2, P b1, P b2) {
  P b = b2-b1;
  double d1 = abs(cross(b, a1-b1));
  double d2 = abs(cross(b, a2-b1));
  double t = d1 / (d1 + d2);

  return a1 + (a2-a1) * t;
}
// a1,a2ðÊé¼üÆb1,b2ðÊé¼üÌð·»è
int is_intersected_l(P a1, P a2, P b1, P b2) {
  return !EQ( cross(a1-a2, b1-b2), 0.0 );
}
// a1,a2ðÊé¼üÆb1,b2ðÊé¼üÌð_vZ
P intersection_l(P a1, P a2, P b1, P b2) {
  P a = a2 - a1; P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}
/*
~üÆüªÌð·»è
*/
bool isCircleCrossLine(P a,P b,P c,double r){
	double d1 = abs(a-c);
	double d2 = abs(b-c);
	if(d1<r&&d2<r){
		return false;
	}
	double d = distance_ls_p(a,b,c);
	if(EQ(d,r)||d<r){
		return true;
	}
	else
		return false;
}
// Op`ÌàÉ_ª é©Ç¤©
// OÏÌ³ª·×Ä¯¶ÈçàÉ_ è
bool isInTriangle(P p1,P p2,P p3,P s){
	P a=p1-s;
	P b=p2-s;
	P c=p3-s;
	return ((cross(a,b)>0&&cross(b,c)>0&&cross(c,a)>0)||(cross(a,b)<0&&cross(b,c)<0&&cross(c,a)<0));
}

int main(){

	int n,m;
	while(cin>>n&&n!=0){
		double S=0;
		int angle=0;
		int sumAngle=0;
		for(int i = 0; i < n-1; i++){
			cin>>angle;
			S+=0.5*sin(((double)angle/180)*acos(-1.0));
			sumAngle+=angle;
		}
		S+=0.5*sin(((double)(360-sumAngle)/180)*acos(-1.0));
		cin>>m;

		double S2=0;
		sumAngle=0;
		for(int i = 0; i < m-1; i++){
			cin>>angle;
			S2+=0.5*sin(((double)angle/180)*acos(-1.0));
			sumAngle+=angle;
		}
		S2+=0.5*sin(((double)(360-sumAngle)/180)*acos(-1.0));
		if(EQ(S,S2)){
			cout<<0<<endl;
		}
		else if(S<S2){
			cout<<2<<endl;
		}
		else{
			cout<<1<<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);
  }
  
  return sum;
}

int main() {

  int n;
  while(cin >> n, n) {
    vector<double> in;
    
    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;
}