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<iostream>
#include<math.h>
#include<cstdio>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

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

	while (1){
		cin >> len >> deg;
		if (len == 0 && deg == 0) break;
		x += len*cos(deg_now / 180.0 * M_PI);
		y += len*sin(deg_now / 180.0 * M_PI);
		deg_now += deg;
	}

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

	return 0;

}

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

const double PI = 3.14159265359;

using namespace std;

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90; //????????????????????????
	scanf("%d,%d", &d, &a);	

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca += a;
		scanf("%d,%d", &d, &a);	
		
		cout << "d" << d << " a" << a << endl;
		
	} while(d != 0 || a!= 0);

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

	return 0;
}

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

const double PI = 3.14159265359;

using namespace std;

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90; //????????????????????????
	scanf("%d,%d", &d, &a);	

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca += a;
		scanf("%d,%d", &d, &a);	
		
		cout << "d" << d << " a" << a << endl;
		
	} while(d != 0 || a!= 0);

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

	return 0;
}

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

int main(){
    double x=0,y=0;
    int degree = 90;
    double t;
    int d;
    char c;
    double pi = 3.141592;
    while(true){
       cin >> t;
       x += t*cos(degree*pi/180);
       y += t*sin(degree*pi/180);
      	cin >> c;
       cin >> d;

       degree += d;
       if(t==0&&d==0)
		break;
       
    }
    cout << -(int)x << endl;
    cout << (int)y << endl;
    x = 0,y = 0;
    
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	double d, a, ang = 90.0;
	double x = 0, y = 0;
	while(1){
		scanf("%lf,%lf", &d, &a);
		if(d == 0 && a == 0) break;
		x += d * cos(M_PI * ang / 180.0);
		y += d * sin(M_PI * ang / 180.0);
		ang -= a;
	}
	modf(x, &x);
	modf(y, &y);
	printf("%.0lf\n%.0lf\n", x, y);
	
	return 0;
}

C++: #include <bits/stdc++.h>
int main(){
	int a,b,r=0;double x=0,y=0;
	while(scanf("%d,%d",&a,&b),a||b){
		x+=a*cos(r*M_PI/180.0);
		y+=a*sin(r*M_PI/180.0);
		r+=b;
	}
	printf("%d\n%d",(int)y,(int)x);
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	P p;
	double c_r = M_PI_2;
	int x,r; char c;
	while(cin>>x>>c>>r,(x||r)){
		P add = P(x,0) * P(cos(c_r),sin(c_r));
		p += add;
		c_r -= r / 180.0 * M_PI;
	}

	cout << (int)p.real() << " " << (int)p.imag() << endl;

	return 0;
}

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

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*M_PI/180);
		h+=x*cos(r*M_PI/180);
		r-=y;
	}
	printf("%.0f\n%.0f\n",h,k);
}

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

using namespace std;

//0016
int main(){
	const double PI = M_PI;
	double x=0.0, y=0.0;
	int deg;
	int acc=90;
	int f=0;

	while(1){
		scanf("%d,%d", &f, &deg);
		if(!f && !deg)break;

		double rad = (double)acc/180*PI;
		x += f * cos(rad);
		y += f * sin(rad);
		acc = (acc - deg);

	}

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

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#define PI 3.14159265358979
double rad(double a){
  return a*PI/180.0;
}

int main(){
  int a,b;
  int th=0;
  double x = 0, y = 0;
  while(scanf("%d,%d",&a,&b)){
    if(a==0&&b==0)break;
    x+=(double)a*sin(rad(th));
    y+=(double)a*cos(rad(th));
    th+=b;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}

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

using namespace std;

int main(void) {
	int len, rot;
	int deg;
	double north, east;
	
	deg = 0;
	north = 0; east = 0;
	while(true) {
		scanf("%d,%d", &len, &rot);
		if(len == 0 && rot == 0) { break; }
		north += sin(deg * 3.1415927 / 180.0) * len;
		east += cos(deg * 3.1415927 / 180.0) * len;
		deg += rot;
	}
	
	printf("%d\n%d\n", (int)north, (int)east);
	
	return 0;
}

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

int main()
{
	int len, angle;
	int sum_ang = 90; // start
	double x = 0.0, y = 0.0;

	// ang(+) -> right 
	while (scanf("%d,%d", &len, &angle), len != 0 || angle != 0){
		x += len * cos(M_PI * sum_ang / 180.0);
		y += len * sin(M_PI * sum_ang / 180.0);

		sum_ang = (sum_ang - angle + 360) % 360;
	}

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

	return (0);
}

C++: #include<bits/stdc++.h>
using namespace std;
static const double pi = 2.0 * acos(0.0);

int d, a;

int main(){
	double theta = pi / 2;
	double x = 0.0, y = 0.0;
	while(1){
		scanf("%d,%d", &d, &a);
		//cout << d << " " << a << endl;
		if(d == 0.0 && a == 0.0) break;
		x += d * cos(theta); y += d * sin(theta);
		theta -= (double)a / 180.0 * pi;
		//cout << x << " " << y << endl;
	}
	cout << (int)x << endl << (int)y << endl;
	return 0;
}

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

using namespace std;

int main() {
    int a=1;
    int b=1;
    
    double degree=90.0;
    
    double x=0.0;
    double y=0.0;

    while (a!=0&&b!=0){
        scanf("%d,%d",&a,&b);
        
        y+=(a*sin(degree* M_PI / 180));
        x+=(a*cos(degree* M_PI / 180));
        
        degree-=b;
    }
    
    cout<<(int)x<<endl<<(int)y<<endl;
    
    return 0;
}

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

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

#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);
}

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

int main(){
  double x=0;
  double y=0;
  double angle=0;
  double r,th;
  while(1){
    scanf("%lf,%lf",&r,&th);
    if(r==0&&th==0)break;
    x+=r*sin(angle);
    y+=r*cos(angle);
    angle+=th;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}