Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import queue

n,m = map(int,input().split())
hen = [[] for i in range(m)]
ans = [0 for i in range(n)]
a,b = 0,0

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

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(n-1):
        print(ans[i+1])
else:
    print('No')


Fixed submission:
import queue

n,m = map(int,input().split())
hen = [[] for i in range(n)]
ans = [0 for i in range(n)]
a,b = 0,0



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

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(n-1):
        print(ans[i+1])
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import queue

n,m = map(int,input().split())
hen = [[] for i in range(m)]
ans = [0 for i in range(n)]
a,b = 0,0
max = 0

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

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(max-1):
        print(ans[i+1])
else:
    print('No')


Fixed submission:
import queue

n,m = map(int,input().split())
hen = [[] for i in range(n)]
ans = [0 for i in range(n)]
a,b = 0,0



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

q = queue.Queue()
q.put(1)

while q.empty() == False:
    head = q.get()
    for h in hen[head-1]:
        if h != 1 and ans[h-1] == 0:
            ans[h-1] = head
            q.put(h)

flag = 0

for i in range(n):
    if i != 0 and ans[i] == 0:
        flag = 1

if flag == 0:
    print('Yes')
    for i in range(n-1):
        print(ans[i+1])
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
sur_list = [0 for i in range(2019)]
sur = 0
ans = 0

s.reverse()

for i in range(len(s)):
    sur_list[sur] += 1
    sur = (int(s[i]) * (10**i) + sur) % 2019
    ans += sur_list[sur]

print(ans)


Fixed submission:
s = list(input())
sur_list = [0 for i in range(2019)]
sur = 0
keta = 1
ans = 0

s.reverse()

for i in range(len(s)):
    keta = (keta*10)%2019
    sur_list[sur] += 1
    sur = (int(s[i]) * keta + sur) % 2019
    ans += sur_list[sur]

print(ans)
Buggy python submission (verdict: Runtime Error):
q = deque()

q.append('a')

n = int(input())

ans_list = []

if n != 1:
    for i in range(n-1):
        for j in range(2**i):
            s = q.pop()
            a = list(s)
            b = s + chr(ord(a[len(a)-1]))
            q.appendleft(b)
            if i == n-2:
                ans_list.append(b)
            c = s + chr(ord(a[len(a)-1])+1)
            q.appendleft(c)
            if i == n-2:
                ans_list.append(c)
else:
    ans_list = ['a']

ans_list = sorted(ans_list)

for i in range(len(ans_list)):
    print(ans_list[i])


Fixed submission:
from collections import deque

q = deque()

q.append('a')

n = int(input())

ans_list = []
flag = 0

if n != 1:
    while flag == 0:
        s = q.pop()
        if len(s) > n:
            flag = 1
        a = list(s)
        x = chr(ord('a')-1)
        a = map(ord,a)
        max_a = max(a)
        while ord(x) != max_a+1:
            x = chr(ord(x)+1)
            y = s + x
            q.appendleft(y)
            if len(y) == n:
                ans_list.append(y)
else:
    ans_list = ['a']

ans_list = sorted(ans_list)

for i in range(len(ans_list)):
    print(ans_list[i])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

d = deque(input())

q = int(input())

headflag = 0

for i in range(q):
    s = input()
    if len(s) == 1:
        if headflag == 0:
            headflag = 1
        else:
            headflag = 0
    else:
        l = list(s)
        if headflag == 0:
            if l[2] == '1':
                d.appendleft(l[4])
            else:
                d.append(l[4])
        else:
            if l[2] == '2':
                d.appendleft(l[4])
            else:
                d.append(l[4])

dl = len(d)

if headflag == 0:
    for i in range(len(d)):
        print(d[i], end='')
else:
    for i in range(len(d)):
        print(d[dl-1-i], end='')

print()


Fixed submission:
from collections import deque

d = deque(input())

q = int(input())

headflag = 0

for i in range(q):
    s = input()
    if len(s) == 1:
        if headflag == 0:
            headflag = 1
        else:
            headflag = 0
    else:
        l = list(s)
        if headflag == 0:
            if l[2] == '1':
                d.appendleft(l[4])
            else:
                d.append(l[4])
        else:
            if l[2] == '2':
                d.appendleft(l[4])
            else:
                d.append(l[4])

result = ''.join(d)

if headflag == 0:
    print(result)
else:
    result = result[::-1]
    print(result)

print()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

d = deque()

d.extend(list(input()))

q = int(input())

headflag = 0

for i in range(q):
    s = input()
    if len(s) == 1:
        if headflag == 0:
            headflag = 1
        else:
            headflag = 0
    else:
        l = list(s)
        if headflag == 0:
            if l[2] == '1':
                d.appendleft(l[4])
            else:
                d.append(l[4])
        else:
            if l[2] == '2':
                d.appendleft(l[4])
            else:
                d.append(l[4])

dl = len(d)

if headflag == 0:
    for i in range(len(d)):
        print(d[i], end='')
else:
    for i in range(len(d)):
        print(d[dl-1-i], end='')

print()


Fixed submission:
from collections import deque

d = deque(input())

q = int(input())

headflag = 0

for i in range(q):
    s = input()
    if len(s) == 1:
        if headflag == 0:
            headflag = 1
        else:
            headflag = 0
    else:
        l = list(s)
        if headflag == 0:
            if l[2] == '1':
                d.appendleft(l[4])
            else:
                d.append(l[4])
        else:
            if l[2] == '2':
                d.appendleft(l[4])
            else:
                d.append(l[4])

result = ''.join(d)

if headflag == 0:
    print(result)
else:
    result = result[::-1]
    print(result)

print()
Buggy python submission (verdict: Runtime Error):
import sympy

n = int(input())
x = sympy.divisors(n)

if len(x)%2 == 0:
    print(x[len(x)//2]+x[(len(x)//2)-1]-2)
else:
    print((x[(len(x)//2)]*2)-2)


Fixed submission:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
x = make_divisors(n)

if len(x)%2 == 0:
    print(x[len(x)//2]+x[(len(x)//2)-1]-2)
else:
    print((x[(len(x)//2)]*2)-2)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
ans = 0
soui = 0
moji = s[0]

for i in range(1,len(s)):
    if s[i] == s[i-1] and soui == 0:
        ans += 1
        soui = 1
    elif soui == 1:
        soui = 0

flag = 0

if s[0] == s[len(s)-1] and soui == 0:
    ans += 1
    flag = 1

for i in range(len(s)):
    if moji != s[i]:
        break
    elif i == len(s)-1:
        flag = 2

if flag == 1:
    print((k*ans)-((k-1)*((a//2)+(b//2)-((a+b)//2))))
elif flag == 2:
    print((k*len(s))//2)
else:
    print(k*ans)


Fixed submission:
s = input()
k = int(input())
ans = 0
soui = 0
moji = s[0]

for i in range(1,len(s)):
    if s[i] == s[i-1] and soui == 0:
        ans += 1
        soui = 1
    elif soui == 1:
        soui = 0


flag = 0
a = 0
b = 0

while s[0] == s[a] and a != len(s)-1:
    a += 1

while s[len(s)-1-b] == s[len(s)-1] and b != len(s)-1:
    b += 1


if s[0] == s[len(s)-1]:
    flag = 1

for i in range(len(s)):
    if moji != s[i]:
        break
    elif i == len(s)-1:
        flag = 2

if flag == 1:
    print((k*ans)-((k-1)*((a//2)+(b//2)-((a+b)//2))))
elif flag == 2:
    print((k*len(s))//2)
else:
    print(k*ans)

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
ans = 0
soui = 0
moji = s[1]

for i in range(1,len(s)):
    if s[i] == s[i-1] and soui == 0:
        ans += 1
        soui = 1
    elif soui == 1:
        soui = 0

flag = 0

if s[0] == s[len(s)-1] and soui == 0:
    ans += 1
    flag = 1

for i in range(len(s)):
    if moji != s[i]:
        break
    elif i == len(s)-1:
        flag = 2

if flag == 1:
    print((k*ans)-1)
elif flag == 2:
    print((k*len(s))//2)
else:
    print(k*ans)


Fixed submission:
s = input()
k = int(input())
ans = 0
soui = 0
moji = s[0]

for i in range(1,len(s)):
    if s[i] == s[i-1] and soui == 0:
        ans += 1
        soui = 1
    elif soui == 1:
        soui = 0


flag = 0
a = 0
b = 0

while s[0] == s[a] and a != len(s)-1:
    a += 1

while s[len(s)-1-b] == s[len(s)-1] and b != len(s)-1:
    b += 1


if s[0] == s[len(s)-1]:
    flag = 1

for i in range(len(s)):
    if moji != s[i]:
        break
    elif i == len(s)-1:
        flag = 2

if flag == 1:
    print((k*ans)-((k-1)*((a//2)+(b//2)-((a+b)//2))))
elif flag == 2:
    print((k*len(s))//2)
else:
    print(k*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
A = map(int,input().split())
A = sorted(A, reverse=True)

#print(A)

for i in range(m):
    if i == 0:
        A[0] = A[0]//2
    else:
        list = A[0:i+1]
#        print(list)
        max_num = max(list)
        max_id = list.index(max_num)
        A[max_id] = max_num//2

#print(A)
print(sum(A))


Fixed submission:
import heapq

n,m = map(int,input().split())
a = list(map(int,input().split()))
list = []
maximum = 0

for i in range(n):
    num = a[i]*(-1)
    heapq.heappush(list,num)

for i in range(m):
    maximum = heapq.heappop(list)
    if maximum%2 == 0:
        maximum = maximum//2
    else:
        maximum = (maximum//2)+1
    heapq.heappush(list,maximum)
#    print(list)

ans = 0
minimum = 0

for i in range(n):
    minimum = heapq.heappop(list)
    minimum = minimum*(-1)
    ans = ans + minimum

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s_list = []
anagrams = []
ans = 0

for i in range(n):
    s = list(input())
    s = sorted(s)
    s_list.append(s)

for i in range(n):
    for j in range(i+1,n):
        if s_list[i] == s_list[j]:
            ans = ans + 1
        elif s_list[i] != s_list[j]:
            continue

print(ans)


Fixed submission:
n = int(input())
dict = {}
ans = 0

for i in range(n):
    s = ''
    list = sorted(input())
    for j in list:
        s += j
    if i != 0 and s in dict.keys():
        ans += dict[s]
        dict[s] += 1
    else:
        dict[s] = 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s_list = []
anagrams = []
ans = 0

for i in range(n):
    s = list(input())
    s = sorted(s)
    s_list.append(s)

for i in range(n):
    for j in range(i+1,n):
#        print(s_list[i],s_list[j])
        if s_list[i] == s_list[j]:
            ans = ans + 1
#        print(i,j)

print(ans)


Fixed submission:
n = int(input())
dict = {}
ans = 0

for i in range(n):
    s = ''
    list = sorted(input())
    for j in list:
        s += j
    if i != 0 and s in dict.keys():
        ans += dict[s]
        dict[s] += 1
    else:
        dict[s] = 1

print(ans)
Buggy python submission (verdict: Runtime Error):
14
99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1

Fixed submission:
n = int(input())
d = sorted(list(map(int,input().split())))

if n%2 == 1:
    print(0)
else:
    print(d[len(d)//2]-d[(len(d)//2)-1])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

lamp=[]
switches=[]
temp=[]

for i in range(m):
    temp=list(map(int,input().split()))
    lamp.append(temp.pop(0))
    switches.append(temp)
    temp=[]

modul=list(map(int,input().split()))

bit_list=[]

for i in range(2**(n)):
    bit_list.append(bin(i)[2:].zfill(n))

ans = 0

for b in bit_list:
    flag = 0
    sum  = 0
    for s,p in zip(switches,modul):
        for k in range(len(s)):
            sum=sum+int(b[s[k]-1])
        if sum%2 != p:
            flag = 1
            break
    if flag == 0:
        ans=ans+1

print(ans)


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

p1=p+(3*a)

print(p1//2)
Buggy python submission (verdict: Runtime Error):
s=input()

a,b=int(s[0]+s[1]),int(s[2]+s[3])

if b==0:
    print('NA')
elif a==0:
    print('NA')
elif a>12:
    if b>12:
        print('NA')
    elif 0<b<13:
        print('YYMM')
elif 0<a<13:
    if b>12:
        print('MMYY')
    elif 0<b<13:
        print('AMBIGUOUS')


Fixed submission:
n,k=map(int, input().split())
s=input()

for i in range(len(s)):
    if i==k-1:
        if s[k-1]=='A':
            print('a',end='')
        elif s[k-1]=='B':
            print('b',end='')
        elif s[k-1]=='C':
            print('c',end='')
    else:
        print(s[i],end='')

print()
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l_list=[]
r_list=[]

for i in range(m):
    l,r=map(int,input().split())
    l_list.append(l)
    r_list.append(r)

n_card=min(r_list)-max(l_list)+1

if n_card<=0:
    print(0)
else:
    print(n_card)


Fixed submission:
n,k = map(int, input().split())
x=0
i=0
pro=0.0
ans=0.0

for i in range(1,n+1):
    x=i
    j=0
    while x<k:
        j=j+1
        x=x*2
    pro=(1/n)*((1/2)**j)
    ans=ans+pro

print(ans)
Buggy python submission (verdict: Runtime Error):
r,g,b,n=map(int, input().split())

r_max=n//r
g_max=n//g

sum=0

for i in range((n//r)+1):
    for j in range((n-(i*r)//g)+1):
        if (n-(i*r)-(j*g))%b==0 and (n-(i*r)-(j*g))//b>=0:
            sum=sum+1
        #    print(i*r,j*g,(n-(i*r)-(j*g))%b)

print(sum)


Fixed submission:
n,k=map(int, input().split())

print(n-k+1)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(s):
    list=[]
    for j in range(len(s)):
        a=0
        b=0
        temp=10000000000000000000
        v=[]
        if len(s)>2:
            for i in range(len(s)):
                if i!=j:
                    x=s[i]
                    v.append(x)
            for i in range(len(v)):
                if i==0:
                    a=v[i]
                    b=v[i+1]
                else:
                    b=v[i]
                if a<b:
                    temp=a
                    a=b
                    b=temp
                while b!=0:
                    temp=a%b
                    a=b
                    b=temp
            list.append(a)
        else:
            list.append(max(s))
    return(max(list))


n=int(input())

v=[]
line=input().split()

for i in range(n):
    v.append(int(line[i]))

print(gcd(v))

Fixed submission:
def gcd(x,y):
    if x<y:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return(y)

n=int(input())

v=[]
line=input().split()

for i in range(n):
    v.append(int(line[i]))

gcd_l=[]
gcd_r=[]

for i in range(n-1):
    if i==0:
        gcd_l.append(v[i])
    else:
        gcd_l.append(gcd(gcd_l[i-1],v[i]))

for i in range(n-1):
    if i==0:
        gcd_r.append(v[n-1])
    else:
        gcd_r.append(gcd(gcd_r[i-1],v[n-i-1]))

gcd_list=[]

for i in range(n):
    if i==0:
        gcd_list.append(gcd_r[n-2])
    elif i==n-1:
        gcd_list.append(gcd_l[n-2])
    else:
#        print(gcd(gcd_l[i-1],gcd_r[n-i-2]))
        gcd_list.append(gcd(gcd_l[i-1],gcd_r[n-i-2]))

#print(gcd_list)

print(max(gcd_list))
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
s = input()
sento = 0
ketu = 0
tmp = '1'
zeroichi = []
cnt = 0

for i in range(n):
    if tmp == s[i]:
        cnt += 1
    else:
        zeroichi.append(cnt)
        cnt = 1
        tmp = s[i]

zeroichi.append(cnt)

if len(zeroichi)%2 == 0:
    zeroichi.append(0)

if len(zeroichi) == 1:
    zeroichi.append(0)
    zeroichi.append(0)

i = 0
ans = 0
ans_list = []
j = 0
right = 1+k*2
left = 0

while i != right:
    ans += zeroichi[i]
    i += 1

ans_list.append(ans)

while right != len(zeroichi):
    ans -= zeroichi[left]
    ans -= zeroichi[left+1]
    ans += zeroichi[right]
    ans += zeroichi[right+1]
    ans_list.append(ans)
    left += 2
    right += 2

print(max(ans_list))


Fixed submission:
n, k = map(int,input().split())
s = input()
sento = 0
ketu = 0
tmp = '1'
zeroichi = []
cnt = 0

for i in range(n):
    if tmp == s[i]:
        cnt += 1
    else:
        zeroichi.append(cnt)
        cnt = 1
        tmp = s[i]

zeroichi.append(cnt)

if len(zeroichi)%2 == 0:
    zeroichi.append(0)

if len(zeroichi) == 1:
    zeroichi.append(0)
    zeroichi.append(0)

i = 0
ans = 0
ans_list = []
j = 0
right = min(1+k*2,len(zeroichi))
left = 0

while i != right:
    ans += zeroichi[i]
    i += 1

ans_list.append(ans)

while right != len(zeroichi):
    ans -= zeroichi[left]
    ans -= zeroichi[left+1]
    ans += zeroichi[right]
    ans += zeroichi[right+1]
    ans_list.append(ans)
    left += 2
    right += 2

print(max(ans_list))
Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(input())
value=[0]*n
ans_list=[]
length=[]
     
for i in range(len(s)-1):
  value[i+1]=value[i]+(1 if s[i]=='A' and s[i+1]=='C' else 0)
  
for i in range(q):
  l,r=map(int,input().split())
  print(value[r-1]-value[l-1])

Fixed submission:
a = input()

if a == 'A':
    print('T')
elif a == 'T':
    print('A')
elif a == 'C':
    print('G')
elif a == 'G':
    print('C')
Buggy python submission (verdict: Runtime Error):
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== AC else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])

Fixed submission:
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== 'AC' else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=list(input())
value=[0]
ans_list=[]
length=[]
s_length=len(s)

for i in range(s_length-1):
  if s[s_length-i-1]=='C' and s[s_length-i-2]=='A':
    value.insert(0,value[0]+1)
  else:
    value.insert(0,value[0])

for i in range(q):
  l,r=map(int,input().split())
  print(value[l-1]-value[r-1])

Fixed submission:
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== 'AC' else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=list(input())
value=[0]
ans_list=[]
length=[]
s_length=len(s)

for i in range(s_length-1):
  if s[s_length-i-1]=='C' and s[s_length-i-2]=='A':
    value.insert(0,value[0]+1)
  else:
    value.insert(0,value[0])

for i in range(q):
  l,r=map(int,input().split())
  ans_list.append(value[l-1]-value[r-1])
  
for i in range(q):
  print(ans_list[i])

Fixed submission:
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== 'AC' else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=list(input())
ans_list=[]
length=[]

for i in range(q):
  ans=0
  l,r=map(int,input().split())
  sublist=s[l-1:r]
  for j in range(len(sublist)-1):
    if sublist[j]=='A' and sublist[j+1]=='C':
      ans=ans+1
  ans_list.append(ans)
  
for i in range(q):
  print(ans_list[i])

Fixed submission:
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== 'AC' else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())

s=input()

input_list=[]

for i in range(q):
    input_list.append(list(map(int,input().split())))

for i in range(q):
    temp=0
    for j in range(input_list[i][0]-1,input_list[i][1]-1):
        if s[j]=='A' and s[j+1]=='C':
            temp=temp+1
    print(temp)


Fixed submission:
N, Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i : i+2]== 'AC' else 0)
for i in range(Q):
  l, r=map(int,input().split())
  print(t[r-1]-t[l-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(len(a)):
  for j in range(len(b)):
    for k in range(len(c)):
      if a+b+c == x:
        ans = ans+1
        
print(ans)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 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:
        ans = ans+1
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())

true=0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                true=true+1

print(true)

Fixed submission:
k,s=map(int,input().split())

true=0

for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            true=true+1

print(true)
Buggy python submission (verdict: Runtime Error):
w,h,n=(int (i) for i in input().split())

w1=0
w2=w
h3=0
h4=h

for i in range(n):
    x,y,a=(int (i) for i in input().split())
    if a==1 and x>w1:
        w1=x
    elif a==2 and x<w2:
        w2=x
    elif a==3 and y>h3:
        h3=y
    elif a==4 and y<h4:
        h4=y

s=(w-w1-(w-w2))*(h-h3-(h-h4))

if s<=0:
    print(0)
else:
    print(s)


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

if a+b==max(a,b,c) or b+c==max(a,b,c) or c+a==max(a,b,c):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s=input()

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[i-1]

for i in range(len(output)):
    print(output[i],end="")

Fixed submission:
s=input()

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[len(output)-1]

for i in range(len(output)):
    print(output[i],end="")
Buggy python submission (verdict: Runtime Error):
n,l=(int(x) for x in input().split())

mojil=[]

for i in range(l):
    mojil.append(input())

mojil.sort()

for i in range(l):
    print(mojil[i],end="")

Fixed submission:
n,l=(int(x) for x in input().split())

mojil=[]

for i in range(n):
    mojil.append(input())

mojil.sort()

for i in range(n):
    print(mojil[i],end="")
Buggy python submission (verdict: Runtime Error):
i=input;i();l=i().split();print(max(l)*2<sum(l)and"Yes"or"No")

Fixed submission:
i=input;i();l=list(map(int,i().split()));print(["No","Yes"][max(l)*2<sum(l)])