Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var r, d float64
        var x, y, rad float64
        rad = math.Pi / 2
        for {
                _, err := fmt.Scanf("%f,%f", &d, &r)
                if err != nil {
                        break
                }
                if r == 0.0 && d == 0.0 {
                        break
                }

                x += d * math.Cos(rad)
                y += d * math.Sin(rad)
                rad -= r * math.Pi / 180
        }

        fmt.Printf("%d\n", int(x))
        fmt.Printf("%d\n", int(y))
}

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

int main(){
	const double PI=3.14159265358979;
	int x,y;
	double theta=0;
	double sum_x=0;
	double sum_y=0;
	char c;
	
	while(std::cin >> x >> c >> y){
		sum_y += x * cos(theta * PI / 180);
		sum_x += x * sin(theta * PI / 180);
		theta += y;
	}
	
	std::cout << (int)sum_x << std::endl;
	std::cout << (int)sum_y << std::endl;

}

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

#define PI 3.1416

using namespace std;

int main(){
  int d;
  float mt=90.0*PI/180;
  float t,x,y;
  x=y=0.0;
  while(1){
    scanf("%d,%f",&d,&t);
    if(d==0&&t==0) break;
    x+=d*cos(mt);
    y+=d*sin(mt);
    mt+=-t*PI/180;
  }
  if(x<0) x+=1;
  if(y<0) y+=1;
  printf("%.0f\n%.0f\n",floor(x),floor(y));
  return 0;
}

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

const double pi = acos(-1.0);

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

C++: #define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>


int main()
{
double N,P=0;
double x,y;
double p=0,P1=0;
x=0;y=0;
while(1)
{
scanf("%lf,%lf",&N,&P1);
if((int)N==0&&(int)P1==0)break;

x+=N*sin(P*M_PI/180);y+=N*cos(P*M_PI/180);

P+=P1;
}
int X,Y;
X=(int)x;Y=(int)y;
printf("%d\n",X);printf("%d\n",Y);

return 0;
}

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

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int main(){
	double x=0, y=0, r=90;//初期設定
	double d, rd;//入力値　更新部分
	char c;//ごみ
	
	while(cin>> d >> c >> rd){
		if(d==0 && rd==0) break;

		x+=d*cos(r/180*M_PI);
		y+=d*sin(r/180*M_PI);
		r-=rd;
	}

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

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class t>
using table = vector<vector<t>>;
const ld eps=1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.answer"
int main() {
	complex<ld>way(0,1);
	complex<ld>now(0, 0);
	while (1) {
		int a, b;
		scanf("%d,%d", &a, &b);
		if (!a&&!b)break;
		now += way*ld(a);
		ld theta = -ld(b) / 180 * acos(-1);
		way *=complex<ld>(cos(theta),sin(theta));

	}
	cout << int(now.real()) << endl << int(now.imag()) << endl;
	return 0;
}

C++: #include <iostream>

#define M_PI 3.141592653589793

using namespace std;

int debug = 0;

int main(void){
	int len, deg, direction=90;
	double x=0, y=0;
	int i_x, i_y;

	while(cin >> len){
		cin.ignore(); //read ,
		cin >> deg;

		if(len == 0 && deg == 0) break;

		//proceed
		x += len * cos(direction * M_PI / 180);
		y += len * sin(direction * M_PI / 180);
		
		//turn clockwise
		direction -= deg;

	}

	i_x = x;
	i_y = y;

	cout << i_x << endl;
	cout << i_y << endl;

	return 0;
}

C++: #include <iostream> 
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
	int x,m,r=90;
	double ansX=0,ansY=0;
	char com;
	while(1){
		cin>>m>>com>>x;
		if(m==0&&x==0)break;
		ansX+=m*cos(3.1415*r/180);
		ansY+=m*sin(3.1415*r/180);
		r-=x;
	}
	cout<<(int)ansX<<" "<<(int)ansY<<endl;
    return 0;
}

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

int main(){
	double teku[10000]={0.0},sita=pi/2,set_sita[10000]={0.0},x=0.0,y=0.0;
	int i=0,j=0;
	
	while(scanf("%lf,%lf",&teku[i],&set_sita[i])!=EOF){
		if(teku[i]==0 && set_sita[i]==0)break;
		
		set_sita[i]=set_sita[i]/180.0 * pi;
		
		for(j=0;j<teku[i];j++){
			x+=cos(sita);
			y+=sin(sita);
		}
		sita+=set_sita[i];
		i++;
	}

		printf("%.0f\n%.0f\n",floor(x),floor(y));
	return 0;
}

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