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 <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

const double EPS=1e-10;

int main()
{
	for(int m,n;cin>>m,m;){
		vi a(m,360);
		rep(i,m-1){
			cin>>a[i];
			a[m-1]-=a[i];
		}
		cin>>n;
		vi b(n,360);
		rep(i,n-1){
			cin>>b[i];
			b[n-1]-=b[i];
		}
		
		double sa=0,sb=0;
		rep(i,m)
			sa+=sin(a[i]*M_PI/180);
		rep(i,n)
			sb+=sin(b[i]*M_PI/180);
		
		if(abs(sa-sb)<EPS)
			cout<<0<<endl;
		else if(sa>sb)
			cout<<1<<endl;
		else
			cout<<2<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){

  int m,n,v,m2,n2;
  double x,h,rad,S1,S2;
  
  while(1){
    
    cin >>m;
    
    if(m == 0)break;

    S1=0;
    S2=0;
    m2=360;
    n2=360;
    
    for(int i=0 ; i < m-1 ; i++){
      cin >>v;
      m2-=v;
      rad=v*(M_PI/180);
      x=sqrt(2-2*cos(rad));
      h=sqrt(1-(x*x/4));
      S1+=h*x/2;
    }
    
    rad=m2*(M_PI/180);
    x=sqrt(2-2*cos(rad));
    h=sqrt(1-(x*x/4));
    S1+=h*x/2;

    cin >>n;
    
    for(int i=0 ; i < n-1 ; i++){
      cin >>v;
      n2-=v;
      rad=v*(M_PI/180);
      x=sqrt(2-2*cos(rad));
      h=sqrt(1-(x*x/4));
      S2+=h*x/2;
    }

    rad=n2*(M_PI/180);
    x=sqrt(2-2*cos(rad));
    h=sqrt(1-(x*x/4));
    S2+=h*x/2;
    
    if( S1 == S2 ){
      cout <<"0"<<endl;
    }else if ( S1 > S2 ){
      cout <<"1"<<endl;
    }else{
      cout <<"2"<<endl;
    }

  }
      
  return 0;
}

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

using namespace std;

int main(int argc, char const* argv[])
{
	int m;
	double naikaku;
	double theta;
	double S1,S2;

	while( cin >> m && m != 0 ){
		S1 = S2 = 0;
		naikaku = 360;
		for( int i = 0;i < m - 1;i++ ){
			cin >> theta;
			naikaku -= theta;
			theta *= 3.14159265 / 180;
			S1 += sin( theta ) / 2;
		}
		S1 += sin( naikaku * 3.14159265 / 180 ) / 2;

		cin >> m;
		naikaku = 360; 
		for( int i = 0;i < m - 1;i++ ){
			cin >> theta;
			naikaku -= theta;
			theta *= 3.14159265 / 180;
			S2 += sin( theta ) / 2;
		}
		S2 += sin( naikaku *  3.14159265 / 180 ) / 2;

		if( S1 == S2 ) cout << 0 << endl;
		else if( S1 > S2 ) cout << 1 << endl;
		else if( S1 < S2 ) cout << 2 << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
using namespace std;
#define EPS 1e-10

int main() {
  int n, m;
  double v, s, t;
  while (1) {
    scanf("%d", &n);
    if (!n) break;
    --n;
    s = 0.;
    for (int i=0; i<n; i++) {
      scanf("%lf", &v);
      s += sin(v*M_PI/180.);
    }
    scanf("%d", &m);
    --m;
    t = 0.;
    for (int i=0; i<m; i++) {
      scanf("%lf", &v);
      t += sin(v*M_PI/180.);
    }
    if (s > t + EPS) {
      puts("1");
    } else if (s < t - EPS) {
      puts("2");
    } else {
      puts("0");
    }
  }
  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;

int main() {
  while(1) {
    double sum[2];
    for(int i = 0; i < 2; ++i) {
      int m;
      cin >> m;
      if(!m) return 0;
      sum[i] = 0;
      double u = 0;
      while(--m) {
        double v;
        cin >> v;
        u += v;
        sum[i] += sin(M_PI * v / 180.0);
      }
      sum[i] += sin(M_PI * (360-u) / 180.0);
    }
    if(sum[0] == sum[1]) {
      cout << 0 << endl;
    } else if(sum[0] > sum[1]) {
      cout << 1 << endl;
    } else {
      cout << 2 << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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()
#define INF 1<<30
const double EPS = 1e-8;

double dtor(double deg) {       // x¨WA
  return deg*M_PI/180;
}

int main() {
  int m;
  while(cin >> m, m) {
    int v1[m];
    int hoge = 0;
    REP(i,m-1) {
      cin >> v1[i];
      hoge += v1[i];
    }
    v1[m-1] = 360-hoge;
    int n;
    cin >> n;
    int v2[n];
    hoge = 0;
    REP(i,n-1) {
      cin >> v2[i];
      hoge += v2[i];
    }
    v2[n-1] = 360-hoge;

    double s1 = 0;
    double s2 = 0;
    REP(i,m) 
      s1 += sin(dtor(v1[i]));
    REP(i,n)
      s2 += sin(dtor(v2[i]));
    //cout << s1 << " " <<s2 << endl;
    if (abs(s1-s2)<1e-10)
      cout << 0;
    else if (s1>s2)
      cout << 1;
    else
      cout << 2;
    cout << endl;
  }
}

C++: #include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int n;
  while(cin>>n,n){
    int a[400]={360};
    for(i=1;i<n;++i){
      cin>>a[i];
      a[0]-=a[i];
    }
    int m;
    cin>>m;
    int b[400]={360};
    for(i=1;i<m;++i){
      cin>>b[i];
      b[0]-=b[i];
    }
    double c=0,d=0;
    for(i=0;i<n;++i)
      c+=sin(M_PI*a[i]/180);
    for(i=0;i<m;++i)
      d+=sin(M_PI*b[i]/180);
    if(0){
    }else if(fabs(c-d)<1e-8){
      cout<<0<<endl;
    }else if(c<d){
      cout<<2<<endl;
    }else if(c>d){
      cout<<1<<endl;
    }
  }
  return 0;
}