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>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    double x = 0, y = 0, r = M_PI/2.0;
    int a, b;
    char delim;
    while (cin >> a >> delim >> b, a||b) {
        x += a * cos(r);
        y += a * sin(r);
        r -= b * M_PI / 180.0;
    }
    cout.precision(0);
    cout << fixed;
    cout << x << "\n";
    cout << y << "\n";

    return 0;
}

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

double rad=90.00000000000;//回転角
double x=0.0,y=0.0;//現在地
int answer_x,answer_y;
double PI=6*asin( 0.5 )/180;

int main()
{
	int a,b;
	while(scanf("%d,%d",&a,&b)!=EOF)
	{
		if(a==0&&b==0)break;
		y+=sin(rad*PI)*a;
		x+=cos(rad*PI)*a;
		rad=(rad-b);
	}
	if(x>0)answer_x=floor(x);
	else answer_x=ceil(x);
	if(y>0)answer_y=floor(y);
	else answer_y=ceil(y);
	printf("%d\n%d\n",answer_x,answer_y);
	return 0;
}

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

#define PI 3.1415926535898

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 += sin(dir*(PI/180))*(double)adv;
		y += cos(dir*(PI/180))*(double)adv;
		dir += rad;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,Y);
}

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

int main()
{
	int len, angle;
	int sum_ang = 90; // start
	double x = 0.0, y = 0.0;

	// ang(+) -> right 
	while (scanf("%d,%d", &len, &angle), len != 0 && angle != 0){
		x += len * cos(M_PI * sum_ang / 180.0);
		y += len * sin(M_PI * sum_ang / 180.0);

		sum_ang = (sum_ang - angle) % 360;
	}

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

	return (0);
}

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

const double PI = 3.14159265358979323846;

struct Vec2
{
	double x;
	double y;
	Vec2( double ix, double iy ):x(ix),y(iy){}
};

class Turtle
{
	Vec2 pos;
	double angle;
public:
	void forward(double length)
	{
		pos.x += length * cos(angle);
		pos.y += length * sin(angle);
	}
	void rotate( double angle1 )
	{
		angle -= angle1;
	}
	Vec2 GetPos(){return pos;}
	Turtle() : pos(Vec2(0.0,0.0)), angle(0.0){}
	Turtle( Vec2 v, double a ) : pos(v), angle(a){}
};

int main()
{
	Turtle turtle;
	int l,a;
	while(scanf("%d,%d",&l,&a),l||a)
	{
		turtle.forward(l);
		turtle.rotate(a*PI/180.0);
	}

	int x = static_cast<int>( turtle.GetPos().x );
	int y = static_cast<int>( turtle.GetPos().y );
	std::cout << x << '\n' << y;
}

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

int main(){
  int x=0, y=0;
  int direction = 90;
  int distance,angle;
  char comma;
  while(true){
    cin >> distance >> comma >> angle;
    if(distance == 0 && angle == 0) break;

    x += distance * cos(direction);
    y += distance * sin(direction);
    direction += angle;
  }
  cout << x << endl;
  cout << y << endl;
  return 0;
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define PI 3.14159265

int main(){

	vector<int>d;
	vector<int>e;

	int a,b;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	d.push_back(a); e.push_back(b);
	}

   int n=d.size();
	vector<double>u;
	vector<double>v;

	int c=90;
    for(int i=0;i<n;i++){
	u.push_back(d[i]*cos(c*PI/180));
	v.push_back(d[i]*sin(c*PI/180));
	c+=-e[i];
    }

	double x=0; double y=0;
	for(int i=0;i<n;i++){
	x+=u[i];
	y+=v[i];
	}

	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,a,b;
  while(scanf("%f,%f",&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 <vector>
#include <list>
#include <map>
#include <set>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, -1, 1};

int main() {
  int dis, ang = -90, cang;
  int ax = 0, ay = 0;
  char c;

  while(1) {
    cin >> dis >> c >> cang;
    if(dis+cang == 0) break;
    ax += dis * cos(-ang*(PI/180));
    ay += dis * sin(-ang*(PI/180));
    ang += cang;
  }
  cout << ax << endl;
  cout << ay << endl;
}

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

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	const double EPS=1e-10;
	double x=0,y=0;
	double dir=M_PI/2;
	for(int a,d;scanf("%d,%d",&a,&d),a|d;){
		x+=a*cos(dir);
		y+=a*sin(dir);
		dir-=d*M_PI/180;
	}
	printf("%d %d\n",int(x+EPS),int(y+EPS));
	
	return 0;
}