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

#define PI 2 * acos(0.0)
#define DEGtoRAD(X) (X*PI)/180.0
#define EPS 1e-06

int main(){
    int m, n, v;
    while(1){
        cin >> m;
        if(m == 0)  break;

        double first = 0, second = 0;

        int rest = 360;
        for(int i = 0; i < m-1; i++){
            cin >> v;
            first += sin(DEGtoRAD(v));
            rest -= v;
        }
        first += sin(DEGtoRAD(rest));

        cin >> n;
        rest = 360;
        for(int i = 0; i < n-1; i++){
            cin >> v;
            second += sin(DEGtoRAD(v));
            rest -= v;
        }
        second += sin(DEGtoRAD(rest));

        if(first - second > EPS)        cout << 1 << endl;
        else if(first - second < -EPS)  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 (true) {
		for (int i = 0; i < 2; i++) {
			cin >> N; V = 0.0L; sum = 0.0L; if (N == 0) { goto E; }
			for (int i = 0; i < N - 1; i++) { cin >> a; sum += SIN(a); V += a; }
			sum += SIN(360.0L - V); s[i] = sum;
		}
		if (fabs(s[0] - s[1]) < 1e-9) { cout << '0' << endl; }
		else if (s[0] > s[1]) { cout << '1' << endl; }
		else if (s[0] < s[1]) { cout << '2' << endl; }
	}
E:;
	return 0;
}

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

int m;
double *v;
double a[2];
double tmp;

int main(){
	while(true){
		for(int k=0; k<2; k++){
			cin >> m;
			if(!m)
				return 0;

			a[k] = 0;
			tmp = 0;

			v = new double[m];
			for(int i=0; i<m-1; i++){
				cin >> v[i];
				tmp += v[i];
			}
			v[m-1] = 360-tmp;

			for(int i=0; i<m; i++)
				a[k] += sin(v[i]*PI/360)*cos(v[i]*PI/360);
			delete[] v;
		}

		if(a[0] == a[1])
			cout << 0 << endl;
		else if(a[0] > a[1])
			cout << 1 << endl;
		else
			cout << 2 << endl;
	}
}

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

using namespace std;

#define PI 3.14159265358979323846264338327950288

int main(){

	int m, n;
	int v, vsum;
	double area1=0, area2=0;

	while(1){

		cin >> m;
		if(m == 0) break;

		vsum = 0;
		for(int i = 0; i < m - 1; i++){
			cin >> v;
			vsum += v;
			area1 += sin(v * PI / 180);
		}
		area1 += sin((360 - vsum) * PI / 180);

		cin >> n;

		vsum = 0;
		for(int i = 0; i < n - 1; i++){
			cin >> v;
			vsum += v;
			area2 += sin(v * PI / 180);
		}
		area2 += sin((360 - vsum) * PI / 180);

		if(area1 == area2) cout << "0" << endl;
		else if(area1 > area2) cout<< "1" << endl;
		else cout<< "2" << endl;

	}

	return 0;
}

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

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int n;
  while(cin>>n, n){
    int sum = 0;
    int ang;
    double s1 = 0.0, s2 = 0.0;
    REP(i,n-1){
      cin>>ang;
      sum += ang;
      s1 += sin(ang/180.0);
    }
    s1 += sin((360-sum)/180.0);

    int m;
    cin >> m;
    sum = 0;
    REP(i,m-1){
      cin>>ang;
      sum += ang;
      s2 += sin(ang/180.0);
    }
    s2 += sin((360-sum)/180.0);

    if(abs(s1-s2) < 1e-15) puts("0");
    else if(s1 > s2) puts("1");
    else puts("2");
  }
  return 0;
}

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

using namespace std;
static double EPS = 1.0e-10;

bool is_zero(const double x){ return abs(x)<EPS; }
double get_area(const double& t){ return sin(t*M_PI/180.0)/2; }

double solve(const int& n){
  double ans=0;
  double t, t_=360;
  for(int i=0; i<n-1; ++i){
    cin >> t;
    t_-=t;
    ans+=get_area(t);
  }
  ans+=get_area(t_);
  return ans;
}

int main(){
  int n, m;
  while(cin >> n && n){
    double a=solve(n);
    cin >> m;
    double b=solve(m);
    if(a==b) printf("0\n");
    else if(a>b) printf("1\n");
    else printf("2\n");
  }
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

static const double eps = 1e-8;

int main(){

	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;

		double areaA=0,areaB=0;
		int remain=360;
		for(int i=0;i<n-1;i++){
			double rad;
			int angle;
			scanf("%d",&angle);
			remain-=angle;
			rad = (double)angle / 180.0 * M_PI;
			areaA += 0.5*sin(rad);
		}

		areaA += 0.5*sin((double)remain / 180.0 * M_PI);

		remain=360;
		scanf("%d",&n);
		for(int i=0;i<n-1;i++){
			double rad;
			int angle;
			scanf("%d",&angle);
			remain-=angle;
			rad = (double)angle / 180.0 * M_PI;
			areaB += 0.5*sin(rad);
		}

		areaB += 0.5*sin((double)remain / 180.0 * M_PI);

		printf("%d\n",abs(areaA - areaB) < eps ? 0 :
			areaA > areaB ? 1 : 2);
	}
}

C++: #include<iostream>
#include<cmath>
#define PI (acos(-1.0))
#define RAD(v) ((v)*(PI/180.0))
#define RADIUS 256
#define EPS 1.0e-10
using namespace std;
int main(){
	while(true){
		int m1,m2;
		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);
			area1 += 0.5 * RADIUS * RADIUS * sin( RAD(v) );
		}
		scanf("%d", &m2);
		for(int i = 0; i < m2 - 1; ++i){
			int v;
			scanf("%d", &v);
			area2 += 0.5 * RADIUS * RADIUS * sin( RAD(v) );
		}

		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>
#include<algorithm>
#include<vector>
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, V; vector<long double, int>vec;
	while (true) {
		cin >> N; V = 0.0L; sum = 0.0L; if (N == 0) { break; }
		for (int i = 0; i < N; i++) { cin >> a; sum += SIN(a); V += a; }
		sum += sin(360.0L - V); vec.push_back(make_pair(sum, cnt)); cnt++;
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < cnt; i++) { K[vec[i].second] = i; }
	for (int i = 0; i < cnt; i++) { cout << K[i] << endl; }
	return 0;
}