Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var r, d float64
        var x, y, rad float64
        rad = math.Pi / 2
        for {
                _, err := fmt.Scanf("%f,%f", &d, &r)
                if err != nil {
                        break
                }
                if r == 0.0 && d == 0.0 {
                        break
                }

                x += d * math.Cos(rad)
                y += d * math.Sin(rad)
                rad -= r * math.Pi / 180
        }

        fmt.Printf("%d\n", int(x))
        fmt.Printf("%d\n", int(y))
}

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

int main(){
  double x,y,angle=0;
  double r,th;
  while(1){
    scanf("%lf,%lf",&r,&th);
    if(r==0&&th==0)break;
    x+=r*sin(angle);
    y+=r*cos(angle);
    angle+=th;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}

C++: #include <stdio.h>
#include <string.h>

int main(){
double x,y,angle,t,r;
x=0;
y=0;
angle=M_PI/2;
while(1){
scanf("%lf,%lf",&r,&t);
if(r==0&&t==0)break;
x+=r*cos(angle);
y+=r*sin(angle);
angle+=t*M_PI/180;
}
printf("%.0f\n%.0f\n",-x,y);
return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

int main() {
    int dest = 90;
    double x = 0;
    double y = 0;
    int d, t;

    while(scanf("%d,%d", &d, &t), d) {
        double rad = dest * M_PI / 180.0;
        x += d * cos(rad);
        y += d * sin(rad);
        dest -= t;
    }
    cout << (int) x << endl;
    cout << (int) y << endl;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double pi=3.14159265358;
int main(){
  double now=90;
  double x=0.0,y=0.0;
  while(1){
    double a,b;
    scanf("%lf,%lf",&a,&b);
    if (a==0.0 and b==0.0)break;
    double xx=0.0,yy=0.0;
    xx=cos(now/180*pi)*a;
    yy=sin(now/180*pi)*a;
    x+=xx;
    y+=yy;
    now-=(b);
    
    
    
  }  
  printf("%d %d\n",(int)x,(int)y);
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
double digrad(double dig) { return dig*M_PI / 180.0; }
int main() {
	double d, a,q=90;
	double x = 0, y = 0;
	char f;

	double rad=M_PI*q/180;
	while (true) {
		cin >> d >> f >> a;
		if (d == 0 && a == 0)break;
		x += d*cos(digrad(q));
		y += d*sin(digrad(q));
		cout << "x: " << x << "  y: " << y << endl;
		q -= a;
	}
	x = (int)x;
	y = (int)y;
	cout << x << endl << y << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

double pi = acos(-1);
typedef complex<double> P;
int main(){
	int a,b;
	P p;
	P d = P(0,1);
	while( scanf("%d,%d",&a,&b) != -1 ){
		p += (1.0 * a) * d;
		d *= exp(P(0,-pi*b/180));
		
	}
	cout << (int)p.real() << "\n" << (int)p.imag() << endl;
}

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

using namespace std;

int main(){
  int d, r;
  double y = 0.0, x = 0.0, t = 90.0;
  while( scanf("%d,%d", &d, &r), d){
    y += d * sin( t / 180.0 * M_PI);
    x += d * cos( t / 180.0 * M_PI);
    t -= r;

  }
  printf("%d\n%d\n", (int)x, (int)y);
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x = 0,y = 0,dis,ang = 90,a;
  for(;;){
    scanf("%lf,%lf",&dis,&a);
    if(dis == 0 && a == 0){break;}
    x+=dis*cos(M_PI*ang/180.0);
    y+=dis*sin(M_PI*ang/180.0);
    ang-=a;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

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

#define PI 3.1415926535898
#define AG (PI/180.0)

int main() {
	int rad, adv;
	double x=0.0, y=0.0,dir=0.0;
	while (scanf("%d%*c%d",&adv,&rad)&&adv!=0.0&&rad!=0.0) {
		x += (double)adv*sin(dir*AG);
		y += (double)adv*cos(dir*AG);
		dir += (double)rad;
	}
	printf("%d\n%d\n",(int)x,(int)y);
}

C++: #include<stdio.h>
#include<math.h>
int main()
{
	int k,h,f;
	double p=3.141592653589,tt,yk,x=0,y=0,r,mk=0;
	while(1){
		scanf("%d,%d",&h,&k);
		if(h==0&&k==0){
			break;
		}
		mk+=k;
		if(mk>=360){
			mk-=360;
		}
		if(mk<=360){
			mk+=360;
		}
		if(mk>=0){
			f=1;
		}else{
			f=0;
		}
		k=fabs(k);
		r=((90-mk)*p)/180;
		yk=cos(r)*h;
		tt=sin(r)*h;
		if(f){
			x+=yk;
		}else{
			x-=yk;
		}
		y+=tt;
	}
	printf("%d,%d\n",(int)x,(int)y);
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#define pi 3.14159
using namespace std;

int main() {
	double ang = pi / 2;
	double X = 0, Y = 0;
	while(1) {
		int x, y;
		scanf("%d, %d",&x, &y);
		if (x == 0 && y == 0) break;
		X = X + x * cos(ang);
		Y = Y + x * sin(ang);
		ang = ang - y * pi / 180;
	}
	printf("%d\n%d\n", (int)X, (int)Y);

	return 0;
}

C++: float x,y,z;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(z),x-=r*sin(z),z-=d/57.3,1:!printf("%d\n%d\n",d=x,r=y););}

C++: //Aizu - 0016 : Treasure Hunt
#include<stdio.h>
#include<math.h>

const double PAI = acos(-1.0);
//#define PAI 3.1415926

int main()
{
	int d,t,ang=0;
	double x=0,y=0;

	while(scanf("%d%*c%d",&d,&t)&&(!(d==0&&t==0)))			//霎灘?0,0扈捺據
	{
		x+=d*sin(1.0*PAI*ang/180.0);						//隶。邂?		y+=d*cos(1.0*PAI*ang/180.0);
		ang+=t;
	}

	printf("%d\n%d\n",(int)x,(int)y);					//霎灘?

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int flr(double x){
	if(x<0)	return ceil(x);
	else 	return floor(x);
}
int main(){
	double x=0,y=0;
	int arg=90;
	while(true){
		int d,a;	scanf("%d,%d",&d,&a);
		if(d==0&&a==0)	break;
		double args=(arg)/180.0*M_PI;
		x+=d*cos(args);	y+=d*sin(args);
		arg-=a;
	}
	printf("%d\n",flr(x));
	printf("%d\n",flr(y));
	return 0;
}

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

#define PI 3.1416

using namespace std;

int main(){
  int d;
  float mt=90.0*PI/180;
  float t,x,y;
  x=y=0.0;
  while(1){
    scanf("%d,%f",&d,&t);
    if(d==0&&t==0) break;
    x+=d*cos(mt);
    y+=d*sin(mt);
    mt+=-t*PI/180;
  }
  if(x<0) x+=1;
  if(y<0) y+=1;
  printf("%.0f\n%.0f",floor(x),floor(y));
  return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int a, b;
  double x, y, angle;

  x = y = angle = 0.0;

  while (true) {
    scanf("%d,%d", &a, &b);
    if (a == 0 && b == 0)
      break;
    y += a * cos(angle / 180 * M_PI);
    x += a * sin(angle / 180 * M_PI);
    angle += b;
  }

  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double x=0,y=0,s=90;
  int a,b;
  while(scanf("%d,%d",&a,&b),a){
    x+=a*cos(s*M_PI/180);
    y+=a*sin(s*M_PI/180);
    s-=b;
  }
  cout<<(int)x<<endl;
  cout<<(int)y<<endl;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
	int A, B;
	double x=0, y=0, angle=3.14159265/2;
	for(;;){
		scanf("%d,%d", &A, &B);
		if(A==0 && B==0) break;
		x+=cos(angle)*A;
		y+=sin(angle)*A;
		angle += B*3.14159265/180;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}