Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <iostream>
#include <cmath>
#include <stdio.h> 

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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef long long ll;
typedef vector<int> vi;
typedef complex<double> P;

int main() {
	int s, t;
	P p(0.0, 0.0);
	P o(0.0, 1.0);
	while(scanf("%d,%d", &s, &t), s|t) {
		p = p + o * (double)s;
		double theta = -M_PI * t / 180.0;
		o = o * P(cos(theta), sin(theta));
	}
	printf("%d\n%d\n", (int)p.real(), (int)p.imag());
}

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(M_PI*2*ang/360);
    y+=dis*sin(M_PI*2*ang/360);
    ang-=a;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    std::scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += -(double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  std::printf("%.0f\n%.0f\n",x,y);

}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	double x = 0, y = 0;
	double ang = 90;
	for (;;)
	{
		string str;
		cin >> str;

		stringstream ss;
		ss << str;

		double d, a;
		ss >> d;
		ss.ignore();
		ss >> a;

		double rad = ang * M_PI / 180.0;
		x += d * cos(rad);
		y += d * sin(rad);

		if (d == 0 && a == 0)
		{
			break;
		}
		ang -= a;
	}

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

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<stdio.h>
const double p = M_PI;
using namespace std;
int main(){
  vector<int> go;
  vector<int> rag;
  double dx,dy,K,x,y;
  int tmpgo,tmprag;
  x = 0; y =0; K = 90;
  for(int count=0;;count++){
    scanf("%d,%d",&tmpgo,&tmprag);
    go.push_back(tmpgo);
    rag.push_back(tmprag);
    if(go[count] == 0 && rag[count] == 0){
      break;
    }
    x += go[count] * cos(K*p /180);
    y += go[count] * sin(K*p /180);
    K = K - rag[count];
  }
    printf("%.0f\n%.0f\n",x,y);

}

C++: #include <iostream>
#include <cmath>
#define d2r(x) ((x)*3.14159265/180)
using namespace std;
int main()
{
	int n, t, a = 90;
	char c;
	double x = 0.0, y = 0.0;
	while (cin >> n >> c >> t, n || t)
	{
		x += n * cos(d2r((double)a));
		y += n * sin(d2r((double)a));
		a -= t;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	
	complex<double> p = (0,0);
	double ang = 90;
	while(1){
		double v_mov;
		double tmp_ang;
		char c;
		cin>> v_mov>> c>> tmp_ang;
		tmp_ang *= -1;
		if(v_mov==0 && tmp_ang==0) break;
		p.real() += v_mov * cos(ang/180*M_PI);
		p.imag() += v_mov * sin(ang/180*M_PI);
		ang += tmp_ang;
		if(ang>180)   ang -= 360;
		if(ang<=-180) ang += 360;
	}
	
	cout<< (int)p.real()<<endl;
	cout<< (int)p.imag()<<endl;

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += -(double)a*cos(-(double)pre_d*M_PI/180);
    y += -(double)a*sin(-(double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  printf("%.0f\n%.0f\n",x,y);

}

C++: #include<iostream>
#include<math.h>
#include <cstdio>
#define pi 3.14159265

using namespace std;

int main()
{
	double dis,ang;
	double nx,ny;
	double nang=pi/2.0,hang=90;
	nx=ny=0;
	while(scanf("%lf,%lf",&dis,&ang),dis){
		ny+=dis*sin(nang);
		nx+=dis*cos(nang);
		nang=(hang-ang)*pi/180;
		hang-=ang;
	}

	cout<<(int)nx<<endl<<(int)ny<<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,b; int c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=b;

	}

	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;

#define PI 3.14159265

vector<int>d;
vector<int>e;


int main(){

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

   int n=d.size();

	int c=90; double x=0; double y=0;
    for(int i=0;i<n;i++){
	x+=d[i]*cos(c*PI/180);
	y+=d[i]*sin(c*PI/180);
	c+=-e[i];
    }

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

	return 0;
    }

C++: #include<stdio.h>
#include<math.h>

typedef long double ldouble;

const double PI = acos(-1.0);
const double eps = 1e-10;
int main()
{
	int d,t;
	double x=0,y=0;
    int dir = 0;
	while(scanf("%d,%d", &d, &t) &&(d!=0||t!=0))			//霎灘?0,0扈捺據
	{
		x -= d * sin((dir) * PI / 180.0);						//隶。邂?		y += d * cos((dir) * PI / 180.0);
	    dir -= t;
	}
	printf("%d\n%d\n", (int)x, (int)y);					//霎灘?

	return 0;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", &len, &rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << x <<  endl;
  cout << y << endl;
  return 0;
}

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

int main(){
  int d, a = 90, a2; 
  double x,y;
  char c;
  while(cin >> d >> c >> a2){
    if(d == 0 && a == 0) break;
    double rad = a * (PI / 180);
    x += d * cos(rad);
    y += d * sin(rad);
    a += a2;
    }
  }
  cout << (int)x << "\n" << (int)y << endl;
}