Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B=map(int,input().split())
res=0
N1=N//(A+B)
N2=N%(A+B)+1
if A==0:
    res=0
elif B==0:
    res=N
else:
    res1=(N1)*A
    res2=0
    for n in range(1,N2):
        if n<=A:
            res2+=1
    res=res1+res2
print(res)

Fixed submission:
N,A,B=map(int,input().split())
res=0
N1=N//(A+B)
N2=N%(A+B)
if A==0:
    res=0
elif B==0:
    res=N
else:
    res1=(N1)*A
    if A<=N2:
        res2=A
    else:
        res2=N2
    res=res1+res2
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B=map(int,input().split())
res=0
if A==0:
    res=0
else:
    res1=(N//(A+B))*A
    res2=0
    for n in range(1,N%(A+B)+1):
        if n<=A:
            res2+=1
    res=res1+res2
print(res)

Fixed submission:
N,A,B=map(int,input().split())
res=0
N1=N//(A+B)
N2=N%(A+B)
if A==0:
    res=0
elif B==0:
    res=N
else:
    res1=(N1)*A
    if A<=N2:
        res2=A
    else:
        res2=N2
    res=res1+res2
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
S=(input())
Q=int(input())
cnt_re=0
for i in range(Q):
    q=list(input().split())
    if q[0]=='1':
        cnt_re+=1
    else:
        if (int(q[1])+cnt_re)%2==1:
            S=q[2]+S
        else:
            S=S+q[2]

if cnt_re%2==1:
    print(S[::-1])
else:
    print(S)

Fixed submission:
S=(input())
Q=int(input())
cnt_re=0
s=''
for i in range(Q):
    q=list(input().split())
    if q[0]=='1':
        cnt_re+=1
    else:
        if (int(q[1])+cnt_re)%2==1:
            s=s+q[2]
        else:
            S=S+q[2]
if cnt_re%2==1:
    print(S[::-1]+s)
else:
    print(s[::-1]+S)

Buggy python submission (verdict: Time Limit Exceeded):
S=(input())
Q=int(input())
cnt_re=0
for i in range(Q):
    q=list(input().split())
    if q[0]=='1':
        cnt_re+=1
    else:
        tmp=cnt_re%2
        tmpq=q[1]
        if ((tmpq=='1')&(tmp==0)) | ((tmpq=='2')&(tmp==1)):
            S=q[2]+S
        else:
            S=S+q[2]

if cnt_re%2==1:
    print(S[::-1])
else:
    print(S)

Fixed submission:
S=(input())
Q=int(input())
cnt_re=0
s=''
for i in range(Q):
    q=list(input().split())
    if q[0]=='1':
        cnt_re+=1
    else:
        if (int(q[1])+cnt_re)%2==1:
            s=s+q[2]
        else:
            S=S+q[2]
if cnt_re%2==1:
    print(S[::-1]+s)
else:
    print(s[::-1]+S)

Buggy python submission (verdict: Time Limit Exceeded):
S=(input())
Q=int(input())
cnt_re=0
for i in range(Q):
    q=input().split()
    if q[0]=='1':
        cnt_re+=1
    else:
        tmp=cnt_re%2
        if ((q[1]=='1')&(tmp==0)) | ((q[1]=='2')&(tmp==1)):
            S=q[2]+S
        elif ((q[1]=='1')&(tmp==1)) | ((q[1]=='2')&(tmp==0)):
            S=S+q[2]
            
if cnt_re%2==1:
    print(S[::-1])
else:
    print(S)

Fixed submission:
S=(input())
Q=int(input())
cnt_re=0
s=''
for i in range(Q):
    q=list(input().split())
    if q[0]=='1':
        cnt_re+=1
    else:
        if (int(q[1])+cnt_re)%2==1:
            s=s+q[2]
        else:
            S=S+q[2]
if cnt_re%2==1:
    print(S[::-1]+s)
else:
    print(s[::-1]+S)

Buggy python submission (verdict: Time Limit Exceeded):
S=(input())
Q=int(input())
cnt_re=0
for i in range(Q):
    q=input().split()
    if q[0]=='1':
        cnt_re+=1
    else:
        tmp=cnt_re%2
        if ((q[1]=='1')&(tmp==0)) | ((q[1]=='2')&(tmp==1)):
            S=q[2]+S
        elif ((q[1]=='1')&(tmp==1)) | ((q[1]=='2')&(tmp==0)):
            S=S+q[2]
S=list(S)
if cnt_re%2==1:
    S.reverse()
print(''.join(S))

Fixed submission:
S=(input())
Q=int(input())
cnt_re=0
s=''
for i in range(Q):
    q=list(input().split())
    if q[0]=='1':
        cnt_re+=1
    else:
        if (int(q[1])+cnt_re)%2==1:
            s=s+q[2]
        else:
            S=S+q[2]
if cnt_re%2==1:
    print(S[::-1]+s)
else:
    print(s[::-1]+S)
Buggy python submission (verdict: Runtime Error):
N,M=map(int, input().split())
SC=list(list(map(int, input().split())) for i in range(M))

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
sc=get_unique_list(SC)

if (N==3) & (max(sc)[0]!=3):
    sc.append([1,1])
if (N==2) & (max(sc)[0]!=2):
    sc.append([2,1])

res=0
if M==0:
    res=-1
for i in range(len(sc)):
    for j in range(len(sc)):
        if (i!=j) & (sc[i][0]==sc[j][0]):
            res=-1
            break
    break
for i in range(len(sc)):
    if (M!=1) & (sc[i][0]==1) & (sc[j][1]==0):
        res=-1
        break
if N<len(sc):
    res=-1
if res!=-1:
    for i in range(len(sc)):
        res = res + sc[i][1]*(10**(N-sc[i][0]))
print(res)

Fixed submission:
n=int(input())
if n%2==0:
    print(n//2)
else:
    print(n//2+1)
Buggy python submission (verdict: Runtime Error):
import numpy as np
A=list(list(map(int, input().split())) for _ in range(3))
N=int(input())
B=list(int(input()) for _ in range(N))
a=np.array(A)
c=a.flatten()
C=c.tolist()

for c in range(len(C)):
    for b in range(len(B)):
        if C[c]==B[b]:
            C[c]=0

            if (sum(C[:3])==0) | (sum(C[3:6])==0) | (sum(C[6:9])==0):
    print("Yes")
elif (C[0]+C[3]+C[6]==0) | (C[1]+C[4]+C[7]==0) | (C[2]+C[5]+C[8]==0):
    print("Yes")
elif (C[0]+C[4]+C[8]==0) | (C[2]+C[4]+C[6]==0): 
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
A=list(list(map(int, input().split())) for _ in range(3))
N=int(input())
B=list(int(input()) for _ in range(N))
a=np.array(A)
c=a.flatten()
C=c.tolist()

for c in range(len(C)):
    for b in range(len(B)):
        if C[c]==B[b]:
            C[c]=0

if (sum(C[:3])==0) | (sum(C[3:6])==0) | (sum(C[6:9])==0):
    print("Yes")
elif (C[0]+C[3]+C[6]==0) | (C[1]+C[4]+C[7]==0) | (C[2]+C[5]+C[8]==0):
    print("Yes")
elif (C[0]+C[4]+C[8]==0) | (C[2]+C[4]+C[6]==0): 
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import numpy as np
A=list(list(map(int, input().split())) for _ in range(3))
N=int(input())
B=list(int(input()) for _ in range(N))
a=np.array(A)
C=a.flatten()

for c in range(len(C)):
    for b in range(len(B)):
        if C[c]==B[b]:
            C[c]=0

            if (sum(C[:3])==0) | (sum(C[3:6])==0) | (sum(C[6:9])==0):
    print("Yes")
elif (C[0]+C[3]+C[6]==0) | (C[1]+C[4]+C[7]==0) | (C[2]+C[5]+C[8]==0):
    print("Yes")
elif (C[0]+C[4]+C[8]==0) | (C[2]+C[4]+C[6]==0): 
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
A=list(list(map(int, input().split())) for _ in range(3))
N=int(input())
B=list(int(input()) for _ in range(N))
a=np.array(A)
c=a.flatten()
C=c.tolist()

for c in range(len(C)):
    for b in range(len(B)):
        if C[c]==B[b]:
            C[c]=0

if (sum(C[:3])==0) | (sum(C[3:6])==0) | (sum(C[6:9])==0):
    print("Yes")
elif (C[0]+C[3]+C[6]==0) | (C[1]+C[4]+C[7]==0) | (C[2]+C[5]+C[8]==0):
    print("Yes")
elif (C[0]+C[4]+C[8]==0) | (C[2]+C[4]+C[6]==0): 
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s=sum(S[:K])
dp=[0]*(N-K+1)
dp[0]=s
for i in range(1,N-K+1):
    s=s-S[i-1]+S[i+K-1]
    if s>dp[i-1]:
        dp[i]=s
print((max(dp)+K)/2)

Fixed submission:
N,K=map(int, input().split())
S=list(map(int, input().split()))
s=sum(S[:K])
dp=[0]*(N-K+1)
dp[0]=s
for i in range(1,N-K+1):
    s=s-S[i-1]+S[i+K-1]
    if s>dp[i-1]:
        dp[i]=s
print((max(dp)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=list(map(int, input().split()))
res=[]
for a in A:
    tmp=0
    for i in range(1,a+1):
        tmp+=i
    res.append(tmp/a)
cnt=0
for i in range(N):
    if K+i<=N:
        B=sum(res[i:K+i])
        if cnt<B:
            cnt=B
print(cnt)

Fixed submission:
N,K=map(int, input().split())
S=list(map(int, input().split()))
s=sum(S[:K])
dp=[0]*(N-K+1)
dp[0]=s
for i in range(1,N-K+1):
    s=s-S[i-1]+S[i+K-1]
    if s>dp[i-1]:
        dp[i]=s
print((max(dp)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=list(map(int, input().split()))
cnt=0
for i in range(N):
    if K+i<=N:
            B=A[i:K+i]
            res=[]
            for b in B:
                tmp=0
                for i in range(1,b+1):
                    tmp+=i
                res.append(tmp/b)
    if cnt<sum(res):
        cnt=sum(res)
print(cnt)

Fixed submission:
N,K=map(int, input().split())
S=list(map(int, input().split()))
s=sum(S[:K])
dp=[0]*(N-K+1)
dp[0]=s
for i in range(1,N-K+1):
    s=s-S[i-1]+S[i+K-1]
    if s>dp[i-1]:
        dp[i]=s
print((max(dp)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=list(map(int, input().split()))
cnt=0
for i in range(N):
    if K+i<=N:
            B=A[i:K+i]
            res=[]
            for b in B:
                tmp=0
                for i in range(1,b+1):
                    tmp+=(i/b)
                res.append(tmp)
    if cnt<sum(res):
        cnt=sum(res)
print(cnt)

Fixed submission:
N,K=map(int, input().split())
S=list(map(int, input().split()))
s=sum(S[:K])
dp=[0]*(N-K+1)
dp[0]=s
for i in range(1,N-K+1):
    s=s-S[i-1]+S[i+K-1]
    if s>dp[i-1]:
        dp[i]=s
print((max(dp)+K)/2)
Buggy python submission (verdict: Runtime Error):
N,M=map(int, input().split())
q=list([] for m in range(M))
if 1<=M:
    x0,y0=input().split()
    q[0].append(y0)
    for m in range(M-1):
        x,y=input().split()
        q[int(x)-int(x0)].append(y)
wa=[0]*M
ac=[0]*M
for i in range(len(q)):
    for j in range(len(q[i])):
        if (q[i][j]=='AC')&(ac[i]==0):
            ac[i]=1
            wa[i]=j
print(sum(ac),sum(wa))

Fixed submission:
N,M=map(int, input().split())
wa=[0]*N # カウント
ac=[0]*N # 何回目でacか
ac_n=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        wa[p-1]+=1
    if (s=='AC') and (ac[p-1]==0):
        ac[p-1]=wa[p-1]+1
        ac_n+=1
print(str(ac_n)+' '+str(sum(ac)-ac_n))
Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int, input().split())
maze=[]
maze.append(list("#"*(W+2)))
for h in range(H):
    maze.append(list("#"+input()+"#"))
maze.append(list("#"*(W+2)))

from collections import deque
import itertools
import copy

def chk_bfd(sy,sx,gy,gx):
    ma=copy.deepcopy(maze)
    ma[sy][sx]=0
    d=[(1,0),(-1,0),(0,1),(0,-1)]
    q=deque([[sy,sx]])
    while q:
        y,x=q.popleft()
        for dy,dx in d:
            if ma[y+dy][x+dx]=='.':
                q.append([y+dy,x+dx])
                ma[y+dy][x+dx]=ma[y][x]+1
    return ma[gy][gx]

s=[]
for h in range(H+2):
    for w in range(W+2):
        if maze[h][w]=='.':
            s.append([h,w])

res=0
for spoint,gpoint in list(itertools.combinations(s,2)):
    sy,sx=spoint[0],spoint[1]
    gy,gx=gpoint[0],gpoint[1]
    tmp=chk_bfd(sy,sx,gy,gx)
    res=max(res,tmp)

print(res)  


Fixed submission:
H,W=map(int, input().split())
maze=[]
maze.append(list("#"*(W+2)))
for h in range(H):
    maze.append(list("#"+input()+"#"))
maze.append(list("#"*(W+2)))

from collections import deque
import itertools
import copy

def chk_bfd(sy,sx):
    m_max=0
    ma=copy.deepcopy(maze)
    ma[sy][sx]=0
    d=[(1,0),(-1,0),(0,1),(0,-1)]
    q=deque([[sy,sx]])
    while q:
        y,x=q.popleft()
        for dy,dx in d:
            if ma[y+dy][x+dx]=='.':
                q.append([y+dy,x+dx])
                ma[y+dy][x+dx]=ma[y][x]+1
                m_max=max(m_max,ma[y+dy][x+dx])
    return m_max

s=[]
for h in range(H+2):
    for w in range(W+2):
        if maze[h][w]=='.':
            s.append([h,w])

res=0
for sy,sx in s:
    res=max(res,chk_bfd(sy,sx))

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[]
for n in range(N):
    s=sorted(list(input()))
    s=''.join(s)
    S.append(s)

import itertools
ans=0
for i in range(N):
    for j in range(N):
        if i!=j:
            if S[i]==S[j]:
                ans+=1
print(int(ans/2))


Fixed submission:
N=int(input())
S={}
c={}
for i in range(N):
    s=''.join(sorted(input()))  
    if s in S:
        c[s]+=1
        if c[s]>=2:
            S[s]=S[s]+c[s]
        else:
            S[s]+=1

    else:
        S[s]=0
        c[s]=0
print(sum(S.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[]
for n in range(N):
    s=sorted(list(input()))
    s=''.join(s)
    S.append(s)

import itertools
ans=0
for s1,s2 in list(itertools.combinations(S,2)):
    if s1==s2:
        ans+=1
print(ans)


Fixed submission:
N=int(input())
S={}
c={}
for i in range(N):
    s=''.join(sorted(input()))  
    if s in S:
        c[s]+=1
        if c[s]>=2:
            S[s]=S[s]+c[s]
        else:
            S[s]+=1

    else:
        S[s]=0
        c[s]=0
print(sum(S.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n_1, n_0, n_m1, k = map(int, input().split())
sum_n = 0

for i in range(k):
  if n_1 != 0:
    sum_n += 1
    n_1 -=1
  elif n_0 != 0:
    n_0 -= 1
  else:
    sum_n -= 1

print(sum_n)
    

Fixed submission:
a, b, c, k = map(int, input().split())
ans = min(a, k) - max(0, k-a-b)
print(ans)
Buggy python submission (verdict: Runtime Error):
M, N = map(int, input().split())
A, B = map(int, input().split())

if M < A + B:
  print(-1)
else:
  print(M - A - B)

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

if M < sum(l):
  print(-1)
else:
  print(M - sum(l))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
check = []

for a in A:
    if not a in check:
        check.append(a)
    else:
        print('NO')
        break
else:
    print('YES')

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

if len(set(A)) == len(A):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
 
list_monster = list(map(int, input().split()))
list_monster.sort(reverse = True) 
 
if N <= K:
  print(0)
  
elif K == 0:
  print(sum(list_monster))
  
else:
  for i in range(K):
    
    list_monster.pop(0)
 
  print(sum(list_monster))

Fixed submission:
N, K = map(int, input().split())
 
list_monster = list(map(int, input().split()))
list_monster.sort(reverse = True) 
 
if N <= K:
  print(0)
  
elif K == 0:
  print(sum(list_monster))
  
else:
  print(sum(list_monster[K:]))

Buggy python submission (verdict: Time Limit Exceeded):
_input = input().split()
n = int(_input[0])
k = int(_input[1])

input_hp = input().split()

list_monster = []
for i in range(n):
  list_monster.append(int(input_hp[i]))
  
list_monster.sort() 
list_monster.reverse() #降順にソート

#使用できる必殺技の残りカウント
count = k 
  
if n <= k:
  print(0)
  
elif k == 0:
  number = 0
  for i in range(len(list_monster)):
    number += list_monster[i]
  
  print(number)
  
else:
  for i in range(k): #最初に持っていた必殺技の数だけ繰り返す
    count -= 1 #使用ごとに必殺技の残りカウントを減らす
    
    list_monster.pop(0)
    
  number = 0

  for i in range(len(list_monster)):
  	number += list_monster[i]

  print(number)

Fixed submission:
N, K = map(int, input().split())
 
list_monster = list(map(int, input().split()))
list_monster.sort(reverse = True) 
 
if N <= K:
  print(0)
  
elif K == 0:
  print(sum(list_monster))
  
else:
  print(sum(list_monster[K:]))

Buggy python submission (verdict: Time Limit Exceeded):
_input = input().split()
n = int(_input[0])
k = int(_input[1])

input_hp = input().split()

list_monster = []
for i in range(n):
  list_monster.append(int(input_hp[i]))
  
list_monster.sort() 
list_monster.reverse() #降順にソート

#使用できる必殺技の残りカウント
count = k 
  
if n <= k:
  print(0)
else:
  for i in range(k): #最初に持っていた必殺技の数だけ繰り返す
    count -= 1 #使用ごとに必殺技の残りカウントを減らす
    
    list_monster.pop(0)
    
  number = 0

  for i in range(len(list_monster)):
  	number += list_monster[i]

  print(number)

Fixed submission:
N, K = map(int, input().split())
 
list_monster = list(map(int, input().split()))
list_monster.sort(reverse = True) 
 
if N <= K:
  print(0)
  
elif K == 0:
  print(sum(list_monster))
  
else:
  print(sum(list_monster[K:]))
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())

a = ''
count = 0
i = 0
while(i < len(S)):
    for j in range(i,len(S)):
        a += S[j]
        if(int(a) % 2019 == 0):
            count += 1
    i += 1
    a = ''
print(count)

Fixed submission:
S = input()
P =2019
ans = 0
 
count = [0] * P
count[0] = 1
u = 0
for i, s in enumerate(reversed(S)):
    u = (int(s) * pow(10, i, P) + u) % P
    ans += count[u]
    count[u] += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())

a = ''
count = 0
for i in range(0,len(S)):
    for j in range(i,len(S)):
        a += S[j]
        if(int(a) % 2019 == 0):
            count += 1
    a = ''
print(count)

Fixed submission:
S = input()
P =2019
ans = 0
 
count = [0] * P
count[0] = 1
u = 0
for i, s in enumerate(reversed(S)):
    u = (int(s) * pow(10, i, P) + u) % P
    ans += count[u]
    count[u] += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())

a = ''
count = 0
for i in range(0,len(S)):
    for j in range(i,len(S)):
        a += S[j]
        if(int(a) % 2019 == 0):
            count += 1
    a = ''
print(count)

Fixed submission:
S = input()
P =2019
ans = 0
 
count = [0] * P
count[0] = 1
u = 0
for i, s in enumerate(reversed(S)):
    u = (int(s) * pow(10, i, P) + u) % P
    ans += count[u]
    count[u] += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())

a = [int(input()) for i in range(M)]

if(N >= sum(a)):
    print(N - sum(a))
else:
    print(-1)

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

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

if(N >= sum(a)):
    print(N - sum(a))
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

sum = 0

for i in range(1,M+1):
    sum += int(input())

if(N >= sum):
    print(N - sum)
else:
    print(-1)

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

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

if(N >= sum(a)):
    print(N - sum(a))
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

sum = 0

for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            sum += (gcd(a, b, c))
print(sum)

Fixed submission:
K = int(input())

from math import gcd


sum = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            sum += gcd(gcd(b,c), a)

print(sum)
Buggy python submission (verdict: Runtime Error):
A,B,T = map(int,intput().split())

print(T//A*B)

Fixed submission:
A,B,T = map(int,input().split())

print(T//A*B)
Buggy python submission (verdict: Runtime Error):
a,b,c=input();print('YNeos'[a!=c::2])

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

if abs(x-b) < abs(x-a):
    print('B')
elif abs(x-a) < abs(x-b):
    print('A')
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input())

print((A+B)%24)

Fixed submission:
A,B = map(int,input().split())

print((A+B)%24)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input())

print(max(A*B,C*D))

Fixed submission:
A,B,C,D = map(int,input().split())

print(max(A*B,C*D))
Buggy python submission (verdict: Runtime Error):
import collections
N,M = map(int,input().split())
H=list(map(int,input().split()))
A=[None for _ in range(M)]
B=[None for _ in range(M)]
for i in range (M):
    A[i],B[i] = map(int,input().split())

C=[None for _ in range(M)]
for i in range(M):
    if H[A[i]-1]<=H[B[i]-1]:
        C[A[i]-1]="bad"
    elif H[A[i]-1]>=H[B[i]-1]:
        C[B[i]-1]="bad"

c = collections.Counter(C)
cook=c["bad"]
ans=N-cook
print(ans)

Fixed submission:
import collections
N,M = map(int,input().split())
H=list(map(int,input().split()))
A=[None for _ in range(M)]
B=[None for _ in range(M)]
for i in range (M):
    A[i],B[i] = map(int,input().split())

C=[None for _ in range(N)]
for i in range(M):
    if H[A[i]-1]<H[B[i]-1]:
        C[A[i]-1]="bad"
    elif H[A[i]-1]>H[B[i]-1]:
        C[B[i]-1]="bad"
    elif H[A[i]-1]==H[B[i]-1]:
        C[A[i]-1]="bad"
        C[B[i]-1]="bad"
c = collections.Counter(C)
cook=c["bad"]
ans=N-cook
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
Sstr = input()
stop=len(Sstr)
count=0
for i in range(stop-3):
    for j in range(i+3,stop):
        if(int(Sstr[i:j+1])%2019==0):
            count=count+1
print(count)

Fixed submission:
p = 2019 
D = input()
n=(len(D))
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
Sstr = input()
stop=len(Sstr)
count=0
for i in range(stop-3):
    for j in range(i,stop):
        if(int(Sstr[i:j+1])%2019==0):
            count=count+1
print(count)

Fixed submission:
p = 2019 
D = input()
n=(len(D))
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
Sstr = input()
stop=len(Sstr)
count=0
for i in range(stop-3):
    for j in range(i,stop):
        if(int(Sstr[i:j+1])%2019==0):
            count=count+1
print(count)

Fixed submission:
p = 2019 
D = input()
n=(len(D))
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())
B = [0 for i in range(N)]
for i in range (N-1):
  for j in range (1,N+1):
    if int(A[i])==j:
      B[j-1]=B[j-1]+1
      break
[print(i) for i in B]
 

Fixed submission:
import collections
N = int(input())
A = list(input().split())
c=collections.Counter(A)
for i in range (1,N+1):
    print(c[str(i)])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())
B = [0 for i in range(N)]
for i in range (N-1):
  for j in range (1,N+1):
    if int(A[i])==j:
      B[j-1]=B[j-1]+1
[print(i) for i in B]
 
    

Fixed submission:
import collections
N = int(input())
A = list(input().split())
c=collections.Counter(A)
for i in range (1,N+1):
    print(c[str(i)])
Buggy python submission (verdict: Runtime Error):
N=int(input())
ans=ceil(N/2)
print(ans)

Fixed submission:
import math
N=int(input())
ans=math.ceil(N/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
if (N == M):
  print("Yes")
else:
  print("No")

Fixed submission:
N,M = map(int,input().split())
if (N == M):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,K,S = map(int,input().split())
X = [1000000000 for _ in range(N)]
ans=""
for i in range (K):
    X[i]=S

print(*X)

Fixed submission:
import math
H=int(input())
W=int(input())
N=int(input())
if H<W :
    max=W
else:
    max=H
ans=math.ceil(N/max)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,S = map(int,input().split())
X = [1000000000 for _ in range(N)]
ans=""
for i in range (K):
    X[i]=S

for i in range(N):
    ans=ans+" "+str(X[i])

print(ans)

Fixed submission:
N,K,S = map(int,input().split())
X = [26845184 for _ in range(N)]
ans=""
for i in range (K):
    X[i]=S

print(*X)