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>

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

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define PI 3.141592

int main(){

	int a,b; int c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*PI/180);
	y+=a*sin(c*PI/180);
	c+=-b;

	}

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

	return 0;

    }

C++: /*Filename: aoj0016.cpp
 *Author: Mushiyo
 */

#include <stdio.h>
#include <cmath>

using namespace std;

int main() {
	double x = 0, y = 0;
	int direction = 90;
	int d = 0, t = 0;

	while (scanf("%d, %d", &d, &t) == 2) {
		if (d == 0 && t == 0) {
			break;
		}

		double dx = d * cos(direction * M_PI / 180.0);
		double dy = d * sin(direction * M_PI / 180.0);

		x += dx;
		y += dy;

		direction -= t;
		direction %= 360;
		if (direction < 0) {
			direction += 360;
		}
	}

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

	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <complex>
using namespace std;
const double PI = 3.141592653589793238462643383279502884L;

int main(int argc, char **argv)
{
  int degree = 90;
  int d, t;
  char c;
  complex<double> v(0, 0);

  while (cin >> d >> c >> t) {
    if (!d && !t)
      break;

    auto next = polar((double)d, degree*PI/180.0);
    v += next;
    degree = (degree - t) % 360;
  }
  printf("%d\n%d\n", (int)v.real(), (int)v.imag());
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}

using namespace std;
int main() {
    double x=0,y=0,theta=0;
    double a,b;
    scanf("%lf,%lf",&a,&b);
    while(a||b){
        y += a*cos(rad(theta));
        x += a*sin(rad(theta));
        theta += b;
        scanf("%lf,%lf",&a,&b);
    }
    x = (abs(x)<0.5)?0:x;
    y = (abs(y)<0.5)?0:y;
    printf("%.0lf %.0lf",x,y);
    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;
		printf("%d\n",cos(kakudos * M_PI / 180) * hosu);
		kakudos -= kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	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);
        printf("%d%d\n",a,b);
        
        y+=(a*sin(degree* M_PI / 180));
        x+=(a*cos(degree* M_PI / 180));
        
        degree-=b;
    }
    
    cout<<(int)x<<" "<<(int)y;
    
    return 0;
}