Problem:
Treasure Hunt When a boy was cleaning up after his grand father passing, he found an old paper:     In addition, other side of the paper says that "go ahead a number of steps equivalent to the first integer, and turn clockwise by degrees equivalent to the second integer".  His grand mother says that Sanbonmatsu was standing at the center of town. However, now buildings are crammed side by side and people can not walk along exactly what the paper says in. Your task is to write a program which hunts for the treature on the paper.  For simplicity, 1 step is equivalent to 1 meter. Input consists of several pairs of two integers d (the first integer) and t (the second integer) separated by a comma. Input ends with "0, 0". Your program should print the coordinate ( x , y ) of the end point. There is the treature where x meters to the east and y meters to the north from the center of town.  You can assume that d ≤ 100 and -180 ≤ t ≤ 180.  Input  A sequence of pairs of integers d and t which end with " 0,0 ".  Output  Print the integer portion of x and y in a line respectively.  Sample Input  56,65
97,54
64,-4
55,76
42,-27
43,80
87,-86
55,-6
89,34
95,5
0,0  Output for the Sample Input  171
-302

Solution (Python):
import math
x = 0.0
y = 0.0
theta = 90.0
while True:
    m, r = map(int, raw_input().split(","))
    if m == 0 and r == 0:
        break
    rad = theta/180*math.pi
    x += m*math.cos(rad)
    y += m*math.sin(rad)
    theta += -r
    
print int(x)
print int(y)

Solution (Python):
from math import sin,cos,pi
pos = [0,0]
d = 0
cmd = map(int, raw_input().split(','))
while cmd != [0,0]:
    pos[0] += cmd[0]*sin(pi*d/180)
    pos[1] += cmd[0]*cos(pi*d/180)
    d += cmd[1]
    cmd = map(int, raw_input().split(','))
for c in map(int, pos):
    print c

Solution (Python):
import math
x=0
y=0
theta=90
while 1:
    a,b=map(float,raw_input().split(','))
    if a==0 and b==0:break
    r=math.radians(theta)
    x+=a*math.cos(r)
    y+=a*math.sin(r)
    theta-=b
print int(x)
print int(y)

Solution (Python):
from math import cos, sin, radians

x, y, d = 0, 0, 90
while 1:
    a, b = map(int, raw_input().split(','))
    if a == b == 0:
        break
    x += a * cos(radians(d))
    y += a * sin(radians(d))
    d = (d - b) % 360
print int(x)
print int(y)

Solution (Python):
import math
x, y, a = 0, 0, math.radians(90)
while True:
    p, q = map(int, raw_input().split(','))
    if p == 0 and q == 0:
        break
    x += math.cos(a) * p
    y += math.sin(a) * p
    a -= math.radians(q)
print int(x)
print int(y)

Solution (Python):
from math import radians
from cmath import rect

z = 0
deg = 90
while True:
    r, d = map(float, input().split(','))
    if r == d == 0: break
    z += rect(r, radians(deg))
    deg -= d
print(int(z.real))
print(int(z.imag))

Solution (Python):
import sys
import math

def readnums():
    for line in sys.stdin:
        yield map(int,line.split(','))

[x,y] = [0.0,0.0]
degree = 90
for [steps,delta_d] in readnums():
    if steps == 0 and degree == 0:
        break
    phi = math.radians(degree)
    x += steps*math.cos(phi)
    y += steps*math.sin(phi)
    degree -= delta_d
print int(x)
print int(y)

Solution (Python):
import math

A = 90
North = 0
East = 0
while True:
    d, a = map(int, input().split(','))
    if d==0 and a==0:
        break
    North += d * math.sin(math.radians(A))
    East += d * math.cos(math.radians(A))
    A -= a

print(int(East))
print(int(North))

Solution (Python):
import math
posx = 0
posy = 0
s = math.radians(90)

while True:
    lst = list(map(int, input().split(",")))
    if lst == [0, 0]:
        break
    
    n = lst[0]
    movex = n* math.cos(s)
    movey = n* math.sin(s)

    posx = posx + movex
    posy = posy + movey

    s = s - math.radians(lst[1])

print(int(posx))
print(int(posy))

Solution (Python):
from math import radians, cos, sin, ceil, floor
g = 90
x = y = 0
while 1:
    d, a = map(int, input().split(","))
    if d == 0:
        break
    t = radians(g)
    x += cos(t) * d
    y += sin(t) * d
    g -= a
x = floor(x) if x > 0 else ceil(x)
y = floor(y) if y > 0 else ceil(y)
print("%d" % x)
print("%d" % y)

Solution (Python):
import math

x = y = 0

totalAngle = 90
while(1):
    try:
        num,angle = (int(x) for x in input().split(","))
        if num == 0:break
        rad = math.radians(totalAngle)
        y += math.sin(rad) * num
        x += math.cos(rad) * num
        
        totalAngle -= angle
    except EOFError:
        break
print(int(x))
print(int(y))

Solution (Python):
import sys
import math

x,y,t = 0,0,0

for s in sys.stdin:
    a,b = map(int,s.split(','))
    if a==0 and b==0:
        break
    x += a*math.sin(math.radians(t))
    y += a*math.cos(math.radians(t))
    t += b

print(int(x))
print(int(y))

Solution (Python):
from math import *
x = 0
y = 0
a = 0

while True:
    l, r = [int(i) for i in input().split(",")]
    if l == 0 and r == 0:
        break
    
    x += l * sin(radians(a))
    y += l * cos(radians(a))
    
    a = (a+r)%360

print(int(x))
print(int(y))

Solution (Python):
import sys
import math
N=[]
for l in sys.stdin:
  a=list(map(int,l.split(",")))
  N.append(a)
  
x=0
y=0
n=90

for d in N:
  if d[0]==0 and d[1]==0:
    break
  x=x+d[0]*math.cos(math.radians(n))
  y=y+d[0]*math.sin(math.radians(n))
  
  n-=d[1]

print(int(x), int(y), sep="\n")

Solution (Python):
import math
x, y, now = 0, 0, 90
while 1:
    d, a = map(float, input().split(','))
    if d == 0 and a == 0:
        break
    x += d*math.cos(now * math.pi / 180)
    y += d*math.sin(now * math.pi / 180)
    now -= a

print(int(x))
print(int(y))

Solution (Python):
import math
X = Y = a = 0
while True:
    x,y = map(int,input().split(','))
    if x == y == 0:
        break
    r = a * math.pi / 180
    X += x*math.sin(r)
    Y += x*math.cos(r)
    a+=y
print(*map(int,(X,Y)),sep='\n')

Solution (Python):
import math

if __name__ == '__main__':

	x = y = 0
	deg = 90

	while True:

		d,a = map(int,input().split(","))
		if d == 0 and a == 0:
			break

		x += math.cos(math.radians(deg)) * d
		y += math.sin(math.radians(deg)) * d

		deg -= a

	print(int(x))
	print(int(y))

Solution (Python):
import math
x,y=0,0
angle=math.pi/2
while True:
    d,a=map(int,input().split(","))
    if (d,a)==(0,0):
        break
    y +=math.cos(angle)*d
    x +=math.sin(angle)*d
    angle -=a*math.pi/180
print(int(y))
print(int(x))

Solution (Python):
import sys, cmath, math
t = complex(0)
a = math.pi/2
for line in sys.stdin:
    l = list(map(int, line.split(",")))
    if l == [0, 0]:
        break
    t += cmath.rect(l[0], a)
    a -= l[1]*math.pi/180
print(int(t.real))
print(int(t.imag))

Solution (Python):
import math
x=0
y=0
face=math.pi/2
while True:
  d,a = map(int,input().split(","))
  if d==0 and a==0:
    break
  x+=math.cos(face)*d
  y+=math.sin(face)*d
  face -=a*math.pi/180
  
  
print(int(x))
print(int(y))

Solution (Python):
import math

PI = 4.0 * math.atan(1.0)
x = 0
y = 0
angle = 90.0 * PI / 180.0
while True:
  a,b = map(int, input().split(','))
  if a == 0 and b == 0:
    print(int(x))
    print(int(y))
    break
  x += a*math.cos(angle)
  y += a*math.sin(angle)
  angle -= b * PI / 180.0

Solution (Python):
deg = 0.0
x = 0.0
y = 0.0
from math import pi, cos,sin
while(1):
    a,b = [int(i) for i in input().split(",")]
    if a == 0.0 and b==0.0:
        print(int(y))
        print(int(x))
        break
    else:
        x += a*cos(deg*pi/180)
        y += a*sin(deg*pi/180)
        deg += b

Solution (Python):
import math

class Pos():
    x = 0
    y = 0
    direction = math.radians(90)

cur_pos = Pos()

while True:
    d, a = [int(i) for i in input().split(",")]
    if d == 0 and a == 0:
        break
    cur_pos.x += d * math.cos(cur_pos.direction)
    cur_pos.y += d * math.sin(cur_pos.direction)
    cur_pos.direction -= math.radians(a)
    
print(int(cur_pos.x))
print(int(cur_pos.y))

Solution (Python):
import math

x = 0
y = 0
angle = math.pi / 2

while(1):
    d, a = map(int, input().split(","))
    if d == 0 and a == 0:
        break

    x += math.cos(angle) * d
    y += math.sin(angle) * d
    angle -= a * math.pi / 180

print(int(x))
print(int(y))

Solution (Python):
import math

if __name__ == '__main__':
    x = 0
    y = 0
    angle = 90

    r, t = map(int, input().split(','))

    while r != 0 or t != 0:
        x = x + r * math.cos(math.radians(angle))
        y = y + r * math.sin(math.radians(angle))
        angle -= t
        r, t = map(int, input().split(','))
    print(int(x))
    print(int(y))

Solution (Python):
from math import sin,cos
x,y,t = 0,0,90
while(True):
    d,a = map(int,input().split(","))
    if d==0 and a==0:
        print(int(x))
        print(int(y))
        break
    x += d*cos(t/180*3.141592)
    y += d*sin(t/180*3.141592)
    t -= a

Solution (Python):
import math

def move(dig):
    rad = math.radians(dig)
    x = math.cos(rad)
    y = math.sin(rad)
    return x,y

def run():
    x, y = 0,0
    dig = 90
    while True:
        r, d = map(int, input().split(','))
        d = -d
        if r == 0 and d == 0:
            break
        _x, _y = move(dig)
        dig += d
        x += r * _x
        y += r * _y

    print(int(x))
    print(int(y))

if __name__ == '__main__':
    run()

Solution (Python):
import math
x = 0
y = 0
shi = 90
while 1:
    a,b = map(int, input().split(","))
    if a == 0 and b == 0:
        break
    else:
        x += a*math.cos(math.radians(shi))
        y += a*math.sin(math.radians(shi))
        shi -= b
print(int(x))
print(int(y))

Solution (Python):

import math
x,y,pd = 0,0,-90
r,d = map(int, input().split(','))
while not (r == 0 and d == 0):
    x += r * math.cos(math.radians(-pd))
    y += r * math.sin(math.radians(-pd))
    pd += d
    r,d = map(int, input().split(','))
print(int(x))
print(int(y))