Go: package main

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

func main() {
	var a, b float64
	var x, y float64
	x = 0
	y = 0
	var now float64
	now = 90
	var info string
	for {
		fmt.Scan(&info)
		infos := strings.Split(info, ",")
		a_int, _ := strconv.Atoi(infos[0])
		b_int, _ := strconv.Atoi(infos[1])
		a = float64(a_int)
		b = float64(b_int)
		// println(a, b)
		if a == 0 && b == 0 {
			break
		}
		x += math.Cos(now*math.Pi/180)*a
		y += math.Sin(now*math.Pi/180)*a
		now -= b
	}
	fmt.Printf("%d\n%d\n", int(x), int(y))
}

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

#define X 0
#define Y 1
#define PI 3.141592653589

int main()
{
    vector<double> udv = {0,1}; // 単位方向ベクトル
    vector<double> cur_position = {0, 0};

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

        cur_position.at(X) += udv.at(X)*step;
        cur_position.at(Y) += udv.at(Y)*step;

        // rotation
        double x =  cos(angle*PI/180.0)*udv.at(X) + sin(angle*PI/180.0)*udv.at(Y);
        double y = -sin(angle*PI/180.0)*udv.at(X) + cos(angle*PI/180.0)*udv.at(Y);
        udv.at(X) = x / sqrt(x*x+y*y);
        udv.at(Y) = y / sqrt(x*x+y*y);
    }    
    cout << static_cast<int>(cur_position.at(X)) << endl << static_cast<int>(cur_position.at(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;

int main(){

	double a,b; double c=90; double x=0; double y=0;
	while(true){

	scanf("%d%d",&a,&b);
	if(a==0 && b==0) break;
	x+=a*cos(c*M_PI/180);
	y+=a*sin(c*M_PI/180);
	c-=b;

	}

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


	return 0;

    }

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

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

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

		sum_ang -= angle;
	}

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

	return (0);
}

C++: #include <bits/stdc++.h>
int main(){
	int a,b,r=0;double x=0,y=0;
	while(scanf("%d,%d",&a,&b),a||b){
		x+=a*cos(r*M_PI/180.0);
		y+=a*sin(r*M_PI/180.0);
		r+=b;
	}
	printf("%d\n%d\n",(int)y,(int)x);
}

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 %d\n",(int)x,(int)y);
	return 0;
}

C++: import Data.List.Split
type Dir = [Double]
type Round = Double

solve :: Round -> Dir -> [Double] -> Dir
solve _ d [] = d
solve r [f,s] (x:y:xs) = solve (y+r) (f+x*sin (pi/180*r) : s+x*cos (pi/180*r):[]) xs

floor' :: Double -> Int
floor' d
  | d < 0 = (0-) $ floor $ -d
  | otherwise = floor d

main = getContents >>= putStr . unlines . map (show . floor') . solve 0 [0,0] . map read . concat . map (splitOn ",") . lines

C++: #include <cstdio>
#include <iostream>
#include <complex>
using namespace std;
const double PI = 3.141592653589793238462643383279502884L;

int main(int argc, char **argv)
{
  int degree = 90;
  int d, t;
  char c;
  complex<double> v(0, 0);

  while (cin >> d >> c >> t) {
    if (!d && !t)
      break;

    auto next = polar((double)d, degree*PI/180.0);
    v += next;
    degree = (degree - t) % 360;
  }
  printf("%d %d\n", (int)v.real(), (int)v.imag());
  return 0;
}

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

int main() {
    int angle = 90;
    double x = 0, y = 0, radian = M_PI * angle / 180;
    while (true) {
        int d, t;
        scanf("%d,%d", &d, &t);
        if (d == 0 && t == 0)
            break;

        x += d * cos(radian);
        y += d * sin(radian);
        angle -= t;
        radian = M_PI * angle / 180;
    }
    printf("%d\n%d\n", (int)x, (int)y);
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	P p;
	double c_th = 90;
	double r,th; char c;
	while(cin>>r>>c>>th,(r||th)){
		P add = P(r,0) * P(cos(c_th * M_PI / 180),sin(c_th* M_PI / 180));
		p += add;
		c_th -= th;
	}

	cout << (int)p.real() << " " << (int)p.imag() << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}

using namespace std;
int main() {
    double x=0,y=0,theta=0;
    double a,b;
    scanf("%lf,%lf",&a,&b);
    while(a||b){
        y += a*cos(rad(theta));
        x += a*sin(rad(theta));
        theta += b;
        scanf("%lf,%lf",&a,&b);
    }
    x = (abs(x)<=(1e-9))?0:x;
    y = (abs(y)<=(1e-9))?0:y;
    printf("%.0lf %.0lf",x,y);
    return 0;
}

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

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

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(Vec2(0.0,0.0),PI*0.5);
	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 <cstdio>
#include <cmath>
using namespace std;

#define Pai 3.141592653589793
int main(void)
{
	double x=0,y=0,l=90,n,m;
	
	while(1){
		scanf("%lf,%lf",&n,&m);
		if (n==0&&m==0) {
			break;
		}
		y+=(double)n*sin((double)l*Pai/180.0);
		x+=(double)n*cos((double)l*Pai/180.0);
		l-=(double)m;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	
	return (0);
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<math.h>
using namespace std;

int main() {
	int dis1, rad1,dis2=0,rad2=0;
	double x = 0, y = 0,PI= 3.141592653589793;
	scanf("%d , %d", &dis1, &rad1);
	y += dis1; rad2 = rad1;
	while (scanf("%d , %d",&dis1,&rad1)) {
		if (dis1 != 0) {
			x += dis1*sin(rad2*PI/180);
			y += dis1*cos(rad2*PI/180);
			rad2 += rad1;
		}
		else {
			cout << int(x) << endl;
			cout << int(y) << endl;
			break;
		}
	}
	return 0;
}

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

int main()
{
    int L,C,W=0;
    double x=0,y=0;
    char c;
    while(1){
        cin >> L >> c >> C;
        if(!(L||C)){
            break;
        }
        x=x+(double)L*sin(W/180.0*M_PI);
        y=y+(double)L*cos(W/180.0*M_PI);
        W+=C;
    }
    cout << (int)x << "\n" << (int)y << endl;
}