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 <bits/stdc++.h>

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int walk, angle;
	double x = 0, y = 0;
	double rad = 90 * (M_PI / 180.0);
	double theta = 90;
	while(scanf("%d,%d", &walk, &angle), walk || angle) {
		y += walk * sin(rad);
		x += walk * cos(rad);
		theta = theta - angle;
		rad = theta * (M_PI / 180.0); 
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

C++: #include <bits/stdc++.h>
#define P 3.14159265
using namespace std;
int main(){
  int a,b;
  double x=0,y=0,s=90;
  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<<(int)y<<endl;
}

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

#define PI 3.141592654

using namespace std;

int main(void)
{
	double x = 0;
	double y = 0;
	int  step, d_angle;
	int  angle = 90;

	while(1)
	{
		scanf( "%d,%d",&step , &d_angle );
		if( step == 0 && d_angle == 0 ) break;

		x += step * cos((double)angle*PI/180);
		y += step * sin((double)angle*PI/180);

		angle -= d_angle;
	}

	cout << (int)x << endl << (int)y << endl;

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
int i,j;
char c;
double x,y,a,pi=3.1415926;
x=y=0;a=90*pi/180;
while(1){
cin>>i>>c>>j;
if(i==0&&j==0)break;
x+=i*cos(a);
y+=i*sin(a);
a-=j*pi/180;
}
cout<<trunc(x)<<endl;
cout<<trunc(y)<<endl;
return 0;
}

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

int main() {
	double x=0, y=0;
	double a, b;
	double c=90;
	while (scanf("%lf,%lf", &a, &b)&&a!=0&&b!=0) {
		x += cos(c*3.14159265/180)*a;
		y += sin(c*3.14159265/180)*a;

		c =90- b;
	}
	x = floor(x);
	y = floor(y);
	cout << x <<' '<< y << endl;

	return 0;
}

C++: #include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cstdio>
using namespace std;

int main(){
	
	double x=0,y=0;
	int r=90;
	int a,b;
	char cn;
	while(cin>>a>>cn>>b){
	if(a!=b!=0){
		double s=r*M_PI/180;
		x+=a*(-cos(s));
		y+=a*sin(s);
		if(r+b<0)
			r=360-r-b;
		else if(r+b>360)
			r=r+b-360;
		else
			r=r+b;
	}
	else
		break;
	}
	int x1=x,y1=y;
	cout<<x1<<endl<<y1<<endl;
		
	
}

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

int main()
{
  int n;
  double x, y, deg, rad;
  
  x = y = deg = rad = 0;
  while (1){
    scanf("%d,%lf", &n, &deg);
    if (n == 0 && deg == 0){
      break;
    }
    x += cos(rad) * n;
    y += sin(rad) * n;
    deg = deg / 180 * M_PI;
    rad += deg;
  }

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

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define PI 3.141592
int main(void) {
    double x = 0, y = 0, theta = 0;
    while (1) {
        int d, dir;
        scanf("%d,%d", &d, &dir);
        if (d == 0 && dir == 0) break;
        y += cos((PI * theta) / 180) * d;
        x += sin((PI * theta) / 180) * d;
        theta = (theta + dir);
    }
    cout << (int)(x) << endl;
    cout << (int)(y) << endl;
    return 0;
}

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,%d",&d,&t)&&(!(d==0&&t==0)))			//霎灘?0,0扈捺據
	{
		x+=d*sin(1.0*PAI*ang/180);						//隶。邂?		y+=d*cos(1.0*PAI*ang/180);
		ang+=t;
	}

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

	return 0;
}

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

#define PI 3.1415926535898
#define ANGLE (PI/180.0)
int main() {
  int step,dir;
  double x=0.0, y=0.0, angle=0.0;
  
  while(1){
    scanf("%d,%d", &step, &dir);
    if(step==0 && dir==0) break;
    x += (double)(step) * sin(angle * ANGLE);
    y += (double)(step) * cos(angle * ANGLE);
    angle += (double)dir;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

C++: #include<stdio.h>
#include<math.h>
double na;
double nx,ny;

int main(){
	int d;
	int a;
	na=90;
	nx=0;
	ny=0;
	while(1){
		scanf("%d,%d",&d,&a);
		if(d==0&&a==0)break;
		nx+=(double)d*cos(M_PI*na/180);
		ny+=(double)d*sin(M_PI*na/180);
		na-=a;
	}
	printf("%d %d\n",(int)nx,(int)ny);
}

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

using namespace std;


int main(){
	int r, n_ang;
	int ang=0;
	double x=0, y=0;

	while(1){
		scanf("%d,%d", &r, &n_ang);
		if(r==0 && n_ang==0){
			break;
		}else{
			y += r * cos(M_PI*ang/180);
			x += r * sin(M_PI*ang/180);
		}
		ang += n_ang;

	}

	cout << (int)x << endl << (int)y << endl;

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
using namespace std;
#define PI 3.141592
int main(){
  double angle;
  double x=0,y=0;
  double d,t;
  string str;
  cin >> str;
  if(str[1]==','){
    d= str[0]-'0';
    if(str[2]=='-'){
      if(str.size()==4) t = (str[3]-'0')*(-1);
      else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
    }else{
      if(str.size()==3) t = str[2]-'0';
      else t = (str[2]-'0')*10+(str[3]-'0');
    }
  }else if(str[2]==','){
    d= (str[0]-'0')*10+str[1]-'0';
    if(str[3]=='-'){
      if(str.size()==5) t = (str[4]-'0')*(-1);
      else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
      if(str.size()==4) t = str[3]-'0';
      else t = (str[3]-'0')*10+(str[4]-'0');
    }
  }else if(str[3]==','){
    d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
    if(str[4]=='-'){
      if(str.size()==6) t = (str[5]-'0')*(-1);
      else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
    }else{
      if(str.size()==5) t = str[4]-'0';
      else t = (str[4]-'0')*10+(str[5]-'0');
    }
  }
  while(d!=0||t!=0){
    x+=d*sin(angle/180*PI);y+=d*cos(angle/180*PI);
    angle+=t;
    if(angle>360) angle-=360;
    if(angle<-360) angle+=360;
    cin >> str;
    if(str[1]==','){
      d= str[0]-'0';
      if(str[2]=='-'){
	if(str.size()==4) t = (str[3]-'0')*(-1);
	else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
      }else{
	if(str.size()==3) t = str[2]-'0';
	else t = (str[2]-'0')*10+(str[3]-'0');
      }
    }else if(str[2]==','){
      d= (str[0]-'0')*10+str[1]-'0';
      if(str[3]=='-'){
	if(str.size()==5) t = (str[4]-'0')*(-1);
	else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
	if(str.size()==4) t = str[3]-'0';
	else t = (str[3]-'0')*10+(str[4]-'0');
      }
    }else if(str[3]==','){
      d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
      if(str[4]=='-'){
	if(str.size()==6) t = (str[5]-'0')*(-1);
	else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
      }else{
	if(str.size()==5) t = str[4]-'0';
	else t = (str[4]-'0')*10+(str[5]-'0');
      }
    }
  }
  int x1=x,y1=y;
  printf("%d\n%d\n",x1,y1);
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
using namespace std;

int main()
{
	double x = 0, y = 0;
	int d = 90;
	int a, b;

	while (true)
	{
		scanf("%d,%d", &a, &b);
		if (a + b == 0) break;
		x += a * cos(d * 3.14159 / 180);
		y += a * sin(d * 3.14159 / 180);
		d -= b;
	}
	printf("%d\n", (int)x);
	printf("%d\n", (int)y);

	return 0;
}