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>
#include <string>
#include <cstdlib>
#define PI 3.141592653589793

using namespace std;

int main() {
  string str;
  int to;
  double x,y,direction,r,theta;
  x = 0;
  y = 0;
  r = 0;
  theta = 0;
  direction = 90;
  while(cin >> str) {
    to = str.find(",",0);
    r = (double)strtol(str.substr(0,to).c_str(),NULL,10);
    theta = strtol(str.substr(to+1).c_str(),NULL,10);
    if( r == 0 && theta == 0) break;
    //cout << direction << endl;
    x += r * cos(direction * (PI / 180.0));
    y += r * sin(direction * (PI / 180.0));
    direction -= (double)theta;
    str = "0";
  }
  cout << (int)x << endl << (int)y << endl;
}

C++: #include <iostream>
#include <stack>
#include <cmath>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	double x = 0 , y = 0, arg = 90; 
	int a,b;
	while((cin>>a).ignore()>>b){
		x += a * cos( arg / 180 * M_PI);
		y += a * sin( arg / 180 * M_PI);
		arg -= b;
	}
	cout << (x>=0?floor(x):ceil(x)) << endl << (y>=0?floor(y):ceil(y)) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int a, b, r = 90;
double x = 0, y = 0;

int main() {
	while ( ~scanf( "%d,%d", &a, &b ) ) {
		x += a * cos( r * PI / 180 );
		y += a * sin( r * PI / 180 );
		r -= b;
	}
	printf( "%d\n%d\n", ( int ) x, ( int ) y );
	return 0;
}

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

int main() {
    double theta;
    double x=0, y=0;
    while(1){
        int step, angle;
        scanf("%d,%d",&step, &angle);
        if(step == 0 && angle == 0) break;
        x += cos( ( 90 - theta ) * M_PI / 180 ) * step;
        y += sin( ( 90 - theta ) * M_PI / 180 ) * step;
        theta += angle;
    }
    cout << (int)x << endl << (int)y << endl;
    return 0;
}

C++: #include <iostream>

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 * 3.14159265358979 / 180);
		y += len * sin(direction * 3.14159265358979 / 180);
		
		//turn clockwise
		direction -= deg;

		if(debug) cout << "(x, y) = ("<< x << ", "<< y << ")"<< endl;
	}

	i_x = (int)x;
	i_y = (int)y;

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

	return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const double EPS = 1e-6,PI = acos(-1.0);

int main()
{
	double X = 0,Y = 0;
	int A,B,R = 90;
	while(scanf("%d,%d",&A,&B) && A && B){
		X += A * cos(R * PI / 180.0);
		Y += A * sin(R * PI / 180.0);
		(R -= B) %= 180;
	}

	printf("%d\n%d\n",(int) X,(int) Y);

	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;
	
	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;
		
		x+=teku[i]*cos(sita);
		y+=teku[i]*sin(sita);
		sita-=set_sita[i];
		i++;
	}
	if(x>0)x=floor(x);
	else x=ceil(x);
	
	if(y>0)y=floor(y);
	else y=ceil(y);
	
		printf("%.0f\n%.0f\n",floor(x),floor(y));
	return 0;
}

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

 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        int  nr=90;
        int l,r;
        while(true){
                cin >> l;
		cin.ignore();
		cin >> r;
                if(!(l|r))
                        break;
                x+=l*cos(nr*M_PI/180.0);
                y+=l*sin(nr*M_PI/180.0);
                nr-=r;
        }
        cout << (int)x << ' '<< (int)y <<  endl;
return 0;
}

C++: #include<bits/stdc++.h>
#define PI 3.14159265
using namespace std;

int main(){

  double d, a;
  double r = 90.0;
  double x = 0, y = 0;

  while(true){
    scanf(" %lf,%lf", &d, &a);

    if(!d && !a) break;
    y += d*sin((r*PI)/180.0);
    x += d*cos((r*PI)/180.0);
    r -= a;
  }

  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;
	
	while(1){
		int a,b;
		cin>>a;
		cin.ignore();  // 1文字読み捨てる
		cin>>b;
		if(a==0&&b==0){
			break;
		}
		x += a*cos(rad);
		y += a*sin(rad);
		rad -= b*(M_PI/180);
	}
	cout<<(int)x <<endl;
	cout<<(int)y <<endl;
	
	return 0;
}

C++: #include <bits/stdc++.h>

const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

inline std::vector<std::string> Split_String(const std::string &str, const char key) {

	std::vector<std::string> result;
	std::stringstream SS(str);
	std::string temp;

	while (std::getline(SS, temp, key)) {
		result.push_back(temp);
	}

	return(result);

}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	std::string str;
	double x = 0, y = 0, rad = 0;
	int distance = 0, degree = 0;

	while (std::cin >> str) {

		std::vector<std::string> v = Split_String(str, ',');
		distance = std::stoi(v[0]);
		rad = degree * de_PI / 180.0;

		x += distance * sin(rad);
		y += distance * cos(rad);

		degree += std::stoi(v[1]);
	}

	std::cout << static_cast<int>(x) << std::endl;
	std::cout << static_cast<int>(y) << std::endl;
}