Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

s = list(input())
t = list(input())
n = len(s)
mp = dict()

cnt = 0
while s != t:
    for i in range(n):
        if s[i] != t[i]:
            c1, c2 = s[i], t[i]
            for j in range(n):
                if s[j] == c1:
                    s[j] = c2
                elif s[j] == c2:
                    s[j] = c1
    cnt += 1
    if cnt > 100:
        break

ok = s == t

print("Yes" if ok else "No")

Fixed submission:


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

s = input()
t = input()

ss = [s.find(c) for c in s]
tt = [t.find(c) for c in t]

print("Yes" if ss == tt else "No")

Buggy python submission (verdict: Time Limit Exceeded):


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

s = list(input())
t = list(input())
n = len(s)
mp = dict()

cnt = 0
while s != t:
    for i in range(n):
        if s[i] != t[i]:
            c1, c2 = s[i], t[i]
            for j in range(n):
                if s[j] == c1:
                    s[j] = c2
                elif s[j] == c2:
                    s[j] = c1
    cnt += 1
    if cnt > 100:
        break

ok = s == t

print("Yes" if ok else "No")

Fixed submission:


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

s = input()
t = input()

ss = [s.find(c) for c in s]
tt = [t.find(c) for c in t]

print("Yes" if ss == tt else "No")
Buggy python submission (verdict: Runtime Error):

a,b=map(int,input())

s = a*b - a - b
print(s)


Fixed submission:

a,b=map(int,input().split())

s = a * b - a - b + 1
print(s)
Buggy python submission (verdict: Runtime Error):


n = map(int,input().split())

def count(x):
    res = 0
    for i in range(1, x + 1):
        if x % i == 0:
            res += 1
    return res

res = 0
for x in range(1, n+1, 2):
    if count(x) == 8:
        res += 1

print(res)


Fixed submission:


n = int(input())

def count(x):
    res = 0
    for i in range(1, x + 1):
        if x % i == 0:
            res += 1
    return res

res = 0
for x in range(1, n+1, 2):
    if count(x) == 8:
        res += 1

print(res)
Buggy python submission (verdict: Runtime Error):


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

s = input()
k = getint()

t = list(itertools.takewhile(lambda s: s == '1', s))

if len(t) > k:
    print(1)
else:
    i = len(t)
    print(s[i])


Fixed submission:


import collections
import itertools
import sys


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

s = input()
k = getint() - 1

t = list(itertools.takewhile(lambda s: s == '1', s))

if len(t) > k:
    print(1)
else:
    i = len(t)
    print(s[i])
Buggy python submission (verdict: Runtime Error):

import math
n = int(input())

print(2 * n // math.gcd(2, n))


Fixed submission:

import math
n = int(input())

if n % 2 == 0:
    n = n // 2

print(2 * n)
Buggy python submission (verdict: Runtime Error):


endday = [31] * 12
endday[2] = 28
for i in [4,6,9,11]:
    endday[i] = 30

a, b = map(int, input().split())

res = 0
done = False
for m in range(1, 13):
    if done:
        break
    for d in range(1, endday[m] + 1):
        if m == d:
            res += 1
        if m == a and d == b:
            done = True
            break

print(res)


Fixed submission:


endday = [31] * 13
endday[2] = 28
for i in [4,6,9,11]:
    endday[i] = 30

a, b = map(int, input().split())

res = 0
done = False
for m in range(1, 13):
    if done:
        break
    for d in range(1, endday[m] + 1):
        if m == d:
            res += 1
        if m == a and d == b:
            done = True
            break

print(res)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, raw_input().split())
print(x + y / 2)



Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a, b) + min(c, d))

Buggy python submission (verdict: Runtime Error):
x, y = map(int, raw_input().split())
print(x + y / 2)



Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a, b) + min(c, d))
Buggy python submission (verdict: Runtime Error):

n = int(input())
ss = [input() for _ in range(n)]
m = int(input())
tt = [input() for _ in range(n)]

res = 0
for u in ss:
    tmp = ss.count(u) - tt.count(u)
    res = max(res, tmp)
print(res)


Fixed submission:

n = int(input())
ss = [input() for _ in range(n)]
m = int(input())
tt = [input() for _ in range(m)]

res = 0
for u in ss:
    tmp = ss.count(u) - tt.count(u)
    res = max(res, tmp)
print(res)
Buggy python submission (verdict: Runtime Error):
n = int(input())
cards = list(sorted(map(int, input()), reverse=True))

a = sum(cards[0::2])
b = sum(cards[1::2])

print(a - b)




Fixed submission:
n = int(input())
cards = list(sorted(map(int, input().split()), reverse=True))

a = sum(cards[0::2])
b = sum(cards[1::2])

print(a - b)
Buggy python submission (verdict: Runtime Error):

xs = sorted(map(int, input().split()))

if xs[0] != xs[1]:
    print(xs[0])
if xs[1] != xs[2]:
    print(xs[2])





Fixed submission:
print(48 - int(input()))

Buggy python submission (verdict: Runtime Error):

xs = sorted(map(int, input().split()))

if xs[0] != xs[1]:
    print(xs[0])
if xs[1] != xs[2]:
    print(xs[2])





Fixed submission:
print(48 - int(input()))

Buggy python submission (verdict: Runtime Error):

xs = sorted(map(int, input().split()))

if xs[0] != xs[1]:
    print(xs[0])
if xs[1] != xs[2]:
    print(xs[2])





Fixed submission:
print(48 - int(input()))

Buggy python submission (verdict: Runtime Error):

xs = sorted(map(int, raw_input().split()))

if xs[0] != xs[1]:
    print(xs[0])
if xs[1] != xs[2]:
    print(xs[2])





Fixed submission:
print(48 - int(input()))
Buggy python submission (verdict: Runtime Error):
input()
xs = list(map(int, input().split()))


possibles = set()
for x in xs:
    possibles.add(x - 1)
    possibles.add(x)
    possibles.add(x + 1)


res = 0
for p in possibles:
    d = 0
    for x in xs:
        c = abs(x - p)
        if c <= 1: d += 1
    if res < d: res = d

print(res)







Fixed submission:


X, t = map(int, input().split())
Y = max(0, X - t)
print(Y)
Buggy python submission (verdict: Time Limit Exceeded):
input()
xs = list(map(int, input().split()))


possibles = set()
for x in xs:
    possibles.add(x - 1)
    possibles.add(x)
    possibles.add(x + 1)


res = 0
for p in possibles:
    d = 0
    for x in xs:
        c = abs(x - p)
        if c <= 1: d += 1
    if res < d: res = d

print(res)







Fixed submission:

from collections import Counter


input()
xs = list(map(int, input().split()))


c = Counter(xs)


res = 0
for i in range(100000):
    res = max(res, c[i] + c[i - 1] + c[i + 1])

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
input()
xs = list(map(int, input().split()))


possibles = set()
for x in xs:
    possibles.add(x - 1)
    possibles.add(x)
    possibles.add(x + 1)


ds = []
for p in possibles:
    d = 0
    for x in xs:
        c = abs(x - p)
        if c <= 1: d += 1
    ds.append(d)


print(max(ds))







Fixed submission:

from collections import Counter


input()
xs = list(map(int, input().split()))


c = Counter(xs)


res = 0
for i in range(100000):
    res = max(res, c[i] + c[i - 1] + c[i + 1])

print(res)

Buggy python submission (verdict: Time Limit Exceeded):

input()
xs = list(map(int, input().split()))


possibles = []
for x in xs:
    possibles.append(x - 1)
    possibles.append(x)
    possibles.append(x + 1)

possibles = set(possibles)

ds = []
for p in possibles:
    d = 0
    for x in xs:
        c = abs(x - p)
        if c <= 1: d += 1
    ds.append(d)

print(max(ds))







Fixed submission:

from collections import Counter


input()
xs = list(map(int, input().split()))


c = Counter(xs)


res = 0
for i in range(100000):
    res = max(res, c[i] + c[i - 1] + c[i + 1])

print(res)
Buggy python submission (verdict: Time Limit Exceeded):

input()
xs = map(int, input().split())

d = dict()
for x in xs:
    if x in d.keys():
        d[x] += 1
    else:
        d[x] = 1

res = 0
for x, c1 in d.items():
    if c1 >= 4:
        if res < x * x: res = x * x
    for y, c2 in d.items():
        if x != y and c1 >= 2 and c2 >= 2:
            if res < x * y: res = x * y


print(res)


Fixed submission:

input()
xs = map(int, input().split())

d = dict()
for x in xs:
    if x in d.keys():
        d[x] += 1
    else:
        d[x] = 1

res = 0
for x, c1 in d.items():
    if c1 >= 4:
        if res < x * x: res = x * x

v = sorted(list(map(lambda s: s[0], (filter(lambda x: x[1] >= 2, d.items())))), reverse=True)

if len(v) >= 2:
    if res < v[0] * v[1]: res = v[0] * v[1]

"""
    for y, c2 in d.items():
        if x != y and c1 >= 2 and c2 >= 2:
            if res < x * y: res = x * y
"""


print(res)
Buggy python submission (verdict: Runtime Error):

n = int(input())

def cnt(a):
    if a == 1:
        return 0:
    return cnt(a//2)

res = 0
for a in range(1, n + 1):
    res = max(res, cnt(a))
print(res)


Fixed submission:

n = int(input())

def cnt(a):
    if a == 1:
        return 0
    return 1 + cnt(a//2)

res, maxcount = 0, -1
for a in range(1, n + 1):
    if maxcount < cnt(a):
        maxcount, res = cnt(a), a
print(res)
Buggy python submission (verdict: Runtime Error):
A, B, C = input().split()


if A[-1] == B[0] && B[-1] == C[0]:
    print('YES')
else:
    print('NO')










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


if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
xs = map(int, input().split())

if xs[1] - xs[0] and xs[2] - xs[1]:
    print('YES')
else:
    print('NO')




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

if xs[1] - xs[0] == xs[2] - xs[1]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):


s = input()

def drop(s):
    if s[0] != 'A':
        return drop(s[1:])
    if s[-1] != 'Z':
        return drop(s[:-1])
    return s

print(len(drop(s)))



Fixed submission:

s = input()

while True:
    if s[0] != 'A':
        s = s[1:]
        continue
    if s[-1] != 'Z':
        s = s[:-1]
        continue
    break

print(len(s))
Buggy python submission (verdict: Runtime Error):

N, K = raw_input().split()
D = raw_input().split()
candi = [str(i) for i in xrange(10)]
for d in D:
    candi.remove(d)

def decide(i):
    if i >= len(N):
        return ''
    for c in candi:
        if N[i] == c:
            return c + decide(i + 1)
        elif N[i] < c:
            return c + candi[0] * (len(N) - i - 1)

if candi[-1] * len(N) >= N:
    print decide(0)
else:
    print (candi[0] if candi[0] != '0' else candi[1]) + candi[0] * len(N)



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

if [A, B, C].count(5) == 2 and [A, B, C].count(7) == 1:
    print 'YES'
else:
    print 'NO'
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200005)
n, q = map(int, input().split())

to = [[] for i in range(n+1)]


for i in range(n-1):
    a, b = map(int, input().split())
    to[a].append(b)
    to[b].append(a)

score = [0]*(n+1)
h = [0] * (n+1)
for i in range(q):
    p, x = map(int, input().split())
    h[p] += x


def down_tree(index, parent):
    global score
    score[index] += score[parent] + h[index]
    for i in to[index]:
        if i == parent:
            continue
        down_tree(i, index)
    return


down_tree(1, 1)

print(' '.join(map(str, score[1:])))

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")

Buggy python submission (verdict: Runtime Error):

n, q = map(int, input().split())

to = [[] for i in range(n)]


for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

score = [0]*n

for i in range(q):
    p, x = map(int, input().split())
    score[p-1] += x


def down_tree(index, parent=-1):
    global score
    for i in to[index]:
        if i == parent:
            continue
        score[i] += score[index]
        down_tree(i, index)
    return


down_tree(0)

print(*score)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
f = 0
for i in range(a,b+1):
  if i%c != 0 and i%d != 0:
    f += 1
print(f)

Fixed submission:
import fractions as f
a,b,c,d = map(int,input().split())
i = abs((a-1)//c-b//c)
j = abs((a-1)//d-b//d)

def lcm(x,y):
  return (x*y)//f.gcd(x,y)
l = lcm(c,d)
k = abs((a-1)//l-b//l)
print(b-a+1-(i+j-k))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
o = [int(input()) for _ in range(m)]
#print(o)
mod = (10**9)+7
dp = [1]+[0]*(n)

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


Fixed submission:
n,m = map(int,input().split())
o = set(int(input()) for _ in range(m))
#print(o)
mod = (10**9)+7
dp = [0]*(n+1)
dp[0] = 1

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
o = [int(input()) for _ in range(m)]
#print(o)
mod = (10**9)+7
dp = [1]+[0]*(n)
 
for i in range(1,n+1):
  dp[i] = dp[i-1]+dp[i-2]
  if i in o:
    dp[i] = 0
  #print(i,dp)
#print(dp)
print(dp[-1]%mod)

Fixed submission:
n,m = map(int,input().split())
o = set(int(input()) for _ in range(m))
#print(o)
mod = (10**9)+7
dp = [0]*(n+1)
dp[0] = 1

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
o = [int(input()) for _ in range(m)]
#print(o)
mod = (10**9)+7
dp = [1]+[0]*(n)
flag1 = False
 
for i in range(n):
  if i+1 not in o:
    dp[i+1] = dp[i] + dp[i-1]
  else:
    dp[i+1] = 0
  #print(i,dp)
#print(dp)
print(dp[-1]%mod)

Fixed submission:
n,m = map(int,input().split())
o = set(int(input()) for _ in range(m))
#print(o)
mod = (10**9)+7
dp = [0]*(n+1)
dp[0] = 1

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

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
o = [int(input()) for _ in range(m)]
#print(o)
mod = (10**9)+7
dp = [1]+[0]*(n)
flag1 = False

for i in range(n):
  if i+1 not in o:
    dp[i+1] = dp[i] + dp[i-1]
  else:
    dp[i+1] = 0
  #print(i,dp)
#print(dp)
print(dp[-1]%mod)


Fixed submission:
n,m = map(int,input().split())
o = set(int(input()) for _ in range(m))
#print(o)
mod = (10**9)+7
dp = [0]*(n+1)
dp[0] = 1

for i in range(1,n+1):
  dp[i] = (dp[i-1]+dp[i-2])%mod
  if i in o:
    dp[i] = 0
  #print(i,dp)
#print(dp)
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
n,m=map(int,input().split())
d = defaultdict(int)
for i in range(m):
  s, e = map(int,input().split())
  for j in range(s,e+1):
    j = str(j)
    d[j] += 1
#print(d)
count = 0
for k,v in d.items():
  if v==m:
    count+=1
print(count)

Fixed submission:
n,m=map(int,input().split())
mi = 0
ma = 10**5+1
for i in range(m):
  s,e = map(int,input().split())
  if s > mi:
    mi = s
#    print('mi',mi)
  if e < ma:
    ma = e
#    print('ma',ma)
print(max(ma-mi+1,0))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce 
from fractions import gcd
n = int(input())
*v, = map(int,input().split())
#print(v)

mn = 0
for i in range(n):
  c = v.copy()
  #print('c',c)
  c.pop(i)
  #print('c2',c)
  ans = reduce(gcd,c)
  #print('v',v)
  #print('ans',ans)
  if ans > mn:
    mn = ans
    
print(mn)

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

def gcd(x, y):
  return gcd(y, x%y) if y else x

l, r = [], []

for i in range(n):
  l.append(gcd(l[i-1], a[i-1]) if i else 0)
  r.append(gcd(r[i-1], a[n-i]) if i else 0)
print(max([gcd(l[i], r[n-i-1]) for i in range(n)]))
Buggy python submission (verdict: Time Limit Exceeded):
m, n = map(int,input().split())
s = input()
dp = [1]*m
#print(s)
for i in range(n):
  t, d = map(str,input().split())
  for j in range(m):
    if s[j] == t and j == 0:
      if d == 'L':
        dp[j] = 0
      elif d == 'R':
        dp[j+1] += dp[j]
        dp[j] = 0
        #print(dp)
    elif s[j] == t and j == m-1:
      if d == 'R':
        dp[j] = 0
      elif d == 'L':
        dp[j-1] += dp[j]
        dp[j] = 0
        #print(dp)
    elif s[j] == t:
      if d == 'L':
        dp[j-1] += dp[j]
        dp[j] = 0
        #print(dp)
      elif d == 'R':
        dp[j+1] += dp[j]
        dp[j] = 0
        #print(dp)
#print(dp)
print(sum(dp))

Fixed submission:
n, q = map(int,input().split())
s = "_" + input() + "_"
l, r = 0, n+1

for (t,d) in [input().split() for i in range(q)][::-1]:
  L = d == 'L'
  R = d == 'R'
  l += (t==s[l+1] and L) - (t==s[l] and R)
  r += (t==s[r] and L) - (t==s[r-1] and R)
print(r-l-1)
Buggy python submission (verdict: Runtime Error):
s = input()
#print(s)
#print(len(s))
ans = []
cnt = 0
for i in range(len(s)):
  #print(s[i])
  if (s[i] != 'A') and (s[i] != 'T') and (s[i] != 'C') and (s[i] != 'G'):
    ans.append(cnt)
    #print(ans)
    cnt = 0
  elif s[i] == 'A':
    cnt += 1
    continue
  elif s[i] == 'T':
    cnt += 1
    continue
  elif s[i] == 'C':
    cnt += 1
  elif s[i] == 'G':
    cnt += 1
print(max(ans))

Fixed submission:
s = input()
#print(s)
#print(len(s))
s = s+'X'
ans = []
cnt = 0
for i in range(len(s)):
  #print(s[i])
  if (s[i] != 'A') and (s[i] != 'T') and (s[i] != 'C') and (s[i] != 'G'):
    ans.append(cnt)
    #print(ans)
    cnt = 0
  elif s[i] == 'A':
    cnt += 1
    continue
  elif s[i] == 'T':
    cnt += 1
    continue
  elif s[i] == 'C':
    cnt += 1
  elif s[i] == 'G':
    cnt += 1

#print(ans)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import re
n, q = map(int,input().split())
s = input()
li = []
idx = -1

while True:
  idx = s.find('AC',idx+1)
  li.append(idx)
  if idx == -1:
    break
#print(li)
#cnt = 0
for i in range(q):
  cnt = 0
  l, r = map(int,input().split())
  for j in li:
    if j == -1:
      break
    elif l-1 <= j < r-1:
      cnt += 1
  print(cnt)

Fixed submission:
n, q = map(int,input().split())
s = input()
li = [0]*(n+1)
for i in range(n):
  li[i+1] = li[i] + (1 if s[i:i+2]=='AC' else 0)
#print(li)
for i in range(q):
  l, r = map(int,input().split())
  print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
s = input()
#cnt = 0
for i in range(q):
  l, r = map(int,input().split())
  #print(s[l-1:r])
  if 'AC' not in s[l-1:r]:
    print(0)
  else:
    print(s[l-1:r].count('AC'))

Fixed submission:
n, q = map(int,input().split())
s = input()
li = [0]*(n+1)
for i in range(n):
  li[i+1] = li[i] + (1 if s[i:i+2]=='AC' else 0)
#print(li)
for i in range(q):
  l, r = map(int,input().split())
  print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
s = input()
#cnt = 0
for i in range(q):
  cnt = 0
  l, r = map(int,input().split())
  #print(s[l-1:r])
  cnt = s[l-1:r].count('AC')
  print(cnt)

Fixed submission:
n, q = map(int,input().split())
s = input()
li = [0]*(n+1)
for i in range(n):
  li[i+1] = li[i] + (1 if s[i:i+2]=='AC' else 0)
#print(li)
for i in range(q):
  l, r = map(int,input().split())
  print(li[r-1]-li[l-1])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
print([i for i in range(1,101) if a%i+b%i<1][-k])

Fixed submission:
a, b, c = map(int, input().split())
ans = b//a
print(c if ans>c else ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
num_li = list(map(int, input().split()))

def gcd(mn, xn):
  if xn == 0:
    return mn
  else:
    return gcd(xn, mn%xn)

ans = 0  
for i in range(N):
  if i < N-1:
    ans = gcd(num_li[i], num_li[i+1])
    if ans == 1:
      print(1)
      exit()
    else:
      ans += gcd(num_li[i], num_li[i+1] 
  
print(ans/N)

Fixed submission:
n = input()
a = list(map(int, input().split()))
import functools, fractions
print(functools.reduce(fractions.gcd, a))
Buggy python submission (verdict: Runtime Error):
N = int(input())
num_li = list(map(int, input().split()))

max_num = max(num_li)
other_num = 0

for n in num_li:
  if n == max_num:
    continue
  other_num += n

if max_num < other_num:
  print('Yes')
else:
  print('No')


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

print(T/X)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, wt = map(int, input().split())
 
d = np.full(n*10**7+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))

Fixed submission:
import numpy as np
n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')

for i in range(n):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, wt = map(int, input().split())

d = np.fill(n*10**7+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))


Fixed submission:
import numpy as np
n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')

for i in range(n):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, wt = map(int, input().split())
d = np.zeros(wt+1,'i8')

for i in range(n):
  w, v = map(int, input().split())
  d[w:] = np.maximum(d[w:], d[:-w]+v)
print(d[-1])

Fixed submission:
import numpy as np
n, wt = map(int, input().split())
 
d = np.full(n*1000+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
  x, y = map(int,input().split())
  g[x-1].append(y-1)

mem = [-1]*n

def dfs(v):
  if mem[v] != -1:
    return mem[v]
  mem[v] = r = max(dfs(w) for w in g[v]) +1 if g[v] else 0
  return r
print(max(dfs(t) for t in range(n)))


Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
  x, y = map(int,input().split())
  g[x-1].append(y-1)
#print(g)
mem = [-1]*n

def dfs(v):
  if mem[v] != -1:
    return mem[v]
  mem[v] = r = max(dfs(w) for w in g[v]) +1 if g[v] else 0
  return r
print(max(dfs(t) for t in range(n)))