Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	x, y := 0.0, 0.0
	rotate := 90.0

	for {
		line := nextString()
		if line == "0,0" {
			break
		}

		numbers := strings.Split(line, ",")
		di, _ := strconv.ParseFloat(numbers[0], 64)
		ai, _ := strconv.ParseFloat(numbers[1], 64)

		rotateRadian := math.Pi * rotate / 180.0
		x += di * math.Cos(rotateRadian)
		y += di * math.Sin(rotateRadian)

		rotate -= ai

		// fmt.Println(x, y)
	}

	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int step,turn;
double x=0,y=0,angle;
while(scanf("%lf,%lf",&step,&turn),step,turn){
x+=(double)step*sin(angle*M_PI/180);
y+=(double)step*cos(angle*M_PI/180);
angle+=(double)turn;
}
cout << (int)x << endl;
cout << (int)y << endl;
return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main() {
	double sum,x,y,b,c;
	int a, d;
	a = 0;
	x = 0;
	y = 0;
	sum = 0;
	while (scanf("%d,%d",&d,&a)) {
		if (a == 0 && d == 0) break;
		b = (double)a;
		c = (double)d;
		x += c*cos(sum*3.1416/180);
		y += c*sin(sum*3.1416/180);
		sum += b;
	}
	cout << (int)y << endl;
	cout << (int)x << endl;
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*M_PI/180.0);
		h+=x*cos(r*M_PI/180.0);
		r-=y;
	}
	printf("%.0f\n%.0f\n",h-1,k);
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define PI 6*asin(0.5)

int main(){
	double x=0,y=0;
	int a,b;
	char t;
	int spin=90;
	//cout<<cos(90/180)<<" "<<sin(90/180)<<endl;
	cin>>a>>t>>b;
	while(!(a==0&&b==0)){
		x+=a*cos(spin*PI/180.0);
		y+=a*sin(spin*PI/180.0);
		spin-=b;
		//cout<<cos(spin/180.0)<<" "<<sin(spin/180.0)<<endl;
		cin>>a>>t>>b;
		//cout<<x<<" "<<y<<endl;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000

using namespace std;
typedef long long ll;

int main(){
    
    int m,n;
    char c;
    double X=0,Y=0;
    double now=90;
    while(cin>>m>>c>>n && (m!=0 || n!=0)){
//        cout<<now*(2*M_PI/360)<<endl;
        
        X+=m*cos(now*(2*M_PI/360));
        Y+=m*sin(now*(2*M_PI/360));
        now-=n;
    }
    printf("%d\n",(int)X);
    printf("%d\n",(int)Y);
    return 0;
}

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

#define PI 3.14159265358979
using namespace std;

int main(void)
{
	int a,b;
	char c;
	double x,y,r;
	x=y=0;
	r=0;
	while(cin>>a>>c>>b){
		if(a==0&&b==0){
			break;
		}
		x+=cos(r)*a;
		y+=sin(r)*a;
		r+=b*PI/180.0;
	}
	cout<<(int)y<<endl<<(int)x<<endl;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
const double pi=acos(-1);
int main(){
    double x=0,y=0,a,d;
    bool f;
    int ang=90,p;
    string s;
    while(true){
        cin>>s;
        for(a=d=p=0;s[p]!=',';p++)a=a*10+s[p]-'0';
        p++;
        f=s[p]=='-';
        if(!f)d=s[p]-'0';
        while(++p<s.size())d=d*10+s[p]-'0';
        if(f)d=-d;
        if(a==0&&d==0)break;
        x+=a*cos(ang*2*pi/360);
        y+=a*sin(ang*2*pi/360);
        ang-=d;
    }
    cout<<(int)x<<endl<<(int)y<<endl;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
int main(){
	int w,deg;
	double x=0,y=0,pre=M_PI/2;
	string buf;
	while(cin>>buf){
		/* atoi */
		int ptr=0;
		string tmp1,tmp2;
		while(buf[ptr]!=',') tmp1+=buf[ptr++];
		w = atoi(tmp1.c_str());
		++ptr;
		while(buf[ptr]) tmp2+=buf[ptr++];
		deg = atoi(tmp2.c_str());
		/* read end */
		if(w==0&&deg==0) break;
		x+=(double)w*cos(pre);
		y+=(double)w*sin(pre);
		pre-=(double)deg*M_PI/180;
	}
	cout << (int) x << endl;
	cout << (int) y << endl;
	return 0;
}

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;
}