Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=[input() for i in range(int(input()))]
m=[input() for i in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l))))

Fixed submission:
n=[input() for i in range(int(input()))]
m=[input() for i in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy python submission (verdict: Runtime Error):
n=[input() for i in range(int(input()))]
m=[input() for i in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i])) for i in range(len(l))))

Fixed submission:
n=[input() for i in range(int(input()))]
m=[input() for i in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
Buggy python submission (verdict: Runtime Error):
n=str(int(input())+1)
print(sum(map(int,list(n[0]+[0]*(len(n)-1)))))


Fixed submission:
n=str(int(input())+1)
print(sum(map(int,list(str(int(n[0]+'0'*(len(n)-1))-1)))))
Buggy python submission (verdict: Runtime Error):
r=range
M=[list(map(int,input().split())) for _ in r(3)]
for i in r(2):
  x=M[0][i]-M[0][i+1]
  y=M[i][0]-M[i+1][0]
  for j in r(3):
    if x!=M[j][i]-M[j][i+1] or y=M[i][j]-M[i+1][j]:
      print('No')
      exit()
print('Yes')

Fixed submission:
r=range
M=[list(map(int,input().split())) for _ in r(3)]
for i in r(2):
  x=M[0][i]-M[0][i+1]
  y=M[i][0]-M[i+1][0]
  for j in r(3):
    if x!=M[j][i]-M[j][i+1] or y!=M[i][j]-M[i+1][j]:
      print('No')
      exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
r=range
M=[list(map(int,input().split())) for _ in r(3)]
x
for i in r(2):
  x=M[0][i]-M[0][i+1]
  y=M[i][0]-M[i+1][0]
  for j in r(3):
    if x!=M[j][i]-M[j][i+1] or y=M[i][j]-M[i+1][j]:
      print('No')
      exit()
print('Yes')

Fixed submission:
r=range
M=[list(map(int,input().split())) for _ in r(3)]
for i in r(2):
  x=M[0][i]-M[0][i+1]
  y=M[i][0]-M[i+1][0]
  for j in r(3):
    if x!=M[j][i]-M[j][i+1] or y!=M[i][j]-M[i+1][j]:
      print('No')
      exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
n,k,x,y=(int(input()) for i in [0]*4)
print(n*x-(x-y)*max(n-k,0))

Fixed submission:
x,a,b=[int(input()) for i in range(3)]
print((x-a)%b)
Buggy python submission (verdict: Runtime Error):
print("Yes" if int(input().replace(" ",""))**0.5%1==0 else "No)

Fixed submission:
print("Yes" if int(input().replace(" ",""))**0.5%1==0 else "No")
Buggy python submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)

Fixed submission:
print("2018"+input()[4:])
Buggy python submission (verdict: Runtime Error):
print(len(set([int(input()) for i in range(int(input()))]))

Fixed submission:
print(len(set([int(input()) for i in range(int(input()))])))
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
s=input()
print("Yes" if s[a]=="_" and s.count("_")==1 else "No")

Fixed submission:
a,b=input().split()
s=input()
print("Yes" if s[int(a)]=="-" and s.count("-")==1 else "No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input(),split())
print("Left" if a+b>c+d else "Right" if a+b<c+d else "Balanced")

Fixed submission:
a,b,c,d=map(int,input().split())
print("Left" if a+b>c+d else "Right" if a+b<c+d else "Balanced")
Buggy python submission (verdict: Runtime Error):
print(-(-eval(input().replace(" ","+")//2))

Fixed submission:
print(-(-eval(input().replace(" ","+"))//2))
Buggy python submission (verdict: Time Limit Exceeded):
input()
A=list(map(int,input().split()))
c=0
for b in set(A):
  a=A.count(b)
  c+=a-b if a>=b else a
print(c)

Fixed submission:
from collections import Counter
input()
A=Counter(list(map(int,input().split()))).most_common()
c=0
for a,b in A:
  c+= b-a if b>=a else b
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
  ans+=1
print(ans)

Fixed submission:
input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n,k=map(int,input().split())
A=sorted(Counter(list(map(int,input().split()))).most_common())
print(n-sum([A[i][1] for i in range(k)]))

Fixed submission:
from collections import Counter
n,k=map(int,input().split())
A=sorted(Counter(list(map(int,input().split()))).most_common(),key=lambda x:x[1],reverse=True)
print(n-sum([A[i][1] for i in range(min(k,len(A)))]))
Buggy python submission (verdict: Runtime Error):
n = input
print("Yes" if n[0] == n[1] == n[2] or n[1] == n[2] == n[3] else "No")


Fixed submission:
n = input()
print("Yes" if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "No")

Buggy python submission (verdict: Runtime Error):
n = input
print("Yes" if n[0] == n[1] == n[2] or n[1] == n[2] == n[3] 
      else "No")

Fixed submission:
n = input()
print("Yes" if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "No")
Buggy python submission (verdict: Runtime Error):
a,b=2,1
for i in range(int(input()):a,b=b,(a+b)
print(a)

Fixed submission:
a,b=2,1
for i in range(int(input())):a,b=b,a+b
print(a)
Buggy python submission (verdict: Runtime Error):
from networkx import *
h,w=map(int,input().split());r=range(10);G=DiGraph();G.add_nodes_from(r);C=[[*map(int,input().split())]for _ in "_"*10];G.add_weighted_edges_from([(i,j,C[i][j])for i in r for j in r]);S=[single_source_dijkstra_path_length(G,i)[1]for i in r];A=[[*map(int,input().split())]for _ in r];print(sum(S[abs(x)] for a in A for x in a))

Fixed submission:
from networkx import *
h,w=map(int,input().split())
G=DiGraph()
G.add_nodes_from(range(10))
C=[[*map(int,input().split())]for _ in "_"*10]
G.add_weighted_edges_from([(i,j,C[i][j])for i in range(10)for j in range(10)])
S=[single_source_dijkstra_path_length(G,i)[1]for i in range(10)]
A=[[*map(int,input().split())]for _ in "_"*h]
print(sum(S[abs(x)] for a in A for x in a))
Buggy python submission (verdict: Runtime Error):
x,y=input().split()
print("<" if x<y else "=" if x==y else">)

Fixed submission:
x,y=input().split()
print("<" if x<y else "=" if x==y else ">")
Buggy python submission (verdict: Runtime Error):
print(-int(input()+int(input())*2) 

Fixed submission:
print(-int(input())+int(input())*2)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input() for i in range(h)]
for i in range(h):
  l=""
  for j in range(w):
    if s[i][j]=="#":
      l+="#"
    else:
      l+=str(sum(t[max(0,j-1):min(w,j+2)].count("#") for t in t[max(0,i-1):min(h,i+2)]))
    print(l)

Fixed submission:
h,w=map(int,input().split())
s=[input() for i in range(h)]
for i in range(h):
  l=""
  for j in range(w):
    if s[i][j]=="#":
      l+="#"
    else:
      l+=str(sum(t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]))
  print(l)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=set()
for i in range(n):
  s^=input()
print(len(s))

Fixed submission:
n=int(input())
s=set()
for i in range(n):
  s^={input()}
print(len(s))
Buggy python submission (verdict: Runtime Error):
C=[0]*100002
for i in map(int,input().split()):
  C[i-1],C[i],C[i+1]+=1
print(max(C))

Fixed submission:
input()
C=[0]*100002
for i in map(int,input().split()):
  C[i-1]+=1
  C[i]+=1
  C[i+1]+=1
print(max(C))
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
c=0
for i,a in enumerate(A):
  i+=1
  if i*a==1:
    c+=1
    A[0]=A[1]
    A[1]=1
  elif i==a:
    c+=1
    A[i]=A[i-1]
    A[i-1]=i
print(c)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))+[0]
c=0
for i in range(n):
  j=i+1
  a=A[i]
  if a==j:
    c+=1
    A[i]=A[i+1]
    A[i+1]=j
print(c)
Buggy python submission (verdict: Runtime Error):
a,*b,c=input()
print(a+str(len(b))+C)

Fixed submission:
a,*b,c=input()
print(a+str(len(b))+c)

Buggy python submission (verdict: Runtime Error):
a,*b,c=input()
print(a+len(b)+C)

Fixed submission:
a,*b,c=input()
print(a+str(len(b))+c)
Buggy python submission (verdict: Runtime Error):
h,w,n,*A=map(int,open(x:=0).read().split());c=[]
for i in range(n):c+=[i+1]*A[i]
for i in range(h):print(*(c[i*w:-~i*w])[::x]);x^=1

Fixed submission:
h,w,n,*A=map(int,open(0).read().split());c=[]
for i in range(1,n+1):c+=[i]*A[i-1]
for i in range(h):print(*(c[i*w:-~i*w])[::(-1)**i])
Buggy python submission (verdict: Runtime Error):
print(2**(len(bin(int(input())))-3)

Fixed submission:
print(2**(len(bin(int(input())))-3))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("Possible" iaf any([a%3==0,b%3==0,(a+b)%3==0]) else "Impossible")

Fixed submission:
a,b=map(int,input().split())
print("Possible" if any([a%3==0,b%3==0,(a+b)%3==0]) else "Impossible")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("Possible" if any(a%3==0,b%3==0,(a+b)%3==0) else "Impossible")

Fixed submission:
a,b=map(int,input().split())
print("Possible" if any([a%3==0,b%3==0,(a+b)%3==0]) else "Impossible")
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,inout().split()))
print(sum(sorted(l)[:k][::-1]))

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
print(sum(sorted(l)[::-1][:k]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
print(*a[::-2],*a[n%2::-2])

Fixed submission:
N=int(input())
A=list(input().split())
print(" ".join(A[::-2] + A[N%2::2]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
c,s=1,a[0]
while S!=2 and c<n:
  c,s=c+1,a[s-1]
print(c if c<n else -1)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
c,s=1,a[0]
while s!=2 and c<n:
  c,s=c+1,a[s-1]
print(c if c<n else -1)
Buggy python submission (verdict: Runtime Error):
print("YES" if int(input().replace(" ",""))%4==0 else "NO)

Fixed submission:
print("YES" if int(input().replace(" ",""))%4==0 else "NO")

Buggy python submission (verdict: Runtime Error):
print("YES" if int(input().replace(" ","")%4==0 else "NO)

Fixed submission:
print("YES" if int(input().replace(" ",""))%4==0 else "NO")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int(input()))
print("YES" if any((a*i)%b==c for i in range(a,b+1)) else "NO")

Fixed submission:
a,b,c=map(int,input().split())
print("YES" if any((a*i)%b==c for i in range(1,b+1)) else "NO")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print((a[0]+b[0]+c[0]).upper())

Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())

Buggy python submission (verdict: Runtime Error):
print((input()[0]+input()[0]+input()[0]).upper())

Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print("LESS" if a<b else "GREATER" else "EQUAL")

Fixed submission:
a=int(input())
b=int(input())
print("LESS" if a<b else "GREATER" if a>b else "EQUAL")
Buggy python submission (verdict: Runtime Error):
O=list(input())
E=list(input())+[""]
for i in zip(O,E):
  print(x+y,end="")

Fixed submission:
O=list(input())
E=list(input())+[""]
for i,j in zip(O,E):
  print(i+j,end="")
Buggy python submission (verdict: Runtime Error):
3 4
10 10
-10 -10
3 3
1 2
2 3
3 5
3 5

Fixed submission:
n,m=map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]
for a,b in A:
  l=[abs(a-c)+abs(b-d) for c,d in C]
  print(l.index(min(l))+1)
Buggy python submission (verdict: Runtime Error):
w,a,b=map(int,input().split())
print(max(abs(s-b)-w,0))

Fixed submission:
w,a,b=map(int,input().split())
print(max(abs(a-b)-w,0))
Buggy python submission (verdict: Runtime Error):
s=input()
print(len(s)-s[::-1].index("z")-s.index("A"))

Fixed submission:
s=input()
print(len(s)-s[::-1].index("Z")-s.index("A"))

Buggy python submission (verdict: Runtime Error):
s=input()
print(len(s)-s[::-1].index("z")+s.index("A"))

Fixed submission:
s=input()
print(len(s)-s[::-1].index("Z")-s.index("A"))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
print([x+y+z for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s))

Fixed submission:
k,s=map(int,input().split())
print(len([1 for z in range(k+1) for y in range(k+1) if 0<=s-z-y<=k]))
Buggy python submission (verdict: Runtime Error):
print(eval(input().split()))

Fixed submission:
print(eval(input().replace(" ","")))
Buggy python submission (verdict: Runtime Error):
S={c:list for c in "abc"}
s="a"
while S[s]:
  s=S[s].pop(0)
print(s.upper())

Fixed submission:
S={c:list(input()) for c in "abc"}
s="a"
while S[s]:
  s=S[s].pop(0)
print(s.upper())
Buggy python submission (verdict: Runtime Error):
print(sum(range(int(input())+1))

Fixed submission:
print(sum(range(int(input())+1)))

Buggy python submission (verdict: Runtime Error):
print(sum(range(1,int(input())+1))

Fixed submission:
print(sum(range(int(input())+1)))
Buggy python submission (verdict: Runtime Error):
ans=""
for i in input():
  if x=="B":
    if len(t)==0:
      t=t[a:-1]
  else:t+=i
print(ans)

Fixed submission:
t=""
for i in input():
  if i=="B":
    if len(t)!=0:
      t=t[:-1]
  else:t+=i
print(t)

Buggy python submission (verdict: Runtime Error):
ans=""
for i in input():
  if x=="B":t=t[:-1]
  else:t+=i
print(ans)

Fixed submission:
t=""
for i in input():
  if i=="B":
    if len(t)!=0:
      t=t[:-1]
  else:t+=i
print(t)

Buggy python submission (verdict: Runtime Error):
ans=""
for i in input():
  if x=="B":
    t=t[:-1]
print(ans)

Fixed submission:
t=""
for i in input():
  if i=="B":
    if len(t)!=0:
      t=t[:-1]
  else:t+=i
print(t)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
m=sum(A)//n
print(max(sum(map(lambda x:(x-m)**2,A)),sum(map(lambda x:(x-m-1)**2,A)))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
m=sum(A)//n
print(min(sum(map(lambda x:(x-m)**2,A)),sum(map(lambda x:(x-m-1)**2,A))))
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    [n, k] = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]

    temp = 1
    for i in range(k):
        temp *= arr[i]

    t = temp
    for i in range(k, n):
        t  = (temp // arr[i-k])
        t *= arr[i]
        if t > temp:
            print('Yes')
        else:
            print('No')

        temp = t


main()



Fixed submission:
def main():
    [n, k] = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]

    for i in range(k, n):
        if arr[i-k] >= arr[i]:
            print('No')
        else:
            print('Yes')



main()

Buggy python submission (verdict: Time Limit Exceeded):

def solve(n, k, arr, temp):
    size = k
    t = temp
    for i in range(k, n):
        t  = temp // arr[i-k]
        t *= arr[i]
        if t > temp:
            print('Yes')
        else:
            print('No')

        temp = t




def main():
    [n, k] = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]

    temp = 1
    for i in range(k):
        temp *= arr[i]

    solve(n, k, arr, temp)


main()


Fixed submission:
def main():
    [n, k] = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]

    for i in range(k, n):
        if arr[i-k] >= arr[i]:
            print('No')
        else:
            print('Yes')



main()
Buggy python submission (verdict: Runtime Error):
[n, m, k] = [int(x) for x in input().split()]

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

if sum(a)+sum(b) <= k:
    print(n+m)


else:
    if sum(a) < sum(b):
        small = a
        big = b
    else:
        small = b
        big = a

    # print(sum(small))

    if sum(small) == k:
        print(len(small))


    if sum(small) < k:
        count = 0
        while sum(small) < k:
            small.append(big.pop(0))
            count += 1
        
        print(len(small) + count)

    elif sum(small) > k:
        # print("here")
        while len(small) > 0 and sum(small) > k:
            small.pop(0)
        count = 0
        while len(small) > 0 and sum(small) <= k:
            small.append(big.pop(0))
            if sum(small) > k:
                small.pop()
            count += 1
        print(len(small))
        # print(small)

    


    
# ans = 0
# temp = 0
# for i in range(len(a)):
#     if temp+a[i] <= k:
#         temp+=a[i]
#         ans += 1

#     else:
#         break

# for i in range(len(b)):
#     if temp+b[i] <= k:
#         temp+=b[i]
#         ans += 1

#     else:
#         break

# print(ans)


# ans =0 


# while k > 0 and len(b)>0 and len(a)>0:
#     if len(a) > 0 and a[0] <= b[0]:
#         if k >= a[0]:
#             k -= a[0]
#             ans += 1
#             a.pop(0)
#         else:
#             break

#     elif len(b) > 0 and  b[0] <= a[0]:
#         if k >= b[0]:
#             k -= b[0]
#             ans += 1
#             b.pop(0)
#         else:
#             break


# if len(b)>0:
#     while len(b)>0 and k >= b[0]:
#         k -= b[0]
#         ans += 1
#         b.pop(0)

# elif len(a)>0:
#     while len(a)>0 and k >= a[0]:
#         k -= a[0]
#         ans += 1
#         a.pop(0)






Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
arr = [int(x) for x in input().split()]

q = int(input())
ans = sum(arr)

hashmap = {}
for val in arr:
    if val in hashmap:
        hashmap[val] += 1
    else:
        hashmap[val] = 1


while q > 0:
    print(hashmap)
    [x, y] =  [int(x) for x in input().split()]
    if x in hashmap:
        if y in hashmap:
            hashmap[y] += hashmap[x]
            ans -= hashmap[x]*x
            ans += y*hashmap[x]
        else:
            diff = hashmap[x] * x
            ans -= diff
            hashmap[y] = hashmap[x]
            del hashmap[x]
            add = hashmap[y] * y
            ans += add
        
    print(ans)
    q -=1

Fixed submission:
N = input()
arr = [int(x) for x in input().split()]

q = int(input())
ans = sum(arr)

hashmap = {}
for val in arr:
    if val in hashmap:
        hashmap[val] += 1
    else:
        hashmap[val] = 1


while q > 0:

    [x, y] =  [int(x) for x in input().split()]
    if x in hashmap:
        if y in hashmap:
            hashmap[y] += hashmap[x]
            ans -= hashmap[x]*x
            ans += y*hashmap[x]
            del hashmap[x]
        else:
            diff = hashmap[x] * x
            ans -= diff
            hashmap[y] = hashmap[x]
            del hashmap[x]
            add = hashmap[y] * y
            ans += add
        
    print(ans)
    q -=1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = 1
l = input().split()
for i in range(n):
    a *= int(l[i])

if a > 1000000000000000000 :
    print(-1)
else :
    print(a)


Fixed submission:
n = int(input())
a = 1
f1 = 0
f2 = 0
l = input().split()
for i in range(n):
    a *= int(l[i])
    if a > 1000000000000000000 :
        f1 = 1
        a = 1
    if a == 0:
        f2 = 1
    
if f2 == 1:
    print(0)
elif f1 == 1:
    print(-1)
else :
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
num=int(input())
date=list(map(int,input().split(" ")))
sum=0
for i in range(num):
    for j in range(num-i-1):
        sum+=date[i]*date[i+j+1]
print(sum%(10**9+7))

Fixed submission:
num=int(input())
date=list(map(int,input().split(" ")))
sum0=0
sum1=0
for i in range(num):
    sum0+=date[i]
for i in range(num):
    sum0-=date[i]
    sum1+=date[i]*sum0
print(sum1%(10**9+7))
Buggy python submission (verdict: Runtime Error):
num=int(input())
print(a+a*a+a*a*a)

Fixed submission:
a=int(input())
print(a+a*a+a*a*a)
Buggy python submission (verdict: Time Limit Exceeded):
num=int(input())
list0=[]
sum=0
for i in range(num):
  date=input()
  list0.append(date)
  j=0
  a=0
  if len(list0)-2>=0:
    for j in range(len(list0)-1):
        if list0[j]==date:
            a+=1
  if a==0:
    sum+=1
print(sum)
  

Fixed submission:
num=int(input())
list0=[]
for i in range(num):
  date=input()
  list0.append(date)
list0=set(list0)
print(len(list0))
Buggy python submission (verdict: Runtime Error):
num=int(input())
print(num*2*3. 1415926535)

Fixed submission:
num=int(input())
print(num*2*3.1415926535)
Buggy python submission (verdict: Runtime Error):
num=input().rstrip().split(" ")
N=int(num[0])
M=int(num[1])
date=input().rstrip().split(" ")
sum=0
for i in range(N):
  sum+=int(date[N])
date=sorted(date,reverse=True)
if (sum/4)/M<=date[M-1]:
  print("Yes")
else:
  print("No")

Fixed submission:
num=input().rstrip().split(" ")
N=int(num[0])
M=int(num[1])
date=input().rstrip().split(" ")
sum=0
for i in range(N):
  sum+=int(date[i])
for j in range(len(date)):
  date[j]=int(date[j])
date=sorted(date,reverse=True)
if (sum/4)/M<=int(date[M-1]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
num=input().rstrip().split(" ")
num1=int(num[0])
num2=int(num[1])
result=1
list0=[num1]
while result>0:
  result=num1-num2
  if result<0:
    result=-result
    list0.append(result)
    break
  else:
     list0.append(result)
list0=sorted(list0)
print(list0[0])

Fixed submission:
num=input().rstrip().split(" ")
num1=int(num[0])
num2=int(num[1])
if num1%num2==0:
  print(0)
else:
  date0=num1%num2
  date1=num2-date0
  if date0>date1:
    print(date1)
  else:
    print(date0)
Buggy python submission (verdict: Runtime Error):
for _ in range(int(input())):
  a,b,c,d=map(int,input().split())
  print(max(a*c,a*d,b*d,b*c))


Fixed submission:
a,b,c,d=map(int,input().split())
print(max(a*c,a*d,b*d,b*c))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

def mult(x, y):
    z = 0
    while y > 0:
        if y % 2 == 1: z = z + x
        x = x << 1
        y = y >> 1
    return z
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
p=1
for i in range(n):
    p=mult(p,a[i])

    if i>=k-1:
        b.append(p)
        p=p//a[i-k+1]

for i in range(1,len(b)):
    if b[i]>b[i-1]:
        print('Yes')
    else:
        print('No')


Fixed submission:
import sys
input=sys.stdin.readline


n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(k,n):

    if a[i]>a[i-k]:

        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
p=1
for i in range(n):
    p=p*a[i]

    if i>=k-1:
        b.append(p)
        p=p//a[i-k+1]

for i in range(1,len(b)):
    if b[i]>b[i-1]:
        print('Yes')
    else:
        print('No')


Fixed submission:
import sys
input=sys.stdin.readline


n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(k,n):

    if a[i]>a[i-k]:

        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
p=1
for i in range(n):
    p=p*a[i]

    if i>=k-1:
        b.append(p)
        p=p//a[i-k+1]

for i in range(1,len(b)):
    if b[i]>b[i-1]:
        print('Yes')
    else:
        print('No')


Fixed submission:
import sys
input=sys.stdin.readline


n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(k,n):

    if a[i]>a[i-k]:

        print('Yes')
    else:
        print('No')