Go: package main

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

func main() {
	var a, b float64
	var x, y float64
	x = 0
	y = 0
	var now float64
	now = 90
	var info string
	for {
		fmt.Scan(&info)
		infos := strings.Split(info, ",")
		a_int, _ := strconv.Atoi(infos[0])
		b_int, _ := strconv.Atoi(infos[1])
		a = float64(a_int)
		b = float64(b_int)
		// println(a, b)
		if a == 0 && b == 0 {
			break
		}
		x += math.Cos(now*math.Pi/180)*a
		y += math.Sin(now*math.Pi/180)*a
		now -= b
	}
	fmt.Printf("%d\n%d\n", int(x), int(y))
}

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

double cos(double x){
	double c = 0.0;
	double y = 1.0;
	double n = 1;
	for(int i = 1; i < 30; i++){
		c += y / n;
		y = - y * x * x;
		n = 2 * i * (2 * i - 1) * n;
	}
	return c;
}

double sin(double x){
	double s = 0.0;
	double y = x;
	double n = 1;
	for(int i = 1; i < 30; i++){
		s += y / n;
		y = - y * x * x;
		n = 2 * i * (2 * i + 1) * n;
	}
	return s;
}

int main(){
	double x = 0.0, y = 0.0;
	double hosu;
	double angle = 90.0;
	double change;
	char c;
	while(cin >> hosu >> c >> change){
		if(hosu == 0 && change == 0) break;
		x += hosu * cos(angle / 180 * 3.14159);
		y += hosu * sin(angle / 180 * 3.14159);
		angle -= change;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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

double setX(double r, double d)
{
	return r*cos(M_PI/2-d);
}

double setY(double r, double d)
{
	return r*sin(d+M_PI/2);
}

int main (void)
{
	double x=0.0, y=0.0, r=0.0, d=0.0, old_d=0;
	
	do
	{
		scanf("%lf,%lf", &r, &d);
		x+=setX(r, old_d);
		y+=setY(r, old_d);
		old_d+=d*M_PI/180;
	}while(r && d);
	
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

int main()
{
    double x = 0;
    double y = 0;
    double a = M_PI_2;
    while(true){
        int d, t;
        char c;
        std::cin >> d >> c >> t;
        if(d == 0 && t == 0) break;
        x += d * std::cos(a);
        y += d * std::sin(a);
        a += (-t * M_PI / 180);
    }
    std::cout << std::floor(x) << std::endl;
    std::cout << std::floor(y) << std::endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
using namespace std;
#define PI 3.141592
int main(){
  float angle;
  float x=0,y=0;
  float d,t;
  string str;
  cin >> str;
  if(str[1]==','){
    d= str[0]-'0';
    if(str[2]=='-'){
      if(str.size()==4) t = (str[3]-'0')*(-1);
      else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
    }else{
      if(str.size()==3) t = str[2]-'0';
      else t = (str[2]-'0')*10+(str[3]-'0');
    }
  }else if(str[2]==','){
    d= (str[0]-'0')*10+str[1]-'0';
    if(str[3]=='-'){
      if(str.size()==5) t = (str[4]-'0')*(-1);
      else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
      if(str.size()==4) t = str[3]-'0';
      else t = (str[3]-'0')*10+(str[4]-'0');
    }
  }else if(str[3]==','){
    d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
    if(str[4]=='-'){
      if(str.size()==6) t = (str[5]-'0')*(-1);
      else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
    }else{
      if(str.size()==5) t = str[4]-'0';
      else t = (str[4]-'0')*10+(str[5]-'0');
    }
  }
  while(d!=0||t!=0){
    x+=d*sin(angle/180*PI);y+=d*cos(angle/180*PI);
    angle+=t;
    //if(angle>360) angle-=360;
    //if(angle<-360) angle+=360;
    
    
    cin >> str;
    if(str[1]==','){
      d= str[0]-'0';
      if(str[2]=='-'){
	if(str.size()==4) t = (str[3]-'0')*(-1);
	else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
      }else{
	if(str.size()==3) t = str[2]-'0';
	else t = (str[2]-'0')*10+(str[3]-'0');
      }
    }else if(str[2]==','){
      d= (str[0]-'0')*10+str[1]-'0';
      if(str[3]=='-'){
	if(str.size()==5) t = (str[4]-'0')*(-1);
	else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
	if(str.size()==4) t = str[3]-'0';
	else t = (str[3]-'0')*10+(str[4]-'0');
      }
    }else if(str[3]==','){
      d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
      if(str[4]=='-'){
	if(str.size()==6) t = (str[5]-'0')*(-1);
	else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
      }else{
	if(str.size()==5) t = str[4]-'0';
	else t = (str[4]-'0')*10+(str[5]-'0');
      }
    }
  }
  int x1=x,y1=y;
  printf("%d\n%d\n",x1,y1);
  return 0;
}

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

using namespace std;

typedef complex<double> Point;

int main() {
    Point pos(0, 0);
    Point unit(0, 1);
    while(true) {
        int r, a;
        char c;
        cin >> r >> c >> a;
        if(r == 0 && a == 0) break;

        pos += unit * (double)r;
        unit *= polar(1.0, -M_PI*a/180);
    }
    cout << (int)pos.real() << endl;
    cout << (int)pos.imag() << endl;
    return 0;
}

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

int main(){
  double x, y, r;
  x = y = 0;
  r = -M_PI/2;
  while(1){
    int n,m;
    scanf("%d,%d", &n, &m);
    if(n==0&&m==0) break;

    x += n*cos(r);
    y += n*sin(r);
    r -= m*M_PI/180;
  }
  printf("%d\n%d\n", (int)x*-1,(int)y*-1);
}

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

using namespace std;

template <typename T, int N>
int ArraySize(const T(&)[N]) {
    return N;
}


int main() {
    constexpr double Pi = 3.1415926535;

    long double x {}, y {}, radianAngle {Pi / 2.0};
    
    char c;

    for(int steps, rotate, currentRotation{90}; cin >> steps >> c >> rotate;) {
        if(steps == 0 && rotate == 0) break;


        x += steps * cos(radianAngle);
        y += steps * sin(radianAngle);

        currentRotation += -rotate < 0 ? -rotate : 360 - rotate;
        radianAngle = 2 * Pi * currentRotation / 360;

    }

    

    std::cout << static_cast<int>(x) << '\n' << static_cast<int>(y) << endl;

    return 0;
}

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

constexpr double pi = 3.141593;

int main() {
	double pos_x = 0;
	double pos_y = 0;
	int degree = 0;
	
	while (true) {
		int norm, deg;
		std::scanf("%d,%d", &norm, &deg);
		if (norm == 0 && deg == 0) {
			break;
		}
		
		double theta = degree * pi / 180.0;
		pos_y += norm * std::sin(theta);
		pos_x += norm * std::cos(theta);
		degree += deg;
	}
	
	std::cout << static_cast<int>(pos_y) << std::endl;
	std::cout << static_cast<int>(pos_x) << std::endl;
}

C++: import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 


print("{:.0f}".format(ystep))
print("{:.0f}".format(xstep))

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

#define PAI acos(-1.0)

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

	while(scanf("%d,%d",&d,&t)&&(!(d==0&&t==0)))
	{
		x+=d*sin(PAI*ang/180.0);
		y+=d*cos(PAI*ang/180.0);
		ang+=t;
	}

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

	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;
  x += 0.5;
  y += 0.5;
  printf("%.0f\n%.0f\n",x,y);

}