Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
dic =[0]*12345
for _ in range(m):
	dic[int(input())]+=1

mod=10**9+7
if n==1:
	print(1)
	exit()
dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if dic[1]!=1 else 0

for i in range(2,n+1):
	if dic[i]:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])


Fixed submission:
n,m=map(int,input().split())
dic =[0]*1234567
for _ in range(m):
	dic[int(input())]+=1

mod=10**9+7
if n==1:
	print(1)
	exit()
dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if dic[1]!=1 else 0

for i in range(2,n+1):
	if dic[i]:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input())for _ in range(m)]
mod=10**9+7
if n==1:
	print(1)
	exit()
dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if a[0]!=1 else 0

for i in range(2,n+1):
	if i in a:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])


Fixed submission:
n,m=map(int,input().split())
dic =[0]*1234567
for _ in range(m):
	dic[int(input())]+=1

mod=10**9+7
if n==1:
	print(1)
	exit()
dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if dic[1]!=1 else 0

for i in range(2,n+1):
	if dic[i]:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input())for _ in range(m)]
mod=10**9+7

dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if a[0]!=1 else 0

for i in range(2,n+1):
	if i in a:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])


Fixed submission:
n,m=map(int,input().split())
dic =[0]*1234567
for _ in range(m):
	dic[int(input())]+=1

mod=10**9+7
if n==1:
	print(1)
	exit()
dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if dic[1]!=1 else 0

for i in range(2,n+1):
	if dic[i]:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
s=[input()for _ in range(h)]

yoko=[[0]*2005 for _ in range(2005)]
tate=[[0]*2005 for _ in range(2005)]

for i in range(h):
	for j in range(w):
		if s[i][j] == ".":
			yoko[i][j]+=1
			if j>0:
				yoko[i][j]+=yoko[i][j-1]
	for j in range(w-2,-1,-1):
		yoko[i][j] = max(yoko[i][j],yoko[i][j+1]) if yoko[i][j] else 0

for j in range(w):
	for i in range(h):
		if s[i][j] == ".":
			tate[i][j]+=1
			if i>0:
				tate[i][j]+=tate[i-1][j]
	for i in range(h-2,-1,-1):
		tate[i][j] = max(tate[i][j],tate[i+1][j])  if tate[i][j] else 0

ans = 0
for i in range(h):
	for j in range(w):
		ans = max(ans,yoko[i][j]+tate[i][j]-1)
print(ans)

Fixed submission:
h,w=map(int,input().split())
s=[input()for _ in range(h)]

yoko=[[0]*2005 for _ in range(2005)]
tate=[[0]*2005 for _ in range(2005)]

for i in range(h):
	for j in range(w):
		if s[i][j] == ".":
			yoko[i][j]+=1
			if j>0:
				yoko[i][j]+=yoko[i][j-1]
	for j in range(w-2,-1,-1):
		yoko[i][j] = max(yoko[i][j],yoko[i][j+1]) if yoko[i][j] else 0

for j in range(w):
	for i in range(h):
		if s[i][j] == ".":
			tate[i][j]+=1
			if i>0:
				tate[i][j]+=tate[i-1][j]
	for i in range(h-2,-1,-1):
		tate[i][j] = max(tate[i][j],tate[i+1][j])  if tate[i][j] else 0

ans = 0
for i in range(h):
	for j in range(w):
		ans = max(ans,yoko[i][j]+tate[i][j]-1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
 
ans = 0
for i in range(n//r+1):
    for j in range((n-r*i)//g+1):
        if (n-r*i-g*j) < 0:
            break
        if (n-r*i-g*j)%b == 0:
            ans += 1
print(ans)

Fixed submission:
r,g,b,n = map(int,input().split())
 
ans = 0
for i in range(n//r+1):
    for j in range((n-r*i)//g+1):
        if (n-r*i-g*j)%b == 0:
            ans += 1
print(ans)

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

ans = 0
for i in range(3001):
    for j in range(3001):
        if (n-r*i-g*j) < 0:
            break
        if (n-r*i-g*j)%b == 0:
            ans += 1
print(ans)

Fixed submission:
r,g,b,n = map(int,input().split())
 
ans = 0
for i in range(n//r+1):
    for j in range((n-r*i)//g+1):
        if (n-r*i-g*j)%b == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
a=[input() for _ in range(h)]

ans = [ [ 12345678 for _ in range(w) ] for d in range(h)]

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            ans[i][j] = 0

for i in range(h):
    for j in range(1,w):
        ans[i][j] = min(ans[i][j], ans[i][j-1]+1)
    for j in range(w-1-1,-1,-1):
        ans[i][j] = min(ans[i][j],ans[i][j+1]+1)

for j in range(w):
    for i in range(1,h):
        ans[i][j] = min(ans[i][j], ans[i-1][j]+1)
    for i in range(h-1-1,-1,-1):
        ans[i][j] = min(ans[i][j], ans[i+1][j]+1)

ma =-4
for x in ans:
    for y in x:
        ma = max(ma,y)
print(ma)

Fixed submission:
h,w=map(int,input().split())
a=[input() for _ in range(h)]

ans = [ [ 12345678 for _ in range(w) ] for d in range(h)]

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            ans[i][j] = 0

for i in range(h):
    for j in range(1,w):
        ans[i][j] = min(ans[i][j], ans[i][j-1]+1)
    for j in range(w-1-1,-1,-1):
        ans[i][j] = min(ans[i][j],ans[i][j+1]+1)

for j in range(w):
    for i in range(1,h):
        ans[i][j] = min(ans[i][j], ans[i-1][j]+1)
    for i in range(h-1-1,-1,-1):
        ans[i][j] = min(ans[i][j], ans[i+1][j]+1)

ma =-4
for x in ans:
    for y in x:
        ma = max(ma,y)
print(ma)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
cnt=[]
for i in range(1,101):
  if a%i==0 and b%i==0:
    cnt.append(i)
print(cnt[-1-k])

Fixed submission:
a,b,k=map(int,input().split())
cnt=[]
for i in range(1,101):
  if a%i==0 and b%i==0:
    cnt.append(i)
print(cnt[-k])
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bit = [0]*60
zouryou = [0]*60
tmpX = 0
if k == 0:
    print(sum(a))
    exit()

t=k
keta=0
while(t):
    keta += 1
    t >>= 1

for num in a:
    for b in range(keta):
        if num>>b & 1:
            bit[b] += 1

for i in range(keta):
    if bit[i] < n-bit[i]:
        zouryou[i] = (n-2*bit[i])*(1<<i)
        tmpX += 1<<i
  
while(tmpX > k):
    mini = 123456789012345
    minidx = -1
    for i in range(keta):
        if zouryou[i] > 0 and zouryou[i] < mini:
            mini = zouryou[i]
            minidx = i
    zouryou[minidx] = 0
    tmpX -= 1<<minidx
print(sum(zouryou) + sum(a))

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

c=[[0 for _ in range(2)] for _ in range(64)]

for i in range(n):
    for j in range(60):
        c[j][a[i]>>j&1] += 1
x=0
for i in range(59,-1,-1):
    if(c[i][0] > c[i][1] and x|(1<<i) <= k):
        x |= 1<<i

sum = 0
for i in range(n):
    sum += a[i]^x
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
fromto=[list(map(int,input().split()))for _ in range(n+m-1)]
m += n-1
fr = [[]for _ in range(n+1)]
to = [0]*(n+1)
ans = [0]*(n+1)
for f,t in fromto:
    fr[f].append(t)
    to[t]+=1
for i in range(1,n+1):
    if to[i] is 0:
        root = i
q=[root]
while q:
    now = q.pop(0)
    for nex in fr[now]:
        to[nex] -= 1
        if to[nex] is 0:
            ans[nex] = now
            q.append(nex)

for i in range(1,n+1):
    print(ans[i])

Fixed submission:
import queue

n,m=map(int,input().split())
fromto=[list(map(int,input().split()))for _ in range(n+m-1)]
m += n-1
fr = [[]for _ in range(n+1)]
to = [0]*(n+1)
ans = [0]*(n+1)
for f,t in fromto:
    fr[f].append(t)
    to[t]+=1
for i in range(1,n+1):
    if to[i] is 0:
        root = i
q=queue.Queue()
q.put(root)
while not q.empty():
    now = q.get()
    for nex in fr[now]:
        to[nex] -= 1
        if to[nex] is 0:
            ans[nex] = now
            q.put(nex)

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

ans = 1
cnta = 0
cntb = 0
mod = 10**9+7
for num in range(n*m,0,-1):
    if num in a and num in b:
        cnta += 1
        cntb += 1
        cnta%=mod
        cntb%=mod
    elif num in a:
        ans *= cntb
        ans %= mod
        cnta += 1
    elif num in b:
        ans *= cnta
        ans %= mod
        cntb += 1
    else:
        ans *= (cnta*cntb - (n*m - num))%mod
        ans %= mod

print(ans)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
A=set(a);B=set(b)
ans = 1
cnta = 0
cntb = 0
mod = 10**9+7
for num in range(n*m,0,-1):
    if num in A and num in B:
        cnta += 1
        cntb += 1
    elif num in A:
        ans *= cntb
        cnta += 1
    elif num in B:
        ans *= cnta
        cntb += 1
    else:
        ans *= (cnta*cntb - (n*m - num))%mod
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)

ans = 1
cnta = 0
cntb = 0
mod = 1000000007
for num in range(n*m,0,-1):
    if num in a and num in b:
        cnta += 1
        cntb += 1
        cnta%=mod
        cntb%=mod
    elif num in a and num not in b:
        ans *= cntb
        ans %= mod
        cnta += 1
    elif num not in a and num in b:
        ans *= cnta
        ans %= mod
        cntb += 1
    else:
        ans *= (cnta*cntb - (n*m - num))%mod
        ans %= mod

print(ans)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
A=set(a);B=set(b)
ans = 1
cnta = 0
cntb = 0
mod = 10**9+7
for num in range(n*m,0,-1):
    if num in A and num in B:
        cnta += 1
        cntb += 1
    elif num in A:
        ans *= cntb
        cnta += 1
    elif num in B:
        ans *= cnta
        cntb += 1
    else:
        ans *= (cnta*cntb - (n*m - num))%mod
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,n):
    for j in range(i-1,max(i-1-k,-1),-1):
        ans[i] = min(ans[i],ans[j]+abs(h[i]-h[j]))
    
print(ans[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,n):
    for j in range(i-1,max(i-1-k,-1),-1):
        ans[i] = min(ans[i],ans[j]+abs(h[i]-h[j]))
    
print(ans[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,min(k+1,n)):
    ans[i]=abs(h[i]-h[0])

for i in range(k+1,n):
    mini=1234567890123
    for j in range(1,k+1):
        mini=min(mini,ans[i-j]+abs(h[i]-h[i-j]))
    ans[i] = mini
print(ans[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,n):
    for j in range(i-1,max(i-1-k,-1),-1):
        ans[i] = min(ans[i],ans[j]+abs(h[i]-h[j]))
    
print(ans[n-1])

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,k+1):
    ans[i]=abs(h[i]-h[0])

for i in range(k+1,n):
    mini=1234567890123
    for j in range(1,k+1):
        mini=min(mini,ans[i-j]+abs(h[i]-h[i-j]))
    ans[i] = mini
print(ans[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans = [1234567890123]*n
ans[0]=0
for i in range(1,n):
    for j in range(i-1,max(i-1-k,-1),-1):
        ans[i] = min(ans[i],ans[j]+abs(h[i]-h[j]))
    
print(ans[n-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(float,input().split()))
result = [[-1.]*n for _ in range(n)]

# i番目のコインまででj枚が表のときの、全体として表が裏より多くなる確率
def dp(i,j):
    if i == n:
        if j > i-j:
            return 1
        else:
            return 0
    if result[i][j] != -1:
        return result[i][j]
    
    res1 = dp(i+1,j+1) * p[i]
    res2 = dp(i+1,j) *(1-p[i])
    result[i][j] = res1+res2
    return result[i][j]

print(dp(0,0))

Fixed submission:
n=int(input())
p = list(map(float,input().split()))
dp = [[0 for _ in range(n+1)] for __ in range(n+1)]
dp[0][0] = 1
for i in range(n+1):
    for j in range(n+1):
        cnt = i + j
        if cnt == 0 or cnt > n:
            continue
        if j == 0:
            dp[i][j] = dp[i-1][0] * p[cnt-1]
        elif i == 0:
            dp[i][j] = dp[i][j-1] * (1 - p[cnt-1])
        else:
            dp[i][j] = dp[i-1][j]*p[cnt-1] + dp[i][j-1]*(1-p[cnt-1])
        
ans = 0
for i in range((n+1)//2, n+1):
    ans += dp[i][n-i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(k+1+1234)

for i in range(0,k+1):
    if dp[i] == 0:
        for x in a:
            dp[i+x] =1

print("First" if dp[k] else "Second")

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans = [False]*(k+1)
for i in range(1,k+1):
    ok = False
    for j in a:
        if i-j<0:
            continue
        if ans[i-j] == False:
            ans[i] = True
            break

print('First' if ans[k] else 'Second')

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans = [False]*(k+1)
for i in range(1,k+1):
    ok = False
    for j in a:
        if i-j<0:
            continue
        if ans[i-j] == False:
            ans[i] = True

print('First' if ans[k] else 'Second')

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans = [False]*(k+1)
for i in range(1,k+1):
    ok = False
    for j in a:
        if i-j<0:
            continue
        if ans[i-j] == False:
            ans[i] = True
            break

print('First' if ans[k] else 'Second')
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
for i in range(k+1):
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(-1)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k > sum(a):
    print(0)
    exit()

mod = 1000000007
dp = [[0 for _ in range(k+1)]for __ in range(n+1)]
for i in range(n+1):
    dp[i][0] = 1
for i in range(k+1):
    dp[0][i] = 0

for i in range(1,n+1):
    for j in range(1,k+1):
        if j > a[i-1]:
            if i is 1:
                break
        dp[i][j] = dp[i-1][j] + dp[i][j-1]
        if j > a[i-1]:
            dp[i][j] -= dp[i-1][j-1-a[i-1]]
        dp[i][j] %= mod
print(dp[n][k])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

def twosum(n):
  now = 1
  while n >= now:
    now *= 2
  return now - n
n=int(input())
a=sorted(list(map(int,input().split())))
d = defaultdict(int)
for i in a:
    d[i] += 1
ans = 0
for i in a[::-1]:
    d[i] -= 1:
    find = twosum(i)
    if d[find] > 0 and d[i] >= 0:
        ans += 1
        d[find] -= 1
    else:
        d[i] += 1
print(ans)

Fixed submission:
from collections import defaultdict

def twosum(n):
  now = 1
  while n >= now:
    now *= 2
  return now - n
n=int(input())
a=sorted(list(map(int,input().split())))
d = defaultdict(int)
for i in a:
    d[i] += 1
ans = 0
for i in a[::-1]:
    d[i] -= 1
    find = twosum(i)
    if d[find] > 0 and d[i] >= 0:
        ans += 1
        d[find] -= 1
    else:
        d[i] += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
printint((x+y/2))

Fixed submission:
x,y = map(int,input().split())
print(int(x+y/2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h = list(map(int,input().split()))
minimu = 1234567890
for i in range(n):
  if( minimu > abs(h[i]*0.006-t):
     minimu=abs(h[i]*0.006-t)
     ans = i+1
print(ans)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h = list(map(int,input().split()))
minimu = 1234567890

for i in range(n):
        if( minimu > abs(t-h[i]*0.006-a)):
                minimu=abs(t-h[i]*0.006-a)
                ans = i+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = 
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)


Fixed submission:
n =int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy python submission (verdict: Runtime Error):
n = 
if n==1:
    print("Hello World")
else:
    int(input())
    int(input())
    print(a+b)


Fixed submission:
n =int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy python submission (verdict: Runtime Error):
n = input()
if n==1:
    print("Hello World")
else:
    a=input()
    b=input()
    print(a+b)


Fixed submission:
n =int(input())
if n==1:
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t = int(input())
ans = 1234567
for i in range(n):
    c = int(input())
    if int(input) <= t:
        ans = max(ans,c)

if ans == 1234567:
    print("LTE")
else:
    print(ans)
        

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

ans = 1234567
for i in range(n):
    c,tt = map(int,input().split())
    if tt <= t:
        ans = min(ans,c)

if ans == 1234567:
    print("TLE")
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n = 1:
    print(abs(a[0]-w))
else:
    print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))

Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n == 1:
    print(abs(a[0]-w))
else:
    print(max(abs(a[-1]-w),abs(a[-1]-a[-2])))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
pl = [0]*(n+5)

for i in range(n):
    num = a[i]
    pl[num-1] += 1
    pl[num+2] -= 1

for i in range(1,n):
    pl[i] += pl[i-1]

print(max(pl))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
pl = [0]*100005

for i in range(n):
    num = a[i]
    pl[num-1 + 2] += 1
    pl[num+2 + 2] -= 1

for i in range(1,100004):
    pl[i] += pl[i-1]

print(max(pl))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
pl = [0]*(n+5)

for i in range(n):
    num = a[i]
    pl[num-1] += 1
    pl[num+2] -= 1

for i in range(1,n+4):
    pl[i] += pl[i-1]

print(max(pl))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
pl = [0]*100005

for i in range(n):
    num = a[i]
    pl[num-1 + 2] += 1
    pl[num+2 + 2] -= 1

for i in range(1,100004):
    pl[i] += pl[i-1]

print(max(pl))
Buggy python submission (verdict: Runtime Error):
n,x,t = map(int,input().split())
if n%x==0:
    print(int(n/x)*t)
else:
    print(int(n//x)+1)*t)

Fixed submission:
n,x,t = map(int,input().split())
if n%x==0:
    print(int(n/x)*t)
else:
    print((int(n//x)+1)*t)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ct = 0
for i in range(len(s)):
    for j in range(i+4,len(s)+1):
        if int(s[i:j])%2019 == 0:
            ct += 1
print(ct)


Fixed submission:
S = input()
m = 2019
dp = [0]*m
dp[0] = 1

acc, d = 0,1

for s in S[::-1]:
    acc = (acc + d*int(s)) % m
    dp[acc] += 1
    d = (d*10) % m

print(str(sum([n*(n-1)//2 for n in dp])))

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


Fixed submission:
S = input()
m = 2019
dp = [0]*m
dp[0] = 1

acc, d = 0,1

for s in S[::-1]:
    acc = (acc + d*int(s)) % m
    dp[acc] += 1
    d = (d*10) % m

print(str(sum([n*(n-1)//2 for n in dp])))

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


Fixed submission:
S = input()
m = 2019
dp = [0]*m
dp[0] = 1

acc, d = 0,1

for s in S[::-1]:
    acc = (acc + d*int(s)) % m
    dp[acc] += 1
    d = (d*10) % m

print(str(sum([n*(n-1)//2 for n in dp])))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

que = [1,2,3,4,5,6,7,8,9]

for i in range(k):
    x = que[0]
    del que[0]
    mod = x%10
    if mod != 0:
        que.append(10*x+mod-1)
    que.append(10*x+mod)
    if mod != 9:
        que.append(10*x+mod+1)
print(x)

Fixed submission:
from collections import deque
k = int(input())
q = deque(list(range(1, 10)))
for _ in range(k-1):
	d = q.popleft()
	if d%10 > 0:
		q.append(d*10 + d%10 - 1)
	q.append(d*10 + d%10)
	if d%10 < 9:
		q.append(d*10 + d%10 + 1)
print(q.popleft())

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

que = [1,2,3,4,5,6,7,8,9]

for i in range(k):
    x = que[0]
    del que[0]
    mod = x%10
    if mod != 0:
        que.append(10*x+mod-1)
    que.append(10*x+mod)
    if mod != 9:
        que.append(10*x+mod+1)
print(x)

Fixed submission:
from collections import deque
k = int(input())
q = deque(list(range(1, 10)))
for _ in range(k-1):
	d = q.popleft()
	if d%10 > 0:
		q.append(d*10 + d%10 - 1)
	q.append(d*10 + d%10)
	if d%10 < 9:
		q.append(d*10 + d%10 + 1)
print(q.popleft())

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

que = [1,2,3,4,5,6,7,8,9]

for i in range(k):
    x = que[0]
    del que[0]
    if x%10 != 0:
        que.append(10*x+(x%10)-1)
    que.append(10*x+(x%10))
    if x%10 != 9:
        que.append(10*x+(x%10)+1)
print(x)

Fixed submission:
from collections import deque
k = int(input())
q = deque(list(range(1, 10)))
for _ in range(k-1):
	d = q.popleft()
	if d%10 > 0:
		q.append(d*10 + d%10 - 1)
	q.append(d*10 + d%10)
	if d%10 < 9:
		q.append(d*10 + d%10 + 1)
print(q.popleft())

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

que = [1,2,3,4,5,6,7,8,9]

for i in range(k):
    x = que[0]
    del que[0]
    if x%10 != 0:
        que.append(10*x+(x%10)-1)
    que.append(10*x+(x%10))
    if x%10 != 9:
        que.append(10*x+(x%10)+1)
print(x)

Fixed submission:
from collections import deque
k = int(input())
q = deque(list(range(1, 10)))
for _ in range(k-1):
	d = q.popleft()
	if d%10 > 0:
		q.append(d*10 + d%10 - 1)
	q.append(d*10 + d%10)
	if d%10 < 9:
		q.append(d*10 + d%10 + 1)
print(q.popleft())