Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03400 (python)

Fixed submission:

n = int(input())
#日
d,x = input().split()
#合宿終了後のチョコレートの個数





#i人目のA日目に食べた数を数える
num = 0

#配列
a = []

#３人分
for i in range(n):
    a.append(int(input()))
    for j in range(int(d)):
        if a[i]*j +1 <= int(d):
            num += 1
    
    
    
    
            
print(num+int(x))

Buggy submission (verdict: Runtime Error):

n = int(input())
#日
d = int(input())
#合宿終了後のチョコレートの個数
x = int(input())




#i人目のA日目に食べた数を数える
num = 0

#配列
a = []

#３人分
for i in range(n):
    a.append(int(input()))
    for j in range(d):
        if a[i]*j +1 <= d:
            num += 1
    
    
    
    
            
print(num+x)

Buggy submission (verdict: Runtime Error):

n = int(input())
#日
d = int(input())
#合宿終了後のチョコレートの個数
x = int(input())




#i人目のA日目に食べた数を数える
num = 0

#配列
a = []

#３人分
for i in range(n):
    a.append(int(input()))

for i in range(n):
    for j in range(d):
        if a[i]*j +1 <= d:
            num += 1
        
    
    
    
    
            
print(num+x)
Problem p03379 (python)

Fixed submission:
n=int(input())
x=list(map(lambda x:int(x), input().split()))
mi = n//2 - 1
sx=sorted(x)
for item in x:
    if item > sx[mi]:
        print(sx[mi])
    else:
        print(sx[mi+1])

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(lambda x:int(x), input().split()))
mi = n/2
sx=sorted(x)
for item in x:
    if item > sx[mi]:
	print(sx[mi])
    else:
	print(sx[mi+1])
Problem p03407 (python)

Fixed submission:
a,b,c=list(map(lambda x:int(x), input().split()))
print("Yes") if a+b>=c else print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=list(map(lambda x:int(x), input().split()))
 print("Yes") if a+b>=c else print("No")
Problem p03377 (python)

Fixed submission:
A, B, X = map(int, input().split())

if X >= A and X <= A + B:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A, B, X = map(int, raw_input().split())

if X >= A and X <= A + B:
    print('YES')
else:
    print('NO')
Problem p03377 (python)

Fixed submission:
inputs = list(map(int,input().split(" ")))
a = inputs[0]
b = inputs[1]
c = inputs[2]
 
if a + b >= c and a <= c:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
inputs = list(map(int,input()))
a = inputs[1]
b = inputs[2]
c = inputs[3]

if a + b >= c and a <= c:
  print("YES")
else:
  print("NO")
Problem p03377 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    a, b, x = map(int, input().split())
    print ('YES' if (x >= a and x <= a + b) else 'NO')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    n, m, x = map(int, input().split())
    a = list(map(int, input().split()))
    print(min(len([b for b in a if b < x]), len([b for b in a if b > x])))

if __name__ == '__main__':
    main()
Problem p03455 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import sys

def main():
    args = input().split()
    a, b = int(args[0]) ,int(args[1])
    result = 'Even' if ( a * b ) % 2 == 0 else 'Odd'
    print(result)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def main():
    args = sys.argv
    a, b = int(args[1]) ,int(args[2])
    result = 'Even' if ( a * b ) % 2 == 0 else 'Odd'
    print(result)

if __name__ == '__main__':
    main()
Problem p03471 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n, y = map(int, input().split())

    for a in range(n + 1):
        if (a * 10000 > y):
            continue
        for b in range((n + 1) - a):
            c = n - (a + b)
            if ((a * 10000 + b * 5000 + c * 1000) == y):
                print('{} {} {}'.format(a, b, c))
                exit()

    print(-1, -1, -1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    y = int(input())

    for a in range(n + 1):
        if (a * 10000 > y):
            continue
        for b in range((n + 1) - a):
            c = n - (a + b)
            if ((a * 10000 + b * 5000 + c * 1000) == y):
                print('{} {} {}'.format(a, b, c))
                exit()

    print(-1, -1, -1)

if __name__ == '__main__':
    main()
Problem p03493 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
def main():
    input_char_list = list(input())
    count = 0
    for char in input_char_list:
        if char == '1':
            count += 1
    print(count)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    input_char_list = list(raw_input("type 3 digits number using only 0 or 1: "))
    count = 0
    for char in input_char_list:
        if char == '1':
            count += 1
    print(count)

if __name__ == '__main__':
    main()
Problem p03380 (python)

Fixed submission:
N = int(input())
X = [int(d) for d in input().split()]

max_ = max(X)
X.remove(max_)

center = max_/2
abs_ = float('inf')
t_index = None


for i in range(N-1):
	if abs(center - X[i]) < abs_:
		abs_ = abs(center - X[i])
		t_index = i

print(max_,X[t_index])

Buggy submission (verdict: Runtime Error):
def comb1(n, r):
    if n == 0 or r == 0: return 1
    return comb1(n, r-1) * (n-r+1) / r 


N = int(input())
X = [int(d) for d in input().split()]

max_ = 0
comb_ = []

X.sort(reverse=True)
for i,v in enumerate(X):
	for h in range(1,len(X)-i):
		#print(v,X[i+h])
		comb_value = comb1(v,X[i+h])
		if max_<comb_value:
			max_ = comb_value
			comb_ = [v,X[i+h]]


print(comb_[0],comb_[1])
Problem p03407 (python)

Fixed submission:
a, b, c = [int(x) for x in input().split(' ')]

if a + b >= c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
s = []
for i in range(n):
    s.append(input())

m = int(input())
t = []
for i in range(m):
    t.append(input())

ls = Counter(s)
lt = Counter(t)

c = 0
for k in ls.keys():
    c_temp = ls[k] - lt[k]
    if c < c_temp:
        c = c_temp

print(c)
Problem p03458 (python)

Fixed submission:
import numpy as np

def getBoundary(p, k, k2):
    if p - k + 1 >= 0:
        return [(p - k + 1, p + 1)]
    else:
        return [(0, p + 1), ((p - k + 1) % k2, k2)]

n, k = map(int, input().strip().split())
k2 = k * 2
b = [[0 for i in range(k2 + 1)] for j in range(k2 + 1)]

for i in range(n):
    x_str, y_str, c_str = input().strip().split()
    x = int(x_str) % k2
    y = (int(y_str) + (c_str == 'B') * k) % k2
    for xb, xe in getBoundary(x % k2, k, k2):
        for yb, ye in getBoundary(y % k2, k, k2):
            b[xb][yb] += 1
            b[xb][ye] -= 1
            b[xe][yb] -= 1
            b[xe][ye] += 1
    for xb, xe in getBoundary((x + k) % k2, k, k2):
        for yb, ye in getBoundary((y + k) % k2, k, k2):
            b[xb][yb] += 1
            b[xb][ye] -= 1
            b[xe][yb] -= 1
            b[xe][ye] += 1

arr_b = np.array(b)
for i in range(k2):
    arr_b[i + 1] += arr_b[i]
for j in range(k2):
    arr_b[:, j + 1] += arr_b[:, j]
print(arr_b.max())

Buggy submission (verdict: Runtime Error):
import time

nk = [int(x) for x in raw_input().strip().split()]
d = []
for i in range(nk[0]):
    d_tmp = raw_input().strip().split()
    d.append([int(d_tmp[0]), int(d_tmp[1]), int(d_tmp[2] == 'B')])

n1 = nk[0]
k1 = nk[1]

check_x = [0] * n1 * 4
check_y = [0] * n1 * 4
for i in range(n1):
    check_x[i * 4] = [d[i][0] - k1
    check_x[i * 4 + 1] = d[i][0] - k1 + 1
    check_x[i * 4 + 2] = d[i][0]
    check_x[i * 4 + 3] = d[i][0] + 1
    check_y[i * 4] = [d[i][1] - k1
    check_y[i * 4 + 1] = d[i][1] - k1 + 1
    check_y[i * 4 + 2] = d[i][1]
    check_y[i * 4 + 3] = d[i][1] + 1
check_x = list(set(check_x))
check_y = list(set(check_y))

#d = tuple(d)
n = 0
#t = time.clock()
for i in check_x:
    for j in check_y:
        n_tmp = [0, 0]
        for k in range(n1):
            x = (d[k][0] - i) // k1 % 2
            y = (d[k][1] - j) // k1 % 2
#            if x == y:
#                n_tmp[1 - d[k][2]] += 1
#            else:
#                n_tmp[d[k][2]] += 1
            n_tmp[(x == y) ^ d[k][2]] += 1
        if n_tmp[0] > n:
            n = n_tmp[0]
        if n_tmp[1] > n:
            n = n_tmp[1]
#print time.clock() - t
print n
Problem p03378 (python)

Fixed submission:
# -*- coding: utf-8 -*-

a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, len(A)):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print("{0}".format(count))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, a[2]):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print("{0}".format(count))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, a[2]):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print("{0}".format(count))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import matplotlib

a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, a[2]):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print("{0}".format(count))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import matplotlib

a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, a[2]):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print(count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import matplotlib

a = list(input().split())
A = list(input().split())

count = 0
for i in range(0, a[2]):
    if(A[i] < a[2]):
        count = count + 1


if(count > (A.shape[0] -  count)):
        count = A.shape[0] -  count

print(count)
Problem p03543 (python)

Fixed submission:
N=int(input())
cnt=0
last=-1
while N>0:
  N,n=divmod(N,10)
  if last == n:
    cnt+=1
    if cnt>=3:
      break
  else:
    cnt=1
  last=n
if cnt>=3:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=input()
cnt=0
last=-1
while N>0:
  N,n=divmod(N,10)
  if last == n:
    cnt+=1
    if cnt>=3:
      break
  else:
    cnt=1
  last=n
if cnt>=3:
  print('yes')
else:
  print('no')
Problem p03545 (python)

Fixed submission:
l=[int(x) for x in list(input())]
if l[0]+l[1]+l[2]+l[3]==7: print('{}+{}+{}+{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]+l[1]+l[2]-l[3]==7: print('{}+{}+{}-{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]+l[1]-l[2]+l[3]==7: print('{}+{}-{}+{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]+l[1]-l[2]-l[3]==7: print('{}+{}-{}-{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]-l[1]+l[2]+l[3]==7: print('{}-{}+{}+{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]-l[1]+l[2]-l[3]==7: print('{}-{}+{}-{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]-l[1]-l[2]+l[3]==7: print('{}-{}-{}+{}=7'.format(l[0],l[1],l[2],l[3]))
elif l[0]-l[1]-l[2]-l[3]==7: print('{}-{}-{}-{}=7'.format(l[0],l[1],l[2],l[3]))

Buggy submission (verdict: Runtime Error):
l=[int(x) for x in list(input())]
if l[0]+l[1]+l[2]+l[3]==7: print('{}+{}+{}+{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]+l[1]+l[2]-l[3]==7: print('{}+{}+{}-{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]+l[1]-l[2]+l[3]==7: print('{}+{}-{}+{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]+l[1]-l[2]-l[3]==7: print('{}+{}-{}-{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]-l[1]+l[2]+l[3]==7: print('{}-{}+{}+{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]-l[1]+l[2]-l[3]==7: print('{}-{}+{}-{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]-l[1]-l[2]+l[3]==7: print('{}-{}-{}+{}=7'.format(l[0],l[1],l[2],l[3])
elif l[0]-l[1]-l[2]-l[3]==7: print('{}-{}-{}-{}=7'.format(l[0],l[1],l[2],l[3])
Problem p03457 (python)

Fixed submission:
N = input()
list=[]
flg = 0 
for i in range(N):
    list.append(map(int, raw_input().split()))
if N == 1:
	rem = abs(list[0][1]) + abs(list[0][2])
	if rem == 1:
		print("Yes")
	else:
		print("No")
else:
	for i in range(N-1):
		rem = abs(list[i][1]-list[i+1][1]) + abs(list[i][2]-list[i+1][2])
		time = list[i+1][0]-list[i][0]
		if (time-rem) < 0:
			    flg = 1
		            break
		elif (time-rem) % 2 ==1:
			    flg = 1
		            break
		            
	if flg == 0:
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
N = input()
list=[]
flg = 0 
for i in range(N):
    list.append(map(int, raw_input().split()))
if N == 1:
	rem = abs(list[0][1]) + abs(list[0][2])
	if rem == 1:
		print("Yes")
	else:
		print("No")
else:
	for i in range(N-1):
		rem = abs(list[i][1]-list[i+1][1]) + abs(list[i][2]-list[i+1][2])
		time = list[i][0]-list[i+1][0]
		if (time-rem) <= 0:
			flg = 1
			break
		elif (time-rem) % 2 ==1:
			flg = 1
		            break
	if flg == 0:
		print("Yes")
	else:
		print("No")
Problem p03463 (python)

Fixed submission:
import math
N,A,B=[int(i) for i in raw_input().split()]
C=B-A
if C % 2 ==0:
     print("Alice")
else:
     print("Borys")

Buggy submission (verdict: Runtime Error):
import math
N,A,B=[int(i) for i in raw_input().split()]
if B-A % 2 ==0:
     print("Alice")
else:
     print("Borys")
Problem p03381 (python)

Fixed submission:
N = int(input())
b = [int(i) for i in input().split()]
c = sorted(b[:])
s = c[(N-1)//2]
l = c[N//2]

for i in b:
    if i > s:
       print(s)
    else:
       print(l)

Buggy submission (verdict: Runtime Error):
N = int(input())
b = input().split(" ")

for i in range(N):
    X = b
    X.pop(i)
    X.sort()
    print(X[len(X)//2])
Problem p03407 (python)

Fixed submission:
# -*- coding: utf-8 -*-

A, B, C = map(int, input().split(" "))

if A + B >= C:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from collections import Counter


N = int(input())
p = {}

for _ in range(N):
    s = input()
    if s not in p.keys():
        p[s] = 1
    else:
        p[s] += 1

M = int(input())

for _ in range(M):
    t = input()
    if t not in p.keys():
        p[t] = -1
    else:
        p[t] -= 1

print(max(max(p.values()), 0))
Problem p03415 (python)

Fixed submission:
# -*- coding: utf-8 -*-

c = []
for i in range(3):
    c.append(input())
print(c[0][0] + c[1][1] + c[2][2])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, K = map(int, input().split(" "))
c = 0
 
if K != 0:
    for b in range(K+1, N+1):
        s = N % b
        t = N - s
        p = t // b * (b - K)
        q = max(0, s - (K - 1))
        c += (p + q)
        
else:
    c = N ** 2

print(c)
Problem p03436 (python)

Fixed submission:
# -*- coding: utf-8 -*-
H, W = [int(s) for s in input().split(" ")]

maze = [list(input()) for _ in range(H)]

distance = [[float("inf") for i in range(W)] for j in range(H)]

def bfs():
    queue = []
    sx = 0
    sy = 0
    gx = H-1
    gy = W-1

    queue.insert(0, (sx, sy))

    distance[sx][sy] = 0

    while len(queue):
        x, y = queue.pop()

        if x == gx and y == gy:
            break

        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
            
            if (0 <= nx < H and 0 <= ny < W):
                if maze[nx][ny] != '#' and distance[nx][ny] == float("inf"):
                    queue.insert(0, (nx, ny))
                    distance[nx][ny] = distance[x][y] + 1

    return distance[gx][gy]

d = bfs()
cnt = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == ".":
            cnt += 1
if  d == float("inf"):
    print(-1)
else:
    print(cnt - d - 1)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from IPython import embed
H, W = [int(s) for s in input().split(" ")]

maze = [list(input()) for _ in range(H)]

distance = [[float("inf") for i in range(W)] for j in range(H)]

def bfs():
    queue = []
    sx = 0
    sy = 0
    gx = H-1
    gy = W-1

    queue.insert(0, (sx, sy))

    distance[sx][sy] = 0

    while len(queue):
        x, y = queue.pop()

        if x == gx and y == gy:
            break

        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
            
            if (0 <= nx < H and 0 <= ny < W):
                if maze[nx][ny] != '#' and distance[nx][ny] == float("inf"):
                    queue.insert(0, (nx, ny))
                    distance[nx][ny] = distance[x][y] + 1

    return distance[gx][gy]

d = bfs()
cnt = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == ".":
            cnt += 1
if  d == float("inf"):
    print(-1)
else:
    print(cnt - d - 1)
Problem p03477 (python)

Fixed submission:
# -*- coding: utf-8 -*-

A, B, C, D = [int(x) for x in input().split()]

if A + B > C + D:
    print("Left")

elif A + B == C + D:
    print("Balanced")

elif A + B < C + D:
    print("Right")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

S = [int(x) for x in list(input())]

if len(S) == 1:
    print(1)

elif len(S) == 2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S) - 1):
        if S[i] == S[i + 1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)

    ans = max(l)
    if ans in l[1:-1]:
        print(ans + 1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    #print(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)
Problem p03643 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N = int(input())
print('ABC' + str(N))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools
import sys

ships = []
N, M = [int(x) for x in input().split()]
for i in range(M):
    ships.append([int(x) for x in input().split()])

from_1 = set([ship[1] for ship in ships if ship[0] == 1])
to_N = set([ship[0] for ship in ships if ship[1] == N])

if from_1 & to_N:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03657 (python)

Fixed submission:
# -*- coding: utf-8 -*-

A, B = [int(x) for x in input().split()]

if A % 3 == 0:
    print ("Possible")
elif B % 3 == 0:
    print("Possible")
elif (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]

l.sort(reverse=True)
print(sum(l[:K]))
Problem p03739 (python)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = [int(x) for x in input().split()]

ans = 1e16
for s in (1, -1):
    res, cumsum = 0, 0
    for j in range(n):
        cumsum += a[j]
        if cumsum * s <= 0:
            res += abs(cumsum-s)
            cumsum = s
        s *= -1
    ans = min(ans, res)

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = input()
a = [int(x) for x in input().split()]

ans = 1e16
for s in (1, -1):
    res, cumsum = 0, 0
    for j in range(n):
        cumsum += a[j]
        if cumsum * s <= 0:
            res += abs(cumsum-s)
            cumsum = s
        s *= -1
    ans = min(ans, res)

print(ans)
Problem p04033 (python)

Fixed submission:
a,b = map(int,raw_input().split())
if a > 0 and b > 0 :
    print 'Positive'
elif (a <= 0 and b >=0) :
    print 'Zero'
else :
    if b == 0 :
        print 'Zero'
    else :
        if (b-a+1)%2 == 0 :
            print 'Positive'
        else :
            print 'Negative'

Buggy submission (verdict: Runtime Error):
n,m = map(int,raw_input().split())
arr = [1]*n
x = [False]*n
x[0] = True
counter = 0
for i in xrange(m) :
    a,b = map(int,raw_input().split())
    if x[a-1] :
        x[b-1] = True
    arr[a-1] -= 1
    arr[b-1] += 1
    if arr[a-1] == 0 :
        x[a-1] = False
for j in x :
    if j  :
        counter += 1
print counter
Problem p04043 (python)

Fixed submission:
a,b,c = map(int,raw_input().split())
if max(a,b,c) == 7 and min(a,b,c) == 5 and a+b+c == 17 :
    print 'YES'
else :
    print 'NO'

Buggy submission (verdict: Runtime Error):
n,l = map(int,raw_input().split())
s = []
for i in xrange(n) :
    s.append(raw_input())
s.sort()
t = ''
for j in xrange(n) :
    t += s[j]
print t
Problem p04047 (python)

Fixed submission:
n = int(raw_input())
a = map(int,raw_input().split())
a.sort()
s_l = 0
for i in xrange(0,2*n,2) :
    s_l += a[i]
print s_l

Buggy submission (verdict: Runtime Error):
n,x = map(int,raw_input().split())
print '%d' %(n + ((n/x) - 1)*2*x + 3*(n%x))

Buggy submission (verdict: Runtime Error):
n,x = map(int,raw_input().split())
if n > 2*x :
    print '%d' %(n + (n/x - 1)*2*x + 3*(n-(n/x)*x))
else :
    print '%d' %(n + x)
Problem p03479 (python)

Fixed submission:
x, y = map(int, input().split())

ans = 0
while x <= y:
    x *= 2
    ans += 1
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
from math import log2
from decimal import Decimal

x, y = map(int, input().split())
dx = Decimal(log2(x))
dy = Decimal(log2(y))
print(1 + int(log2(dy) - log2(dx)))