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<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#define EPS 0.0000001
using namespace std;

double getRad(int n){
  return (180*n)/M_PI;
}

int main(){

  int N,thita,thita2;

  while(1){
    double s1=0,s2=0;
    thita2=0;
    cin>>N;
    if(N==0) break;
    for(int i=0;i<N-1;i++){
      cin>>thita;
      thita2+=thita;
      s1+=abs( sin( getRad(thita) ) );
    }
    s1+=abs( sin( getRad(360-thita2) ));
    thita2=0;
    cin>>N;
    for(int i=0;i<N-1;i++){
      cin>>thita;
      thita2+=thita;
      s2+=abs( sin( getRad(thita) ) );
    }
    s2+=abs( sin( getRad(360-thita2) ));
    if(fabs(s1-s2)<EPS) cout<<0<<endl;
    else if(s1>s2) cout<<1<<endl;
    else cout<<2<<endl;
  }
  return 0;
}

C++: #include <cmath>
#include <iostream>
#include <vector>
using namespace std;

double get_area(const vector<double> vs) {
	double ang = 0, res = 0;
	for (auto v : vs) {
		ang += v;
		res += sin(M_PI * v / 180.);
	}
	res += sin(M_PI * (360 - ang) / 180.);
	return res;
}

int main() {
	int m;
	while (cin >> m, m) {
		vector<double> vs1(m - 1);
		for (auto& v : vs1) cin >> v;
		cin >> m;
		vector<double> vs2(m - 1);
		for (auto& v : vs2) cin >> v;

		double a = get_area(vs1);
		double b = get_area(vs2);
		if (a < b) cout << 1 << endl;
		else if (a > b) cout << 2 << endl;
		else cout << 0 << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
    int m;
    while (cin >> m, m) {
        double a1 = 0;
        int v_sum = 0;
        for (int i = 0; i < m-1; i++) {
            int v;
            cin >> v;
            a1 += sin(M_PI * v / 180.0);
            v_sum += v;
        }
        a1 += sin(M_PI * (360 - v_sum) / 180.0);
        int n;
        cin >> n;
        double a2 = 0;
        v_sum = 0;
        for (int i = 0; i < n-1; i++) {
            int v;
            cin >> v;
            a2 += sin(M_PI * v / 180.0);
            v_sum += v;
        }
        a2 += sin(M_PI * (360 - v_sum) / 180.0);
        int ans = 0;
        if (a1 > a2) {
            ans = 1;
        } else if (a1 < a2) {
            ans = 2;
        }
        cout << ans << endl;
    }
}

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

    return 0;
}

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

using namespace std;

#define PI 3.14159265358979323846264338327950288

int main(){

	int m, n;
	int v, vsum;
	double area1=0, area2=0;

	while(1){

		cin >> m;
		if(m == 0) break;

		vsum = 0;
		for(int i = 0; i < m - 1; i++){
			cin >> v;
			vsum += v;
			area1 += sin(v * PI / 180.0);
		}
		area1 += sin((360 - vsum) * PI / 180.0);

		cin >> n;

		vsum = 0;
		for(int i = 0; i < n - 1; i++){
			cin >> v;
			vsum += v;
			area2 += sin(v * PI / 180.0);
		}
		area2 += sin((360 - vsum) * PI / 180.0);

		if(fabs(area1 - area2) <= 1e-7) cout << "0" << endl;
		else if(area1 > area2) cout<< "1" << endl;
		else cout<< "2" << endl;

	}

	return 0;
}

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

int main(){
	int m, n;
	while(std::cin >> m, m){
		long long int Sm = 0, Sn = 0;
		for(int i=0;i<m-1;i++){
			double angle;
			std::cin >> angle;
			Sm += sin(angle * M_PI / 180) * 10000000000;
		}

		std::cin >> n;
		for(int i=0;i<n-1;i++){
			double angle;
			std::cin >> angle;
			Sn += sin(angle * M_PI / 180) * 10000000000;
		}

		if(Sm == Sn){
			puts("0");
		}else if(Sm > Sn){
			puts("1");
		}else{
			puts("2");
		}
	}
}

C++: // テ」ツつ「テ」ツつォテ」ツつヲテ」ツδウテ」ツδ暗ゥツ鳴禿ゥツ?陛」ツ?暗」ツ?淌・ツ按?」ツ?ョテ」ツδ堙」ツδ甘」ツδォテ」ツδ?」ツつ」ireta
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

long double calcArea( vector<long double> v ) {
  long double sum = 0;
  
  for(int i=0; i<v.size(); i++) {
    sum += sin(v[i]*M_PI/180);
  }
  
  return sum;
}

int main() {

  vector<long double> in;
  int n;
  while(cin >> n, n) {
    in.clear();
    
    long double sum = 0;
    for(int i=0; i<n-1; i++) {
      long double x;
      cin >> x;
      in.push_back(x);
      sum += x;
    }
    if( 360-sum < 180 ) {
      in.push_back(360-sum);
    }
    
    long double A1 = calcArea(in);

    in.clear();
    int m;
    cin >> m;

    sum = 0;
    for(int i=0; i<m-1; i++) {
      long double x;
      cin >> x;
      in.push_back(x);
      sum += x;
    }
    
    if( 360-sum < 180 ) {
      in.push_back(360-sum);
    }
    long double A2 = calcArea(in);
    
    if( (float)A1 < (float)A2 ) cout << 2 << endl;
    else if( (float)A1 == (float)A2 ) cout << 0 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}

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

#define s(a) sin(a*M_PI/180)
#define S(a) (float)a

int main(){
  int n;

  while(scanf("%d" ,&n),n){
    double a1 = 0.0,a2 = 0.0,in,rem = 360;
    for(int i = 0 ; i < n-1 ; i++){
      scanf("%lf" ,&in);
      rem -= in;
      a1 += s(in);
    }
    a1 += s(rem);

    scanf("%d" ,&n);
    rem = 360;
    for(int i = 0 ; i < n-1 ; i++){
      scanf("%lf" ,&in);
      rem -= in;
      a2 += s(in);
    }    
    a2 += s(rem);

    if(S(a1) > S(a2)){
      puts("1");
    }else if(S(a1) < S(a2)){
      puts("2");
    }else{
      puts("0");
    }
  }

  return 0;
}