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<iostream>
#include<cmath>
using namespace std;
int main(){
  int m,v,n,count=0;
    double S[10001];

  while(cin >> m && m!=0){
    S[count]=0; S[count+1]=0;

    for(int i=0;i<m-1;i++){
  
      cin >> v ;
   
      S[count]+= +sin(v*3.14159/180.0);
    }
 
    cin >> n;
    
    for(int j=0;j<n-1;j++){
    
      cin >> v;
      
      S[count+1]+= +sin(v*3.14159/180.0);
    }
    
    count+=2;
  
  }

  for(int i=0;i<=count/2+1;i+=2){

    if(S[i]==S[i+1]){
      cout << 0 << endl;}
    else if(S[i]>S[i+1]){
      cout << 1<< endl;}
    else if(S[i]<S[i+1]){
      cout << 2<< endl;}
  }

  

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

const double PI = acos(-1);

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

int main()
{
    int n, m;
	while(cin >> n && n)
	{
		double S = 0;
		
		while(1 < n--)
		{
			double v;
			cin >> v; v = rad(v);
			S += sin(v) * cos(v);
		}
		
		cin >> m;
		while(1 < m--)
		{
			double v;
			cin >> v; v = rad(v);
			S -= sin(v) * cos(v);
		}
		
		cout << (abs(S) < EPS ? 0 : (S < 0 ? 2 : 1)) << endl;
	}
}

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

int main(){
    double n;
    
    while(cin >> n,n){
        double angle,nn = 360;
        double first = 0 , second = 0;
        for(int i = 0 ; i < n-1 ; i++){
            cin >> angle;
            first += sin((angle*M_PI)/180.0);
            nn -= angle;
        }

        first += sin((nn*M_PI)/180.0);
   
        cin >> n;
        nn = 360;
        for(int i = 0 ; i < n-1 ; i++){
            cin >> angle;
            second += sin((angle*M_PI)/180.0);
            nn -= angle;
        }
        second += sin((nn*M_PI)/180.0);
  
        if((float)first == (float)second) cout << '0' << endl;
        else if((float)first > (float)second) cout << '1' << endl;
        else cout << '2' << endl;
    }
    
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
using namespace std;
#define all(a) a.begin(),a.end()
double calc(double a,double b,double c)
{
	double s=(a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}

int main()
{
	int m,n;
	
	while(cin>>m&&m)
	{
		double a=0,b=0;
		for(int i=0;i<m-1;i++)
		{
			double v;cin>>v;
			a+=calc(sin(v/2)*2,1,1);
		}
		cin>>n;
		for(int i=0;i<n-1;i++)
		{
			double v;cin>>v;
			b+=calc(sin(v/2)*2,1,1);
		}
		if(fabs(a-b)<1e-15)cout<<0<<endl;
		else if(a>b)cout<<1<<endl;
		else cout<<2<<endl;
	}
}

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-3;

#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;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  int m,v,n,count=0,count1=0;
    double S[10001];

  while(cin >> m && m!=0){
    S[count]=0; S[count+1]=0;
    count1++;

    for(int i=0;i<m-1;i++){
  
      cin >> v ;
   
      S[count]+= sin(v*3.14159/180.0);
    }
 
    cin >> n;
    
    for(int j=0;j<n-1;j++){
    
      cin >> v;
      
      S[count+1]+= sin(v*3.14159/180.0);
    }
    
    count+=2;
  
  }

  for(int i=0;i<count1*2;i+=2){

    if(S[i]==S[i+1]){
      cout << 0 << endl;}
    else if(S[i]>S[i+1]){
      cout << 1<< endl;}
    else if(S[i]<S[i+1]){
      cout << 2<< endl;}
  }

  

  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 / 180.0 * PI);
		}
		area1 += sin((360 - vsum) / 180.0 * PI);

		cin >> n;

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

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

	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

void solve()
{
	int m;
	while(cin >>m, m)
	{
		double angle_remain1 = 360;
		double angle1;
		double sum1 = 0;
		for(int i = 1; i < m; ++i)
		{
			cin >> angle1;
			angle_remain1 -= angle1;
			sum1 += sin(angle1 / 180 * M_PI);
		}
		sum1 += sin(angle_remain1 / 180 * M_PI);
		int n;
		cin >> n;
		double angle_remain2 = 360;
		double angle2;
		double sum2 = 0;
		for(int i = 1; i < n; ++i)
		{
			cin >> angle2;
			angle_remain2 -= angle2;
			sum2 += sin(angle2 / 180 * M_PI);
		}
		sum2 += sin(angle_remain2 / 180 * M_PI);
		if(fabs(sum1 - sum2) < 0.000000001)
		{
			cout << 0 << endl;
		}
		else if(sum1 > sum2)
		{
			cout << 1 << endl;
		}
		else if(sum1 < sum2)
		{
			cout << 2 << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}