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 <cmath>
#include <iostream>
#define PI 3.14159265358979L
using namespace std;
int n, a, s; long double p, q;
int main() {
	while(true) {
		cin >> n; s = 360, p = 0.0L;
		if(n == 0) break;
		for(int i = 0; i < n - 1; i++) {
			cin >> a; s -= a;
			p += sinl(PI / 2.0L - a * PI / 360.0L) * cosl(PI / 2.0L - a * PI / 360.0L);
		}
		p += sinl(PI / 2.0L - s * PI / 360.0L) * cosl(PI / 2.0L - s * PI / 360.0L);
		cin >> n; s = 360, q = 0.0L;
		for(int i = 0; i < n - 1; i++) {
			cin >> a; s -= a;
			q += sinl(PI / 2.0L - a * PI / 360.0L) * cosl(PI / 2.0L - a * PI / 360.0L);
		}
		q += sinl(PI / 2.0L - s * PI / 360.0L) * cosl(PI / 2.0L - s * PI / 360.0L);
		if(abs(p - q) < 0.0000000001L) printf("0\n");
		else if (p > q) printf("1\n");
		else printf("2\n");
	}
}

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);
    int res=(s1>s2)?1:(s1==s2)?0:2;
    cout << res << endl;
  }

  return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define PI atan(1.0)*4

int main() {
	int a,b;
//cout<<PI<<endl;
	while(a=in()){
		int i;
		double d;
		double r=360;
		double aa=0;
		for(i=0;i<a-1;i++){
			cin>>d;
			r-=d;
//cout<<sin(d/180*PI);
			aa+=sin(d/180*PI);
//cout<<aa<<endl;
		}
		aa+=sin(r/180*PI);
		cin>>b;
		r=360;
		double bb=0;
		for(i=0;i<b-1;i++){
			cin>>d;
			r-=d;
			bb+=sin(d/180*PI);
		}
		bb+=sin(r/180*PI);
//cout<<aa<<" "<<bb<<endl;
		if(fabs(aa-bb)<=1e-9){
			cout<<0<<endl;
		}else if(aa>bb){
			cout<<1<<endl;
		}else{
			cout<<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) {
    double sum = 0.0;
    double S = 0.0;
    for(int i=0; i<M-1; i++) {
      double 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++) {
      double arg; cin >> arg;
      T += sin(conv(arg));
      sum += arg;
    }
    T += sin(conv(360-sum));
    
    if(S > T) cout << 1 << endl;
    else if(S < T) cout << 2 << endl;
    else cout << 0 << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include <vector>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

void solve()
{
	int m;
	while(cin >>m, m)
	{
		double angle_remain1 = 360;
		double angle1;
		double sum1 = 0;
		for(int i = 1; i < m; ++i)
		{
			cin >> angle1;
			angle_remain1 -= angle1;
			sum1 += sin(angle1 / 180 * M_PI);
		}
		sum1 += sin(angle_remain1);
		int n;
		cin >> n;
		double angle_remain2 = 360;
		double angle2;
		double sum2 = 0;
		for(int i = 1; i < n; ++i)
		{
			cin >> angle2;
			angle_remain2 -= angle2;
			sum2 += sin(angle2 / 180 * M_PI);
		}
		sum2 += sin(angle_remain2);
		if(fabs(sum1 - sum2) < 0.000000001)
		{
			cout << 0 << endl;
		}
		else if(sum1 > sum2)
		{
			cout << 1 << endl;
		}
		else if(sum1 < sum2)
		{
			cout << 2 << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

#define EPS 1e-5
#define PI acos(-1)

int main(){
	int m,n,ret;
	
	while(cin >> m && m){
		double sm=0, sn=0;
		vector<int> ms(m);
		for(int i=0;i<m-1;i++){
			cin >> ms[i];
		}
		ms[m-1] = 360 - accumulate(ms.begin(),ms.end(),0);
		cin >> n;
		vector<int> ns(n);
		for(int i=0;i<n-1;i++){
			cin >> ns[i];
		}
		ns[n-1] = 360 - accumulate(ns.begin(),ns.end(),0);
		for(int i=0;i<m;i++){
			sm += sin((double)ms[i] / 180 * PI);
		}
		for(int i=0;i<n;i++){
			sn += sin((double)ns[i] / 180 * PI);
		}

		if(sm == sn){
			ret = 0;
		}else if(sm > sn){
			ret = 1;
		}else{
			ret = 2;
		}
		cout << ret << endl;
	}
}