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++: // 0166
#include <iostream>
#include <math.h>
#define  PI   3.14159265
using namespace std;

void area_com(int m, double &s){
	int d, deg = 0;

	for(int i=1;i<m;i++){
		cin>>d;
		s += sin(d*PI/180);
		deg += d;
	}
	s += sin((360-deg)*PI/180);
}

int main(){
	while(1){
		int m, n;
		double s1 = 0, s2 = 0;

		cin>>m;
		if(m == 0)
			break;
		
		area_com(m, s1);
		
		cin>>n;
		area_com(n, s2);

		if(fabs(s1-s2) < 0.0001)
			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 n, i;
	double d, dd, s1, s2;
	while (cin>>n, n) {
		s1 = s2 = 0;
		dd = 360.0;
		for (i = 1; i < n; i++) {
			cin>>d;
			dd -= d;
			s1 += sin(M_PI * d/180.0);
		}
		s1 += sin(M_PI * dd/180.0);
		cin>>n;
		dd = 360.0;
		for (i = 1; i < n; i++) {
			cin>>d;
			dd -= d;
			s2 += sin(M_PI * d/180.0);
		}
		s2 += sin(M_PI * dd/180.0);
		if (s1>s2) cout<<1<<endl;
		else if (s1==s2) cout<<0<<endl;
		else cout<<2<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const double PI = acos(-1);
const double EPS = 1e-8;

int main(){
	int m;
	while(1){
		cin >> m;
		if(m==0) break;
		
		vector<double> area(2, 0);
		for(int i=0; i<2; i++){
			if(i==1) cin >> m;
			int deg = 360;
			for(int j=0; j<m-1; j++){
				int v;
				cin >> v;
				deg -= v;
				area[i] += sin(v*PI/180);
			}
			area[i] += sin(deg*PI/180);
		}
		if(area[0] > area[1] +EPS){
			cout << 1 << endl;
		}else if(area[0] +EPS < area[1]){
			cout << 2 << endl;
		}else{
			cout << 0 << endl;
		}
	}
	return 0;
}

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

#define _USE_MATH_DEFINES

using namespace std;

int main(){
	
	while(true){
		
		int m, n;
		
		cin >> m;
		
		if(m == 0){
			break;
		}
		
		vector<int> v1, v2;
		
		int count = 0;
		
		for(int i = 0; i < m - 1; i++){
			int num;
			cin >> num;
			count += num;
			v1.push_back(num);
		}
		
		v1.push_back(360 - count);
		
		cin >> n;
		
		count = 0;
		
		for(int i = 0; i < n - 1; i++){
			int num;
			cin >> num;
			count += num;
			v2.push_back(num);
		}
		
		v2.push_back(360 - count);
		
		double sum1 = 0;
		double sum2 = 0;
		
		sort(v1.begin(), v1.end());
		sort(v2.begin(), v2.end());
		
		for(int i = 0; i < m; i++){
			sum1 += sin(double(v1[i]) * M_PI / 180);
		}
		
		for(int i = 0; i < n; i++){
			sum2 += sin(double(v2[i]) * M_PI / 180);
		}
		
		if(sum1 == sum2){
			cout << "0" << endl;
		}else if(sum1 > sum2){
			cout << "1" << endl;
		}else{
			cout << "2" << endl;
		}
		
	}
	
	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-15)
typedef long double ld;
int N,M;
ld calc(int an){
  ld rad = (ld)an * M_PI/180.0;
  return sqrt((ld)2.0-cos(rad)*(ld)2.0);
}
bool equal(ld a,ld b){ return abs(a-b) < EPS; }
int main(){
  while(cin >> N && N ){
    ld 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<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define EPS (1e-10)
#define PI 3.14159265358979323846264
using namespace std;


 
double rad(double d)
{
  return d*(PI/180.0);
}

int main()
{
  int m;
  while(cin >> m,m)
    {
      double v,areaA,areaB;
      areaA = areaB = 0;
      double ano = 360;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  areaA += sin(rad(v));
	  ano -= v;
	}
      areaA += sin(rad(ano));
 
      cin >> m;
      ano = 360;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  areaB += sin(rad(v));
	  ano -= v;
	}
      areaB += sin(rad(ano));
            

      if(fabs(areaA-areaB) < EPS)
	cout << 0 << endl;
      else if(areaA > areaB)
	cout << 1 << endl;
      else 
	cout << 2 << endl;
      
    }
  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;
  }
}