Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
t = str(input())

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)

Fixed submission:
n = int(input())
rawString = str(input())
splitString = rawString.split()
s = splitString[0]
t = splitString[1]

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
t = str(input())

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)

Fixed submission:
n = int(input())
rawString = str(input())
splitString = rawString.split()
s = splitString[0]
t = splitString[1]

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache
import sys

iMaxStackSize = 5000
sys.setrecursionlimit(iMaxStackSize)
n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))


Fixed submission:
from functools import lru_cache
import sys

iMaxStackSize = 5000000
sys.setrecursionlimit(iMaxStackSize)
n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))


Fixed submission:
from functools import lru_cache
import sys

iMaxStackSize = 5000000
sys.setrecursionlimit(iMaxStackSize)
n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
cnt = 1
ans = 7
ans %= k
flags = [False] * k
flags[ans] = True
while ans != 0:
    ans += 7*pow(10,cnt,k)
    cnt += 1
    ans %= k
    if flags[ans]:
        cnt = -1
        break
    flags[ans] = True

print(cnt)


Fixed submission:
k = int(input())
cnt = 1
ans = 7
mul = 70 % k
ans %= k
flags = [False] * k
flags[ans] = True
while ans != 0:
    ans += mul
    cnt += 1
    ans %= k
    mul *= 10
    mul %= k
    if flags[ans]:
        cnt = -1
        break
    flags[ans] = True

print(cnt)
Buggy python submission (verdict: Runtime Error):
s=input()
print("a" if s=s.lower() else "A")

Fixed submission:
s=input()
print("a" if s == s.lower() else "A")
Buggy python submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
arr.sort()
print(sum(arr[:k])

Fixed submission:
n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
arr.sort()
print(sum(arr[:k]))
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
pritn(a*b)

Fixed submission:
a,b = list(map(int,input().split()))
print(a*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
ans = 1
limit = 10 * 18

if arr[-1] == 0:
  ans = 0
else:
  for i in arr:
    ans *= arr[i]
    if ans > limit:
      ans = -1
      break
print(ans)

Fixed submission:
n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
ans = 1
limit = 10**18

if arr[-1] == 0:
  ans = 0
else:
  for i in arr:
    ans *= i
    if ans > limit:
      ans = -1
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
path = [list(map(int,input().split())) for _ in range(m)]

graph = [[] for _ in range(m)]
for a,b in path:
    graph[a-1].append(b-1); graph[b-1].append(a-1)

parents = [-1]*n
children = [[] for _ in range(n)]
orders = []
stack = [0]
flags = [True] * n
flags[0] = False

while any(flags):
    while stack:
        tmp = stack.pop()
        for node in graph[tmp]:
            if flags[node]:
                flags[node] = False
                children[tmp].append(node)
                parents[node] = tmp
                orders.append(node)
    stack = orders[:]
    
print("Yes")
for i in parents[1:]:
    print(i+1)

Fixed submission:
n,m = list(map(int,input().split()))
path = [list(map(int,input().split())) for _ in range(m)]

graph = [[] for _ in range(n)]
for a,b in path:
    graph[a-1].append(b-1); graph[b-1].append(a-1)

parents = [-1]*n
tmparr = []
children = [0]
flags = [True] * n
flags[0] = False

while any(flags):
    while children:
        tmp = children.pop()
        for node in graph[tmp]:
            if flags[node]:
                flags[node] = False
                parents[node] = tmp
                tmparr.append(node)
    children = tmparr[:]
    tmparr = []
    
print("Yes")
for i in parents[1:]:
    print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = list(map(int,input().split()))

MOD = 998244353
cmbarr = [1] * (N)
for r in range(N-1):
    cmbarr[r+1] = cmbarr[r] * (N - 1 - r) // (r + 1)

A = [M*pow(M-1,N-1-i,MOD) % MOD for i in range(K+1)]
A = [A[i] * cmbarr[i] % MOD for i in range(K+1)]
print(sum(A) % MOD)

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

fac = [1] * (N+1)
inv = [1] * (N+1)
ifac = [1] * (N+1)
for i in range(2,N+1):
    fac[i]=(fac[i-1]*i)%MOD
    inv[i]= -(inv[MOD%i]*(MOD//i))%MOD
    ifac[i]=(ifac[i-1]*inv[i])%MOD

cmbarr = [1] * N
for r in range(N-1):
    cmbarr[r+1] = cmbarr[r] * (N - 1 - r) * inv[r + 1] % MOD

A = [M*pow(M-1,N-1-i,MOD)*cmbarr[i] % MOD for i in range(K+1)]
print(sum(A) % MOD)

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

MOD = 998244353
F = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, F + 1 ):
    g1.append( ( g1[-1] * i ) % MOD )
    inverse.append( ( -inverse[MOD % i] * (MOD//i) ) % MOD )
    g2.append( (g2[-1] * inverse[-1]) % MOD )

def cmb(n, r, MOD):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD

A = [M*pow(M-1,N-1-i,MOD) % MOD for i in range(K+1)]
A = [A[i] * cmb(N-1,i,MOD) % MOD for i in range(K+1)]
print(sum(A) % MOD)

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

fac = [1] * (N+1)
inv = [1] * (N+1)
ifac = [1] * (N+1)
for i in range(2,N+1):
    fac[i]=(fac[i-1]*i)%MOD
    inv[i]= -(inv[MOD%i]*(MOD//i))%MOD
    ifac[i]=(ifac[i-1]*inv[i])%MOD

cmbarr = [1] * N
for r in range(N-1):
    cmbarr[r+1] = cmbarr[r] * (N - 1 - r) * inv[r + 1] % MOD

A = [M*pow(M-1,N-1-i,MOD)*cmbarr[i] % MOD for i in range(K+1)]
print(sum(A) % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
addarr = [i+1+A[i] for i in range(N)]
difarr = [i+1-A[i] for i in range(N)]
ans = 0
for i in range(1,N):
    tmp = difarr[i]
    ans += addarr[:i].count(tmp)
    
print(ans)

Fixed submission:
n = int(input())
arr = list(map(int,input().split()))
addarr = [i+1+arr[i] for i in range(n)]
diffarr = [i+1-arr[i] for i in range(n)]

from collections import Counter
cnt = Counter([addarr[0]])
ans = 0

for i in range(1,n):
    tmp = diffarr[i]
    ans += cnt[tmp]
    cnt.update([addarr[i]])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(map(int,input()))
t = len(s)
mod = 2019

import numpy as np
arr = [0] * t
arr = np.array(arr)
arr[0] = s[0]
for i in range(1,t):
    arr[i] = (arr[i-1] * 10 + s[i]) % mod

powarr = [1] * t
for i in range(1,t):
    powarr[i] = powarr[i-1]*10 % mod

ans = list(arr).count(0)
for i in range(1,t):
    tmp = (arr[i:] - powarr[i]*arr[:t-i]) % mod
    ans += list(tmp).count(0)

print(ans)

Fixed submission:
s = list(map(int,input()))
s.reverse()
t = len(s)
mod = 2019

arr = [0] * (t+1)
arr[-2] = s[0]
for i in range(1,t):
    arr[t-i-1] = (arr[t-i] + s[i]*pow(10,i,mod)) % mod

from collections import Counter
arr = Counter(arr)

ans = 0
for i in arr:
    ans += (arr[i] - 1) * arr[i] // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#import pdb; pdb.set_trace()

s = list(map(int,input()))
t = len(s)
mod = 2019

import numpy as np
arr = [0] * t
arr = np.array(arr)
arr[0] = s[0]
for i in range(1,t):
    arr[i] = (arr[i-1] * 10 + s[i]) % mod

powarr = [pow(10,i,mod) for i in range(t)]

ans = list(arr).count(0)
for i in range(1,t):
    tmp = (arr[i:] - powarr[i]*arr[:t-i]) % mod
    ans += list(tmp).count(0)


print(ans)

Fixed submission:
s = list(map(int,input()))
s.reverse()
t = len(s)
mod = 2019

arr = [0] * (t+1)
arr[-2] = s[0]
for i in range(1,t):
    arr[t-i-1] = (arr[t-i] + s[i]*pow(10,i,mod)) % mod

from collections import Counter
arr = Counter(arr)

ans = 0
for i in arr:
    ans += (arr[i] - 1) * arr[i] // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input())
from collections import deque
queue = deque(range(1,10))
count = 0

while count < k:
  count += 1
  tmp = deque.popleft()
  tail = tmp % 10
  if tail!=0:
    deque.append(tmp*10+tail-1)
  deque.append(tmp*10+tail)
  if tail!=9:
    deque.append(tmp*10+tail+1)
  
print(tmp)

Fixed submission:
k = int(input())

numset = {i for i in range(1,10)}
flag = False
count = len(numset)
if count >= k:
    flag = True
arr = [numset]
index = 0

while not flag:
    beforeset = arr[index]
    tmpset = set()
    for i in beforeset:
        tail = str(i)[-1]
        if tail == "0":
            tmpset.add(int(str(i)+str(0)))
            tmpset.add(int(str(i)+str(1)))
        elif tail == "9":
            tmpset.add(int(str(i)+str(8)))
            tmpset.add(int(str(i)+str(9)))
        else:
            tmpset.add(int(str(i)+str(int(tail))))
            tmpset.add(int(str(i)+str(int(tail)+1)))
            tmpset.add(int(str(i)+str(int(tail)-1)))
    count += len(tmpset)
    if count >= k:
        flag = True
    arr.append(tmpset)
    index += 1
    
totalarr = []
for tmpset in arr:
    totalarr += list(tmpset)
    
totalarr.sort()
print(totalarr[k-1])

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

from collection import deque
queue = deque(range(1,10))
count = 0
while count < k:
  count += 1
  tmp = queue.popleft()
  tail = tmp%10
  if tail != 0:
    queue.append(10*tmp+tail-1)
  queue.append(10*tmp)
  if tail != 9:
    queue.append(10*tmp+tail+1)

print(tmp)

Fixed submission:
k = int(input())

numset = {i for i in range(1,10)}
flag = False
count = len(numset)
if count >= k:
    flag = True
arr = [numset]
index = 0

while not flag:
    beforeset = arr[index]
    tmpset = set()
    for i in beforeset:
        tail = str(i)[-1]
        if tail == "0":
            tmpset.add(int(str(i)+str(0)))
            tmpset.add(int(str(i)+str(1)))
        elif tail == "9":
            tmpset.add(int(str(i)+str(8)))
            tmpset.add(int(str(i)+str(9)))
        else:
            tmpset.add(int(str(i)+str(int(tail))))
            tmpset.add(int(str(i)+str(int(tail)+1)))
            tmpset.add(int(str(i)+str(int(tail)-1)))
    count += len(tmpset)
    if count >= k:
        flag = True
    arr.append(tmpset)
    index += 1
    
totalarr = []
for tmpset in arr:
    totalarr += list(tmpset)
    
totalarr.sort()
print(totalarr[k-1])
Buggy python submission (verdict: Runtime Error):
2 2 4 4 4
11 12 13 14
21 22 23 24
1 2 3 4


Fixed submission:
x,y,a,b,c = map(int,input().split())
parr = list(map(int,input().split()))
qarr = list(map(int,input().split()))
rarr = list(map(int,input().split()))

parr.sort(reverse=True)
qarr.sort(reverse=True)
rarr.sort(reverse=True)
parr = parr[:x]
qarr = qarr[:y]
arr = parr + qarr + rarr
arr.sort(reverse=True)
print(sum(arr[:x+y]))
Buggy python submission (verdict: Time Limit Exceeded):
n,s = list(map(int,input().split())); arr = list(map(int,input().split()))

mod = 998244353
ans = 0
dp = [0]*(s+1)

for i in range(n):
    dp[0] += 1
    tmp = arr[i]
    for j in range(s,tmp-1,-1):
        dp[j] += dp[j-tmp]
        dp[j] %= mod
    ans += dp[s]
    ans %= mod
print(ans)

Fixed submission:
n,s = list(map(int,input().split())); arr = list(map(int,input().split()))

mod = 998244353
ans = 0
dp = [0]*(s+1)

for i in range(n):
    dp[0] += 1
    tmp = arr[i]
    for j in range(s,tmp-1,-1):
        dp[j] += dp[j-tmp]
    ans += dp[s]
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,s = list(map(int,input().split())); arr = list(map(int,input().split()))

mod = 998244353
ans = 0
dp = [list() for i in range(s+1)]
if arr[0] < s+1:
    dp[arr[0]].append([0])

for i in range(1,n):
    tmp = arr[i]
    for j in range(s-tmp,0,-1):
        if dp[j]:
            dp[j+tmp] += [info+[i] for info in dp[j]]
    if tmp < s+1:
        dp[tmp].append([i])

for cmb in dp[s]:
    ans += (cmb[0]+1) * (n-cmb[-1])
    ans %= mod
    
print(ans)

Fixed submission:
n,s = list(map(int,input().split())); arr = list(map(int,input().split()))

mod = 998244353
ans = 0
dp = [0]*(s+1)

for i in range(n):
    dp[0] += 1
    tmp = arr[i]
    for j in range(s,tmp-1,-1):
        dp[j] += dp[j-tmp]
    ans += dp[s]
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

n,p = list(map(int,input().split())); s = input()

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i])%p == 0:
            ans += i+1
    print(ans)
    sys.exit()
    
res = [0] * p
arr = [int(s[i:])%p for i in range(n)]
for i in arr:
    res[i] += 1
for i in res:
    ans += i*(i-1)
ans //= 2
ans += res[0]
    
print(ans)

Fixed submission:
n,p = list(map(int,input().split())); s = [int(i) for i in input()]

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i]%p == 0:
            ans += i+1
    print(ans)
    
else:
    s = s[::-1]
    res = [0] * p
    arr = [0] * n
    tmp = 0
    for i in range(n):
        tmp += s[i]*pow(10,i,p)
        tmp %= p
        arr[i] = tmp
    for i in arr:
        res[i] += 1
    for i in res:
        ans += i*(i-1)
    ans //= 2
    ans += res[0]
        
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,p = list(map(int,input().split())); s = input()

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i])%p == 0:
            ans += i+1
else:
    arr = [int(s[i:])%p for i in range(n)]
    from collections import Counter
    cnt = Counter(arr)
    
    for i in cnt:
        ans += (cnt[i]-1)*cnt[i]
    ans //= 2
    if 0 in arr:
        ans += cnt[0]
    
print(ans)

Fixed submission:
n,p = list(map(int,input().split())); s = [int(i) for i in input()]

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i]%p == 0:
            ans += i+1
    print(ans)
    
else:
    s = s[::-1]
    res = [0] * p
    arr = [0] * n
    tmp = 0
    for i in range(n):
        tmp += s[i]*pow(10,i,p)
        tmp %= p
        arr[i] = tmp
    for i in arr:
        res[i] += 1
    for i in res:
        ans += i*(i-1)
    ans //= 2
    ans += res[0]
        
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,p = list(map(int,input().split())); s = input()

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i])%p == 0:
            ans += i+1
else:
    arr = [int(s[i:])%p for i in range(n)]
    from collections import Counter
    cnt = Counter(arr)
    
    for i in cnt:
        ans += (cnt[i]-1)*cnt[i]
    ans //= 2
    if 0 in arr:
        ans += cnt[0]
    
print(ans)

Fixed submission:
n,p = list(map(int,input().split())); s = [int(i) for i in input()]

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if s[i]%p == 0:
            ans += i+1
    print(ans)
    
else:
    s = s[::-1]
    res = [0] * p
    arr = [0] * n
    tmp = 0
    for i in range(n):
        tmp += s[i]*pow(10,i,p)
        tmp %= p
        arr[i] = tmp
    for i in arr:
        res[i] += 1
    for i in res:
        ans += i*(i-1)
    ans //= 2
    ans += res[0]
        
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
arr = list(map(int,input().split()))

exarr = [(i+1)/2 for i in arr]
sol = 0

for i in range(n-k+1):
    tmpsum = sum(exarr[i:i+k])
    sol = max(sol,tmpsum)
    
print(sol)

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

exarr = [(i+1)/2 for i in arr]
tmpsum = sum(exarr[:k])
sol = tmpsum

for i in range(n-k):
    tmpsum = tmpsum - exarr[i] + exarr[i+k]
    sol = max(sol,tmpsum)
    
print(sol)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

arr = [[0]*10 for _ in range(10)]
count = 0

for i in range(1,10):
  for j in range(1,10):
    arr[i][j] = len([k for k in range(1,n+1) if (str(k)[0] == str(i) and str(k)[-1] == str(j))])

for i in range(1,10):
  for j in range(1,10):
    count += arr[i][j]*arr[j][i]
print(count)

Fixed submission:
n = int(input())

arr = [[list() for _ in range(10)] for _ in range(10)]
count = 0

for i in range(1,n+1):
  arr[int(str(i)[0])][int(str(i)[-1])].append(i)

for i in range(1,10):
  for j in range(1,10):
    arr[i][j] = len(arr[i][j])

for i in range(1,10):
  for j in range(1,10):
    count += arr[i][j]*arr[j][i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
num = 101000
arr = list(range(2,num))
arr = set(arr)
primes = {2}

prime = min(arr)
while prime < num-500:
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)
    prime = min(arr)

sol = {i for i in primes if i >= x}

print(min(sol))

Fixed submission:
x = int(input())
num = 100200
arr = list(range(2,num))
arr = set(arr)
primes = {2}
floor = int(num**0.5)+2

prime = min(arr)
while prime < floor:
    prime = min(arr)
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)

primes = primes.union(arr)

sol = {i for i in primes if i >= x}

print(min(sol))

Buggy python submission (verdict: Runtime Error):
x = int(input())
num = 11000
arr = list(range(2,num))
arr = set(arr)
primes = {2}

prime = min(arr)
while prime < num-500:
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)
    prime = min(arr)

sol = {i for i in primes if i >= x}

print(min(sol))

Fixed submission:
x = int(input())
num = 100200
arr = list(range(2,num))
arr = set(arr)
primes = {2}
floor = int(num**0.5)+2

prime = min(arr)
while prime < floor:
    prime = min(arr)
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)

primes = primes.union(arr)

sol = {i for i in primes if i >= x}

print(min(sol))

Buggy python submission (verdict: Runtime Error):
x = int(input())
num = 11000
arr = list(range(2,num))
arr = set(arr)
primes = {2}

prime = min(arr)
while prime < num-500:
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)
    prime = min(arr)

arr = {i for i in primes if i > x }
print(min(arr))

Fixed submission:
x = int(input())
num = 100200
arr = list(range(2,num))
arr = set(arr)
primes = {2}
floor = int(num**0.5)+2

prime = min(arr)
while prime < floor:
    prime = min(arr)
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)

primes = primes.union(arr)

sol = {i for i in primes if i >= x}

print(min(sol))

Buggy python submission (verdict: Runtime Error):
x = int(input())
num = 11000
arr = list(range(2,num))
arr = set(arr)
primes = {2}

prime = min(arr)
while prime < num-500:
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)
    prime = min(arr)

arr = {i for i in primes if i > x }
print(min(arr))

Fixed submission:
x = int(input())
num = 100200
arr = list(range(2,num))
arr = set(arr)
primes = {2}
floor = int(num**0.5)+2

prime = min(arr)
while prime < floor:
    prime = min(arr)
    primes.add(prime)
    nonprime = {prime * i for i in range(1,num//prime + 2)}
    arr = arr.difference(nonprime)

primes = primes.union(arr)

sol = {i for i in primes if i >= x}

print(min(sol))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
if a<=9 and b<=9:
    print(a*b)
else:
    print(-1)

Fixed submission:
a,b = map(int,input().split())
if a<=9 and b<=9:
    print(a*b)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
arr = list(map(int,input().split()))

arr.sort(reverse = True)
count = 0
combiarr = [[arr[i]+arr[j] if i < j else 0 for j in range(n)] for i in range(n)]
combiarr = np.array(combiarr)
for i in range(n-2):
    long = arr[i]
    tmparr = combiarr[i+1:,i+1:] - long
    count += sum(sum(tmparr > 0))    
    
print(count)

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

arr.sort(reverse=True)
count = 0
for i in range(n-2):
    j = i+1
    k = n-1
    while j < k:
        if arr[i] < arr[j] + arr[k]:
            count += k-j
            j += 1
        else:
            k -= 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
arr = list(map(int,input().split()))

arr.sort(reverse = True)
count = 0
combiarr = [[arr[i]+arr[j] if i < j else 0 for j in range(n)] for i in range(n)]
combiarr = np.array(combiarr)
for i in range(n-2):
    long = arr[i]
    tmparr = combiarr[i+1:,i+1:] - long
    count += sum(sum(tmparr > 0))    
    
print(count)

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

arr.sort(reverse=True)
count = 0
for i in range(n-2):
    j = i+1
    k = n-1
    while j < k:
        if arr[i] < arr[j] + arr[k]:
            count += k-j
            j += 1
        else:
            k -= 1
print(count)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n,m,l = map(int,input().split())
town = [list(map(int,input().split())) for _ in range(m)]
q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

def warshall_floyd(d,n):
    for i in range(n):
        for j in range(n):
            for k in range(n):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])

inf = (l+1)*n
d = [[inf]*n for _ in range(n)]
for i in range(n):
    d[i][i] = 0
for a,b,c in town:
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    
warshall_floyd(n,d)

d2 = [None]*n
for i,row in enumerate(d):
    d2[i] = [1 if val<=l else inf for val in row]
    d2[i][i] = 0

warshall_floyd(n,d2)
 
for s,t in query:
    s -= 1
    t -= 1
    count = (d2[s][t]%inf)-1
    print(count)

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

N,M,L = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*M]
Q = int(input())
ST = [list(map(int,input().split())) for _ in [0]*Q]


INF = (L+1)*N
d = [[INF]*N for _ in [0]*N]
for i in range(N):
    d[i][i] = 0
for a,b,c in ABC:
    a-=1;b-=1
    d[a][b] = c
    d[b][a] = c

def Warshall_Floyd(d,N=None):
    if N==None : N = len(d)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])

Warshall_Floyd(d,N)

d2 = [None]*N
for i,row in enumerate(d):
    d2[i] = [1 if e<=L else INF for e in row]
    d2[i][i] = 0

Warshall_Floyd(d2,N)

for s,t in ST:
    s-=1;t-=1
    ans = (d2[s][t]%INF)-1
    print(ans)