Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()

Fixed submission:
from collections import defaultdict

def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()
Buggy python submission (verdict: Time Limit Exceeded):
def ST_string():
	x = str(raw_input())
	len_changed = True
	l2 = 0
	while len_changed:
		l1 = len(x)
		x = x.replace("ST", "", 1)
		l2 = len(x)
		if l1==l2:
			len_changed = False
	print l2

if __name__ == "__main__":
	ST_string()

Fixed submission:
def ST_string_2():
	x = str(raw_input())
	stack = ['#']
	for c in x:
		if c=="S":
			stack.append(c)
		else:
			if stack[-1]=="S":
				stack.pop()
			else:
				stack.append(c)
	print len(stack)-1

if __name__ == "__main__":
	ST_string_2()
Buggy python submission (verdict: Runtime Error):
N,A,B,C,D=map(int,input().split())
N=N-2
for i in range(0,N+1):
    l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))

for _ in l:
    if B-A in _:
        print("YES")
        break
else:
    print("NO")


Fixed submission:
N,A,B,C,D=map(int,input().split())
N=N-1
l=[]
for i in range(0,N+1):
    l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))

for _ in l:
    if B-A in _:
        print("YES")
        break
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
N,A,B,C,D=map(int,input().split())
for i in range(0,N-1):
    l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))

for _ in l:
    if B-A in _:
        print("YES")
        break
else:
    print("NO")

Fixed submission:
N,A,B,C,D=map(int,input().split())
N=N-1
l=[]
for i in range(0,N+1):
    l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))

for _ in l:
    if B-A in _:
        print("YES")
        break
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, split.input())
print((a+b)%24)

Fixed submission:
a, b = map(int, input().split())
print((a+b)%24)
Buggy python submission (verdict: Runtime Error):
x = int(input())

if x < 1200:
    a = ABC
else:
    a = ARC

print(a)

Fixed submission:
x = int(input())
 
if x < 1200:
    a = 'ABC'
else:
    a = 'ARC'
 
print(a)
Buggy python submission (verdict: Runtime Error):
uk3zdbr9

Fixed submission:
# coding: utf-8
# Here your code !
N = input()
print("ABC" + N)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

j = list(map(int, input().split()))
k = []
for i in range(1, len(j) + 1):
    k.append(sum(j[0:i]))
mi = 9999999999
for m in range(len(k)-1):
    mi = min(abs(k[n - 1] - 2 * k[m]), mi)
print(mi)

Fixed submission:
n = int(input())

j = list(map(int, input().split()))
k = [j[0]]
for i in range(1, len(j)):
    k.append(k[i-1] + j[i])
mi = 9999999999
for m in range(len(k)-1):
    mi = min(abs(k[n - 1] - 2 * k[m]), mi)
print(mi)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,raw_input().split())
S = []
for i in range(M):
        S.append(map(int, raw_input().split()))

toN =[]
first = []
end = False

for i in range(M):
    if S[i][1] == N:
        toN.append(S[i][0])

for i in range(M):
    if S[i][0] == 1:
        first.append(S[i][1])

for i in toN:
    if end:
        break
    for j in first:
        if end:
            break
        if i == j:
            print "POSSIBLE"
            end = True
            break


if not end:
    print "IMPOSSIBLE"

Fixed submission:
N, M = map(int,raw_input().split())
S = []
for i in range(M):
        S.append(map(int, raw_input().split()))

toN =[]
first = []
end = False

for i in range(M):
    if S[i][1] == N:
        toN.append(S[i][0])

for i in range(M):
    if S[i][0] == 1:
        first.append(S[i][1])

toN = set(toN)
first = set(first)

if toN.intersection(first):
    print "POSSIBLE"

else:
    print "IMPOSSIBLE"
Buggy python submission (verdict: Runtime Error):
K = int(raw_input())

res = range(51)

k = K/50
mod = K%50

for i in res:
    res[i] = i+k

res.pop(51-mod)

print 50
for i in range(len(res)):print res[i],

Fixed submission:
K = int(raw_input())

res = range(51)

k = K/50
mod = K%50

for i in res:
    res[i] = i+k

res.pop(-1-mod)


print 50
for i in range(len(res)):print res[i],
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
d = {}
for _ in range(n-1):
  v,u = map(int, raw_input().split())
  if v in d:
    d[v].append(u)
  else:
    d[v] = [u]

  if u in d:
    d[u].append(v)
  else:
    d[u] = [v]

visited = [False] * (n+1)
# 0 == fennec, 1 == sunuke
q = [(1,1,0), (n,n,1)]

count_f = 0
count_s = 0

while len(q) > 0:
  cur, prev, sunuke = q.pop(0)
  # print cur,prev,sunuke

  if visited[cur]:
    continue

  visited[cur] = True
  if sunuke:
    count_s += 1
  else:
    count_f += 1

  for v in d[cur]:
    q.append([v, cur, sunuke])

if count_f > count_s:
  print 'Fennec'
else:
  print 'Snuke'

Fixed submission:
n = int(raw_input())
d = {}
for _ in range(n-1):
  v,u = map(int, raw_input().split())
  if v in d:
    d[v].append(u)
  else:
    d[v] = [u]

  if u in d:
    d[u].append(v)
  else:
    d[u] = [v]

# -1: not yet, 0: fennec, 1: sunuke
visited = [-1] * (n+1)
visited[1] = 0
visited[n] = 1

# 0 == fennec, 1 == sunuke
q = [(1,1), (n,n)]

# 0: fennec
# 1: sunuke
count = [1,1]

while len(q) > 0:
  cur, prev = q.pop(0)

  for v in d[cur]:
    if v == prev: continue
    if visited[v] != -1: continue

    chara = visited[prev]
    visited[v] = chara
    count[chara] += 1

    q.append([v, cur])


if count[0] > count[1]:
  print 'Fennec'
else:
  print 'Snuke'

# TLE
# while len(q) > 0:
#   cur, prev, sunuke = q.pop(0)
#   # print cur,prev,sunuke

#   if visited[cur]:
#     continue

#   visited[cur] = True
#   if sunuke:
#     count_s += 1
#   else:
#     count_f += 1

#   for v in d[cur]:
#     q.append([v, cur, sunuke])

# if count_f > count_s:
#   print 'Fennec'
# else:
#   print 'Snuke'
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
a = raw_input().split()

b = []
for i in range(n):
  if i % 2:
    b.append(a[i])
  else:
    b.insert(0, a[i])

if n % 2:
  print " ".join(b)
else:
  print " ".join(b[::-1])


Fixed submission:
n = int(raw_input())
a = raw_input().split()

b = []
c = []
for i in range(n):
  if i % 2:
    b.append(a[i])
  else:
    # b.insert(0, a[i])
    c.append(a[i])

b = c[::-1] + b

if n % 2:
  print " ".join(b)
else:
  print " ".join(b[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = raw_input()
t = raw_input()
n = int(raw_input())
q = []
for i in range(n):
    abcd = map(int, raw_input().split())
    q.append(abcd)

def shorten(s):
    if s[0] != s[1]:
        return s[2:]
    elif s[1] != s[2]:
        return s[0] + s[3:]
    return s[3:]

def check(s):
    sc = [s]
    while len(s) >= 3:
        if s in visited:
            s = visited[s]
            break
        s = shorten(s)
        sc.append(s)

    if len(s) == 2:
        if s == 'AA':
            s = 'B'
        elif s == 'BB':
            s = 'A'
        else:
            s = ''

    for sci in sc:
        visited[sci] = s

    return s

visited = {}
for a,b,c,d in q:
    si = check(s[a-1:b])
    ti = check(t[c-1:d])

    if si == ti:
        print 'YES'
    else:
        print 'NO'


Fixed submission:
S = raw_input()
T = raw_input()
n = int(raw_input())
q = []
for i in range(n):
    abcd = map(int, raw_input().split())
    q.append(abcd)

toi = lambda c: 1 if c == 'A' else 2
s = [0] * (len(S)+1)
for i in range(len(S)):
    s[i+1] = s[i] + toi(S[i])

t = [0] * (len(T)+1)
for i in range(len(T)):
    t[i+1] = t[i] + toi(T[i])

for a,b,c,d in q:
    si = (s[b] - s[a-1]) % 3
    ti = (t[d] - t[c-1]) % 3
    if si == ti:
        print 'YES'
    else:
        print 'NO'
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
S = int(raw_input())
x = 0
maxx = 0

for c in S:
    if c == 'I':
        x += 1
    if c == 'D':
        x -= 1
    if x > maxx:
        maxx = x

print maxx

Fixed submission:
N = int(raw_input())
S = raw_input()
x = 0
maxx = 0

for c in S:
    if c == 'I':
        x += 1
    if c == 'D':
        x -= 1
    if x > maxx:
        maxx = x

print maxx
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
nn = list(map(int,input().split()))
nnn = nn.copy()

if b in nn:
    print('POSSIBLE')
    exit()
if b > max(nn):
    print("IMPOSSIBLE")
    exit()
len_nn = [0]
while 1:
    lnn = len(nn)
    for x in range(len(nn)):
        for y in range(len(nn) - x -len_nn):
            y = len(nn)-y-1
            #print(x,y)
            num = abs(x-nn[y])
            if num == b or num == 1:
                print('POSSIBLE')
                exit()
            elif num not in nn and num != 0:
                nn.append(num)
    len_nn += lnn
    if nn == nnn:
        print('IMPOSSIBLE')
        exit()


Fixed submission:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(a): return "".join(list(map(str, a)))

n,k = rli()
A = rli()

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

b = 0
for a in A:
    b  = gcd(a, b)

if k%b or k > max(A):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
# output
if c >= a and c <= b:
    print('Yes')
else:
    print("No")


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

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
# output
if c >= a and c <= b:
    print "Yes" 
else:
    print "No"

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

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
if c >= a and c <= b:
    print('Yes')
else:
    print("No")
# output


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

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
# output
if c >= a and c <= b:
    print "Yes" 
else:
    print "No"

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

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
if c >= a and c <= b:
    print('Yes')
else
    print("No")
# output


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

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
# output
if c >= a and c <= b:
    print "Yes" 
else:
    print "No"
Buggy python submission (verdict: Runtime Error):
a,b,c = (int(x) for x in input())
ans = abs(a*b*(c//2)-a*b*(c-c//2))
ans = min(ans, abs(a*c*(b//2)-a*c*(b-b//2)))
ans = min(ans, abs(b*c*(a//2)-b*c*(a-a//2)))
print(ans)

Fixed submission:
a,b,c = (int(x) for x in input().split())
ans = abs(a*b*(c//2)-a*b*(c-c//2))
ans = min(ans, abs(a*c*(b//2)-a*c*(b-b//2)))
ans = min(ans, abs(b*c*(a//2)-b*c*(a-a//2)))
print(ans)
Buggy python submission (verdict: Runtime Error):
result = 0
N, K = map(int, input().split())
if N == 1:
    result = K
else:
    result = K
    for i in range(N-1):
        result = result * (K - 1)
print(result)


Fixed submission:
count = 3
a, b, c = map(int, input().split())
if a == b:
    count -= 1
if a == c:
    count -= 1
if b == c:
    count -= 1
if count == 0:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
A, B = input.split()
n = int(A) + int(B)
if n % 3 == 0:
    print(Possible)
else:
    print(Impossible)

Fixed submission:
A, B = input().split()
A, B = int(A), int(B)
n = int(A) + int(B)
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
 
x=input()
a=int(x.split(" ")[0])
b=int(x.split(" ")[1])
y=input()
c=y.split(" ")
c=sorted(c,reverse=True)
sum = 0
for i in range(b):
    sum += int(c[i])
print (sum)

Fixed submission:
# coding: utf-8
# Here your code !
 
x=input()
a=int(x.split(" ")[0])
b=int(x.split(" ")[1])
if (a%3==0 or b%3==0 or (a+b)%3==0):
    print ("Possible")
else:
    print ("Impossible")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 13 20:59:33 2016

@author: kt
"""
max=-1000
min=1000
cost=[0]*100
N=input()
i=0
l = map(int, raw_input().split())
for var in l:
    if var>max:
        max=var
    if var<min:
        min=var
        
"""if max-min==1:
        if cost[0]>cost[1]:
            print cost[1]
        else: 
            print cost[1]
    else :
        print cost[0]"""
if max==min:
    print 0
if max-min==1:
    if l.index(max)>l.index(min): 
        print l.count(min)

    else:      
        print l.count(max)
        print max
else :
    for var in range(min,max+1):
        for var2 in l:
           cost[i]+=(var-var2)*(var-var2)
        i+=1
        if i>2:
            if cost[i-2]<cost[i-1] and cost[i-2]<cost[i-3]:
                print cost[i-2]
            
    

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 13 20:59:33 2016

@author: kt
"""
max=-1000
min=1000
N=input()
i=0
minx=0
l = map(int, raw_input().split())
sum=0
for var in l:
     sum+=var
sum=float(sum)/float(N)
isum=int(sum)
if sum==isum:
    minx=sum
elif isum+1-sum >sum-isum:
    minx=isum
else: 
    minx=isum+1
result=0
for var in l:
    result+=(var-minx)*(var-minx)
print int(result)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
n = int(input())
a =list(map(int, input().split()))

N = sum(a)
r = float('inf')
x = 0

for i in range(N-1):
    x += a[i]
    y = N - x
    if r > abs(x -y):
        r = abs(x -y)
print(r)

Fixed submission:
# -*- coding: utf-8 -*-
 
n = int(input())
a =list(map(int, input().split()))

N = sum(a)
r = float('inf')
x = 0
 
for i in range(n-1):
    x += a[i]
    y = N - x
    if r > abs(x -y):
        r = abs(x -y)
print(r)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

if N % 2 == 0:
    print(" ".join(a[N::-2] + a[::2]))
else:
    print(" ".join(a[N::-2] + a[1::2]))


Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
a = input().split()

if N % 2 == 0:
    b = a[N::-2] + a[::2]
else:
    b = a[N::-2] + a[1::2]

print(" ".join(b))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

if N % 2 == 0:
    print(" ".join(a[N::-2] + a[::2])
else:
    print(" ".join(a[N::-2] + a[1::2])


Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
a = input().split()

if N % 2 == 0:
    b = a[N::-2] + a[::2]
else:
    b = a[N::-2] + a[1::2]

print(" ".join(b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0 for i in range(n)]
for i in range(n):
    a[i] = int(input())
now = a[0]
count = 0
while True:
    count += 1
    if now ==2:
        print(count)
        break
    else:
        now = a[now-1]
if count == n:
    print(-1)


Fixed submission:
import sys
a = [int(i) for i in sys.stdin]
now = a[1]
count = 0
while count!=a[0]:
    count += 1
    if now == 2:
        print(count)
        exit()
    now = a[now]
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0 for i in range(n)]
for i in range(n):
    a[i] = int(input())
now = a[0]
count = 0
while True:
    count += 1
    if now ==2:
        print(count)
        break
    else:
        now = a[now-1]


Fixed submission:
import sys
a = [int(i) for i in sys.stdin]
now = a[1]
count = 0
while count!=a[0]:
    count += 1
    if now == 2:
        print(count)
        exit()
    now = a[now]
print(-1)
Buggy python submission (verdict: Runtime Error):
import math
n,m = map(int, input().split())
if abs(n-m) <= 1:
    a = max(n,m)
    b = min(n,m)
    if a-b == 1:
        print((math.factorial(a)*math.factorial(b))%(10**9+7))
    else:
        print((math.factorial(a)*math.factorial(b)*2%(10**9+7))
else:
    print(0)


Fixed submission:
import math
n,m = map(int, input().split())
if abs(n-m) <= 1:
    a = max(n,m)
    b = min(n,m)
    if a-b == 1:
        print((math.factorial(a)*math.factorial(b))%(10**9+7))
    else:
        print((math.factorial(a)*math.factorial(b)*2)%(10**9+7))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(num) for num in input().split()]
print(str(max(a)-min(a))

Fixed submission:
N = int(input())
a = [int(num) for num in input().split()]
print(str(max(a)-min(a)))
Buggy python submission (verdict: Runtime Error):
N = input()
string = input()
arrange = string
while True:
    after_arrange = arrage.replace('()','')
    if after_arrange == arrage:
        break
    arrange = after_arrange
left = after_arrange.count(')')
right = after_arrange.count('(')
print('('*left+string+')'*right)


Fixed submission:
N = input()
string = input()
arrange = string
while True:
    after_arrange = arrange.replace('()','')
    if after_arrange == arrange:
        break
    arrange = after_arrange
left = after_arrange.count(')')
right = after_arrange.count('(')
print('('*left+string+')'*right)

Buggy python submission (verdict: Runtime Error):
N = input()
string = input()
arrange = string
while True:
    after_arrange = arrage.replace('()','')
    if after_arrange == arrage
        break
    arrange = after_arrange
left = after_arrange.count(')')
right = after_arrange.count('(')
print('('*left+string+')'*right)


Fixed submission:
N = input()
string = input()
arrange = string
while True:
    after_arrange = arrange.replace('()','')
    if after_arrange == arrange:
        break
    arrange = after_arrange
left = after_arrange.count(')')
right = after_arrange.count('(')
print('('*left+string+')'*right)

Buggy python submission (verdict: Runtime Error):
N = input()
string = input()
arrange = string.replace('()','')
while True:
    if arrange == arrage.replace('()',''):
        break
    arrange = arrage.replace('()','')
left = arrange.count(')')
right = arrange.count('(')
print('('*left+string+')'*right)


Fixed submission:
N = input()
string = input()
arrange = string
while True:
    after_arrange = arrange.replace('()','')
    if after_arrange == arrange:
        break
    arrange = after_arrange
left = after_arrange.count(')')
right = after_arrange.count('(')
print('('*left+string+')'*right)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
string = ''
for i in range(n):
    a,b=(input().split())
    string += a*int(b)
string = [int(i) for i in string]
print(sorted(string[k-1]))

Fixed submission:
a = [int(num) for num in input().split()]
print('Yes' if a[0]<=a[2]<=a[1] else 'No')

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
string = ''
for i in range(n):
    a,b=(input().split())
    string += a*int(b)
print(sorted(string)[k-1])

Fixed submission:
a = [int(num) for num in input().split()]
print('Yes' if a[0]<=a[2]<=a[1] else 'No')

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
string = ''
for i in range(n):
    a,b=(input().split())
    string += a*int(b)
print(string[k-1])

Fixed submission:
a = [int(num) for num in input().split()]
print('Yes' if a[0]<=a[2]<=a[1] else 'No')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
flag = 0
for i in range(1,b+1):
    if (a*1-c)%b==0:
        flag = 1
        break
print('YES' if flag = 1 else 'NO')


Fixed submission:
a,b,c = map(int, input().split())
flag = 0
for i in range(1,b+1):
    if (a*i-c)%b==0:
        flag = 1
        break
print('YES' if flag == 1 else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
i = 1
while True:
    bef = sum(range(1,i))
    i += 1
    aft = sum(range(1,i))
    if bef < num <= aft:
        print(i-1)
        break


Fixed submission:
num = int(input())
i = 1
bef = 0
while True:
    bef += i-1
    aft = bef + i
    if bef < num <= aft:
        print(i)
        break
    i += 1

Buggy python submission (verdict: Runtime Error):
num = int(input())
i = 1
while True:
    bef = range(1,i)
    i += 1
    aft = range(1,i)
    if bef < num <= aft:
        print(i-1)
        break


Fixed submission:
num = int(input())
i = 1
bef = 0
while True:
    bef += i-1
    aft = bef + i
    if bef < num <= aft:
        print(i)
        break
    i += 1

Buggy python submission (verdict: Runtime Error):
num = int(input())
i = 0
while True:
    bef = range(1,i)
    i += 1
    aft = range(1,i)
    if bef < num <= aft:
        print(i-1)
        break

Fixed submission:
num = int(input())
i = 1
bef = 0
while True:
    bef += i-1
    aft = bef + i
    if bef < num <= aft:
        print(i)
        break
    i += 1
Buggy python submission (verdict: Runtime Error):
N = int(input())
list = input().rstrip().split()
a=[]
for i in range(N):
    a = a + [int(list[i])]
sunuke=0
arai = 0
for i in range(N):
    arai = arai + a[i]
for i in range(N):
    sunuke1 = sunuke + a[i]
    arai1 = arai - a[i]
    if sunuke1 > arai1:
        x = abs(sunuke-arai)
        y = abs(sunuke1-arai1)
        res = min(x,y)
        break
    else:
        sunuke = sunuke1
        arai = arai1
print(res)

Fixed submission:
list = input().rstrip().split()
A = int(list[0])
B = int(list[1])
if A%3 != 0:
    if B%3 != 0:
        if (A+B)%3 != 0:
            print("Impossible")
        else: print("Possible")
    else: print("Possible")
else: print("Possible")

Buggy python submission (verdict: Runtime Error):
def solution(a):
    A = a[0]
    B = sum(a) - a[0]
    Min = abs(A - B)
    for i in xrange(1, len(a)-1):
        A += a[i]
        B -= a[i]
        if Min > abs(A- B):
            Min = abs(A - B)
    print Min
import math
N = int(raw_input())
a = map( int, raw_input().split())
solution(a)


Fixed submission:
a,b =map( int, raw_input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
    print 'Possible'
else:
    print 'Impossible'

Buggy python submission (verdict: Runtime Error):
def solution(a):
    A = a[0]
    B = sum(a) - a[0]
    Min = abs(A - B)
    for i in xrange(1, len(a)-1):
        A += a[i]
        B -= a[i]
        if Min > abs(A- B):
            Min = abs(A - B)
    print Min
import math
N = int(raw_input())
a = map( int, raw_input().split())
solution(a)

Fixed submission:
a,b =map( int, raw_input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
    print 'Possible'
else:
    print 'Impossible'
Buggy python submission (verdict: Time Limit Exceeded):
import math
def solution(a):
    for i in xrange(1, len(a)):
        ab = abs(sum(a[:i]) - sum(a[i:]))
        if i == 1:
            Min = ab 
            continue
        if ab < Min:
            Min = ab
    print Min
N = int(raw_input())
a = map( int, raw_input().split())
solution(a)

Fixed submission:
def solution(a):
    A = a[0]
    B = sum(a) - a[0]
    Min = abs(A - B)
    for i in xrange(1, len(a)-1):
        A += a[i]
        B -= a[i]
        if Min > abs(A- B):
            Min = abs(A - B)
    print Min
import math
N = int(raw_input())
a = map( int, raw_input().split())
solution(a)
Buggy python submission (verdict: Runtime Error):
import re

n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7

pow = [0]*n+2

tmp = 1
for i in range(1, n+2):
        tmp *= i
        pow[i] = tmp

for i in range(0, n + 1):
        x = a.index(a[i])
        if a[i] in a[x+1:]:
                left = i
                right = a[x+1:].index(a[i]) + x + 1
                break

for i in range(1, n + 2):
        ans = (pow[n + 1] / (pow[i] * pow[n + 1 - i]))
        x = (pow[left + n - right] / (pow[i - 1] * pow[left + n - right - i + 1]))
        print (ans - x) % mask


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

import re

x = raw_input()
x = map(int, re.split("\s", x))
x.sort()

print x[0] + x[1]