Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <cstdio>
#include <cmath>
using namespace std;
#define PI 3.141592653

double to_radian(int angle) {
  return double(angle) * PI / 180.0;
}

int main() {
  int len,angle;
  double x,y,rad;
  x = y = 0.0;
  rad = to_radian(90);
  while(scanf("%d,%d",&len,&angle)) {
    if((len | angle) == 0) break;
    x += len * cos(rad);
    y += len * sin(rad);
    rad = rad - to_radian(angle);
  }
  printf("%d\n%d\n",int(x),int(y));
}

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.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<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int stringTOlint(string s) {
	//string→lint
	lint Z = s.size();
	lint ret = 0;
	reverse(s);
	rep(i, Z) {
		ret += ((s[i] - '0') * pow(10, i));
	}
	return ret;
}

int main() {
	double pi = 3.1415926535;
	string S;
	int LD=0, LA=0;
	double D=0, A=0;
	double NX = 0, NY = 0, NA = 90;
	while (1) {
		cin >> S;
		if (S == "0,0") {
			cout << int(NX)*(-1) << endl << int(NY) << endl;
			return 0;
		}
		else {
			string SD, SA;
			bool flag = false;
			rep(i, S.size()) {
				if (S[i] == ',') {
					flag = true;
				}
				else {
					if (flag == false) {
						SD.push_back(S[i]);
					}
					else {
						SA.push_back(S[i]);
					}
				}
			}
			LD = stoi(SD);
			LA = stoi(SA);
			D = double(LD);
			A = double(LA);
			NX += D * cos(NA * pi / 180);
			NY += D * sin(NA * pi / 180);
			NA += A;
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <complex>
#define _USE_MATH_DEFFINES
#include <cmath>
using namespace std;
typedef complex<double> P;

double convert(double angle) {
    return((M_PI * (angle / 180.0)));
}

P now(0, 0);
double angle = 0;

int main(void) {
    int fd, spin;
    
    while(scanf("%d,%d", &fd, &spin), fd + spin != 0) {
        double nextx = now.real() + fd * cos(convert(angle)),
        nexty = now.imag() + fd * sin(convert(angle));
        now = P(nextx, nexty);
        angle += spin;
    }
    cout << (int)now.real() << endl << (int)now.imag() << endl;
    return(0);
}

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

double PI = 3.141592653589793238;

int main() {
	double x = 0.0, y = 0.0, dir = PI / 2;
	while (true) {
		int d, a;
		std::scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0) break;
		x += std::cos(dir) * d;
		y += std::sin(dir) * d;
		dir -= a * PI / 180;
	}
	int ix = x, iy = y;
	std::cout << ix << std::endl << iy << std::endl;
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  double d, t, x, y, n;
  x = y  = 0;
  n = 90;
  while(scanf("%lf,%lf", &d, &t) && d && t){
    x += d * sin(n * M_PI / 180);
    y += d * cos(n * M_PI / 180);
    n -= t;

  }
  printf("%d\n%d\n", (int)y, (int)x);
  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);
	return 0;
}

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

double diffx(int d,int r){
  return d*cos(-1*(r*PI/180.0-PI/2));
}

double diffy(int d,int r){
  return d*sin(-1*(r*PI/180.0-PI/2));
}

int main(){
  double x=0,y=0;
  int r=0;
  int move,rr;
  while(true){
    scanf("%d,%d",&move,&rr);
    if(move==0){
      cout<<(int)x<<endl<<(int)y<<endl;  
      return 0;
    }
    x+=diffx(move,r);
    y+=diffy(move,r);
    //  cout<<diffx(move,r)<<' '<<diffy(move,r)<<endl;
    r+=rr;
    // cout<<'('<<x<<','<<y<<')'<<endl;  
  } 

}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main(){
	double tot = 0,alfa = 90,x=0,y=0;
	int m,t;
	while(scanf("%d,%d",&m,&t),m || t){
		//alfa += t;
		x += m*cos(alfa*3.1416/180.0);
		y += m*sin(alfa*3.1416/180.0);
		alfa -= t;
	}
	x = (int)x;
	y = (int)y;
	cout<<x<<endl;
	cout<<y<<endl;
	return 0;
}

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

using namespace std;

int main()
{
    double v;

    while (scanf("%lf", &v) != EOF) {
        double ans = (v*v/98);
        if (ans - (int)ans < 0.00000000001) {
            printf("%d\n", (int)ans + 1);
        } else {
            printf("%d\n", (int)ans + 2);
        }

    }

    return 0;
}

C++: #include <cstdio>
#include <cmath>
#define PI 3.14159265358979323846

int correct(int d){
  if(d<0){
    return d+360;
  }else if(d>360){
    return d-360;
  }else{
    return d;
  }
}

int main(){
  double x=0,y=0;
  int l,d,dir=0;

  while(scanf("%d,%d",&l,&d),l){
    x += l*sin(PI*dir/180);
    y += l*cos(PI*dir/180);
    dir = correct(dir+d);
  }

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

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int d, r;
	int w = 0;
	double  x = 0, y = 0;
	char n;
	 

	 while(1){

	 	cin >> d >> n >> r;
	 	
	 	if(d == 0 && n == ',' && r == 0) break;
	 	
	 	x += d * sin(w * M_PI / 180);
	 	y += d * cos(w * M_PI / 180);
	 	w += r;
	 	
	 
	 	
	 }
	 
	 cout << (int)x << endl << (int)y << endl;
	return 0;
}

C++: #include<iostream>
#include<math.h>
#define Pi 3.1415926535898
#define ANGLE (Pi/180.0)
using namespace std;

int main(){
	double x, y;
	int a, b;
	double angle;
	char kanma;
	cin >> a >> kanma >> b;
	angle = 0;
	while(a || b){
		x += a*sin(angle*ANGLE);
		y += a*cos(angle*ANGLE);
		angle += b;
		cin >> a >> kanma >> b;
	}
	cout << (int)(x) << endl;
	cout << (int)(y) << endl;
	return 0;
}