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,v,n;
  double S1,S2;

  while(cin >> m && m!=0){
    S1=0; S2=0;

    for(int i=0;i<m-1;i++){
  
      cin >> v ;
   
      S1+=sin(v*3.14159/180.0);
    }
    cin >> n;
    
    for(int j=0;j<n-1;j++){
    
      cin >> v;
      
      S2+=sin(v*3.14159/180.0);
    }
    
     if(S1==S2){
      cout << 0 << endl;}
    else if(S1>S2){
      cout << 1<< endl;}
    else if(S1<S2){
      cout << 2<< endl;}
  }

  

  return 0;
}

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

#define PI	3.1415926535
#define EPS	0.0000000001

int main()
{
	int n,a;
	int a1,a2;
	double h1,h2;
	while(cin >> n, n)
	{
		a1=a2=0;
		h1=h2=0;
		while(--n)
		{
			cin >> a;
			a1 += a;
			h1 += sin(a*PI/180.0);
		}
		cin >> n;
		while(--n)
		{
			cin >> a;
			a2 += a;
			h2 += sin(a*PI/180.0);
		}

		h1 += sin((360-a1)*PI/180.0);
		h2 += sin((360-a2)*PI/180.0);

		if(-EPS<h1-h2 && h1-h2<EPS)
		{
			cout << 0 << endl;
		}
		else if(h1>h2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 2 << endl;
		}
	}

	return 0;
}

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

int m, n;
int D[MAX];

double getArea(int size ){
    D[size-1] = 360;
    for ( int i = 0; i < size-1; i++ ) D[size-1] -= D[i];
    double a = 0.0;
    for ( int i = 0; i < size; i++ ){
	a += sin(D[i]*acos(-1)/180.0)/2.0;
    }
    return a;
}

main(){
    int d;
    double S1, S2;
    while(1){
	cin >> m;
	if ( m == 0 ) break;
	for ( int i = 0; i < m-1; i++ ) {
	    cin >> D[i];
	}
	S1 = getArea(m);
	cin >> n;
	for ( int i = 0; i < n-1; i++ ) {
	    cin >> D[i];
	}
	S2 = getArea(n);
	if ( fabs(S1 - S2) < 0.0000001 ) cout << 0 << endl;
	else if ( S1 > S2 ) cout << 1 << endl;
	else cout << 2 << endl;
    }
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028841971
using namespace std;

class Point
{
public:
  double x,y;

  Point(double x = -1,double y = -1): x(x),y(y){}

  Point operator + (Point p ){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}

  bool operator < (const Point& p) const
  {
    return x != p.x?x<p.x:y<p.y;
  }

  bool operator == (const Point& p)const
  {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

struct Segment
{
  Point p1,p2;
  Segment(Point p1 = Point(-1,-1),Point p2 = Point(-1,-1)):p1(p1),p2(p2){}
};
typedef Segment Line;
typedef vector<Point> Polygon;

double dot(Point a,Point b)
{
  return a.x*b.x + a.y*b.y;
}
double cross(Point a,Point b)
{
  return a.x*b.y - a.y*b.x;
}

double norm(Point a)
{
  return a.x*a.x+a.y*a.y;
}

double getArea(vector<Point>& vec)
{
  double sum = 0;
  for(int i=0;i<vec.size();i++)
    sum += cross(vec[i],vec[(i+1)%vec.size()]);
  return fabs(sum)/2.0;
}

double rad(double d)
{
  return d*(PI/180.0);
}

Point Rotate(Point p,double d)
{
  Point ret;
  double r = rad(d);
  ret.x = p.x*cos(r) - p.y*sin(r);
  ret.y = p.x*sin(r) + p.y*cos(r);
  return ret;
}


int main()
{
  int m;
  while(cin >> m,m)
    {
      vector<Point> A,B;
      Point p(1,0);
      A.push_back(p),B.push_back(p);
      double v;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  p = Rotate(p,v);
	  A.push_back(p);
	}

      cin >> m;
      p = Point(1,0);
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  p = Rotate(p,v);
	  B.push_back(p);
	}

      double areaA,areaB;
      areaA = getArea(A);
      areaB = getArea(B);
      if(areaA == areaB)
	cout << 0 << endl;
      else if(areaA > areaB)
	cout << 1 << endl;
      else 
	cout << 2 << endl;

    }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

const double Eps = 1e-8;
const double PI = 4*atan(1.0);

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		double area[2];
		area[0] = area[1] = 0;
		for (int w = 0; w < 2; ++w)
		{
			for (int i = 1; i < n; ++i)
			{
				int v;
				scanf("%d", &v);
				area[w] += sin(v*PI / 180);
			}
			if (!w)
				scanf("%d", &n);
		}
		if (abs(area[0] - area[1]) < Eps)
			puts("0");
		else if (area[0] > area[1])
			puts("1");
		else
			puts("2");
	}

	return 0;
}

C++: // 2014/06/03 Tazoe

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	while(true){
		int m;
		cin >> m;

		if(m==0)
			break;

		double S1 = 0.0;
		int V1 = 360;

		for(int i=0; i<m-1; i++){
			int v;
			cin >> v;

			S1 += sin((double)v*M_PI/180.0);
			V1 -= v;
		}

		S1 += sin((double)V1*M_PI/180.0);

		int n;
		cin >> n;

		double S2 = 0.0;
		int V2 = 360;

		for(int i=0; i<n-1; i++){
			int v;
			cin >> v;

			S2 += sin((double)v*M_PI/180.0);
			V2 -= v;
		}

		S2 += sin((double)V2*M_PI/180.0);

		if(fabs(S1-S2)<0.0000001){
			cout << 0 << endl;
		}
		else if(S1>S2){
			cout << 1 << endl;
		}
		else{
			cout << 2 << endl;
		}
	}

	return 0;
}

C++: // テ」ツつ「テ」ツつォテ」ツつヲテ」ツδウテ」ツδ暗ゥツ鳴禿ゥツ?陛」ツ?暗」ツ?淌・ツ按?」ツ?ョテ」ツδ堙」ツδ甘」ツδォテ」ツδ?」ツつ」ireta
#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;
    }
    if( 360-sum < 180 ) {
      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;
    }
    
    if( 360-sum < 180 ) {
      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 <iostream>
#include <cmath>
using namespace std;


double degToRad(int deg) {
  return (double)deg*M_PI/180;
}
double calcS(int deg) {
  return sin(degToRad(deg));
}

main() {
  while(1) {
    int m;
    double S[2];
    bool flag = false;
    for(int t = 0; t < 2; t++) {
      S[t] = 0;
      cin >> m;
      if(m == 0) {
	flag = true;
	break;
      }
      int tmp = 0;
      for(int i = 0; i < m-1; i++) {
	int deg;
	cin >> deg;
	S[t] += calcS(deg);
	tmp += deg;
      }
      S[t] += calcS(360-tmp);
    }
    if(flag) break;
    if(S[0] > S[1]) cout << 1 << endl;
    else if(S[0] < S[1]) cout << 2 << endl;
    else            cout << 0 << endl;
  }
}