ZhenlongDai/ACPR huggingface dataset:
Problem: p03197
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
ret = "seconde"
for _ in range(N):
    a = int(input())
    if a % 2 != 0:
        ret = "first"
print(ret)


Failing test case input:
3
000010
4214
64578

Expected output:
second


Actual output:
seconde


Fixed submission (verdict: Accepted):
N = int(input())
ret = "second"
for _ in range(N):
    a = int(input())
    if a % 2 != 0:
        ret = "first"
print(ret)

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[int(input()) for i in range(n)]
b=list(set(a))
if len(b)==1 and b[0]==1:
    print("first")
elif sum(a)%2==0:
    if n%2==1:
        print("first")
    else:
        print("second")
else:
    print("first")



Failing test case input:
3
000000
4214
93116

Expected output:
second


Actual output:
first


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(input()) for i in range(n)]
b=list(set(a))
c=0
for i in range(n):
    if a[i]%2==1:
        c+=1
if len(b)==1 and b[0]==1:
    print("first")
elif sum(a)%2==0:
    if c%2==0 and c>=2:
        print("first")
    else:
        print("second")
else:
    print("first")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
ans = min(a)

if ans % 2 == 0:
    print('second')
else:
    print('first')



Failing test case input:
3
001011
2
63165

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):

n = int(input())
a = [0] * n
flag = True
for i in range(n):
    a[i] = int(input())
    if a[i] % 2 == 1:
        flag = False

if not flag:
    print('first')
else:
    print('second')

Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    n = int(input())
    a = list([(int(input())) % 2 for i in range(n)])
    su = sum(a)
    xors = 0
    for i in(a):
        xors ^= i
    if(xors != 0 or su == n):
        print('first')
    else:
        print('second')

main()

Failing test case input:
3
000010
23529
19141

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    a = list([(int(input())) % 2 for i in range(n)])
    ans = sum(a)
    if(ans == 0):
        print('second')
    else:
        print('first')

main()

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(int(input()) for i in range(N))

if sum(a) % 2 == 0:
    print('second')
else:
    print('first')

Failing test case input:
3
000011
30000
29639

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
a = list(int(input()) for i in range(N))

if all(a[i] % 2 == 0 for i in range(N)):
    print('second')
else:
    print('first')
Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(input())%2 for i in range(N)]
if sum(a)%2 == 0:
    print('second')
else:
    print('first')

Failing test case input:
3
001011
4
63165

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(input())%2 for i in range(N)]
if 1 not in a:
    print('second')
else:
    print('first')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = sorted([int(input()) for i in range(N)])

if 1 in A or sum(A) % 2 == 1:
    print('first')
else:
    print('second')


Failing test case input:
3
100110
883
19035

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for i in range(N)]

if [a for a in A if a % 2 == 1]:
    print('first')
else:
    print('second')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=0
for i in range(n):
  if int(input())%2==1:
    print("first")
    a=1
  break
if a==0:
  print("second")

Failing test case input:
3
100110
625
30619

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
n=int(input())
a=0
for i in range(n):
  if int(input())%2==1:
    print("first")
    a=1
    break
if a==0:
  print("second")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a_list = [int(input()) for _ in range(n)]

d = ["second", "first"]

for a in a_list:
  if a % 2 != 0:
    print(d[1])
else:
  print(d[0])

Failing test case input:
3
111110
727
13058

Expected output:
first


Actual output:
first
second


Fixed submission (verdict: Accepted):
n = int(input())
a_list = [int(input()) for _ in range(n)]

d = ["second", "first"]

for a in a_list:
  if a % 2 != 0:
    print(d[1])
    break
else:
  print(d[0])

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = sorted([int(input()) for i in range(N)])

if sum(A) % 2 == 1:
    print('first')
else:
    print('second')


Failing test case input:
3
000010
491
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for i in range(N)]

if [a for a in A if a % 2 == 1]:
    print('first')
else:
    print('second')

Problem: p03197
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())

a=[int(input()) for _ in range(n)]

flag=0
for aa in a:
    if aa%2==1:
        flag=1
if flag=="0":
    print("second")
else:
    print("first")
















Failing test case input:
3
111110
626
13058

Expected output:
second


Actual output:
first


Fixed submission (verdict: Accepted):
n=int(input())

a=[int(input()) for _ in range(n)]

flag=0
for aa in a:
    if aa%2==1:
        flag=1

if flag==0:
    print("second")
else:
    print("first")
Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

        
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    flag = 0
    for i in range(n):
        a = int(input())
        flag &= (a%2 == 1)
    if flag:
        print('first')
    else:
        print('second')

    




                
if __name__ == '__main__':
    main()

Failing test case input:
3
100110
246
19035

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):

        
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    flag = 0
    for i in range(n):
        a = int(input())
        if a%2 == 1:
            print('first')
            return
    print('second')


    




                
if __name__ == '__main__':
    main()

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for k in range(N)]
t = 0
for a in A:
    if a%2 == 0:
        t -= 1
    else:
        t += 1
if t >= 0:
    print("first")
else:
    print("second")


Failing test case input:
3
011110
626
7919

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for k in range(N)]

for a in A:
    if a%2 == 1:
        print("first")
        exit(0)
print("second")

Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        a = int(input().strip())
        A.append(a)
    return N, A


def solve(N, A):
    A.sort()
    if N == 1:
        grundy = A[0] % 2
    elif A[0] > 1:
        grundy = 0
    else:
        grundy = (A[1] - A[0]) % 2
    if grundy:
        return "first"
    else:
        return "second"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Failing test case input:
3
001001
4
46333

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        a = int(input().strip())
        A.append(a)
    return N, A


def solve(N, A):
    grundy = any([a % 2 != 0 for a in A])
    if grundy:
        return "first"
    else:
        return "second"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
tmp = 0
nim = 1
for i in range(N):
	A[i] -=tmp
	if A[i] >= 2:
		tmp += A[i]
		continue
	else:
		nim = 0
		break

if nim == 1:
	print('second')
else:
	print('first')

Failing test case input:
3
000010
24912
19141

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]

cond = 0
for i in range(N):
	if A[i] % 2 == 1:
		cond = 1
		break

if cond:
	print('first')
else:
	print('second')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    a = [None]*n
    for i in range(n):
        a[i] = int(input())
    a.sort(reverse=True)
    if a[0] % 2 == 1 or sum(a) % 2 == 1:
        print("first")
    else:
        print("second")

if __name__ == "__main__":
    main()


Failing test case input:
3
100110
625
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    f = False
    for i in range(n):
        a = int(input())
        if a%2 == 1:
            f = True
    if f:
        print("first")
    else:
        print("second")

if __name__ == "__main__":
    main()

Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    n = int(input())
    a = list([int(input()) for i in range(n)])
    ans = sum(a)
    if(ans % 2 == 0 and n != ans):
        print('second')
    else:
        print('first')

main()

Failing test case input:
3
000010
491
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    a = list([(int(input())) % 2 for i in range(n)])
    ans = sum(a)
    if(ans == 0):
        print('second')
    else:
        print('first')

main()

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for n in range(N)]

win = 1
for i in range(N-1):
    if A[i] % 2 == win:
        win = 0
    else: win = 1
if A[-1] % 2 == win: print("first")
else: print("second")

Failing test case input:
3
010000
8221
62387

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input())%2 for n in range(N)] 
 
for i in range(N):
    if A[i] == 1:
        print("first")
        break
else: print("second")
Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        a = int(input().strip())
        A.append(a)
    return N, A


def solve(N, A):
    grundy = sum(A) % 2
    if grundy:
        return "first"
    else:
        return "second"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Failing test case input:
3
000001
30000
29639

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = []
    for i in range(N):
        a = int(input().strip())
        A.append(a)
    return N, A


def solve(N, A):
    grundy = any([a % 2 != 0 for a in A])
    if grundy:
        return "first"
    else:
        return "second"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]

f="first"
s="second"

if sum(a)==n or sum(a)==n+1:
    print(f)
    exit()

if sum(a)%2:
    print(f)
else:
    print(s)

Failing test case input:
3
100110
883
19035

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]

f="first"
s="second"
for i in range(n):
    if a[i]%2==1:
        print(f)
        break
else:
    print(s)

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

A = [int(input()) for _  in range(N)]

A.sort()

xor_val =  0

last = 0
for a in A:
    num = a-last
    if num%2:
        xor_val = xor_val ^ num

if xor_val:
    print("first")
else:
    print("second")

Failing test case input:
2
3
3

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())

A = [int(input()) for _  in range(N)]

A.sort()

xor_val =  0

last = 0
for i,a in enumerate(A):
    if i< N -1 and A[i]==A[i+1]:
        continue
    num = a-last
    if num%2:
        xor_val = xor_val ^ num

if xor_val:
    print("first")
else:
    print("second")
Problem: p03197
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
print('first' if any(x%2 for x in a) else 'second')

Failing test case input:
3
011010
613
9926

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
a = list(range(N))
for i in range(N):
	a[i] = int(input())
print('first' if any(x%2 for x in a) else 'second')

Problem: p03197
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
A_sum=0
for i in range(N):
    A_sum+=int(input())
    A_sum%=2

if A_sum:
    print("first")
else:
    print("second")

Failing test case input:
3
001010
491
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N=int(input())
flag=False
for i in range(N):
    a=int(input())
    flag|=a%2



if flag:
    print("first")
else:
    print("second")

Problem: p03197
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]

if all([int(a % 2 == 0) for a in A]):
    print("first")
else:
    print("second")


Failing test case input:
3
111110
626
7919

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) % 2 == 0 for _ in range(N)]

if all(A):
    print("second")
else:
    print("first")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = list(int(input()) for _ in range(n))

flg = False
for i in range(n):
    if A[i]%2==0:
        flg = True
        break
if flg:
    print('second')
else:
    if (sum(A)-1)%2==0:
        print('first')
    else:
        print('second')

Failing test case input:
3
000000
24912
40529

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
n = int(input())
A = list(int(input()) for _ in range(n))

flg = False
for i in range(n):
    if A[i]%2==1:
        flg = True
        break
if flg:
    print('first')
else:
    print('second')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]

odd_flag = False
for a in range(N):
    if a % 2 == 1:
        odd_flag = True
        break

if odd_flag:
    print("first")
else:
    print("second")


Failing test case input:
3
100110
2
34268

Expected output:
second


Actual output:
first


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]

odd_flag = False
for a in A:
    if a % 2 == 1:
        odd_flag = True
        break

if odd_flag:
    print("first")
else:
    print("second")

Problem: p03197
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a=[]
x=0
for i in range(n):
    x^=int(input())%2

if x==1:
    print('first')
else:
    print('second')

Failing test case input:
3
001001
4
46333

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
x=0
for i in range(n):
    x|=int(input())%2

if x==1:
    print('first')
else:
    print('second')
Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
even = 0
A = []

for i in range(N):
    a = int(input())
    if not a%2:
        even += 1
    A.append(a)

if N == 1:
    print("sfeicrosntd"[(A[0]%2)::2])
elif N == 2:
    print("second")
else:
    if even == N:
        print("second")
    else:
        print("first")

Failing test case input:
2
6
3

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
even = 0
A = []

for i in range(N):
    a = int(input())
    if not a%2:
        even += 1
    A.append(a)

if N == 1:
    print("sfeicrosntd"[(A[0]%2)::2])
elif sum(A) == N:
    print("first")
else:
    if even == N:
        print("second")
    else:
        print("first")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

for _ in range(n):
    if int(input())%2 == 0:
        print("second")
        exit()
else:
    print("first")


Failing test case input:
3
011010
7813
7919

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
n = int(input())

for _ in range(n):
    if int(input())%2 == 1:
        print("first")
        exit()
else:
    print("second")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())





A=[]
for i in range(N):
  a=int(input())
  A.append(a)

if sum(A)%2==1:
  print("first")
else:
  print("second")



Failing test case input:
3
000110
729
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N=int(input())





ok=False
for i in range(N):
    a=int(input())
    if a%2==1:
        ok=True
if ok:
    print("first")
else:
    print("second")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

num = 0
for i in range(N):
    num ^= A[i] % 2

if num % 2:
    print("first")
else:
    print("second")

Failing test case input:
3
100110
883
19035

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
n = int(input())
flag = False
for i in range(n):
    a = int(input())
    if a % 2 != 0:
        flag = True

if flag:
    print("first")
else:
    print("second")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = [int(readline()) for i in range(n)]
if sum(a) % 2 == 1 or len(set(a)) == 1:
    print('first')
else:
    print('second')


Failing test case input:
3
001010
613
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
print('second' if all(int(readline()) % 2 == 0 for i in range(n)) else 'first')
Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]
print('first' if all(A[i] % 2 == 0 for i in range(N)) else 'second')

Failing test case input:
3
000110
491
19247

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]
print('second' if all(A[i] % 2 == 0 for i in range(N)) else 'first')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
arr=[int(input()) for _ in range(n)]
cnt=0
flag1=10**10
for i in range(n):
  if arr[i]==1:
    cnt+=1
  else:
    flag1=min(flag1,arr[i])
flag2=sum(arr)-cnt-flag1*(n-cnt)
flag1=flag1%2
flag2=flag2%2
if cnt==0:
  if flag1+flag2==0:
    print('second')
  else:
    print('first')
else:
  print('first')

Failing test case input:
3
001010
7813
5019

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
n=int(input())
arr=[int(input()) for _ in range(n)]
cnt=0
flag=0
for i in range(n):
  if arr[i]==1:
    cnt+=1
  else:
    if arr[i]%2==1:
      flag=1
if cnt==0:
  if flag==0:
    print('second')
  else:
    print('first')
else:
  print('first')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
aList = [int(input()) for _ in range(N)]

ans = "fisrt"
for a in aList:
    if a % 2 == 1:
        break
else:
    ans = "second"

print(ans)

Failing test case input:
3
100011
24068
19141

Expected output:
first


Actual output:
fisrt


Fixed submission (verdict: Accepted):
N = int(input())
aList = [int(input()) for _ in range(N)]

ans = "first"
for a in aList:
    if a % 2 == 1:
        break
else:
    ans = "second"

print(ans)

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    s += a[i]
    
re = 'first'
if s % 2 == 0:
    re ='second'
    
print(re)

Failing test case input:
2
3
3

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
a = []
s = 0
for i in range(N):
    a.append(int(input()))
    if a[i] % 2 == 0:
        s += 1
        
if s == N:
    re = 'second'
else:
    re = 'first'
    
print(re)

Problem: p03197
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
a=[int(i) for i in range(N)]
for i in a:
  if i%2==1:
    print("First")
    exit()
print("Second")

Failing test case input:
3
101001
4
46333

Expected output:
first


Actual output:
First


Fixed submission (verdict: Accepted):
N=int(input())
a=[int(input()) for i in range(N)]
for i in a:
  if i%2==1:
    print("first")
    exit()
print("second")
Problem: p03197
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())

p=0
q=0

for _ in range(N):
    a=int(input())
    if a>=p:
        q=p
        p=a

if p==1:
    print('first')
elif (p-q)%2==0:
    print('second')
else:
    print('first')



Failing test case input:
3
000010
24068
19141

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N=int(input())

flag=False
for _ in range(N):
    a=int(input())
    if a%2==1:
        flag=True
if flag:
    print('first')
else:
    print('second')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for i in range(n)]
for i in a:
    if i%2==1:
        print('frist')
        exit()
print('second')

Failing test case input:
3
100110
246
19035

Expected output:
first


Actual output:
frist


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for i in range(N)]
 
ok = 1
for a in A:
    if a % 2 == 1:
        ok = 0
print(["first", "second"][ok])

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(int(input()) for i in range(n))

for i in range(n):
    if a[i]%2==1:
        print('First')
        exit()
print('Second')



Failing test case input:
3
111010
244
13058

Expected output:
second


Actual output:
Second


Fixed submission (verdict: Accepted):
n=int(input())
a=list(int(input()) for i in range(n))

for i in range(n):
    if a[i]%2==1:
        print('first')
        exit()
print('second')

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
As = [int(input()) for i in range(N)]




cnt = 0
add = 0
for a in As:
    if a >= 2:
        add += a-2
        


if add % 2 == 0:
    print("first")
else:
    print("second")

Failing test case input:
3
000000
4214
93116

Expected output:
second


Actual output:
first


Fixed submission (verdict: Accepted):
N = int(input())
As = [int(input()) for i in range(N)]

cnt = 0
for a in As:
    if a % 2 == 0:
        cnt += 1
if cnt == N:
    print("second")
else:print("first")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = sum([int(readline()) for i in range(n)])
if a % 2 == 1:
    print('first')
else:
    print('second')


Failing test case input:
3
010000
41819
40529

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
print('second' if all(int(readline()) % 2 == 0 for i in range(n)) else 'first')
Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]

odd_flag = False
for a in A:
    if a % 2 == 1:
        odd_flag = True
        break

if odd_flag:
    print("first")
else:
    print("No")


Failing test case input:
3
011010
244
13058

Expected output:
second


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]

odd_flag = False
for a in A:
    if a % 2 == 1:
        odd_flag = True
        break

if odd_flag:
    print("first")
else:
    print("second")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[int(input()) for i in range(n)]
b=list(set(a))
c=0
for i in range(n):
    if a[i]%2==1:
        c+=1
if len(b)==1 and b[0]==1:
    print("first")
elif sum(a)%2==0:
    if c%2==0:
        print("first")
    else:
        print("second")
else:
    print("first")



Failing test case input:
3
011010
346
13058

Expected output:
second


Actual output:
first


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(input()) for i in range(n)]
b=list(set(a))
c=0
for i in range(n):
    if a[i]%2==1:
        c+=1
if len(b)==1 and b[0]==1:
    print("first")
elif sum(a)%2==0:
    if c%2==0 and c>=2:
        print("first")
    else:
        print("second")
else:
    print("first")

Problem: p03197
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]
print('first' if sum(A) % 2 == 1 else 'second')

Failing test case input:
3
001001
4
63165

Expected output:
first


Actual output:
second


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]
print('second' if all(A[i] % 2 == 0 for i in range(N)) else 'first')
Problem: p03570
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
n = len(s)
cA = ord('a')
P = {0: -1}
cur = 0

dp = [10**18]*(n+1)
dp[-1] = 0

for i in range(n):
    c = ord(s[i]) - cA
    dp[i] = dp[i-1] + 1
    cur ^= 1 << c
    
    if cur in P:
        dp[i] = min(dp[i], P[cur] + 1)
    
    for k in range(26):
        need = cur ^ (1 << k)
        if need in P:
            dp[i] = min(dp[i], P[need] + 1)
    P[cur] = min(P.get(cur, 10**18), dp[i])
print(dp[n-1])

Failing test case input:
aabwyzzz

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
s = input()
n = len(s)
cA = ord('a')
P = {0: 0}
cur = 0

dp = [10**18]*(n+1)
dp[-1] = 0

for i in range(n):
    c = ord(s[i]) - cA
    dp[i] = dp[i-1] + 1
    cur ^= 1 << c
    
    if cur in P:
        dp[i] = min(dp[i], P[cur] + 1)
    
    for k in range(26):
        need = cur ^ (1 << k)
        if need in P:
            dp[i] = min(dp[i], P[need] + 1)
    P[cur] = min(P.get(cur, 10**18), dp[i])
print(dp[n-1])

Problem: p03570
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import defaultdict
s = input()
n = len(s)
dp = defaultdict(int)
dp[0] = 1
ls = [1<<(ord(s[0])-97)]
for i in range(1,n):
  ls.append(ls[-1]^(1<<(ord(s[i])-97)))
for i in range(n):
  for b in range(26):
    bit = 1<<b
    if dp[ls[i]^bit] == 0:
      continue
    if dp[ls[i]] == 0:
      dp[ls[i]] = dp[ls[i]^bit]+1
    else:
      dp[ls[i]] = min(dp[ls[i]^bit]+1,dp[ls[i]])
print(dp[ls[n-1]]-1)

Failing test case input:
ebyeyb

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
from collections import defaultdict
s = input()
n = len(s)
dp = defaultdict(int)
dp[0] = 1
ls = [1<<(ord(s[0])-97)]
for i in range(1,n):
  ls.append(ls[-1]^(1<<(ord(s[i])-97)))
if ls[-1] == 0:
  print(1)
  exit()
for i in range(n):
  for b in range(26):
    bit = 1<<b
    if dp[ls[i]^bit] == 0:
      continue
    if dp[ls[i]] == 0:
      dp[ls[i]] = dp[ls[i]^bit]+1
    else:
      dp[ls[i]] = min(dp[ls[i]^bit]+1,dp[ls[i]])
print(dp[ls[n-1]]-1)
Problem: p03570
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
N = len(S)

def ctoi(c):
    return ord(c) - ord('a')

cums = [0]
for c in S:
    cums.append(cums[-1] ^ (1<<ctoi(c)))
if cums[-1] == 0:
    print(1)
    exit()

dp = {0:0}
for b in cums:
    if b in dp: continue
    for k in range(26):
        if b&(1<<k)==0: continue
        msk = b^(1<<k)
        if msk in dp:
            if b in dp:
                dp[b] = min(dp[b], dp[msk]+1)
            else:
                dp[b] = dp[msk]+1
last = cums[-1]
print(dp[last] if last in dp else N)

Failing test case input:
arroikqxuxfxmvcxecjmjetogf

Expected output:
12


Actual output:
26


Fixed submission (verdict: Accepted):
def ctoi(c):
    return ord(c) - ord('a')

def solve(s):
    masks = [1<<k for k in range(26)]
    cums = [0]
    for c in s:
        cums.append(cums[-1] ^ masks[ctoi(c)])
    if cums[-1] == 0:
        print(1)
        exit()

    dp = {0:0}
    for b in cums:
        for m in masks:
            msk = b^m
            if msk in dp:
                if b in dp:
                    dp[b] = min(dp[b], dp[msk]+1)
                else:
                    dp[b] = dp[msk]+1
    return dp[cums[-1]]

print(solve(input()))
Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-7):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-7):
        y=round(y)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Failing test case input:
56,75
97,53
64,-4
65,76
42,-27
43,80
77,-86
56,-4
89,44
85,5
0,0

Expected output:
115
-314


Actual output:
115
-315


Fixed submission (verdict: Accepted):
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-7):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-7):
        y=round(y)
    sum_a += A[i]
if x >= 0:
    print(floor(x))
else:
    print(floor(x)+1)
if y >= 0:
    print(floor(y))
else:
    print(floor(y)+1)

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import sin,cos,pi
x = 0
y = 0
ca = 90
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca*pi/180)
        y += d*sin(ca*pi/180)
        ca -= a
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y))

Failing test case input:
56,65
97,54
64,-4
65,75
42,-27
43,80
77,-86
55,-6
89,34
95,5
0,0

Expected output:
195
-302


Actual output:
196
-302


Fixed submission (verdict: Accepted):
from math import sin,cos,pi
x = 0
y = 0
ca = 90
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca*pi/180)
        y += d*sin(ca*pi/180)
        ca -= a
    else:
        break

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

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print("{:.0f}".format(xstep))
print("{:.0f}".format(ystep))

Failing test case input:
56,65
97,54
64,-4
55,76
42,-27
43,80
87,-76
55,-6
89,34
5,59
0,0

Expected output:
156
-221


Actual output:
-221
157


Fixed submission (verdict: Accepted):
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print(int(ystep))
print(int(xstep))
Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(*map(int,(x,y)),sep=',')


Failing test case input:
56,75
97,53
64,-4
65,77
42,-27
43,80
77,-86
56,-4
89,44
85,5
0,0

Expected output:
109
-313


Actual output:
109,-313


Fixed submission (verdict: Accepted):
import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(*map(int,(x,y)),sep='\n')

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = pi / 2

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    treasure_x += d * cos(angle)
    treasure_y += d * sin(angle)

    angle += a * 2 * pi / 180


print(int(treasure_x))
print(int(treasure_y))

Failing test case input:
56,65
97,55
65,-4
65,76
42,-27
348,0
77,-86
55,-6
89,34
85,5
0,0

Expected output:
524
-403


Actual output:
205
132


Fixed submission (verdict: Accepted):
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = pi / 2

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    treasure_x += d * cos(angle)
    treasure_y += d * sin(angle)

    angle -= a * pi / 180

print(int(treasure_x))
print(int(treasure_y))

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import math as m
x,y,d=0,0,90
while True:
    r,t=map(int,input().split(","))
    if (r,t)==(0,0):
        break
    x+=r*m.cos(m.radians(d))
    y+=r*m.sin(m.radians(d))
    d-=t
print(int(m.sqrt(x**2+y**2)))
print(d)

Failing test case input:
56,65
97,45
64,-5
55,76
42,-26
43,80
87,-86
54,-6
89,44
59,5
0,0

Expected output:
221
-245


Actual output:
330
-102


Fixed submission (verdict: Accepted):

import math as m
x,y,d=0,0,90
while True:
    r,t=map(int,input().split(","))
    if (r,t)==(0,0):
        break
    x+=r*m.cos(m.radians(d))
    y+=r*m.sin(m.radians(d))
    d-=t
print(int(x))
print(int(y))

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import math
x=0
y=0
angle=0
while True:
    r,c=map(int, input().split(","))
    if r == c == 0:
        break

    x += r*math.cos(-angle)
    y += r*math.sin(-angle)
    angle += c

print(x)
print(y)

Failing test case input:
56,65
46,79
64,-3
57,64
42,-27
43,80
77,-86
54,-6
89,34
55,9
0,0

Expected output:
33
-309


Actual output:
-35.195958730888634
-97.50068384740283


Fixed submission (verdict: Accepted):
import math
x=0
y=0
angle=0
while True:
    r,c=map(int, input().split(","))
    if r == c == 0:
        break

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


print(int(-x))
print(int(y))
Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import sin,cos,pi
x = 0
y = 0
ca = pi/2
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca)
        y += d*sin(ca)
        ca -= a*pi/180
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y))

Failing test case input:
56,65
97,54
64,-5
55,76
42,-26
43,80
87,-86
55,-6
89,34
95,5
0,0

Expected output:
172
-301


Actual output:
173
-301


Fixed submission (verdict: Accepted):
from math import sin,cos,pi
x = 0
y = 0
ca = 90
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca*pi/180)
        y += d*sin(ca*pi/180)
        ca -= a
    else:
        break

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

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 


print("{:.0f}".format(ystep))
print("{:.0f}".format(xstep))

Failing test case input:
56,65
97,64
64,-4
67,54
42,-27
43,80
77,-86
55,-6
89,34
95,5
0,0

Expected output:
250
-317


Actual output:
251
-317


Fixed submission (verdict: Accepted):
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print(int(ystep))
print(int(xstep))

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import math as mas

x,y,d=0,0,90
for t in sys.stdin:
	a,b=map(int,t.split(','))
	if a==b==0:break
	x+=a*mas.cos(mas.radians(d))
	y+=a*mas.sin(mas.radians(d))
	d-=b
print(x)
print(y)




Failing test case input:
76,55
97,44
64,-4
55,76
42,-27
43,80
77,-86
56,-4
89,44
85,5
0,0

Expected output:
280
-203


Actual output:
280.27584275003886
-203.21718847104717


Fixed submission (verdict: Accepted):
import sys
import math as mas

x,y,d=0,0,90
for t in sys.stdin:
	a,b=map(int,t.split(','))
	if a==b==0:break
	x+=a*mas.cos(mas.radians(d))
	y+=a*mas.sin(mas.radians(d))
	d-=b
print(int(x))
print(int(y))
Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import itertools
import math

curdeg = 90
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += -step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print("{:.0f}".format(xstep))
print("{:.0f}".format(ystep))

Failing test case input:
56,65
97,54
64,-4
67,56
42,-27
43,80
77,-86
55,-6
43,98
95,5
0,0

Expected output:
178
-224


Actual output:
179
-225


Fixed submission (verdict: Accepted):
import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print(int(ystep))
print(int(xstep))

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(map(int,(x,y)),sep=',')


Failing test case input:
56,66
97,54
64,-4
65,76
42,-27
34,80
77,-86
55,-6
89,34
85,5
0,0

Expected output:
182
-286


Actual output:
<map object at 0x7f0189b65210>


Fixed submission (verdict: Accepted):
import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(*map(int,(x,y)),sep='\n')

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == 0 and t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print("{} {}".format(int(math.modf(x)[1]), int(math.modf(y)[1])))


Failing test case input:
46,65
97,64
64,-4
67,54
42,-27
43,80
77,-86
55,-6
89,34
9,55
0,0

Expected output:
241
-241


Actual output:
241 -241


Fixed submission (verdict: Accepted):
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print(int(x))
print(int(y))
Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = 90

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    radian_a = a * 2 * pi / 180

    treasure_x += d * cos(radian_a)
    treasure_y += d * sin(radian_a)

print(int(treasure_x))
print(int(treasure_y))

Failing test case input:
56,65
97,54
65,-4
65,76
42,-27
34,80
77,-86
55,-6
89,34
5,58
0,0

Expected output:
197
-204


Actual output:
-57
199


Fixed submission (verdict: Accepted):
from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = pi / 2

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    treasure_x += d * cos(angle)
    treasure_y += d * sin(angle)

    angle -= a * pi / 180

print(int(treasure_x))
print(int(treasure_y))

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x += D[i] * cos(-sum_a * pi / 180)
    y += D[i] * sin(-sum_a * pi / 180)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Failing test case input:
56,65
46,79
64,-4
57,64
42,-27
43,80
77,-86
55,-6
89,34
55,9
0,0

Expected output:
39
-310


Actual output:
39
-311


Fixed submission (verdict: Accepted):
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-7):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-7):
        y=round(y)
    sum_a += A[i]
if x >= 0:
    print(floor(x))
else:
    print(floor(x)+1)
if y >= 0:
    print(floor(y))
else:
    print(floor(y)+1)

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print("{} {}".format(int(x), int(y)))


Failing test case input:
56,65
46,79
64,-3
57,64
42,-27
43,80
77,-86
54,-6
89,34
55,9
0,0

Expected output:
33
-309


Actual output:
33 -309


Fixed submission (verdict: Accepted):
import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print(int(x))
print(int(y))
Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import radians
from cmath import rect

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

Failing test case input:
56,65
97,54
64,-4
65,76
42,-27
43,80
77,-86
54,-6
43,98
5,58
0,0

Expected output:
173
-167


Actual output:
-173 -167


Fixed submission (verdict: Accepted):
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))

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import sin,cos,pi
x = 0
y = 0
ca = pi/2
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca)
        y += d*sin(ca)
        ca -= a*pi/180
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y),end="")

Failing test case input:
56,65
97,54
64,-4
55,76
42,-27
43,80
77,-86
55,-6
89,34
95,5
0,0

Expected output:
180
-297


Actual output:
181
-298

Fixed submission (verdict: Accepted):
from math import sin,cos,pi
x = 0
y = 0
ca = 90
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca*pi/180)
        y += d*sin(ca*pi/180)
        ca -= a
    else:
        break

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

Problem: p00016
Buggy submission (Python3, verdict: Wrong Answer):
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-5):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-5):
        y=round(y)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Failing test case input:
56,65
97,54
64,-4
65,76
42,-27
43,80
77,-86
55,-6
89,34
85,5
0,0

Expected output:
190
-291


Actual output:
190
-292


Fixed submission (verdict: Accepted):
from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-7):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-7):
        y=round(y)
    sum_a += A[i]
if x >= 0:
    print(floor(x))
else:
    print(floor(x)+1)
if y >= 0:
    print(floor(y))
else:
    print(floor(y)+1)