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++: #define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	double x = 0, y = 0;
	double dist, ang = 0, d;
	while (scanf("%lf,%lf", &dist, &d), dist || d) {
		x += sin(ang*M_PI / 180)*dist;
		y += cos(ang*M_PI / 180)*dist;
		ang += d;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define PI 3.14159265358979323846264

using namespace std;

int main()
{
	double x=0.0,y=0.0;
	int a,b,theta=90;

	scanf("%d,%d",&a,&b);
	while(a!=0 && b!=0){
		x+=a*cos(theta*PI/180.0);
		y+=a*sin(theta*PI/180.0);

		theta-=b;
		scanf("%d,%d",&a,&b);

	}

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

	return 0;
}

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

#define PI 3.141592

int main() {
  double l, ang;
  double nowang = PI/2;
  double x = 0, y = 0;
  while(true) {
    scanf("%lf,%lf", &l,&ang);
    if (l+ang==0) break;
    x += cos(nowang) * l;
    y += sin(nowang) * l;
    nowang -= ang * PI / 180;
  }
  printf("%d\n%d\n", (int)x,(int)y);
}

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

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

	int angle = 90;

	int l, a;

	while(scanf("%d,%d",&l,&a) + 1){
		if(l == 0 && a == 0)break;

		x -= l * cos(angle * PI / 180);
		y += l * sin(angle * PI / 180);

		angle += a;
	}

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

	return 0;
}

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

int main()
{
	double PI = atan(1.0)*4;
	double a = 90;
	double x=0, y=0;

	while ( true )
	{
		char c;
		int r,t;
		cin>>r>>c>>t;
		if ( r==0 && t==0 )
			break;

		x += r*cos(a/360.*2*PI);
		y += r*sin(a/360.*2*PI);
		a -= t;
	}

	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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

int main(void) {
  double x = 0, y = 0;
  int d = 90;
  while( 1 ) {
    int a, b;
    scanf("%d,%d", &a, &b);
    if(!a && !b) break;
    x += cos((double)d / 180.0 * pi) * a;
    y += sin((double)d / 180.0 * pi) * a;
    //printf("%d %d %d\n", d, (int)x, (int)y);
    d -= b;
    d %= 360;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

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

C++: //14
#include<iostream>
#include<complex>
#include<cmath>

using namespace std;

int main(){
  complex<double> p;
  double ang=0;
  for(double a,b;(cin>>a).ignore()>>b,a!=0||b!=0;){
    p+=polar(a,ang/180*acos(-1));
    ang+=b;
  }
  cout<<(int)p.imag()<<endl<<(int)p.real()<<endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
	double x = 0, y = 0;
	int ang = 90;
	while(true) {
		int r, t;
		cin >> r;
		x += r*cos(ang*PI/180);
		y += r*sin(ang*PI/180);
		cin.ignore(); cin >> t;
		if(!r && !t) break;
		ang -= t;
		ang = (ang + 360) % 360;
	}
	cout << (int)x << endl << (int)y << endl;

	return 0;
}

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

#define PI 3.14159265358979
#define rad(deg) ((deg) / 180 * PI) 

using namespace std;

int main() {
	int d, a;
	float x = 0., y = 0., deg = 0.;

	while (scanf("%d,%d", &d, &a)) {
		if (d == 0 && a == 0) { break; }

		x += d * sin(rad(deg));
		y += d * cos(rad(deg));

		deg += a;
	}

	cout << (int)x << endl << (int)y << endl;
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  double x=0, y=0;
  int direction = 90;
  int distance,angle;
  char comma;
  while(true){
    cin >> distance >> comma >> angle;
    if(distance == 0 && angle == 0) break;

    x += distance * cos(direction * M_PI/180.0);
    y += distance * sin(direction);
    direction -= angle;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const double PI = acos(-1.0);

int main()
{
	double X = 0.0,Y = 0.0;
	int A,B,R = 90;
	while(scanf("%d,%d",&A,&B),(A || B)){
		X += A * cos(R * PI / 180.0);
		Y += A * sin(R * PI / 180.0);
		R -= B;
		if(R > 180) R -= 360;
		if(R < -180) R += 360;
	}

	printf("%d\n%d\n",(int) X,(int) Y);

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
 
int main(){
    double a;
    double b;
    double now=90;
    double x=0,y=0;
    double PI=3.14159265358;
    while(1){
        scanf("%lf,%lf",&a,&b);
        if(a==b&&b==0)break;
        x+=cos(now*PI/180)*a;
        y+=sin(now*PI/180)*a;
        now-=b;
    }
    printf("%d\n%d\n",(int)x,(int)y);
}

C++: #include <cstdio>
#include <algorithm>
#include <complex>

using namespace std;

using Point=complex<double>;

static const double PI=3.141592653589793;

int main() {
    Point arg=polar(1.0, PI/2);
    Point target=0.0+0.0i;
    while (true) {
        double d, a;
        scanf("%lf, %lf", &d, &a);

        if (d == 0.0 && a == 0.0)
            break;

        target += d*arg;
        arg *= polar(1.0, -a*PI/180);
    }

    int x=target.real(), y=target.imag();

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define PI 3.14159265358979323846264

using namespace std;

int main()
{
	double x=0.0,y=0.0;
	int a,b,theta=90;

	scanf("%d,%d",&a,&b);
	while(a!=0 && b!=0){
		x+=a*cos(theta%360*PI/180.0);
		y+=a*sin(theta%360*PI/180.0);

		theta-=b;
		scanf("%d,%d",&a,&b);

	}

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

	return 0;
}