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 <cmath>
#include <stdio.h>

const double PI = 3.141592653589;

int main()
{
	int len,deg;
	double x,y,deg_sum;
	x = 0;
	y = 0;
	deg_sum = 0;
	scanf("%d,%d",&len, &deg);
	while(len != 0 || deg != 0){
		x += sin(deg_sum * PI / 180) * (double)len;
		y += cos(deg_sum * PI / 180) * (double)len;
		deg_sum += (double)deg;
		scanf("%d,%d",&len, &deg);
	}
	if(x > -0.5 && x < 0.5){
		x = 0;
	}
	if(y > -0.5 && y < 0.5){
		y = 0;
	}
	printf("%.0f\n%.0f\n",x,y);
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90;
	char c;
	cin >> d >> c >> a;

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca -= a;
		cin >> d >> c >> a;

	} while (d != 0 || a != 0);
	//cout << fixed << setprecision(0) << x << endl << y << endl;
	cout << int(x) << endl << int(y) << endl;
}

C++: #include <stdio.h>
#include <math.h>
int main()
{
    double d,a,s,x,y;
    x = 0.0;
    y = 0.0;
    s = M_PI/2;
    while(scanf("%lf,%lf",&d,&a) != EOF){
        x -= d*cos(s);
        y += d*sin(s);
        s += a/180*M_PI;
    }
    int ax = x;
    int ay = y;
    printf("%d\n%d\n",ax,ay);
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int a,b;
    char c;
    double pi=acos(-1.0);
    double x=0,y=0,angle=90;
    for(;;){
       cin>>a>>c>>b;
       if(a==0 && b==0) break;
       x+=a*cos(angle*pi/180);
       y+=a*sin(angle*pi/180);
       angle-=b;      
   }
   cout<<(int)x<<"\n"<<(int)y<<endl;
   return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<cstdio>
#include<string.h>
using namespace std;

int main()
{
	double hosu, kaku, x=0, y=0, now=0;

	while (1)
	{
		scanf("%lf,%lf", &hosu, &kaku);
		if (hosu == kaku&&hosu==0)break;
		x += sin(now)*hosu;
		y += cos(now)*hosu;
		now += kaku / 180 * 3.1415;

	}
	int A = x;
	int B = y;
	cout << A<< endl << B << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#define P 3.14159265358979
using namespace std;

double Y(int z){
	if(z<180)return sin(P/180*z);
	return -sin(P/180*(360-z));
}
double X(int z){
	if(z<180)return cos(P/180*z);
	return cos(P/180*(360-z));
}
int main(){
	double x=0,y=0;
	int z=90,a,b;char u;
	while(cin>>a>>u>>b&&a+b){
		y+=a*Y(z),x+=a*X(z);
		z-=b;z%=360;if(z<0)z+=360;
	}
	int xx=x,yy=y;
	cout<<xx<<" "<<yy<<endl;
	return 0;
}

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
double degToRad(int deg) {
  return deg * M_PI / 180;
}
 
int main(void) {
  double x = 0.0, y = 0.0;
  int deg = 90;
 
  while(1) {
    int l, d;
    scanf("%d,%d", &l, &d);
    if(l == 0 && d == 0) break;
 
    x += l*cos(degToRad(deg));
    y += l*sin(degToRad(deg));
 
    deg -= d;
  }
 
  cout << (int)x << endl;
  cout << (int)y << endl;
 
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

void solve()
{
	int d, t;
	double x = 0, y = 0;
	double angle = 90;
	while(true)
	{
		scanf("%d,%d", &d, &t);
		if(d == 0 && t == 0)
		{
			break;
		}
		x += d * cos(angle / 180 * M_PI);
		y += d * sin(angle / 180 * M_PI);
		angle -= t;
	}
	cout << (int)x << endl;	
	cout << (int)y << endl;
}

int main()
{
	solve();
	return(0);
}

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

double totheta(int k){
	double ret = k * M_PI / 180.0;
	return ret;
}

int main(){
	string input;
	int meter = 0, theta = 0;
	float x=0, y=0, c=0;
	while (true)
	{
		scanf("%d,%d", &meter, &theta);
		if (meter == 0 && theta == 0) { break; }
		x += meter * sin(c);
		y += meter * cos(c);
		c += totheta(theta);
	}
	int ansx, ansy;
	ansx = x;
	ansy = y;
	cout << ansx << endl << ansy << endl;
	return 0;
}

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