Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split())


S = []
for _ in range(Q):
    S.append(input())

score_l = [K] * N

for j in S:
        for i in range(len(score_l)):
                if i != int(j)-1:
                        score_l[i]  = score_l[i] - 1


for score in score_l:
        if score <= 0:
                print("No")
        else:
                print("Yes")

Fixed submission:
N,K,Q = map(int, input().split())


S = []
for _ in range(Q):
    S.append(input())

#score_l = [K] * N
seikai_num = [K-Q] * N

for j in S:
        seikai_num[int(j)-1] += 1



for num in seikai_num:
        if num > 0:
                print("Yes")
        else:
                print("No")
Buggy python submission (verdict: Runtime Error):
m,d= map(int, input().split())

ans=0
for mon in range(1,m+1):
	for day in range(1,d+1):
    	if day<22:
        	continue
        d1,d2=str(day)
  		if d1*d2==mon:
            ans+=1
print(ans)

Fixed submission:
m,d= map(int, input().split())

ans=0
for mon in range(1,m+1):
    for day in range(1,d+1):
        if day<22:
            continue
        d1,d2=str(day)
        d1,d2=int(d1),int(d2)
        if d1<2 or d2<2:
            continue
        if d1*d2==mon:
            ans+=1

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


import heapq

heapq.heapify(V_list)


for i in range(N-1):
        v1=heapq.heappop(V_list)
        v2=heapq.heappop(V_list)
        new_v = (v1+v2)/2
        heapq.heappush(V_list,new_v)





print(V_list[0])
~

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


import heapq

heapq.heapify(V_list)


for i in range(N-1):
        v1=heapq.heappop(V_list)
        v2=heapq.heappop(V_list)
        new_v = (v1+v2)/2
        heapq.heappush(V_list,new_v)





print(V_list[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())

S = []
for _ in range(N):
    tmp=sorted(input())
    S.append(tmp)

S.sort()

for i in range(len(S)):
    S[i]=''.join(S[i])

import collections
from math import factorial

c = collections.Counter(S)

res=0
for v in c.values():
    if v>1:
        res += factorial(v) / factorial(2) / factorial(v - 2)

print(int(res))

Fixed submission:
N = int(input())

S = []
for _ in range(N):
    tmp=sorted(input())
    S.append(tmp)

for i in range(len(S)):
    S[i]=''.join(S[i])

import collections
from math import factorial

res=0
dic = {}
for tmp in S:
    if tmp in dic.keys():
        res+=dic[tmp]
        dic[tmp]+=1
    else:
        dic[tmp]=1

print(int(res))
Buggy python submission (verdict: Runtime Error):
a,b,c= map(int, input().split())
print(max(0,c-(a-b))

Fixed submission:
a,b,c= map(int, input().split())
print(max(0,c-(a-b)))
Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
s.reverse()

MOD=10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s)+1)]
dp[0][0]=1
keta=1
for i in range(len(s)):
    nd=s[i]
    for mod in range(13):
        dp[i][mod] %=MOD
        if dp[i][mod]==0:
            continue

        for d in range(10):
            if nd != "?" and str(d)!=nd:
                continue
            nmod=(d*keta + mod) % 13
            dp[i+1][nmod] += dp[i][mod]
    keta*=10
    keta%=13

print(dp[-1][5]%MOD)

Fixed submission:
s=list(input())
s.reverse()

MOD=10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s)+1)]
dp[0][0]=1
keta=1
for i in range(len(s)):
    nd=s[i]
    for mod in range(13):
        dp[i][mod] %=MOD
        if dp[i][mod]==0:
            continue

        for d in range(10):
            if nd != "?" and str(d)!=nd:
                continue
            nmod=(d*keta + mod) % 13
            dp[i+1][nmod] += dp[i][mod]
    keta*=10
    keta%=13

print(dp[-1][5]%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
s.reverse()

MOD=10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s)+1)]
dp[0][0]=1
for i in range(len(s)):
    nd=s[i]
    for mod in range(13):
        dp[i][mod] %=MOD
        if dp[i][mod]==0:
            continue

        for d in range(10):
            if nd != "?" and str(d)!=nd:
                continue
            nmod=(d*(pow(10,i,13)) + mod) % 13
            dp[i+1][nmod] += dp[i][mod]

print(dp[-1][5]%MOD)

Fixed submission:
s=list(input())
s.reverse()

MOD=10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s)+1)]
dp[0][0]=1
keta=1
for i in range(len(s)):
    nd=s[i]
    for mod in range(13):
        dp[i][mod] %=MOD
        if dp[i][mod]==0:
            continue

        for d in range(10):
            if nd != "?" and str(d)!=nd:
                continue
            nmod=(d*keta + mod) % 13
            dp[i+1][nmod] += dp[i][mod]
    keta*=10
    keta%=13

print(dp[-1][5]%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
s=list(input())
s.reverse()

MOD=10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s)+1)]
dp[0][0]=1
for i in range(len(s)):
    nd=s[i]
    for mod in range(13):
        dp[i][mod] %=MOD
        for d in range(10):
            if nd != "?" and str(d)!=nd:
                continue
            nmod=(d*(pow(10,i,13)) + mod) % 13
            dp[i+1][nmod] += dp[i][mod]

print(dp[-1][5]%MOD)

Fixed submission:
s=list(input())
s.reverse()

MOD=10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s)+1)]
dp[0][0]=1
keta=1
for i in range(len(s)):
    nd=s[i]
    for mod in range(13):
        dp[i][mod] %=MOD
        if dp[i][mod]==0:
            continue

        for d in range(10):
            if nd != "?" and str(d)!=nd:
                continue
            nmod=(d*keta + mod) % 13
            dp[i+1][nmod] += dp[i][mod]
    keta*=10
    keta%=13

print(dp[-1][5]%MOD)
Buggy python submission (verdict: Runtime Error):
 print(3*int(input())**2)

Fixed submission:
r=int(input())
print(3*(r**2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))


for i in range(len(S)):
        maax=-100
        for j in range(len(S)):
                if i==j:
                        continue
                if S[j] > maax:
                        maax = S[j]
        print(maax)

Fixed submission:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))


max1=-1
max2=-10

max1_ind=-100
max2_ind=-100

for i in range(len(S)):
        if S[i] > max1:
                max2=max1
                max2_ind = max1_ind

                max1=S[i]
                max1_ind=i
        elif S[i] > max2:
                max2=S[i]
                max2_ind=i

for i in range(len(S)):
        if i != max1_ind:
                print(max1)
        else:
                print(max2)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())

mi=10**10
for l in range(L,new_R+1):
    for r in range(L+1,new_R+1):
        mod = (l*r) % 2019
        if mod < mi:
            mi=mod
        if mi==0:
            print(mi)
            import sys
            sys.exit()
print(mi)

Fixed submission:
L, R = map(int, input().split())

new_L = L % 2019
new_R = R % 2019


if R - L >= 2019:
    print(0)
else:
    mi=10**10
    for l in range(new_L,new_R+1):
        for r in range(l+1,new_R+1):
            mod = (l*r) % 2019
            if mod < mi:
                mi=mod
    print(mi)
Buggy python submission (verdict: Runtime Error):
s=input()

for i in range(3):
        if s[i] == s[j+1]:
                print("Bad")
                exit()
print("Good")

Fixed submission:
s=input()

for i in range(3):
        if s[i] == s[i+1]:
                print("Bad")
                exit()
print("Good")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    tmp = list(map(int,input().split()))
    l.append(tmp)

from collections import defaultdict
d = defaultdict(int)

for i in range(len(l)):
    for j in range(len(l)):
        difx = l[i][0] - l[j][0]
        dify = l[i][1] - l[j][1]
        if difx!=0 or dify!=0:
            dif = str(difx) + "_" + str(dify)
            d[dif] += 1

p_q = max((v,k) for (k,v) in d.items())[1]
p,q = p_q.split("_")

ans=0
for i in range(len(l)):
    found=False
    for j in range(len(l)):
        difx = l[i][0] - l[j][0]
        dify = l[i][1] - l[j][1]
        if difx==int(p) and dify==int(q):
            found=True
            break
    if not found:
        ans+=1
print(ans)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    tmp = list(map(int,input().split()))
    l.append(tmp)

if len(l) == 1:
    print(1)
    exit()


from collections import defaultdict
d = defaultdict(int)

for i in range(len(l)):
    for j in range(len(l)):
        difx = l[i][0] - l[j][0]
        dify = l[i][1] - l[j][1]
        if difx!=0 or dify!=0:
            dif = str(difx) + "_" + str(dify)
            d[dif] += 1

p_q = max((v,k) for (k,v) in d.items())[1]
p,q = p_q.split("_")

ans=0
for i in range(len(l)):
    found=False
    for j in range(len(l)):
        difx = l[i][0] - l[j][0]
        dify = l[i][1] - l[j][1]
        if difx==int(p) and dify==int(q):
            found=True
            break
    if not found:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
print(180*(int(input())−2))

Fixed submission:
print(180*(int(input())-2))
Buggy python submission (verdict: Runtime Error):
k=int(input())
s=input()

import collections
c = collections.Counter(s)

win = c["o"]

if win-k>=23:
  print("YES")
else:
  print("NO")

Fixed submission:
s=input()
k=len(s)
import collections
c = collections.Counter(s)
win = c["o"]

if win+15-k>=8:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
V = list(map(int, input().split()))
from collections import deque
d=deque(V)
my_gem = []
max_value=-1000000000
def nxt(num,cur_v):
        global max_value
        global my_gem
        if num == K :
                return

        if len(d) > 0:

                # sousa A
                gem_v = d.popleft()
                cur_v+=gem_v
                if max_value < cur_v:
                        max_value = cur_v

                my_gem.append(gem_v)
                nxt(num+1,cur_v)

                my_gem.remove(gem_v)
                cur_v -= gem_v
                d.appendleft(gem_v)

                # sousa B
                gem_v = d.pop()
                cur_v+=gem_v
                if max_value < cur_v:
                        max_value = cur_v

                my_gem.append(gem_v)
                nxt(num+1,cur_v)
                my_gem.remove(gem_v)

                cur_v -= gem_v
                d.append(gem_v)

        # sousa C
        itr = 0
        for pushgem in my_gem:
                itr+=1
                my_gem.remove(pushgem)
                cur_v -= pushgem

                if max_value < cur_v:
                        max_value = cur_v

                d.appendleft(pushgem)
                nxt(num+1,cur_v)
                d.popleft()

                cur_v += pushgem
                my_gem.append(pushgem)
                if itr == len(my_gem):
                        break

        # sousa D
        itr = 0
        for pushgem in my_gem:
                my_gem.remove(pushgem)
                cur_v -= pushgem

                if max_value < cur_v:
                        max_value = cur_v

                d.append(pushgem)
                nxt(num+1,cur_v)
                d.pop()

                cur_v += pushgem
                my_gem.append(pushgem)
                if itr == len(my_gem):
                        break

nxt(0,0)
print(max_value)

Fixed submission:
N,K = map(int, input().split())
V = list(map(int, input().split()))
import sys
max_value=-1000000000

for i in range(K+1):
        for left in range(i+1):
                right= i - left

                leftlist = V[:left]

                if right == 0:
                        rightlist = []
                else:
                        rightlist = V[-right:]

        #       print(left)
        #       print(right)


                leftlist.extend(rightlist)

                leftlist.sort()


#               for push in range(K-i):

                num = 0
                for value in range(len(leftlist)):
                        num+=1
                        if num > K-i:
                                break

                        if leftlist[value] > 0:
                                break
                        leftlist[value]=0
        #       print(leftlist)



                s = sum(leftlist)
                if max_value < s:
                        max_value = s

                if left+right > N:
                        print(max_value)
                        sys.exit()

print(max_value)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(m):
    data = list(map(int,input().split()))
    l.append(data)
l.sort(key=lambda x:x[1])

import heapq
heapq.heapify(a)

for tmp in l:
    b=tmp[0]
    c=tmp[1]

    for i in range(b):
        heapq.heappushpop(a,c)

print(sum(a))

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(m):
    data = list(map(int,input().split()))
    l.append(data)
l.sort(key=lambda x:x[1])
l.reverse()

a.sort()

b_idx=0
nokori=l[b_idx][0]
for i in range(n):
    if a[i] > l[b_idx][1]:
        break
    else:
        a[i] = l[b_idx][1]
        nokori-=1
        if nokori == 0:
            b_idx+=1
            if b_idx >= m:
                break
            nokori=l[b_idx][0]

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(m):
    data = list(map(int,input().split()))
    l.append(data)
l.sort(key=lambda x:x[1])

import heapq
heapq.heapify(a)

for tmp in l:
    b=tmp[0]
    c=tmp[1]

    for i in range(b):
        heapq.heappushpop(a,c)

print(sum(a))

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(m):
    data = list(map(int,input().split()))
    l.append(data)
l.sort(key=lambda x:x[1])
l.reverse()

a.sort()

b_idx=0
nokori=l[b_idx][0]
for i in range(n):
    if a[i] > l[b_idx][1]:
        break
    else:
        a[i] = l[b_idx][1]
        nokori-=1
        if nokori == 0:
            b_idx+=1
            if b_idx >= m:
                break
            nokori=l[b_idx][0]

print(sum(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l=[]
for i in range(n-1):
    tmp = list(map(int,input().split()))
    l.append(tmp)
l.sort()

from collections import deque
Q = deque()
Q.append(0)

dis = [0]*n
dis[0]=0

while Q:
    num=Q.popleft()

    for tmp in l:
        if tmp[0]-1 == num:
            nxt=tmp[1]-1
            Q.append(nxt)
            dis[nxt] = dis[num] + tmp[2]

for a in dist:
    print(a%2)

Fixed submission:
n = int(input())
l=[]
for i in range(n-1):
    tmp = list(map(int,input().split()))
    l.append(tmp)
l.sort()

link = [[] for _ in range(n)]

for tmp in l:
    link[tmp[0]-1].append([tmp[1]-1,tmp[2]])
    link[tmp[1]-1].append([tmp[0]-1,tmp[2]])

from collections import deque
Q = deque()
Q.append(0)

dis = [-1]*n
dis[0]=0

while Q:
    num=Q.popleft()
    for tmp in link[num]:
        if dis[tmp[0]] == -1:
            dis[tmp[0]] = dis[num]+tmp[1]
            Q.append(tmp[0])

for a in dis:
    print(a%2)
Buggy python submission (verdict: Runtime Error):
a,b,c= map(int, input().split())
if a<c<b or b<c<a:
  	print("Yes")
  else:
    print("No")

Fixed submission:
a,b,c= map(int, input().split())
if a<c<b or b<c<a:
	print("Yes")
else:
	print("No")

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

Fixed submission:
a,b,c= map(int, input().split())
if a<c<b or b<c<a:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
lis=[]
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
ans=0
lis_h=[]
for i in range(5):
        hito=int(str(lis[i])[-1])
        time=lis[i]
        if hito==0:
                ans+=time
        else:
                lis_h.append([hito,time])
lis_h.sort()
ans+=lis_h[0][1]

for i in range(len(lis_h)):
        if i==0:
                continue
        num = (lis_h[i][1]//10) * 10
        if lis_h[i][0] != 0:
                num+=10
        ans+=num

print(ans)

Fixed submission:
lis=[]
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
lis.append(int(input()))
ans=0
lis_h=[]
for i in range(5):
        hito=int(str(lis[i])[-1])
        time=lis[i]
        if hito==0:
                ans+=time
        else:
                lis_h.append([hito,time])
lis_h.sort()

if len(lis_h)==0:
        print(ans)
        exit()
ans+=lis_h[0][1]

for i in range(len(lis_h)):
        if i==0:
                continue
        num = (lis_h[i][1]//10) * 10
        if lis_h[i][0] != 0:
                num+=10
        ans+=num

print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
if s=="A":
  print("T")
eilf s=="T":
  print("A")
eilf s=="C":
  print("G")
eilf s=="G":
  print("C")

Fixed submission:
s=input()
if s=="A":
  print("T")
elif s=="T":
  print("A")
elif s=="C":
  print("G")
elif s=="G":
  print("C")
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()

lr=[]
for _ in range(q):
    D = list(map(int, input().split()))
    lr.append(D)

ac_list=[]

for i in range(len(s)):
    if s[i]=="A" and s[i+1]=="C":
        ac_list.append(i)

import bisect

for j in range(q):
    ind1 = bisect.bisect_left(ac_list,lr[j][0]-1)
    ind2 = bisect.bisect_left(ac_list,lr[j][1]-1)

    print(ind2-ind1)

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

lr=[]
for _ in range(q):
    D = list(map(int, input().split()))
    lr.append(D)

ac_list=[]

for i in range(len(s)-1):
    if s[i]=="A" and s[i+1]=="C":
        ac_list.append(i)

import bisect

for j in range(q):
    ind1 = bisect.bisect_left(ac_list,lr[j][0]-1)
    ind2 = bisect.bisect_left(ac_list,lr[j][1]-1)

    print(ind2-ind1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
b = list(map(int, input().split()))
ans=[]
dl = -1
for num in range(n):
    for i in range(len(b)):
        if b[i] == i+1:
            dl=i
    if dl==-1:
        print(-1)
        exit()
    b.pop(dl)
    ans.append(dl+1)
ans = list(reversed(ans))
for i in ans:
    print(i)

Fixed submission:
n=int(input())
b = list(map(int, input().split()))
ans=[]
for num in range(n):
    dl=-1
    for i in range(len(b)):
        if b[i] == i+1:
            dl=i
    if dl==-1:
        print(-1)
        exit()
    b.pop(dl)
    ans.append(dl+1)
ans = list(reversed(ans))
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
l = []
for i in range(3):
  a,b = map(int, input().split())
  l.append(a)
  l.append(b)

for i in range(1,5):
  cnt=0
  for itm in l:
    if i==l:
      cnt+=1
  if cnt>=3:
    print("NO")
 	exit()
print("YES")
  	
  

Fixed submission:
l = []
for i in range(3):
  a,b = map(int, input().split())
  l.append(a)
  l.append(b)

for i in range(1,5):
  cnt=0
  for itm in l:
    if i==itm:
      cnt+=1
  if cnt>=3:
    print("NO")
    exit()
print("YES")
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

res=0


while True:

#       print(H)
        for l in range(N):
                if H[l]!=0:
                        break
        for r in range(l+1,N):
                if H[r]==0:
                        r-=1
                        break

#       print(l,r)

        if l>r:
                break

        if l==r:
                miin=H[l]
        else:
                miin=min(H[l:r])


#       print(min(H[l:r]))

        res+=miin

        if miin == 0:
                break

        for i in range(l,r+1):
                H[i] -= miin


res += H[N-1]
print(res)

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

mizu=0

while True:

    end=True
    for i in range(n):
       if h[i]!=0:
           end=False

    if end:
        break

    for l in range(n):
        if h[l]!=0:
            break

    for r in range(l,n):
        if h[r]==0:
            r-=1
            break

    mizu+=1
    for i in range(l,r+1):
        h[i] -= 1

print(mizu)

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

res=0


while True:

#       print(H)
        for l in range(N):
                if H[l]!=0:
                        break
        for r in range(l+1,N):
                if H[r]==0:
                        r-=1
                        break

#       print(l,r)

        if l>r:
                break

        if l==r:
                miin=H[l]
        else:
                miin=min(H[l:r])


#       print(min(H[l:r]))

        res+=miin

        if miin == 0:
                break

        for i in range(l,r+1):
                H[i] -= miin


res += H[N-1]
print(res)

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

mizu=0

while True:

    end=True
    for i in range(n):
       if h[i]!=0:
           end=False

    if end:
        break

    for l in range(n):
        if h[l]!=0:
            break

    for r in range(l,n):
        if h[r]==0:
            r-=1
            break

    mizu+=1
    for i in range(l,r+1):
        h[i] -= 1

print(mizu)
Buggy python submission (verdict: Runtime Error):
s = input()
import re
if "keyence" == s:
    print("YES")
    exit()

if re.fullmatch(".*keyence",s) is not None:
    print("YES")
    exit()

if re.fullmatch("k.*eyence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("ke.*yence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("key.*ence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keye.*nce",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyen.*ce",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyenc.*e",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyence.*",s) is not None:
    print("YES")
    exit()
print("NO")

Fixed submission:
s = input()
import re
if "keyence" == s:
    print("YES")
    exit()

if re.fullmatch(".*keyence",s) is not None:
    print("YES")
    exit()

if re.fullmatch("k.*eyence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("ke.*yence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("key.*ence",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keye.*nce",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyen.*ce",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyenc.*e",s) is not None:
    print("YES")
    exit()
if re.fullmatch("keyence.*",s) is not None:
    print("YES")
    exit()
print("NO")