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

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.1415

int main(){
	vector<int>u;
    vector<int>v;

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

	int n=u.size();
	int c=90; float x=0; float y=0;
	for(int i=0;i<n;i++){
	x+=u[i]*cos(c*PI/180);
	y+=u[i]*sin(c*PI/180);
	c+=-v[i];

	}

	cout << (int)x << endl;
	cout << (int)y << endl;

	return 0;

    }

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

int main()
{
	int n,r,next=90;
	double x=0,y=0;
	char tmp;
	while(1)
	{
		cin>>n>>tmp>>r;
		if(n==0&&r==0) break;

		double rad=M_PI/180*next;
		next-=r;

		x+=n*cos(rad);
		y+=n*sin(rad);
	}

	cout<<(int)x<<endl;
	cout<<(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(){

	int a; int b; int 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;

    }