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>
#include<vector>
#include<algorithm>
#define EPS (1e-10)
#define PI 3.14159265358979323846264
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(100,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(Point(p.x+1000,p.y+1000));
	}

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

      

      double areaA,areaB;
      areaA = getArea(A);
      areaB = getArea(B);

      //cout << areaA << " - " << areaB << endl;

      if(areaA == areaB)
	cout << 0 << endl;
      else if(areaA > areaB)
	cout << 1 << endl;
      else 
	cout << 2 << endl;

    }
  return 0;
}

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

using namespace std;

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

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+=calc(v);
    }
    s1+=calc(360-sum1);
    cin >> m;
    for(int j=0;j<m-1;j++){
      int v;
      cin >> v;
      sum2+=v;
      s2+=calc(v);
    }
    s2+=calc(360-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(void){
  int n,m;
  double v;
  
  while(cin >> n,n){
    double sum1=0,sum2=0,s1=0,s2=0;
    for(int i=0;i<n-1;i++){
      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++){
      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 <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;
const double EPS = 1e-12;
#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()]
#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 calc(int N){
  int sd = 0.0;
  double sum = 0.0;
  REP(i, N - 1){
    int d; cin >>d;
    sd += d;
    sum += sin(d * M_PI / 180.0);
  }
  sum += sin((360.0 - sd) * M_PI / 180.0);
  return sum;
}

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 <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) {
    int sum = 0;
    double S = 0.0;
    for(int i=0; i<M-1; i++) {
      int arg; cin >> arg;
      S += sin(conv(arg));
      sum += arg;
    }
    
    S += sin(conv(360-sum));
    cin >> M;
    sum = 0;
    double T = 0.0;
    for(int i=0; i<M-1; i++) {
      int arg; cin >> arg;
      T += sin(conv(arg));
      sum += arg;
    }
    
    T += sin(conv(360-sum));
    
    if(abs(S-T) < EPS) cout << 0 << endl;
    else if(S < T) cout << 2 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}