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 <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int m,n;
	const double pi = 3.14159265358979;
	const double EPS = 1e-10;

	while( cin >> m , m ){
		int v, angleA=0, angleB=0;
		vector<int> a,b;

		for(int i=0 ; i < m-1 ; i++ ){
			cin >> v;
			a.push_back( v );
			angleA += v;
		}
		cin >> n;
		for(int i=0 ; i < n-1 ; i++ ){
			cin >> v;
			b.push_back( v );
			angleB += v;
		}

		a.push_back( 360 - angleA );
		b.push_back( 360 - angleB );
		double sa=0.0, sb=0.0;
		for(int i=0 ; i < a.size() ; i++ ){
			sa += sin( a[i]*pi/180.0 );
		}
		for(int i=0 ; i < b.size() ; i++ ){
			sb += sin( b[i]*pi/180.0 );
		}

		if( fabs(sa-sb) < EPS )
			cout << 0 << endl;
		else if( sa > sb )
			cout << 1 << endl;
		else 
			cout << 2 << endl;
	}
}

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

using namespace std;

double EPS=1e-10;
double pi=3.1415926535;

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

int main(void){
  int n,m;
  
  while(true){
    cin >> n;
    if(n==0)break;
    double sum1=0,sum2=0,s1=0,s2=0,v;
   
    for(int i=0;i<n-1;i++){
      cin >> v;
      sum1+=v;
      s1+=calc(v);
    }
    s1+=calc(360.0-sum1);
    cin >> m;
    for(int j=0;j<m-1;j++){
      int v;
      cin >> v;
      sum2+=v;
      s2+=calc(v);
    }
    s2+=calc(360.0-sum2);
    if(s1-s2>EPS) cout << 1 << endl;
    else if(s1-s2<EPS) 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;
    while(--n){
      cin >> v;
      sum1+=abs(sin(v));
    }

    cin >> m;
    while(--m){
      cin >> v;
      sum2+=abs(sin(v));
    }

    int res= (sum1==sum2)?0:(sum1>sum2)?1:2;
    cout << res << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
const double EPS = 1e-10;
#define eq(a,b) fabs(a - b) < EPS

int main()
{
  int m;
  for(;cin>>m,m;)
    {
      int a=0;
      int sum=360;
      for(int i=0;i<m-1;i++)
	{
	  int t;
	  cin>>t;
	  sum-=t;
	  a+=abs(t-90);	  
	}
      a+=abs(sum-90);
      sum=360;
      int n;
      cin>>n;
      int b=0;
      for(int i=0;i<n-1;i++)
	{
	  int t;
	  cin>>t;
	  sum-=t;
	  b+=abs(t-90);
	}
      b+=abs(sum-90);      
      if(a==b)
	cout<<"0"<<endl;
      else if(a>b)
	cout<<"1"<<endl;
      else
	cout<<"2"<<endl;
    }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-12;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    double m1,m2;
    rep(i,n-1){
      int tmp;
      cin>>tmp;
      m1+=100.0*sin(PI*tmp/100.0);
    }
    cin>>n;
    rep(i,n-1){
      int tmp;
      cin>>tmp;
      m2+=100.0*sin(PI*tmp/100.0);
    }
    if(abs(m1-m2)<ESP)cout<<0<<endl;
    else if(m1>m2)cout<<1<<endl;
    else cout<<2<<endl;
  }

}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

double get_area(double a){
	return sin(a) / 2;
}

int main(){
	int n, m;
	while(cin >> n && n){
		double sum1 = 0;
		double sum2 = 0;
		double area1 = 0;
		double area2 = 0;
		double theta;
		rep(i, n-1) {
			cin >> theta;
			area1 += get_area(theta / 180.0 * M_PI);
			sum1 += theta / 180.0 * M_PI;
		}
		area1 += get_area(2 * M_PI - sum1);
		area1 = abs(area1);
		cin >> m;
		rep(i, m-1){
			cin >> theta;
			area2 += get_area(theta / 180.0 * M_PI);
			sum2 += theta / 180.0 * M_PI;
		}
		area2 += get_area(2 * M_PI - sum2);
		area2 = abs(area2);
		if(abs(area1 - area2) < EPS) cout << 0 << endl;
		else if(area1 > area2) cout << 1 << endl;
		else cout << 2 << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int m,n;
	double sum1,sum2,degree,rest1,rest2;

	while(true){
		scanf("%d",&m);
		if(m == 0)break;

		sum1 = sum2 = 0;
		rest1 = 0,rest2 = 0;

		for(int i = 0; i < m-1; i++){
			scanf("%lf",&degree);
			sum1 += sin((M_PI*degree)/180);
			rest1 += degree;
		}

		rest1 = 360 - rest1;
		sum1 += sin((M_PI*rest1)/180);

		scanf("%d",&n);

		for(int i = 0; i < n-1; i++){
			scanf("%lf",&degree);
			sum2 += sin((M_PI*degree)/180);
			rest2 += degree;
		}

		rest2 = 360 - rest2;
		sum2 += sin((M_PI*rest2)/180);

		if(fabs(sum1-sum2) < 0.00000001){
			printf("0\n");
		}else if(sum1 > sum2){
			printf("1\n");
		}else{
			printf("2\n");
		}
	}

    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int m;
  while(cin>>m){
    if(m==0) break;
    double s1=0,s2=0;
    int t1=0,t2=0;
    REP(i,m-1){
      int t;
      cin>>t;
      s1 += sin((double)t*M_PI/180);
      t1 += t;
    }
    s1+=sin((double)(360-t1)*M_PI/180);
    cin>>m;
    REP(i,m-1){
      int t;
      cin>>t;
      s2 += sin((double)t*M_PI/180);
      t2 += t;
    }
    s2 += sin((double)(360-t2)*M_PI/180);
    if(abs(s1-s2)<EPS){
      cout<<0<<endl;
    }else if(s1>s2){
      cout<<1<<endl;
    }else if(s2>s1){
      cout<<2<<endl;
    }
  }
  return 0;
}