Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b,c = (int(_) for _ in input().split())

print(min(c, int(b/a))

Fixed submission:
a,b,c = (int(_) for _ in input().split())

print(min(c, int(b/a)))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(N: int, K: int):
 	from math import ceil
    if(ceil(N/2) >= K):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.5.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(N: int, K: int):
    from math import ceil
    if(ceil(N/2) >= K):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    dp = [[0] * (W+1) for i in range(N+1)]

    for i in range(1,N+1):
        for j in range(1,W+1):
            if j-w[i-1] >= 0:
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1])
            else:
                dp[i][j] = dp[i-1][j]

    print(dp[N][W])

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]" 
    v = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
    dp = [[0] * (W+1) for i in range(N+1)]

    for i in range(1,N+1):
        for j in range(1,W+1):
            if j-w[i-1] >= 0:
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1])
            else:
                dp[i][j] = dp[i-1][j]

    print(dp[N][W])

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    w = [int()] * (N)  # type: "List[int]" 
    v = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        w[i] = int(next(tokens))
        v[i] = int(next(tokens))
    solve(N, W, w, v)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(s: str, t: str):
    N = len(s)
    W = len(t)
    dp = [[''] * (W+1) for i in range(N+1)]

    for i in range(N):
        for j in range(W):
            if(s[i] == t[j]):
                dp[i+1][j+1] = dp[i][j]+s[i]
            else:
                if(len(dp[i][j+1]) > len(dp[i+1][j])):
                    dp[i+1][j+1] = dp[i][j+1]
                else:
                    dp[i+1][j+1] = dp[i+1][j]

    print(dp[N][W])

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(s: str, t: str):
    N = len(s)
    W = len(t)
    dp = [[0] * (W+1) for i in range(N+1)]

    for i in range(N):
        for j in range(W):
            if(s[i] == t[j]):
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]) 

    ans = []
    while N > 0 and W > 0:
        if(dp[N][W] == dp[N-1][W]):
            N -= 1
        elif(dp[N][W] == dp[N][W-1]):
            W -= 1
        elif(dp[N][W] == dp[N-1][W-1]+1):
            ans = [s[N-1]] + ans
            N -= 1
            W -= 1


    print(''.join(ans))

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    t = next(tokens)  # type: str
    solve(s, t)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
from math import ceil

def solve(N: int, p: "List[float]"):

    dp = [[0.0] * (N+1) for i in range(N+1)]

    dp[0][0] = 1
    for i in range(N):
         for j in range(N):
             dp[i+1][j] += dp[i][j] * (1-p[i])
             dp[i+1][j+1] += dp[i][j] * p[i]

    print(sum(dp[N][ceil(N/2):]))


    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    p = [ float(next(tokens)) for _ in range(N) ]  # type: "List[float]"
    solve(N, p)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
from math import ceil

def solve(N: int, p: "List[float]"):

    dp = [[0.0] * (N+1) for i in range(N+1)]

    dp[0][0] = 1
    for i in range(N):
         for j in range(N):
             dp[i+1][j] += dp[i][j] * (1-p[i])
             dp[i+1][j+1] += dp[i][j] * p[i]

    print(sum(dp[N][ceil(N/2):]))


    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    p = [ float(next(tokens)) for _ in range(N) ]  # type: "List[float]"
    solve(N, p)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = input()
ln = list(n)

for i in range(len(ln)):
    if ln[i] == '1':
        ln[i] = '9'
    elif ln[i] == '9':
        ln[i] = '1'
        
n = ''.join(ln)
print(n = ''.join(ln))

Fixed submission:
n = input()
ln = list(n)
 
for i in range(len(ln)):
    if ln[i] == '1':
        ln[i] = '9'
    elif ln[i] == '9':
        ln[i] = '1'
        
n = ''.join(ln)
print(int(n))
Buggy python submission (verdict: Runtime Error):
import sys

n,m,x,y = (int(_) for _ in input().split())
xl = [int(_) for _ in input().split()]
yl = [int(_) for _ in input().split()]

xl.sort()
yl.sort()

for i in range(x+1,y+1):
    if((x < int(i) <= y) and (x[-1] < int(i)) and (y[0] >= int(i))):
        print('No War')
        sys.exit()
    else:
        pass

print('War')

Fixed submission:
import sys

n,m,x,y = (int(_) for _ in input().split())
xl = [int(_) for _ in input().split()]
yl = [int(_) for _ in input().split()]

xl.append(x)
yl.append(y)

xl.sort()
yl.sort()

print('War') if (xl[-1] >= yl[0]) else print('No War')
Buggy python submission (verdict: Runtime Error):
import math as mh
import fractions as fr
from functools import reduce

n, p = (int(_) for _ in input().split())
x = list(int(_) for _ in input().split())
x.append(p)
x.sort()

dx = []
for i in range(1,len(x)+1):
    dx.append(x[i] - x[i-1])

exgcd = reduce(fr.gcd, x)
print(exgcd)



Fixed submission:
import math as mh
import fractions as fr
from functools import reduce

n, p = (int(_) for _ in input().split())
x = list(int(_) for _ in input().split())
x.append(p)
x.sort()

dx = []
for i in range(1,len(x)):
    dx.append(x[i] - x[i-1])

exgcd = reduce(fr.gcd, dx)
print(exgcd)

Buggy python submission (verdict: Runtime Error):
import math as mh
import fractions as fr
from functools import reduce as rd

n, p = (int(_) for _ in input().split())
x = list(int(_) for _ in input().split())

lmin = abs(p - min(x))
lmax = abs(p - max(x))

d = fr.gcd(lmin, lmax)
exgcd = rd.reduce(fr.gcd, [d,lmin,lmax])

print(exgcd)

Fixed submission:
import math as mh
import fractions as fr
from functools import reduce

n, p = (int(_) for _ in input().split())
x = list(int(_) for _ in input().split())
x.append(p)
x.sort()

dx = []
for i in range(1,len(x)):
    dx.append(x[i] - x[i-1])

exgcd = reduce(fr.gcd, dx)
print(exgcd)

Buggy python submission (verdict: Runtime Error):
import math as mh
import fractions as fr

n, p = (int(_) for _ in input().split())
x = list(int(_) for _ in input().split())

if p < min(x):
    lmin = abs(p + min(x))
    lmax = abs(p - max(x))
elif p > max(x):
    lmin = abs(p - min(x))
    lmax = abs(p + max(x))
else:
    lmin = abs(p - min(x))
    lmax = abs(p - max(x))

d = mh.gcd(lmin, lmax)

#while (d*2)%lmin == 0 and (d*2)%lmax == 0:
#    d *= 2
print(d)



Fixed submission:
import math as mh
import fractions as fr
from functools import reduce

n, p = (int(_) for _ in input().split())
x = list(int(_) for _ in input().split())
x.append(p)
x.sort()

dx = []
for i in range(1,len(x)):
    dx.append(x[i] - x[i-1])

exgcd = reduce(fr.gcd, dx)
print(exgcd)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = (int(_) for _ in input().split())

c = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        if (i+j)%k != 0:
            continue
        for a in range(1,n+1):
            if (j+a)%k == 0 and (a+i)%k == 0:
                c += 1
            else:
                continue

print(c)

Fixed submission:
#!/usr/bin/env python3
import sys
import math

def solve(N: int, K: int):

    ans = int(N/K) ** 3

    if(K%2 == 0):
        cnt = 0
        for i in range(int(K/2), N+1, K):
            cnt += 1
        ans += cnt ** 3
    
    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = mymath.prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))

Fixed submission:
n = int(input())

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= int(i)
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

a = [1]*(n+1)
for i in range(3,n+1,2):
    il = prime_decomposition(i)
    il_unique = list(set(il))
    ans = 1
    for j in il_unique:
        ans *= (il.count(j)+1)
    a[i] = max(a[i],ans)


print(a.count(8))
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm(a,b):
    return a*b // math.gcd(a,b)

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

# gcd = functools.reduce(math.gcd, values)
m = reduce(lcm, a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)

Fixed submission:
import fractions
from functools import reduce

def lcm(a,b):
    return a*b // fractions.gcd(a,b)

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

# gcd = functools.reduce(math.gcd, values)
m = reduce(lcm, a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)

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

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

m = lcm(*a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)

Fixed submission:
import fractions
from functools import reduce

def lcm(a,b):
    return a*b // fractions.gcd(a,b)

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

# gcd = functools.reduce(math.gcd, values)
m = reduce(lcm, a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)
Buggy python submission (verdict: Time Limit Exceeded):
# C 
import numpy as np

# n = 127
n = int(input())

max_n = 100000
memo = np.full(max_n,999999,dtype=np.int64)
memo[0] = 0

nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    k = 6
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 9
        
print(memo[n])

Fixed submission:
# C 
# import numpy as np

# n = 127
n = int(input())

max_n = 100000
# memo = np.full(max_n,999999,dtype=np.int32)
memo = [999999]*(max_n+1)
memo[0] = 0

# nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
# nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    k = 6
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 9
        
print(memo[n])

Buggy python submission (verdict: Time Limit Exceeded):
# C 
import numpy as np

# n = 127
n = int(input())

max_n = 100000
memo = np.full(max_n,999999,dtype=np.int64)
memo[0] = 0

nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    for i6 in nl6:
        if(i-i6 >= 0):
            memo[i] = min(memo[i], memo[i-i6]+1)
        
    for i9 in nl9:
        if(i-i9 >= 0):
            memo[i] = min(memo[i], memo[i-i9]+1)
            
print(memo[n])

Fixed submission:
# C 
# import numpy as np

# n = 127
n = int(input())

max_n = 100000
# memo = np.full(max_n,999999,dtype=np.int32)
memo = [999999]*(max_n+1)
memo[0] = 0

# nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
# nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    k = 6
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 9
        
print(memo[n])

Buggy python submission (verdict: Time Limit Exceeded):
# C 
import numpy as np

# n = 127
n = int(input())

max_n = 100000
memo = np.full(max_n,999999,dtype=np.int64)
memo[0] = 0

nl = [1]
nl6 = nl+[6**i for i in range(1,1000) if 6**i <= 100000]
nl9 = nl+[9**i for i in range(1,1000) if 9**i <= 100000]
nl.sort(reverse=True)


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    for i6 in nl6:
        if(i-i6 >= 0):
            memo[i] = min(memo[i], memo[i-i6]+1)
        
    for i9 in nl9:
        if(i-i9 >= 0):
            memo[i] = min(memo[i], memo[i-i9]+1)
            
print(memo[n])

Fixed submission:
# C 
# import numpy as np

# n = 127
n = int(input())

max_n = 100000
# memo = np.full(max_n,999999,dtype=np.int32)
memo = [999999]*(max_n+1)
memo[0] = 0

# nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
# nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    k = 6
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 9
        
print(memo[n])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())

max = 0
for i in range(1,n):
    l = len(set(s[:i]&s[i:]))
    if l > max:
        max = l

print(max)

Fixed submission:
n = int(input())
s = list(input())


max = 0
for i in range(1,n):
    xs = set(s[:i])
    ys = set(s[i:])
    l = len(xs&ys)
    if l > max:
        max = l

print(max)
Buggy python submission (verdict: Runtime Error):
from math import sqrt

x = int(input())
xr = int(sqrt(x))

l=[1]
for i in range(1,xr+1):
    t=[]
    for j in range(2,xr):
        if i**j <= x:
            t.append(i**j)
        else:
            continue
    l = l+t
l = list(set(l))
l.sort()


left=0
right=len(l)
center=0

while left < right:
    center = (left+right)//2
    if l[center] == x:
        break
    elif l[center] < x:
        left = center+1
    else:
        right = center

print(l[center])

Fixed submission:
a,b,c,d = (int(_) for _ in input().split())
print('Yes') if abs(c-a) <= d or (abs(b-a) <= d and abs(c-b) <= d) \
    else print('No')
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt

x = int(input())
xr = int(sqrt(x))

l=[1]
for i in range(1,xr+1):
    t=[]
    for j in range(2,xr):
        if i**j <= x:
            t.append(i**j)
        else:
            break
    l = l+t
l = list(set(l))
l.sort()


left=0
right=len(l)
center=0

while left < right:
    center = (left+right)//2
    if l[center] == x:
        break
    elif l[center] < x:
        left = center
    else:
        right = center

print(l[center])

Fixed submission:
from math import sqrt

x = int(input())
xr = int(sqrt(x))

l=[1]
for i in range(1,xr+1):
    t=[]
    for j in range(2,xr):
        if i**j <= x:
            t.append(i**j)
        else:
            break
    l = l+t
l = list(set(l))
l.sort()


left=0
right=len(l)
center=0

while left < right:
    center = (left+right)//2
    if l[center] == x:
        break
    elif l[center] < x:
        left = center+1
    else:
        right = center

print(l[center])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):
    sl = set()

    for i in range(len(s)):
        for j in range(i,len(s)):
            sl.add(s[i:j+1])

    sl = list(sorted(sl))   
    # print(sl)
    print(sl[K-1])

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):
    sl = set()

    for i in range(len(s)):
        for j in range(i,min(i+K,len(s))):
            sl.add(s[i:j+1])

    sl = list(sorted(sl))   
    # print(sl)
    print(sl[K-1])

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):
    if N < 10:
        print(n)
        exit()

    n = len(list(str(N)))
    t = sum(map(int, str(N)[0]+'9'*(n-1)))

    al = [t]
    for i in range(max(0, N-10), N+1):
        x = sum(map(int, list(str(i))))
        # print(i, x)
        al.append(x)

    print(max(al)-1)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):
    sn = str(N)
    if sn[1:] == '9'*(len(sn)-1):
        print(int(sn[0])+9*(len(sn)-1))
    else:
        print(int(sn[0])+9*(len(sn)-1)-1)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()