Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(100):
    if bool(s[i:i+1]) == False:
        if t[i:i+1]:
            print("Yes")
            break
        else:
            print("No")
            break
    elif bool(t[i:i+1]) == False:
        print("No")
        break
    elif (s[i] < t[i]):
        print("Yes")
        break
    elif (s[i] > t[i]):
        print("No")
        break

Fixed submission:
a,b = map(int, input().split())
c = -(-(a + b)//2)
print("{}".format(c))

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(100):
    if bool(s[i:2]) == False:
        if t[i:2]:
            print("Yes")
            break
        else:
            print("No")
            break
    elif bool(t[i:2]) == False:
        print("No")
        break
    elif (s[i] < t[i]):
        print("Yes")
        break
    elif (s[i] > t[i]):
        print("No")
        break

Fixed submission:
a,b = map(int, input().split())
c = -(-(a + b)//2)
print("{}".format(c))
Buggy python submission (verdict: Runtime Error):
l = (("A","T"),("G","C"))
i = inpit()
if i in l[0]:
  if i == l[0][0]:
    print(l[0][1])
  else: print(l[0][0])
else:
  if i == l[1][0]:
    print(l[1][1])
  else: print(l[1][0])

Fixed submission:
# coding: utf-8

l = (("A","T"),("G","C"))
i = input()
if i in l[0]:
    if i == l[0][0]:
        print(l[0][1])
    else: print(l[0][0])
else:
    if i == l[1][0]:
        print(l[1][1])
    else: print(l[1][0])
Buggy python submission (verdict: Runtime Error):

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
                
    divisors.sort()
    return divisors


a, b, c = map(int, input().split())

c_set = list(set(make_divisors(a))&set(make_divisors(b)))

c_set.sort()
print(c_set[-c])


Fixed submission:
a, b, c = map(int, input().split())

if b//a >= c:
    print(c)
else:
    print(b//a)
Buggy python submission (verdict: Runtime Error):
print(*input().split(',')

Fixed submission:
print(*input().split(','))
Buggy python submission (verdict: Runtime Error):
print("Yes" if input()[0] == input()[1] == input()[2]\
      or input()[1] == input()[2] == input()[3] else "No")

Fixed submission:
num = input()
print("Yes" if num[0] == num[1] == num[2] or num[1] == num[2] == num[3] else "No")
Buggy python submission (verdict: Runtime Error):
o = input()
n1 = len(o)
e = input()
n2 = len(e)
for i in range(max(n1,n2)):
  print(o[i] + e[i], end = "")

Fixed submission:
o = input()
n1 = len(o)
e = input()
n2 = len(e)
if n1 == n2:
  for i in range(n1):
    print(o[i] + e[i], end = "")
else:
  for i in range(n2):
    print(o[i] + e[i], end = "")
  print(o[n1 - 1])
Buggy python submission (verdict: Runtime Error):
a, b = map(int,input.split())

print('Even' if a*b % 2 == 0 else 'Odd')


Fixed submission:
a, b = map(int,input().split())
print('Even' if a*b % 2 == 0 else 'Odd')
Buggy python submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input.split()))
print(c*10 + b + a)

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print(c*10 + b + a)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(input().split(","))
print(a,b,c)

Fixed submission:
a,b,c=input().split(",")
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
print("A" + int()[8] + "C")

Fixed submission:
print("A" + input()[8] + "C")
Buggy python submission (verdict: Runtime Error):
a = sorted(map(int),input().split())
print(10*a[0]+a[1]+a[2])


Fixed submission:
a = sorted(list(map(int, input().split())))
print(10*a[2]+a[1]+a[0])

Buggy python submission (verdict: Runtime Error):
a = sorted(map(int), list(input().split()))
print(10*a[0]+a[1]+a[2])


Fixed submission:
a = sorted(list(map(int, input().split())))
print(10*a[2]+a[1]+a[0])

Buggy python submission (verdict: Runtime Error):
a = list(input().split()).sort()
print(int(a[0])*10+int(a[1])+int(a[2]))

Fixed submission:
a = sorted(list(map(int, input().split())))
print(10*a[2]+a[1]+a[0])

Buggy python submission (verdict: Runtime Error):
a = list(input().split()).sort()
print(a[0]*10+a[1]+a[2])

Fixed submission:
a = sorted(list(map(int, input().split())))
print(10*a[2]+a[1]+a[0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = set([int(input()) for in range(n)])
print(len(S))

Fixed submission:
n = int(input())
S = set([int(input()) for i in range(n)])
print(len(S))

Buggy python submission (verdict: Runtime Error):
n = input()
S = set([int(input()) for in range(n)])
print(len(S))

Fixed submission:
n = int(input())
S = set([int(input()) for i in range(n)])
print(len(S))

Buggy python submission (verdict: Runtime Error):
n = input()
S = set(int(input()) for in range(n))
print(len(S))

Fixed submission:
n = int(input())
S = set([int(input()) for i in range(n)])
print(len(S))
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>=3200:
   print(s)
if a<3200:
   print("red")

Fixed submission:
a,b=map(int,input().split())
if a>b:print(a+a-1)
elif b>a:print(b+b-1)
else:
  print(a+b)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
s = input()
l = [[int(i) for i in input().split()] for i in range(q)]
c = [0 for i in range(n)]
cc = 0
f = False
for i in range(n):
    t = s[0:i+1]
    c[i] = t.count("AC")
for i in range(q):
    print(c[l[i][1]-1]-c[l[i][0]-1])

Fixed submission:
n, q = map(int,input().split())
s = input()
l = [[int(i) for i in input().split()] for i in range(q)]
c = [0 for i in range(n)]
cc = 0
f = False
for i in range(n):
    if f:
        f = False
        if s[i] == "C":
            cc += 1
    if s[i] == "A":
        f = True
    c[i] = cc
for i in range(q):
    print(c[l[i][1]-1]-c[l[i][0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
s = input()
l = [[int(i) for i in input().split()] for i in range(q)]
for i in range(q):
    t = s[l[i][0]-1:l[i][1]]
    c = 0
    for j in range(len(t)-1):
        if t[j] == "A":
            if t[j+1] == "C":
                c += 1
        else:
            continue
    print(c)

Fixed submission:
n, q = map(int,input().split())
s = input()
l = [[int(i) for i in input().split()] for i in range(q)]
c = [0 for i in range(n)]
cc = 0
f = False
for i in range(n):
    if f:
        f = False
        if s[i] == "C":
            cc += 1
    if s[i] == "A":
        f = True
    c[i] = cc
for i in range(q):
    print(c[l[i][1]-1]-c[l[i][0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
s = input()
l = [[int(i) for i in input().split()] for i in range(q)]
for i in range(q):
    t = s[l[i][0]-1:l[i][1]]
    c = 0
    f = False
    for j in t:
        if f:
            if j=="C":
                c += 1
                f = False
            else:
                f = False
        if j=="A":
            f = True
    print(c)

Fixed submission:
n, q = map(int,input().split())
s = input()
l = [[int(i) for i in input().split()] for i in range(q)]
c = [0 for i in range(n)]
cc = 0
f = False
for i in range(n):
    if f:
        f = False
        if s[i] == "C":
            cc += 1
    if s[i] == "A":
        f = True
    c[i] = cc
for i in range(q):
    print(c[l[i][1]-1]-c[l[i][0]-1])
Buggy python submission (verdict: Runtime Error):
q={22:"Christmas Eve Eve Eve",23:"Christmas Eve Eve",24:"Christmas Eve",25:"Christmas"}
print(q[int(input())]

Fixed submission:
q={22:"Christmas Eve Eve Eve",23:"Christmas Eve Eve",24:"Christmas Eve",25:"Christmas"}
print(q[int(input())])
Buggy python submission (verdict: Runtime Error):
a=input()
a[3]="8"
print(a)

Fixed submission:
a=input()
a=a.replace("2017","2018")
print(a)
Buggy python submission (verdict: Runtime Error):
li=["A","B","C","D","E"]
a,b=input().split()
if li.index(a)==li.index(b):
  print("=")
elif li.index(a)>li.index(b):
  print(">")
else:
  print("<")

Fixed submission:
li=["A","B","C","D","E","F"]
a,b=input().split()
if li.index(a)==li.index(b):
  print("=")
elif li.index(a)>li.index(b):
  print(">")
else:
  print("<")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")
Buggy python submission (verdict: Runtime Error):
a = int(input())
e = int(input())
k = int(input())
if e-a =< k:
  print("Yay!")
else:
  print(":(")
  

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a <= k:
	print("Yay!")
else:
	print(":(")
Buggy python submission (verdict: Runtime Error):
def main():
    n = input()
    s = input()
    raw_list = list(map(int, raw_list))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = input()
    s = input()
    raw_list = list(map(int, s.split()))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
s = input()
print(+1 if + else -1 if -)

Fixed submission:
s = input()
print(s.count('+')*1+s.count('-')*-1)
Buggy python submission (verdict: Runtime Error):
c11,c12,c13 = input()
c21,c22,c23 = input()
c31,c32,c33 = input()
print(c11,c12,c13[1], c21,c22,c23[2], c31,c32,c33[3])

Fixed submission:
a = input()
b = input()
c = input()
print(a[0] + b[1] + c[2])
Buggy python submission (verdict: Runtime Error):
X,A,B = map(int,input().split())
print((X-A)%B)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())
print((X-A)%B)
Buggy python submission (verdict: Runtime Error):
s = ['2017', '/', '01', '/', '07']
print(s.pop[2017])
print(s.append[2018])

Fixed submission:
s = input()
print('2018' + s[4:])
Buggy python submission (verdict: Runtime Error):
s1, s2, s3 = input().split()
print(s1,s2,s3.pop = 1)


Fixed submission:
s = input()
print(s.count('1'))
Buggy python submission (verdict: Runtime Error):
x,y = input().split()
print('<' if x<y else '>' if x>y else '=' if x==y)

Fixed submission:
X,Y = input().split()
print('<' if X<Y  else '=' if X==Y else '>')

Buggy python submission (verdict: Runtime Error):
x,y = input().split()
print('<' if x<y else '>' if x>y else '=' if x==y)

Fixed submission:
X,Y = input().split()
print('<' if X<Y  else '=' if X==Y else '>')

Buggy python submission (verdict: Runtime Error):
x = input()
y = input()
a == 11
b == 12
c == 13
d == 14
f == 15
print('<' if x<y else '>' if x>y else '=' if x==y )

Fixed submission:
X,Y = input().split()
print('<' if X<Y  else '=' if X==Y else '>')
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(int(n**.5)**2)

Fixed submission:
s = input()
t = input()
print('YES' if s==t[::-1]  else 'NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(int((n**.5)**2)

Fixed submission:
n=int(input())
print(int(n**.5)**2)
Buggy python submission (verdict: Runtime Error):
n = input().range(3)
print('Yes' if n[0]==n[2] else 'No')

Fixed submission:
n = input()
print('Yes' if n[0]==n[2] else 'No')

Buggy python submission (verdict: Runtime Error):
n = input()
print('YES' if n==::n else 'NO')

Fixed submission:
n = input()
print('Yes' if n[0]==n[2] else 'No')
Buggy python submission (verdict: Runtime Error):
a,b,c = input().split()
if('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Fixed submission:
a,b,c = input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')
Buggy python submission (verdict: Runtime Error):
a,b = input()
print('H' if a==b else 'D')

Fixed submission:
a,b = input().split()
print('H' if a==b else 'D')
Buggy python submission (verdict: Runtime Error):
A, B, C = int(input())
print('YES' if A, B, C == 5 7 5 else 'NO')

Fixed submission:
x = input().split()
print('YES' if x.count('5')==2 and x.count('7')==1 else 'NO')
Buggy python submission (verdict: Runtime Error):
bt = input()
bt_A, bt_B = bt.split()
bt_max, bt_min = max(bt_A, bt_B), min(bt_A, bt_B)
max_num = bt_max + max(bt_max - 1, bt_min)
print(max_num)

Fixed submission:
bt = input()
bt_A, bt_B = bt.split()
bt_max, bt_min = max(int(bt_A), int(bt_B)), min(int(bt_A), int(bt_B))
max_num = bt_max + max(bt_max - 1, bt_min)
print(max_num)

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

res = 0

if A > B:
  res = A + (A-1)
elif A == B:
  res = A + B
else
  res = B + (B-1)

print(res)

Fixed submission:
A, B = map(int, input().split())
 
res = 0
 
if A > B:
  res = A + (A-1)
elif A == B:
  res = A + B
else:
  res = B + (B-1)
 
print(res)
Buggy python submission (verdict: Runtime Error):
X = int(input())

if any(X == 3, X == 5, X == 7):
  print("YES")
else:
  print("NO")

Fixed submission:
X = int(input())
 
if X == 3 or X == 5 or X == 7:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A.sort(resverse = True)

print(sum(A[0::2]) - sum(A[1::2]))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse="True")

print(sum(a[0::2]) - sum(a[1::2]))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=TRUE)
print(sum(A[0::2]) - sum(A[1::2]))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
 
if N%2 == 0:
  print(N/2)
else:
  print([N+1] / 2)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

res += 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if a*500 + 100*b + c*50 == X:
        res += 1
        
print(res)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
res = 0
 
for i in range(A + 1):
  for j in range(B + 1):
    for k in range(C + 1):
      if 500*i + 100*j + 50*k == X:
        res += 1
 
print(res)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

res = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if a*500 + b*100 + c*50 == N:
        res += 1
       
print(res)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
res = 0
 
for i in range(A + 1):
  for j in range(B + 1):
    for k in range(C + 1):
      if 500*i + 100*j + 50*k == X:
        res += 1
 
print(res)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input.split())

if a*b%2 == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
N, A ,B = map(int, input().split())
res = 0

for n in range(N+1):
  if A <= int(s) <= B for s in str(n):
    res += n
    
print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A ,B = map(int, input().split())
res = 0

for n in N:
  if A <= int(s) <= B for s in str(n):
    res += n
    
print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

res = 0

for n in range(N+1):
  if A <= sum([int(s) for s in str(n)]) <= B:
  res += n
  
print(res)


Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

res = 0

for n in range(N+1):
  if A <= sum([int(s) for s in str(n)]) <= B:
  res += n
  
print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
res = 0

for n in range(1+N):
  if A <= sum([int(s) for s in str(n)]) <= B:
    res += s
    
print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
res = 0

for n in range(1+N):
  if A <= sum(int(s) for s in str(n)) <= B:
    res += s
    
print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int input().split())
res = 0
 
for i in range(N+1):
  if A <= sum([int(n) for n in str(i)]) <= B:
    res += 1
 
print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int input().split())
res = 0

for i in range(N+1):
  if A <= sum([int(n) for n in str(i)]) <= B:
    res += 1:

print(res)

Fixed submission:
N, A, B = map(int, input().split())
res = 0
for i in range(N+1):
    if A <= sum([int(s) for s in str(i)]) <= B:
        res += i
print(res)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
res = 0
 
while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  res += 1
 
print(res)

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))

res = 0

while all(a%2 == 0 for a iin A):
  A = [a/2 for a in A]
  res += 1

print(res)

Fixed submission:
N = input()
A = list(map(int, input().split()))
cnt = 0
while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
cnt = 0

while all(a%2 == 0 for a in A):
  A = [a/2 a for A]
  cnt += 1

print(cnt)

Fixed submission:
N = input()
A = list(map(int, input().split()))
cnt = 0
while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
r, g, b = int(input)
N = r*100 + g*10 + b

if N%4 == 0:
  print("YES")
else:
  print("NO")

Fixed submission:
r, g, b = map(int, input().split())
N = r*100 + g*10 + b

if N%4 == 0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
right = 0
left = len(s)-1

for i in range(len(s)*2):

    if ( s[right] != s[left]):
        count += 1
        if(s[right]!="x"):
            right -= 1

        else:
            left += 1
            
    right += 1
    left -= 1
    if(right>=left):
        print count
        sys.exit()

Fixed submission:
import sys
s = raw_input()

ss = s.replace("x","")

if(ss == ss[::-1]):
    pass

else:
    print "-1"
    sys.exit()


count = 0

right = 0
left = len(s)-1

for i in range(len(s)*2):

    if ( s[right] != s[left]):
        count += 1
        if(s[right]!="x"):
            right -= 1

        else:
            left += 1
            
    right += 1
    left -= 1
    if(right>=left):
        print count
        sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = input()
d = [int(i) for i in raw_input().split()]
m = input()
t = [int(i) for i in raw_input().split()]

for i in t:
    if i in d:
        d.remove(i)

    else:
        print 'NO'
        sys.exit()

print 'YES'

Fixed submission:
import sys
n = input()
d = [int(i) for i in raw_input().split()]
m = input()
t = [int(i) for i in raw_input().split()]

dd = {}
tt = {}

for ddd in d:
    dd.setdefault(ddd,0)
    dd[ddd] += 1

for ttt in t:
    tt.setdefault(ttt,0)
    tt[ttt] += 1




for search in tt.keys():
    if search in dd:
        if tt[search] > dd[search]:
            
            print 'NO'
            sys.exit()

    else:
        print 'NO'
        sys.exit()

print 'YES'
Buggy python submission (verdict: Runtime Error):
n = raw_input()
count = 0
for i in n:
    if(i=='1'):count+=1;

print(count)

Fixed submission:
n = raw_input()
count = 0
for i in n:
    if(i=='1'):count+=1;

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
a = map(int, raw_input().split())

all = sum(a)

mini = 10000000000

for i in range(1,N):
    x = sum(a[:i])
    y = all - x 
    ret = abs(x-y)

    if(ret < mini): mini=ret

print mini


Fixed submission:
N = input()
a = map(int, raw_input().split())

all = sum(a)

mini = 10000000000

x = 0
y = all

for i in range(0,N-1):
    x += a[i]
    y -= a[i]
    ret = abs(x-y)

    if(ret < mini): mini=ret

print mini
Buggy python submission (verdict: Time Limit Exceeded):
n,t = [int(i) for i in raw_input().split()]

a = [int(i) for i in raw_input().split()]

good = []

for i in range(len(a)-1):
    good.append(max(a[i+1:])-a[i])

m = max(good)

count = 0

for g in good:
    if g==m:count+=1

print count


Fixed submission:
n,t = [int(i) for i in raw_input().split()]

a = [int(i) for i in raw_input().split()]

good = []

mmm = []

mmm.append(a[n-1])

for i in range(n-1):
    mmm.append(max(mmm[i],a[n-i-2]))

mmm.reverse()

for i in range(len(a)-1):
    good.append(mmm[i+1]-a[i])

m = max(good)

count = 0

for g in good:
    if g==m:count+=1

print count
Buggy python submission (verdict: Time Limit Exceeded):
import sys

x = raw_input()

x = [i for i in x]

while(True):
    end = True
    for i in range(0,len(x)-1):
#        print len(x),i,x[i],x[i+1],end
        if(x[i]=='S' and x[i+1]=='T'):
            del x[i+1]
            del x[i]
            end = False
#            print x
        if end is False:
            break

    if end:
        print len(x)
        sys.exit()

Fixed submission:
x = raw_input()

l = len(x)

s = 0
for i in x:
    if(i=='S'): s+=1
    if(i=='T' and s>0): 
        s-=1
        l-=2

print l
Buggy python submission (verdict: Runtime Error):
words = list(map(int,input().split()))
a = words[0][-1:]
b = words[1][0]
c = words[1][-1:]
d = words[2][0]
if a==b and c == d:
  print('YES')
else:
  print('NO')

Fixed submission:
words = input().split()
a = words[0][-1:]
b = words[1][0]
c = words[1][-1:]
d = words[2][0]
if a==b and c == d:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
d = {'A': 'T', 'C': 'D', 'T': 'A', 'D': 'C'}
b = input()
print(d[b])

Fixed submission:
s = input()
ans = ''
if s == 'A':
    ans = 'T'
elif s == 'T':
    ans = 'A'
elif s == 'C':
    ans= 'G'
elif s == 'G':
    ans = 'C'

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a + b == 15:
    ans = '+'
elif a * b == 15:
    ans = '*'
print(ans)

Fixed submission:
a, b = map(int, input().split())
print('+' if a+b==15 else '*' if a*b==15 else 'x')