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;

double area(int n){
	double r = 10, s = 0, rem = 360;

	for(int i=0;i<n;i++){
		double v;

		if(i == n-1){ v = rem; }
		else{ cin>>v; rem -= v; }

		double rad = M_PI * v / 180;
		s += r * r * sin(rad) / 2;
	}

	return s;
}

int main(void){
	int n,m;

	while(cin>>n && n){
		double s1 = area(n);

		cin>>m;
		double s2 = area(m);

		if(s1 > s2) cout<<1<<endl;
		else if(s1 < s2) cout<<2<<endl;
		else cout<<0<<endl;
	}

	return 0;
}

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

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

C++: #include<cstdio>
#include<cmath>
#include<numeric>
using namespace std;
double Square(double x){return x*x;}
double D2R(double x){return x/180*3.14159265358979;}

double Area2(int angle[], double r, int n)
{
	double result=0;
	double s,a,b,c;
	for(int i = 0; i < n-1; ++i)
	{
		a=b=r;
		c=sqrt( Square( cos(D2R(angle[i])) - cos(D2R(angle[i]+angle[i+1])) ) +
				Square( sin(D2R(angle[i])) - sin(D2R(angle[i]+angle[i+1])) ) );
		s=(a+b+c)/2;
		result += (s*(s-a)*(s-b)*(s-c));
	}
	return result;
}
int main()
{
	int n,m,angle[360],i;
	double s1,s2;
	while(scanf("%d",&m),m)
	{
		for(i = 0; i < m-1; ++i)
			scanf("%d",&angle[i]);
		angle[m-1] = 360-accumulate(angle,angle+m-1,0);
		s1 = Area2(angle, 1, m);
		scanf("%d", &n);
		for(i = 0; i < n-1; ++i)
			scanf("%d", &angle[i]);
		angle[n-1] = 360-accumulate(angle, angle+n-1,0);
		s2 = Area2(angle, 1, n);
		if(fabs(s1-s2)<0.001)
			puts("0");
		else if(s1>s2)
			puts("1");
		else puts("2");
	}
	return 0;
}

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

double abs(double d){
	return (d>0)?d:-d;
}

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

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

		if(abs(Sm - Sn) < 1e-8){
			puts("0");
		}else if(Sm > Sn){
			puts("1");
		}else{
			puts("2");
		}
	}
}

C++: #include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

const double EPS = 1e-8;

int main()
{
	int m;
	while(scanf("%d", &m), m){
		double sm1 = 0.0;
		int arg = 0;
		rep(i, m-1){
			int deg;
			scanf("%d", &deg);
			arg += deg;
			sm1 += sin(deg*M_PI/180.0);
		}
		sm1 += sin((360-arg)*M_PI/180.0);
		
		int n;
		scanf("%d", &n);
		
		double sm2 = 0.0; 
		arg = 0;
		rep(i, n-1){
			int deg;
			scanf("%d", &deg);
			arg += deg;
			sm2 += sin(deg*M_PI/180.0);
		}
		sm2 += sin((360-arg)*M_PI/180.0);
		
		if(fabs(sm1 - sm2) < EPS)
			puts("0");
		else
			puts(sm1>sm2 ? "1" : "2");
	}
}

C++: #include <cmath>
#include <iostream>
using namespace std;
int n, m, a, s; long double p, q;
int main() {
	while(true) {
		cin >> n; s = 360, p = 0.0L;
		if(n == 0) break;
		for(int i = 0; i < n - 1; i++) {
			cin >> a;
			p += sinl(a / 2.0L) * cosl(a / 2.0L);
		}
		p += sinl(s / 2.0L) * cosl(s / 2.0L);
		cin >> m; s = 360, q = 0.0L;
		for(int i = 0; i < m - 1; i++) {
			cin >> a;
			q += sinl(a / 2.0L) * cosl(a / 2.0L);
		}
		q += sinl(s / 2.0L) * cosl(s / 2.0L);
		if(abs(p - q) < 0.0000000001L) printf("0\n");
		else if(p > q) printf("1\n");
		else printf("2\n");
	}
}

C++: #include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 

 
const int INF = 1000000;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);

double convert(int d){
	return PI*d/180;
}


int main(){
	int n, m, sum, t;
	double s1, s2;
	while(cin>>n && n){
		sum = 0;
		s1 = s2 = 0.0;
		rep(i, n-1){
			cin>>t;
			sum+=t;
			s1+=sin(convert(t));
		}
		s1+=sin(convert(360-sum));
		cin>>m;
		sum = 0;
		rep(i, m-1){
			cin>>t;
			sum += t;
			s2 += sin(convert(t));
		}
		s2 += sin(convert(360-sum));
		int ans;
		if(abs(s1-s2)<EPS){
			ans = 0;
		}
		else if(s1>s2){
			ans = 1;
		}
		else {
			ans = 2;
		}
		cout<<ans<<endl;
	}
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define PI atan(1.0)*4

int main() {
	int a,b;
cout<<PI<<endl;
	while(a=in()){
		int i;
		double d;
		double r=360;
		double aa=0;
		for(i=0;i<a-1;i++){
			cin>>d;
			r-=d;
//cout<<sin(d/180*PI);
			aa+=sin(d/180*PI);
cout<<aa<<endl;
		}
		aa+=sin(r/180*PI);
		cin>>b;
		r=360;
		double bb=0;
		for(i=0;i<b-1;i++){
			cin>>d;
			r-=d;
			bb+=sin(d/180*PI);
		}
		bb+=sin(r/180*PI);
cout<<aa<<" "<<bb<<endl;
		if(fabs(aa-bb)<=1e-9){
			cout<<0<<endl;
		}else if(aa>bb){
			cout<<1<<endl;
		}else{
			cout<<2<<endl;
		}
	}
	return 0;
}