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<stdio.h>
#include<math.h>
#define PI 3.141592653589793238462643383279
const double r=10.0;
const double eps=1e-8;
int main(void)
{
  int m,n,i,a[100],b[100];
  long double sa,sb;
  for(;;){
    scanf("%d",&m); if(!m)break;
    a[m-1]=360;
    for(i=0;i<m-1;i++){
      scanf("%d",a+i);
      a[m-1]-=a[i];
    }
    scanf("%d",&n);
    b[n-1]=360;
    for(i=0;i<n-1;i++){
      scanf("%d",b+i);
      b[n-1]-=b[i];
    }
    sa=sb=0;
    for(i=0;i<m;i++)
      sa+=1.0/2.0*r*r*sin(a[i]*PI/180);
    for(i=0;i<n;i++)
      sb+=1.0/2.0*r*r*sin(b[i]*PI/180);
    sa=fabs(sa); sb=fabs(sb);
    if(sa>sb+eps)puts("1");
    else if(sa+eps<sb)puts("2");
    else puts("0");
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <vector>
using namespace std;
typedef complex<double> c;
int main(){

  int m;
  double deg,ta1,ta2,tp;
  cin>>m;
  while(m){
    ta1=0;tp=360;
    for(int i=0;i<m-1;i++){
      cin>>deg;
      ta1+=sin(deg/180*3.14);
      tp-=deg;
    }
    ta1+=sin(tp/180*3.14);
    
   
    ta2=0;tp=360;
    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>deg;
      ta2+=sin(deg/180*3.14);
      tp-=deg;
    }
    ta2+=sin(tp/180*3.14);
    
    
    if(ta1>ta2) cout<<1<<endl;
    if(ta1<ta2) cout<<2<<endl;
    if(ta1==ta2) cout<<0<<endl;
    cin>>m;
  }
  return 0;
}

C++: #include<cmath>
#include<cstring>
#include<string>
#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
#define EPS (1e-9)
int N,M;
double calc(int an){
  double rad = (double)an * M_PI/180.0;
  return 1.0-cos(rad);
}
bool equal(double a,double b){ return abs(a-b) < EPS; }
int main(){
  while(cin >> N && N ){
    double a1=0.0,a2=0.0;
    int an,suman=0;
    for(int i=0;i<N-1;i++){
      cin >> an;
      //cout << "an " <<calc(an) << endl;
      a1 += calc(an);
      suman+=an;
    }
    a1 += calc(360-suman);
    cin >> M;
    suman = 0;
    for(int i=0;i<M-1;i++){
      cin >> an;
      //      cout << "an " <<calc(an) << endl;
      a2 += calc(an);
      suman += an;
    }
    a2 += calc(360-suman);
    //cout << a1 << " " <<a2<<endl;
    if( equal(a1,a2) ) cout << 0 << endl;
    else if( a1 < a2 ) cout << 1 << endl;
    else cout << 2 <<endl;
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

#define EPS (1e-7)

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));
    
    int N; cin >> N;
    sum = 0;
    double T = 0.0;
    for(int i=0; i<N-1; i++) {
      double arg; cin >> arg;
      T += sin(conv(arg));
      sum += arg;
    }
    T += sin(conv(360-sum));
    
    if(fabs(S-T) < EPS) cout << 0 << endl;
    else if(S > T) cout << 1 << endl;
    else if(S < T) cout << 2 << 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 (s[0] == s[1]) { cout << '0' << endl; }
		if (s[0] > s[1]) { cout << '1' << endl; }
		if (s[0] < s[1]) { cout << '2' << endl; }
	}
E:;
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

const int EPS = 1e-6;

int main(){
	while(true){
		int N[2], V, V_;
		double S[2] = {};
		for(int i = 0; i < 2; i++){
			cin >> N[i];
			if(N[i] == 0) return 0;
			V_ = 360;
			for(int j = 0; j < N[i]-1; j++){
				cin >> V;
				V_ -= V;
				S[i] += sin(M_PI*V/180);
			}
			S[i] += sin(M_PI*V_/180);
		}
		if(S[0] - S[1] > EPS) puts("1");
		else if(S[1] - S[0] > EPS) puts("2");
		else puts("0");
	}
	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-10) puts("0");
    else if(s1 > s2) puts("1");
    else puts("2");
  }
  return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <algorithm>
#define eps 1e-10
#define pi 3.14159265358979
using namespace std;
int main() {
    int m, n;
    while (scanf("%d",&m)) {
        if (m==0) break;
        double a=0.0, b=0.0;
        double arg=360.0;
        for (int i=0; i<m-1; i++) {
            int v; scanf("%d",&v);
            a+=sin((double)v/180.0*pi);
            arg-=v;
        }
        a+=sin(arg/180.0*pi);
        arg=360.0;
        scanf("%d",&n);
        for (int i=0; i<n-1; i++) {
            int v; scanf("%d",&v);
            b+=sin((double)v/180.0*pi);
            arg-=v;
        }
        b+=sin(arg/180.0*pi);
        if (abs(a-b)<eps) puts("0");
        else if (a-eps>b) puts("1");
        else puts("2");
    }
}

C++: #include <iostream>
#include <cmath>
#define pi 3.14159265359

using namespace std;

int main(void){

  double s1,s2;
  int n,m;
  int angle;

  while( cin >> n , n ){

    s1 = s2 = 0;

    for( int i = 0 ; i < n - 1 ; i++ ){
      cin >> angle;
      s1 += sin(angle*pi/180.0) / 2.0;
    }

    cin >> m;
    for( int i = 0 ; i < m - 1 ; i++ ){
      cin >> angle;
      s2 += sin(angle*pi/180.0) / 2.0;
    }

    //  cout << s1 << "  "  << s2 << endl;

    if( fabs( s1 - s2 ) < 0.0000001 ) cout << 0 << endl;
    else if( s1 > s2 ) cout << 1 << endl;
    else cout << 2 << endl;


  }


  return 0;
}