Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
n = int(input())

t = []
a = []
for i in s:
    ord_i = ord(i)
    t.append((123 - ord_i, ord_i))

for i in t:
    if n >= i[0]:
        a.append(chr(97))
        n -= i[0]
    else:
        a.append(chr(i[1]))
    
temp = ord(a[-1]) + n
a[-1] = chr(temp)
print(''.join(a))

Fixed submission:
def main():
    s = input()
    n = int(input())
    
    t = []
    a = []
    for i in s:
        ord_i = ord(i)
        t.append(((123 - ord_i)%26, ord_i))
    
    for i in t:
        if n >= i[0]:
            a.append('a')
            n -= i[0]
        else:
            a.append(chr(i[1]))
            
    a[-1] = chr(ord(a[-1]) + n%26)
    print(''.join(a))
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
if __name__='__main__':
    m,n = map(int,input().split())
    if abs(m-n)>1:
        print('Alice')
    else:
        print('Brown')
   

Fixed submission:
if __name__=='__main__':
    m,n = map(int,input().split())
    if abs(m-n)>1:
        print('Alice')
    else:
        print('Brown')
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
f = np.zeros((n, 10), dtype=np.int64)
p = np.zeros((n, 11), dtype=np.int64)

for i in range(n):
  tmp = list(map(int, input().split()))
  for j in range(10):
      f[i][j] = tmp[j]
for i in range(n):
  tmp = list(map(int, input().split()))
  for j in range(11):
    p[i][j] = tmp[j]

r = -1e18
for b in range(1, 1<<10):
  s = 0
  for i in range(n):
    c = 0
    for j in range(10):
      if (b >> j) & 1 == 1 and f[i][j]:
        c += 1
    s += p[i][c]
  if r < s:
    r = s

print(r)


Fixed submission:
import numpy as np

n = int(input())
f = np.zeros((n, 10), dtype=np.int64)
p = np.zeros((n, 11), dtype=np.int64)

for i in range(n):
  tmp = list(map(int, input().split()))
  for j in range(10):
      f[i][j] = tmp[j]
for i in range(n):
  tmp = list(map(int, input().split()))
  for j in range(11):
    p[i][j] = tmp[j]

r = -1e18
for b in range(1, 1<<10):
  s = 0
  for i in range(n):
    c = 0
    for j in range(10):
      if (b >> j) & 1 == 1 and f[i][j]:
        c += 1
    s += p[i][c]
  if r < s:
    r = s

print(r)
Buggy python submission (verdict: Runtime Error):
print((n=int(input()))*-~n>>1)

Fixed submission:
def acum(n):
    if n <= 1:
        return 1
    return n + acum(n - 1)
print(acum(int(input())))

Buggy python submission (verdict: Runtime Error):
def fact(n):
    if n <= 0:
        return 1
    return n * fact(n - 1)

n = input()
print(fact(n))


Fixed submission:
def acum(n):
    if n <= 1:
        return 1
    return n + acum(n - 1)
print(acum(int(input())))
Buggy python submission (verdict: Runtime Error):
ProNum = int(input())
time = input()
time = time.split()
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time[int(line[0])])
  print(TotalTime+diff)


Fixed submission:
ProNum = int(input())
time = input()
time = (time.split())
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time[int(line[0])-1])
  print(TotalTime+diff)

Buggy python submission (verdict: Runtime Error):
ProNum = int(input())
time = input()
time = time.split()
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time(int(line[0])))
  print(TotalTime+diff)


Fixed submission:
ProNum = int(input())
time = input()
time = (time.split())
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time[int(line[0])-1])
  print(TotalTime+diff)

Buggy python submission (verdict: Runtime Error):
ProNum = int(input())
time = input()
time = time.split()
TotalTime = 0

for t in time:
  TotalTime += t

DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time(int(line[0])))
  print(TotalTime+diff)

Fixed submission:
ProNum = int(input())
time = input()
time = (time.split())
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time[int(line[0])-1])
  print(TotalTime+diff)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

count = 0

if a != b:
  count += 1
if b != c:
  count += 1
if a != c:
  count += 1
  
print(int(count/2))

Fixed submission:
s = input()
l = s.split()
 
 
count = 6
 
if l[0] == l[1]:
  count -= 1
if l[1] == l[2]:
  count -= 1
if l[2] == l[0]:
  count -= 1
  
print(int(count/2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())

ans=1

for i in range(k):
  ans = ans*n
  n -= 1
  
print(ans)

Fixed submission:
s = input()
s = s.split()
n = int(s[0])
k = int(s[1])

if n==1:
  print(k)
elif n==2:
  print(k*(k-1))
else:
  ans = k
  for i in range(n-1):
    ans = ans*(k-1)
  print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
d = {}
for i in s:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

for key in d:
  if d[key] %2 != 0
  	print("No")
    break


Fixed submission:
flag = 1
s = input()
d = {}
for i in s:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

for key in d:
    if d[key] %2 != 0:
      flag = 0     
if flag == 0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(len(s)-1):
  if s[i+1] != 'B':
    ans += s[i]
    
print(ans)


Fixed submission:
s = input()
output_s = ""

for i in s:
  if i == "B" and len( output_s) != 0:
    output_s = output_s[0:len( output_s)-1]
  elif i != "B":
    output_s += i
  
print(output_s)

Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
  if s[i+1] != 'B':
    ans += s[i]
    
print(ans)

Fixed submission:
s = input()
output_s = ""

for i in s:
  if i == "B" and len( output_s) != 0:
    output_s = output_s[0:len( output_s)-1]
  elif i != "B":
    output_s += i
  
print(output_s)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
if a>b or b>c or a>c or a>b:
    print("NO")
else:
    print("YES")

Fixed submission:
form = input()
form = form.split()
form.sort()

if form == ["5","5","7"]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
s = input()
s = s.split()

s.sort()

if s = ["5","5","7"]:
  print("YES")
else:
  print("NO")

Fixed submission:
form = input()
form = form.split()
form.sort()

if form == ["5","5","7"]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
Firstline = input()
Firstline = Firstline.split()

List = []
for i in int(Firstline[0]):
  List.append(input())

List.sort()
s = ""
for i in List:
  s += i

print(s)

Fixed submission:
Firstline = input()
Firstline = Firstline.split()

List = []
for i in range(int(Firstline[0])):
  List.append(input())

List.sort()
s = ""
for i in List:
  s += i

print(s)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())

P = []
max = -9999999999999
count = 0
a = int(input())
b = a
max = a
P.append(a)
for i in range(0,N-1):
    a = int(input())
    if a < b:
        P.
        count += 1
        b = a
    if a > max:
        max = a
        count += 1


print(count)


Fixed submission:
# coding: utf-8
a, b = map(int, input().split())
max = -99999999999999
X = [a+b,a-b,a*b]
for i in range(len(X)):
    if X[i] > max:
        max = X[i]

print(max)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
s = input()
k = int(input())
sb_str = []
for i in range(len(s)+1):
    for j in range(1+i,len(s)+1):
        if i < j:
            sb_str.append(s[i:j])

sb_str = list(set(sb_str))
sb_str.sort()
print(sb_str[k-1])


Fixed submission:
# coding: utf-8
s = input()
k = int(input())
sb_str = []
for i in range(len(s)+1):
    for j in range(1+i,len(s)+1):
        if len(s[i:j]) > 5:
            break
        if i < j:
            sb_str.append(s[i:j])

sb_str = list(set(sb_str))
sb_str.sort()
print(sb_str[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
s = input()
k = int(input())
sb_str = []
for i in range(len(s)+1):
    for j in range(1,len(s)+1):
        if i < j:
            sb_str.append(s[i:j])

sb_str = list(set(sb_str))
sb_str.sort()
print(sb_str[k-1])


Fixed submission:
# coding: utf-8
s = input()
k = int(input())
sb_str = []
for i in range(len(s)+1):
    for j in range(1+i,len(s)+1):
        if len(s[i:j]) > 5:
            break
        if i < j:
            sb_str.append(s[i:j])

sb_str = list(set(sb_str))
sb_str.sort()
print(sb_str[k-1])
Buggy python submission (verdict: Runtime Error):
from itertools import permutations

def f(n, m, uu, vv):
    a = [[0] * n for _ in range(n)]
    for u, v in zip(uu, vv):
        a[u][v] = 1
        a[v][u] = 1
    res = 0
    for p in permutations(range(n)):
        if p[0] != 0:
            break
        ok = True
        for i in range(n-1):。
            if a[p[i][p[i+1]] == 0:
                ok = False
                break
        if ok:
            res += 1
    return res


n,m = map(int,input().split())
a = []
b = []
for i in range(m):
    _a, _b = map(int, input().split())
    _a -= 1
    _b -= 1
    a.append(_a)
    b.append(_b)

print(f(n, m, a, b))


Fixed submission:
from itertools import permutations

def f(n, m, uu, vv):
    a = [[0] * n for _ in range(n)]
    for u, v in zip(uu, vv):
       
        a[u][v] = 1
        a[v][u] = 1
 
    res = 0
    for p in permutations(range(n)):
        if p[0] != 0:
            break
     
        ok = True
        for i in range(n-1):
            if a[p[i]][p[i+1]] == 0:
                ok = False
                break
        if ok:
            res += 1
    return res


n,m = map(int,input().split())
a = []
b = []

for i in range(m):
    _a, _b = map(int, input().split())
    _a -= 1
    _b -= 1
    a.append(_a)
    b.append(_b)

print(f(n, m, a, b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split( )))
for l in range(N):
    Y = X[ : ]
    del Y[l]
    Y.sort( )
    l = N//2-1
    print(Y[l])

Fixed submission:
N = int(input())
X = list(map(int, input().split( )))
X1 = X[ : ]
X1.sort()
for l in range(N):
    if X[l] <= X1[N//2-1]:
        print(X1[N//2])
    else:
        print(X1[N//2-1])
Buggy python submission (verdict: Runtime Error):
import math
A = int(input())
B = int(input())
if B < A: A,B = B,A

if A == B:
    print(1)
else:
    t = int(math.floor(math.log2(B)))
    while (A & 2**t) == (B & 2**t):
        if A & 2**t:
            A -= 2**t
            B -= 2**t
        t-=1
    ans = 2**t - A              # [A,2^t-1]
    r = t-1
    while 2**t + 2**r > B:
        r-=1
    # [2^t,2^t+2^{r+1}-1] \cup [2^t+A,2^{t+1}-1]
    C = 2**(r+1)
    if C < A:
        ans += C + 2**t - A
    else:
        ans += 2**t

print(ans)


Fixed submission:

import math
A = int(input())
B = int(input())
if B < A: A,B = B,A

if A == B:
    print(1)
else:
    t = int(math.floor(math.log2(B)))
    while (A & 2**t) == (B & 2**t):
        if A & 2**t:
            A -= 2**t
            B -= 2**t
        t-=1
    ans = 2**t - A              # [A,2^t-1]
    r = t-1
    while 2**t + 2**r > B and r>=0:
        r-=1
    # [2^t,2^t+2^{r+1}-1] \cup [2^t+A,2^{t+1}-1]
    C = 2**(r+1)
    if C < A:
        ans += C + 2**t - A
    else:
        ans += 2**t
    print(ans)
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
a, b= map(int, input().split())

diff = b-a
d = 0
for i in enumerate(diff+1, 1):
    d += i 

print(abs(d-a)
    


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

diff = b-a
d = 0
for i in range(1, diff):
    d += int(i)
print(abs(d-a))
Buggy python submission (verdict: Runtime Error):
number = input()

if number > 0 and number < 1000:
    print("ABC")

if number >= 1000 and number <= 1998:
    print("ABD")

Fixed submission:
number = int(input())

if number > 0 and number < 1000:
    print("ABC")

if number >= 1000 and number <= 1998:
    print("ABD")
Buggy python submission (verdict: Time Limit Exceeded):
X = list(input())
while True:
    before = len(X)
    for i in range(len(X) - 1):
        if X[i] == "S" and X[i + 1] == "T":
            del X[i:i + 2]
            break
    if len(X) == before:
        break     
print(len(X))


Fixed submission:
X = input()
ans = 0

for c in X:
    if c == 'S':
        ans += 1
    if c == 'T' and ans > 0:
        ans -= 1
print(ans * 2)

Buggy python submission (verdict: Time Limit Exceeded):
X = input()
while X.find("ST") != -1:
    Xlist = list(X)
    del Xlist[X.find("ST"):X.find("ST") + 2]
    X = "".join(Xlist)
print(len(X))

Fixed submission:
X = input()
ans = 0

for c in X:
    if c == 'S':
        ans += 1
    if c == 'T' and ans > 0:
        ans -= 1
print(ans * 2)

Buggy python submission (verdict: Time Limit Exceeded):
X = input()
while X.find("ST") != -1:
    X = X.replace("ST", "", 1)
print(len(X))

Fixed submission:
X = input()
ans = 0

for c in X:
    if c == 'S':
        ans += 1
    if c == 'T' and ans > 0:
        ans -= 1
print(ans * 2)
Buggy python submission (verdict: Runtime Error):
a,b = [int(i) for i in input().split()]
n = b-a-1
print(int(n*(n+1)/2-a))

Fixed submission:
N = int(input())
if N < 1000:
    print('ABC')
elif N >= 1000:
    print('ABD')

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

Fixed submission:
N = int(input())
if N < 1000:
    print('ABC')
elif N >= 1000:
    print('ABD')
Buggy python submission (verdict: Runtime Error):
a = input()
b = int(a)
if b < 1000 :
    print "ABC"
else:
    print "ABD"

Fixed submission:
a = input()
b = int(a)
if b < 1000 :
    print "ABC"
else: 
    print "ABD"
Buggy python submission (verdict: Runtime Error):
N = int(input())
count = 0
ans = []
for i in range(N+1):
    count1 = 0
    count2 = 0
    N1 = N - i
    x = i
    while x:
        count1 += x % 6
        x //= 6
    while N1
        count2 += N1 % 9
        N1 //= 9
    count = count1 + count2
    ans.append(count)
print(min(ans))


Fixed submission:
N = int(input())
count = 0
ans = []
for i in range(N+1):
    count1 = 0
    count2 = 0
    N1 = N - i
    x = i
    while x:
        count1 += x % 6
        x //= 6
    while N1:
        count2 += N1 % 9
        N1 //= 9
    count = count1 + count2
    ans.append(count)
print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
count = 0
ans = []
for i in range(N+1):
    count1 = 0
    count2 = 0
    N1 = N - i
    x = i
    while x:
        count1 += x % 6
        x //= 6
    while N1
        count2 += x % 9
        N1 //= 9
    count = count1 + count2
    ans.append(count)
print(min(ans))


Fixed submission:
N = int(input())
count = 0
ans = []
for i in range(N+1):
    count1 = 0
    count2 = 0
    N1 = N - i
    x = i
    while x:
        count1 += x % 6
        x //= 6
    while N1:
        count2 += N1 % 9
        N1 //= 9
    count = count1 + count2
    ans.append(count)
print(min(ans))
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
C = (B - A )*( B - A + 1 )/ 2 - B 
print(C)

Fixed submission:
N = int(input())
if N <= 999:
    print("ABC")
else:
    print("ABD")
Buggy python submission (verdict: Runtime Error):
a=(int,input())
b=(int,input())
if a>b:
   print(a-1)
else:
   print(a)

Fixed submission:
a,b=map(int,input().split())
if a>b:
   print(a-1)
else:
   print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b=int(input())
b=int(a%500)
if (b<=n):
  print("Yes")
else:
  print("No")


Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
a%500==b
if (b<=n):
  print("Yes")
else:
  print("No")


Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
if((a%500)<=b):
  print("Yes")
else:
  print("No")


Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if((a%500)<=b):
  print("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,A=map(int.input().split())
if N%500<=A:
  print ("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
int.("A")
int.("N")
if N%500<=A:
  print ("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
int(A)
int(N)
if N%500<=A:
  print ("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
int("A")
int("N")
if N%500<=A:
  print ("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,A=map(int,input().split())
if N%500<=A:
  print ("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,A=map(int,input().split())
if N%500<=A:
print("Yes")
else: 
print("No")


Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,A=map(int,input().split())
if N%500<=A
print("Yes")
else 
print("No")

Fixed submission:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
(a,b)=map(int,input().split())
if a*b%2==0:
  print(偶数)
else
  print(奇数)

Fixed submission:
(a,b)=map(int,input().split())
if a*b%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
A=input().split()
a=A[0]
b=A[1]
c=A[2]
d=A[3]
if abs(a-c) <= d:
  print("Yes")
elif (abs(a-b) <= d) & (abs(b-c) <= d):
  print("Yes")
else:
  print("No")

Fixed submission:
A=input().split()
a=int(A[0])
b=int(A[1])
c=int(A[2])
d=int(A[3])
if abs(a-c) <= d:
  print("Yes")
elif (abs(a-b) <= d) & (abs(b-c) <= d):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
A=input().split()
a=A[0]
b=A[1]
c=A[2]
d=A[3]
if abs(a-c) <= d:
  print("Yes")
elif (abs(a-b) <= d) && (abs(b-c) <= d):
  print("Yes")
else:
  print("No")

Fixed submission:
A=input().split()
a=int(A[0])
b=int(A[1])
c=int(A[2])
d=int(A[3])
if abs(a-c) <= d:
  print("Yes")
elif (abs(a-b) <= d) & (abs(b-c) <= d):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input());*a,=map(int,input().split())
for i in range(n):print(sorted(a[:i]+a[-~i:])[~-n//2])

Fixed submission:
n=int(input());*a,=map(int,input().split());b=sorted(a);l,m=b[n//2-1],b[n//2]
for x in a:print([l,m][x<m])
Buggy python submission (verdict: Runtime Error):
print(['Four','Three'][len(set(list(input().split())))-4])

Fixed submission:
input();print(['Four','Three'][len(set(list(input().split())))-4])
Buggy python submission (verdict: Runtime Error):
a=[0]*9;input()
for x in list(map(int,input().split())):a[x//400]=1 if x<3200 else a[8]+1
b=sum(a[:8]);print(b,b*(b in[0,8])ora=[0]*9;input()
for x in list(map(int,input().split())):
    if x<3200:a[x//400]=1
    else:a[8]+=1
b=sum(a[:8]);print(b,b*(b==8)or b+a[8]) b+a[8])

Fixed submission:
input();a=[0]*9
for x in input().split():
    x=int(x)
    if x>3599:x=3200
    a[x//400]+=1
b=sum([1 if x else 0 for x in a[:8]])
print(max(1,b),b+a[8])

Buggy python submission (verdict: Runtime Error):
a=[0]*9;input()
for x in list(map(int,input().split())):a[x//400]=1 if x<3200 else a[8]+1
b=sum(a[:8]);print(b,b*(b in[0,8])or b+a[8])

Fixed submission:
input();a=[0]*9
for x in input().split():
    x=int(x)
    if x>3599:x=3200
    a[x//400]+=1
b=sum([1 if x else 0 for x in a[:8]])
print(max(1,b),b+a[8])

Buggy python submission (verdict: Runtime Error):
a=[0]*9;input()
for x in list(map(int,input().split())):
    if x<3200:a[x//400]=1
    else:a[x//400]+=1
b=sum(a[:8]);print(b,b*(b==8)or b+a[8])

Fixed submission:
input();a=[0]*9
for x in input().split():
    x=int(x)
    if x>3599:x=3200
    a[x//400]+=1
b=sum([1 if x else 0 for x in a[:8]])
print(max(1,b),b+a[8])

Buggy python submission (verdict: Runtime Error):
a=[0]*9;input()
for x in list(map(int,input().split())):
    if x<3200:a[x//400]=1
    else:a[x//400]+=1
b=sum(a[:8]);print((b,b)*(b==8)or b,b+a[8])

Fixed submission:
input();a=[0]*9
for x in input().split():
    x=int(x)
    if x>3599:x=3200
    a[x//400]+=1
b=sum([1 if x else 0 for x in a[:8]])
print(max(1,b),b+a[8])
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split());w+=2
print('#'*w)
for _ in[0]*h:print('#'+input()+'#')
print('#'*w)

Fixed submission:
x,y=map(int,input().split());a=[4,6,9,11];b=[1,3,5,7,8,10,12];print(['No','Yes'][int(x in a)*(y in a)+ int(x in b)*(y in b)])

Buggy python submission (verdict: Runtime Error):
nput().split());a=[4,6,9,11];b=[1,3,5,7,8,10,12];print(['No','Yes'][(x in a and y in a)+x in b and y in b])

Fixed submission:
x,y=map(int,input().split());a=[4,6,9,11];b=[1,3,5,7,8,10,12];print(['No','Yes'][int(x in a)*(y in a)+ int(x in b)*(y in b)])

Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split());a=[4,6,9,11];b=[1,3,5,7,8,10,12];print(['No','Yes'][x in a and y in a+x in b and y in b])

Fixed submission:
x,y=map(int,input().split());a=[4,6,9,11];b=[1,3,5,7,8,10,12];print(['No','Yes'][int(x in a)*(y in a)+ int(x in b)*(y in b)])
Buggy python submission (verdict: Time Limit Exceeded):
a=[];n,k=map(int,input().split())
for _ in[0]*n:
    b,c=map(int,input().split())
    a+=[b]*c
print(sorted(a)[~-k])

Fixed submission:
a=[];n,k=map(int,input().split())
for _ in[0]*n:a+=[list(map(int,input().split()))]
a.sort();i=0
while k>0:k-=a[i][1];i+=1
print(a[~-i][0])
Buggy python submission (verdict: Runtime Error):
a,_,c=map(int,input()).split();print(['YES','NO'][a&1==0and c&1])

Fixed submission:
def g(a,b):
    while b:a,b=b,a%b
    return a
a,b,c=map(int,input().split());print(['NO','YES'][c%g(a,b)==0])
Buggy python submission (verdict: Runtime Error):
a=int(input());b=int(input());print('EQUAL' if a==b else 'GREATER' if a>b else 'LESS')

Fixed submission:
print(*[x[0].swapcase() for x in input().split()],sep='')
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split());print((min(2*n,m)+m)//4)

Fixed submission:
n=int(input())
print(n*800-n//15*200)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=n%(m//2)
m-=2*a
if m<0:m=0
print(a+m//4)

Fixed submission:
n,m=map(int,input().split())
print(min((m+2*n)//4,m//2))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=n%(m//2)
print(a+(m-2*a)//4)

Fixed submission:
n,m=map(int,input().split())
print(min((m+2*n)//4,m//2))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split());a=0
while n and m>1:
    n-=1;m-=2;a+=1
print(a+m//4)

Fixed submission:
n,m=map(int,input().split())
print(min((m+2*n)//4,m//2))
Buggy python submission (verdict: Runtime Error):
n=int(input());s=input();a=['SS','WS','SW','WW']
for i in range(n):
    for j in range(4):a[j]+='SW'[::-1 if s[i]=='o' else 1][a[j][i]==a[j][i+1]]
for i in range(4):
    if a[i][1]==a[i][n+1] and a[i][0] == a[i][n]:print(a[i][1:n+1]);exit()
print(-1)

Fixed submission:
n,m=map(int,input().split())
print(min(m+2*n,2*m)//4)