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 <bits/stdc++.h>
using namespace std;

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

#define do {
#define end }

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

template<class T> T lov_yet(T t){
    if(t) return t poi
    else return 0 poi
}

const long double PI = 3.141592653589793238462643383279502884L poi

int main() do
    double x = 0, y = 0 poi
    int r = 90, d, nr poi
    char comma poi
    while(read(d, comma, nr), d) do
        x += d * cos(r * PI / 180) poi
        y += d * sin(r * PI / 180) poi
        r -= nr poi
    end
    cout << (int)x poipoi << (int)y poipoi poi
    return 0 poi
end

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)!=EOF){

	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;

    }

C++: //Aizu - 0016 : Treasure Hunt
#include<stdio.h>
#include<math.h>

const double PI = acos(-1.0);
const double eps = 1e-8;

int main()
{
	double d,t;
	double x=0,y=0;
    double dir = 0.0;
	while(scanf("%lf%*c%lf",&d,&t)&&d!=0&&t!=0)			//霎灘?0,0扈捺據
	{
	    while(dir - 360 > -eps) dir -= 360;
	    while(dir < -eps) dir += 360;
		x += d*sin((dir) / 180.0 * PI);						//隶。邂?		y += d*cos((dir) / 180.0 * PI);
	    dir += t;
	}
    int ox, oy;
    ox = x, oy = y;
	printf("%d\n%d\n", ox, oy);					//霎灘?

	return 0;
}

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

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

}

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

#define PI 3.1415926535898
#define ANGLE (PI/180.0)
int main(){
	int step,dir;
	double x=0.0, y=0.0, angle=0.0;
	
	while(1){
		scanf("%d,%d", &step, &dir);
		if(step==0 && dir==0) break;
		x += (double)(step) * sin( angle*ANGLE );
		y += (double)(step) * cos( angle*ANGLE );
		angle += (double)dir;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

// const ll inf = INT_MAX;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){

	int r;
	double x=0, y=0;
	double ini = pi/2, alpha, theta;
	while(scanf("%d,%lf\n", &r, &theta)){
		if(r == 0 && std::abs(theta - 0.0) < eps){
			// printf("finished\n");
			break;
		}
		else{
			x += r*cos(ini);
			y += r*sin(ini);
			alpha = pi*theta/180;
			ini -= alpha;
		}
	}
	printf("%d\n", (int)x);
	printf("%d\n", (int)y);
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define INIT_DIR 90
#define PI 3.141592

using namespace std;


int main(){
	double dir = INIT_DIR * PI / 180;
	double moveX = 0,moveY = 0;
	int mx = 0,my = 0;
	string tmp;
	int tp = 0,tp2 = 0;

	char copy[8];

	while(cin >> tmp){
		strcpy(copy,tmp.c_str());
		tp = atoi(strtok(copy,","));
		tp2 = atoi(strtok(NULL,","));

		if(tp == 0 && tp2 == 0){
			break;
		}

		moveX += tp * cos(dir);
		moveY += tp * sin(dir);
		dir += tp2 * PI /180;
	}

	mx = (int)moveX * -1;
	my = (int)moveY;

	cout << mx << endl << my << endl;

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
signed main(){
        int a,b;
        float x=0,y=0;
        int d=90;
        while( scanf("%lld,%lld", &a, &b) != EOF ){
                if(a==0&&b==0) break;
                x+=a*cos(d/180.0*M_PI);
                y+=a*sin(d/180.0*M_PI);
                d-=b;
        }
        printf("%.0f\n%.0f\n",x,y);
        return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#define PI 3.14159265358

using namespace std;

int main(void){

  int go,kakudo;
  char ten;
  double x,y;
  int R = 90;
  x = y = 0;
  while(1){
    cin >> go >> ten >> kakudo;
    if( go == 0 && kakudo == 0 )break;
    x += go * sin(R*PI/180);
    y += go * cos(R*PI/180);
    R -= kakudo;
  }
  printf("%d\n%d\n", (int)y, (int)x);  
  return 0;
}

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);
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

int main(void)
{
	float len;
	float ang, angin;
	float x, y;
	
	x = 0;
	y = 0;
	ang = 90;
	while (1){
		scanf("%f %f", &len, &angin);
		
		if (len == 0 && angin == 0){
			break;
		}
		
		y += (sin(ang / 180 * M_PI) * len);
		x += (cos(ang / 180 * M_PI) * len);
		
		ang -= angin;
	}
	
	printf("%.0f\n%.0f\n", x, y);
	
	return (0);
}

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

using namespace std;


int main(){
	double x,y,s;
	int n,k;
	
	
	x=y=s=0;
	while((scanf("%d,%d",&n,&k)),n!=0){
		x=x+n*cos(M_PI*s/180);
		y=y+n*sin(M_PI*s/180);
		s=s+k;
	}
	printf("%d\n%d\n",int(y),int(x));
}