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++: #define _USE_MATH_DEFINES
#include<cmath>
#include<iostream>
int main()
{
	double x = 0, y = 0;
	int a = 90;
	while (true)
	{
		int di, ai;
		char temp;
		std::cin >> di >> temp >> ai;
		if (di == 0 && ai == 0)
		{
			break;
		}
		x += di * cos(a * M_PI / 180);
		y += di * sin(a * M_PI / 180);
		a -= ai;
	}
	std::cout << static_cast<int>(x >= 0 ? floor(x) : ceil(x)) << std::endl;
	std::cout << static_cast<int>(y >= 0 ? floor(y) : ceil(y)) << std::endl;
	return 0;
}

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

#define PI 3.1415926535

int main(void){
    double dst,angl,angl_now;
    double x,y;
    x=y=0;
    angl_now=90;
    char ch;
    while(std::cin>>dst>>ch>>angl){
        if(dst==0 && angl==0) break;
        x+=dst*cos(PI/180*angl_now);
        y+=dst*sin(PI/180*angl_now);
        angl_now-=angl;
    }
    std::cout<<(int)x<<std::endl<<(int)y<<std::endl;
    return 0;
}

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

int main()
{
	char c;
	int d, a;
	ld x = 0, y = 0;
	int deg = 90;
	while (cin >> d >> c >> a, d | a) {
		ld ar = deg * acosl(-1) / 180;
		x += d * cosl(ar);
		y += d * sinl(ar);
		deg -= a;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define MY_PI 3.1415926535897932384626433832795028841971693993751058209749445923
using namespace std;

int main() {
	double sumx=0, sumy=0;
	int ideg = 0;
	while(true) {
		int a,b; scanf("%d,%d",&a,&b);
		if(a==0 && b==0)break;
		sumx += a*sin(ideg*MY_PI/180);
		sumy += a*cos(ideg*MY_PI/180);
		ideg = (ideg+b)%360;
		if(ideg<0)ideg+=360;
	}
	printf("%d\n%d\n",(int)sumx,(int)sumy);
	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)){
if(!step&&!turn)break;
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 <cstdio>
#include <cmath>
using namespace std;

int main()
{
  int n;
  double x, y, deg, rad;
  
  x = y = deg = rad = 0;
  while (1){
    scanf("%d,%lf", &n, &deg);
    if (n == 0 && deg == 0){
      break;
    }
    x += cos(rad) * n;
    y += sin(rad) * n;
    deg = deg / 180 * M_PI;
    rad += deg;
  }
  printf("%.0f\n%.0f\n", y, x);
  //cout << x << "\n" << y << endl;
  return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

int main(){
	int len, deg;
	int deg_now = 90;
	double x = 0, y = 0;

	while (1){
		scanf("%d,%d", &len, &deg);
		if (len == 0 && deg == 0) break;
		x += len*cos(deg_now / 180 * M_PI);
		y += len*sin(deg_now / 180 * M_PI);
		deg_now -= deg;
	}

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

	return 0;

}

C++: import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(*map(int,(x,y)),sep='\n')

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  double angle=90,x=0,y=0,pi=3.141592653589793;
  int d,a;
  while(cin >> s){
    if(s=="0,0"){
      cout << (int)x << endl << (int)y << endl;
      return 0;
    }
    for(int i=0;i<s.size();i++){
      if(s[i]==','){
        string ss=s.substr(0,i),tt=s.substr(i+1,s.size()-i-1);
        d=atoi(ss.c_str()),a=atoi(tt.c_str());
      }
    }
    x+=cos(pi*(angle)/180)*(double)d;
    y+=sin(pi*(angle/180))*(double)d;
    angle-=(double)a;
  }
  return 0;
}

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

#define PI 3.14159265

using namespace std;

int main(){
  int theta,x,theta_sum;
  double x_sum,y_sum;
  
  x_sum =0;
  scanf("%d,%d",&x,&theta);
  y_sum = (double)x,theta_sum =(double)theta;
  while(1){
    scanf("%d,%d",&x,&theta);
    if(x == 0 && theta == 0) break;
    x_sum += (double)x * sin(theta_sum * PI / 180);
    y_sum += (double)x * cos(theta_sum * PI / 180);
    theta_sum += theta;
  }

  cout << floor(x_sum) << endl <<floor(y_sum) << endl;

  return 0;

}

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

int main(){
	int ang=90, walk, inang;
	double x=0.0, y=0.0, rad;
	while(true){
		scanf("%d,%d", &walk, &inang);
		if(walk==0 && inang==0) break;
		rad=ang*M_PI/180.0;
		x = x+( (double)walk*cos(rad) );
		y = y+( (double)walk*sin(rad) );
		ang = (ang-inang)%360;
	}
	cout<<int(x)<<endl<<int(y)<<endl;
	return 0;
}

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

using namespace std;
int main(void)
{
	int x = 0,y = 0;
	int hosu,kakudo;
	int kakudos = 90;
	while(scanf("%d,%d",&hosu,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		kakudos -= kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

int main(){
	int ang=90, walk, inang;
	double x=0.0, y=0.0, rad;
	while(true){
		scanf("%d,%d", &walk, &inang);
		if(walk==0 && inang==0) break;
		rad=ang*M_PI/180.0;
		x = x+( (double)walk*cos(rad) );
		y = y+( (double)walk*sin(rad) );
		ang = (ang-inang)%360;
	}
	printf("%.0f\n%.0f\n", x, y);
	return 0;
}

C++: d;double x,y,c;main(s){for(;~scanf("%d,%d",&s,&d);c+=d/57.29578)x+=s*sin(c),y+=s*cos(c);exit(!printf("%d\n%d\n",d=x,s=y));}

C++: #include <cmath>
#include <cstdio>
int a, b; double x, y, r;
int main() {
	r = asin(1);
	while(scanf("%d,%d", &a, &b), a | b) {
		x += a * cos(r), y += a * sin(r);
		r -= b / 180.0 * acos(-1);
	}
	printf("%d\n%d\n", (int)(x), (int)(y));
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double x=0,y=0,rad=M_PI/2;
	int a,b;
	while(1){
		cin>>a;
		cin.ignore();
		cin>>b;
		if(!a&&!b)break;
		x += a*cos(rad);
		y += a*sin(rad);
		rad -= b*M_PI/180;
	}
	cout<<(int)x<<endl<<(int)y<<endl;
	return 0;
}