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 <cstdio>
#include <cmath>
#define PI 3.14159265358979323846

int correct(int d){
  if(d<0){
    return d+360;
  }else if(d>360){
    return d-360;
  }else{
    return d;
  }
}

int main(){
  double x=0,y=0;
  int l,d,dir=0;

  while(scanf("%d,%d",&l,&d),l){
    x += l*sin(PI*dir/180);
    y += l*cos(PI*dir/180);
    dir = correct(dir+d);
  }

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

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int d, r;
	int w = 0;
	double  x = 0, y = 0;
	char n;
	 

	 while(1){

	 	cin >> d >> n >> r;
	 	
	 	if(d == 0 && n == ',' && r == 0) break;
	 	
	 	x += d * sin(w * M_PI / 180);
	 	y += d * cos(w * M_PI / 180);
	 	w += r;
	 	
	 
	 	
	 }
	 
	 cout << (int)x << endl << (int)y << endl;
	return 0;
}

C++: #include<iostream>
#include<math.h>
#define Pi 3.1415926535898
#define ANGLE (Pi/180.0)
using namespace std;

int main(){
	double x, y;
	int a, b;
	double angle;
	char kanma;
	cin >> a >> kanma >> b;
	angle = 0;
	while(a || b){
		x += a*sin(angle*ANGLE);
		y += a*cos(angle*ANGLE);
		angle += b;
		cin >> a >> kanma >> b;
	}
	cout << (int)(x) << endl;
	cout << (int)(y) << endl;
	return 0;
}

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

const double PI = 3.1415926535;

int main(){
	int n, th;
	double x = 0;
	double y = 0;
	int nth = 90;
	while(scanf("%d,%d", &n, &th)){
		cout<<n<<th<<endl;
		if(!n&&!th) break;
		x += n*cos(PI*nth/180);
		y += n*sin(PI*nth/180);
		nth -= th;
		nth %= 360;
	}
	printf("%d\n", x > 0 ? int(x) : -1*int(-1*x));
	printf("%d\n", y > 0 ? int(y) : -1*int(-1*y));
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main(){
	double D,A,x=0,y=0,r=0;
	while(scanf("%lf,%lf",&D,&A),D||A){
		x += D*sin(r/180*M_PI);
		y += D*cos(r/180*M_PI);
		r += A;
	}
	printf("%d\n%d\n",(int)x,(int)y);
}

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

int main()
{
    double x = 0, y = 0;            //x座標y座標
    double d, a = 0, b = 0;         //d距離a角度b角度
    char c;

    double pi = acos(-1);           //cos(pi) = -1より acos(-1) = pi;

    //最初は必ずy軸正の方向にdだけ進むので、bの初期値は0とする。cos(0) = 1
    while( cin >> d >> c >> a )
    {
        if( d == 0 && a == 0 )  //終了処理
            break;

        double si, co;
        si = sin(b*pi/180);
        co = cos(b*pi/180);

        //x軸の処理
        if( b >= 0 || b <= 180 )    // 0 <= θ <= 180のときx軸正の方向に動く
            x += d * si;
        else                        // -180 <= θ < 0のときx軸負の方向に動く
            x -= d * si;

        //y軸の処理
        if( b >= -90 || b <= 90 )   //y軸正の方向に動く時の条件
            y += d * co;
        else
            y -= d * co;
        b += a;
    }


    cout << (int)x << endl << (int)y << endl;   //int型でキャスト

    return 0;
}
// b>=0やabs(b)<=90という条件が相応しくなかった理由は、角度aという値が0°から360°の範囲を取るから。
// 対して180°までの範囲しか頭になかったので反省。

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

int main(){
	//hosuu = üÍ³êéà, kakudo = üÍ³êépx
	//x = »Ýn_ÌxÀW, y = »Ýn_ÌyÀW, rad = ¡ü¢Ä¢épx(WA)
	int hosuu, kakudo;
	double x = 0.0, y = 0.0, rad = 0.0;
	while(scanf("%d,%d", &hosuu, &kakudo)){
		if(hosuu == 0 && kakudo == 0) break;
		
		//x = hosuu * sin(kakudo), y = hosuu * cos(kakudo)
		x += (hosuu * sin(rad));
		y += (hosuu * cos(rad));
		
		//Éü­pxðwè(WAÉ¼·)
		rad += kakudo * PI / 180.0;
		
	}
	cout <<(int)x <<endl <<(int)y <<endl;
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

double to_rad(int ang)
{
    return ang * acos(-1) / 180.0;
}

int main()
{
    double a, b, x = 0, y = 0, ang = 0;
    char c;
    while (cin >> a >> c >> b, (a != 0 || b != 0)) {
        x += a * sin(to_rad(ang));
        y += a * cos(to_rad(ang));
        ang += b;
    }
    cout << (int)x << endl << (int)y << endl;
    return 0;
}

C++: float x,y,z;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(z),x-=r*sin(z),z-=d/57.3,1:!printf("%d\n%d\n",d=x,r=y););}

C++: #include <iostream>
#include <cmath>
#define PI (6*asin( 0.5 ))
using namespace std;

int main() {
	double x=0,y=0,a=90;
	int step,angle;
	while(true)
	{
		scanf("%d,%d",&step,&angle);
		if (step==0) break;
		x+= cos(a*PI/180)*step;
		y+= sin(a*PI/180)*step;
		a-= angle;
	}
	x>0 ? x=floor(x) : x=floor(x+1);
	y>0 ? y=floor(y) : y=floor(y+1);
	cout << x << endl << y << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;

using db = double;

int main() {
	cout << fixed << setprecision(0);
	ios :: sync_with_stdio(false);
	db d, t; char c;
	db x, y, a;
	while(cin >> d >> c >> t) {
		a -= t;
		x += d * cos(a);
		y += d * sin(a);
	}
	cout << x << ' ' << y << '\n';
	return 0;
}

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

using namespace std;

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

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

int main(){
	double x, y;
	double angle = 90;
	int a, b;
	while(1){
		scanf("%d,%d", &a, &b);
		if(a == 0 && b == 0) break;
		double rad = angle * M_PI / 180;
		x += a * cos(rad);
		y += a * sin(rad);
		angle -= b;
	}
	cout << (int)x << endl << (int)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(scanf("%lf%lf",&a,&b), a || b){

	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;

const double PI = 3.1415926535;

int main(){
	int n, th;
	double x = 0;
	double y = 0;
	int nth = 90;
	while(scanf("%d,%d", &n, &th)){
		cout<<n<<th<<endl;
		if(!n&&!th) break;
		x += n*cos(PI*nth/180);
		y += n*sin(PI*nth/180);
		nth -= th;
		nth %= 360;
	}
	printf("%d\n", int(x));
	printf("%d\n", int(y));
	return 0;
}

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

using namespace std;

int main(){
    int d,phi;
    int tot_phi = 90;
    float tot_dcos,tot_dsin;
    while(d || phi){
        scanf("%d,%d",&d,&phi);
        tot_dcos += d*cos(tot_phi*M_PI/180);
        tot_dsin += d*sin(tot_phi*M_PI/180);
        tot_phi -= phi;
    }
    cout << (int)tot_dcos << endl << (int)tot_dsin << endl;
}