Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
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> int GetInt(T a){ return a >= 0 ? floor(a) : ceil(a); }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
const double PI = 3.141592653583;
#define DegreeToRadian(Degree) ((float)Degree * (PI / 180.0f))

vector<string> split(string str, string delim)
{
    vector<string> result;
    int cutAt;
    while( (cutAt = str.find_first_of(delim)) != str.npos )
    {
        if(cutAt > 0)
        {
            result.push_back(str.substr(0, cutAt));
        }
        str = str.substr(cutAt + 1);
    }
    if(str.length() > 0)
    {
        result.push_back(str);
    }
return result;
}

int main()
{
	int x, r, R = 0;
	pair<double, double> point = mp(0, 0);
	string str;
	
	while(cin >> str)
	{
		vector<string> l = split(str, ",");

		x = r = 0;
		rep(i, l[0].size())
		{
			if(l[0][i] != '-')
				x += (l[0][i] - '0') * pow(10, (float)l[0].size() - i -1);
		}
		rep(i, l[1].size())
		{
			if(l[1][i] != '-')
				r += (l[1][i] - '0') * pow(10, (float)l[1].size() - i -1);
		}
		if(l[0][0] == '-')
			x *= -1;
		if(l[1][0] == '-')
			r *= -1;

		if(!(x || r))
			break;

		R = min(R, 360);

		point.first += sin(DegreeToRadian(R)) * x;
		point.second += cos(DegreeToRadian(R)) * x;

		R += r;
	}

	pint res = mp(GetInt(point.first), GetInt(point.second));
	printf("%d\n%d\n", res.first, res.second);
}

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

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

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += -(double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  printf("%.0f\n%.0f\n",x,y);

}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#define PI 3.1415926535897932384626433
using namespace std;
int main(){
    double nowx=0,nowy=0,nowkaku=PI/2;
    while(1){
        double ho,kaku;
        scanf("%lf,%lf",&ho,&kaku);
        if(ho==0&&kaku==0)break;
        nowy+=sin(nowkaku)*ho;
        nowx+=cos(nowkaku)*ho;
        nowkaku+=PI/180*kaku;
    }
    printf("%d\n%d\n",(int)nowx*-1,(int)nowy);
    return 0;
}

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

int main(){
	double x = 0;
	double y = 0;
	int angle = 90;
	int d, a;
	while(scanf("%d,%d", &d, &a)){
		if(d == 0 && a == 0){
			break;
		}
		x += d*cos(angle*M_PI/180);
		y += d*sin(angle*M_PI/180);
		angle += a;
		if(angle >= 360){
			angle %= 360;
		}else if(angle <= 0){
			angle += 360;
		}
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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

using namespace std;

class Position {
  private:
    double x;
    double y;
    double angle;
    double radian;
  public:
    Position();
    void Rotate(double);
    void Move(double);
    double GetX();
    double GetY();
};

Position::Position() {
  x = 0;
  y = 0;
  angle = 90;
  radian = angle / 180.0 * M_PI;
}

void Position::Rotate(double d_angle) {
  angle += d_angle;
  radian = angle / 180.0 * M_PI;
}

void Position::Move(double d_distance) {
  x += d_distance * cos(radian);
  y += d_distance * sin(radian);
}

double Position::GetX() {
  return x;
}

double Position::GetY() {
  return y;
}

int main() {
  Position pos;
  double distance, angle;

  while (1) {
    scanf("%lf,%lf", &distance, &angle);
    if (distance == 0 && angle == 0)
      break;
    angle *= -1;
    pos.Move(distance);
    pos.Rotate(angle);
  }

  cout << (int)pos.GetX() << endl;
  cout << (int)pos.GetY() << endl;
  
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", &len, &rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << y <<  endl;
  cout << x << endl;
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", len, rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << x <<  endl;
  cout << y << endl;
  return 0;
}

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

const double PI = 3.1415926535897932384626433832795;

inline double deg2rad(const double deg)
{
  return deg * PI / 180.0;
}

int main()
{
  double x = 0.0, y = 0.0, angle = 0.0;
  int step, deg;
  while (scanf("%d,%d", &step, &deg) != EOF) {
    if (step == 0 && deg == 0)
      break;

    x += step * sin(deg2rad(angle));
    y += step * cos(deg2rad(angle));

    angle += deg;

  }
  cout << static_cast<int>(x) << endl;
  cout << static_cast<int>(y) << endl;

  return 0;
}

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

void walk(double current_point[2], int r, int sum_theta) {
	double pi = 3.14159265358979; 
	double rad = ((double)sum_theta / 180) * pi;
	current_point[0] += r * sin(rad);
	current_point[1] += r * cos(rad);
}

int main() {
	int r;
	int theta;
	int sum_theta = 0;
	double current_point[2] = {0, 0};

	do {
		scanf("%d,%d", &r, &theta);

		walk(current_point, r, sum_theta);
		sum_theta += theta;
	} while(r || theta);

	printf("%d\n", (int)current_point[0]);
	printf("%d\n", (int)current_point[1]);

	return 0;
}

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

int main(){
	string str;
	double x, y;
	int step, carb, arg;
	int p;
	bool minus;
	
	x = 0; y = 0; arg = 90;
	while(true){
		cin >> str;
		step = 0; carb = 0;
		p = 0;
		while(str[p] != ','){
			step = step * 10 + (str[p] - 48);
			p++;
		}
		p++;
		minus = false;
		while(p < str.size()){
			if(str[p] == '-') minus = true;
			else carb = carb * 10 + (str[p] - 48);
			p++;
		}
		if(step == 0 && carb == 0) break;
		if(!minus) carb *= -1;
		
		x += (double)step * cos((double)arg * 3.1415 / 180.0);
		y += (double)step * sin((double)arg * 3.1415 / 180.0);
		
		arg += carb;
	}
	
	cout << (int)x << endl << (int)y << endl;
	
	return 0;
}