Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

    k = int(input())
    ans = 0

    for h in range(1, k+1):
        for i in range(1, k+1):
            l = math.gcd(h, i)
            for j in range(1, k+1):
                ans += math.gcd(l, j)

    print(ans)

Fixed submission:
from functools import reduce
import math

k = int(input())

s = 0

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

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            s += gcd(i,j,l)

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
ans = 0

for  h in range(1, k+1):
    for i in range(1, k+1):
        for j in range(1, k+1):
            ans += math.gcd(math.gcd(h, i), j)

print(ans)

Fixed submission:
from functools import reduce
import math

k = int(input())

s = 0

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

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            s += gcd(i,j,l)

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p, q):
    if p%q == 0:
        return q
    else:
        return gcd(q, p%q)

k = int(input())
s = 0

for h in range(1, k+1):
    for i in range(1, k+1):
        for j in range(1, k+1):
            s += gcd(gcd(h, i), j)

print(s)

Fixed submission:
from functools import reduce
import math

k = int(input())

s = 0

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

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            s += gcd(i,j,l)

print(s)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
import math

k = int(input())

s = 0

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

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            s += gcd(i,j,l)

print(s)



Fixed submission:
from functools import reduce
import math

k = int(input())

s = 0

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

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            s += gcd(i,j,l)

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())

if n < k:
    ans = min(abs(n-k), n)

else:    
    if n%k == 0:
        ans = 0
    else:
        for i in range(-k,k+1):
            if (i%k == n%k and i < 0):
                nega = -i
            elif (i%k == n%k and i >= 0):
                posi = i
        ans = (min(nega, posi))
print(ans)

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

a = n%k
b = abs(a-k)
print(min(n,a,b))

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

if n%k == 0:
    ans = 0
else:
    for i in range(-k,k+1):
        if (i%k == n%k and i < 0):
            nega = -i
        elif (i%k == n%k and i >= 0):
            posi = i
    ans = (min(nega, posi))
print(ans)

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

a = n%k
b = abs(a-k)
print(min(n,a,b))
Buggy python submission (verdict: Runtime Error):
s = input()
if s = 'AAA' or s =='BBB':
    print('No')
else:
    print('Yes')

Fixed submission:
s = input()
if s == 'AAA' or s =='BBB':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int, input().split())

ball = [0,0]
#左が青, 右が赤
while True:
    ball[0] += a
    if sum(ball) == n:
        print(ball[0])
        exit()
    elif sum(ball) > n:
        ball[0] -= sum(ball) - n
        print(ball[0])
        exit()
    
    ball[1] += b
    if sum(ball) >= n:
        print(ball[0])
        exit()

Fixed submission:
n,a,b = map(int, input().split())
block = n // (a+b)
rest = n % (a+b)

ans = block*a + min(a,rest)
print(ans)

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

ball = [0,0]
#左が青, 右が赤
while True:
    ball[0] += a
    if sum(ball) == n:
        print(ball[0])
        exit()
    elif sum(ball) > n:
        ball[0] -= sum(ball) - n
        print(ball[0])
        exit()
    
    ball[1] += b
    if sum(ball) >= n:
        print(ball[0])
        exit()

Fixed submission:
n,a,b = map(int, input().split())
block = n // (a+b)
rest = n % (a+b)

ans = block*a + min(a,rest)
print(ans)

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

ball = [0,0]
#左が青, 右が赤
while True:
    for i in range(a):
        ball[0] += 1
        if sum(ball) == n:
            print(ball[0])
            exit()
    for i in range(b):
        ball[1] += 1
        if sum(ball) == n:
            print(ball[0])
            exit()

Fixed submission:
n,a,b = map(int, input().split())
block = n // (a+b)
rest = n % (a+b)

ans = block*a + min(a,rest)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = [input() for i in range(n)]

s_count = collections.Counter(s)

values = []
ans = []

for key in list(s_count.keys()):
    values.append(s_count.get(key))

for key in list(s_count.keys()):
    if s_count.get(key) == max(values):
        ans.append(key)

ans.sort()

for word in ans:
    print(word)

Fixed submission:
import collections

n = int(input())
s = [input() for i in range(n)]

s_count = collections.Counter(s)
largest = max(list(s_count.values()))
ans = []

for key in list(s_count.keys()):
    if s_count.get(key) == largest:
        ans.append(key)

ans.sort()

for word in ans:
    print(word)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    for j in range(i+1,n):
        if a[i] == a[j]:
            print('NO')
            exit()
print('YES')

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

a.sort()

for i in range(n-1):
    if a[i] == a[i+1]:
        print('NO')
        exit()
print('YES')

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

for i in range(n):
    for j in range(n):
        if i == j:
            pass
        else:
            if a[i] == a[j]:
                print('NO')
                exit()
print('YES')

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

a.sort()

for i in range(n-1):
    if a[i] == a[i+1]:
        print('NO')
        exit()
print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

count = 1

for i in range(1,n):
    temp = p[:i]
    if min(temp) >= p[i]:
        count += 1

print(count)

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

count = 0
m = p[0]

for i in range(0,n):
    if m >= p[i]:
        count += 1
    m = min(m, p[i])

print(count)

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

count = 1

for i in range(1,n):
    temp = p[:i]
    if min(temp) >= p[i]:
        count += 1

print(count)

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

count = 0
m = p[0]

for i in range(0,n):
    if m >= p[i]:
        count += 1
    m = min(m, p[i])

print(count)

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

count = 0

for i in range(n):
    for j in range(i):
        if p[i] > p[j]:
            break
    else:
        count += 1

print(count)


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

count = 0
m = p[0]

for i in range(0,n):
    if m >= p[i]:
        count += 1
    m = min(m, p[i])

print(count)
Buggy python submission (verdict: Runtime Error):
import math

x = int(input())

if x == 2:
    print(3)
elif x%2 == 0:
    ans = x+1
else:
    ans = x

#2以外の素数は奇数であることに注意

while True:
    for i in range(3, int(math.sqrt(ans))+1, 2):
        if ans%i == 0:
            ans += 2
            break
    else:
        print(ans)
        exit()



Fixed submission:
import math

x = int(input())

if x == 2:
    print(2)
    exit()

elif x%2 == 0:
    ans = x+1

else:
    ans = x

#2以外の素数は奇数であることに注意

while True:
    for i in range(3, int(math.sqrt(ans))+1, 2):
        if ans%i == 0:
            ans += 2
            break
    else:
        print(ans)
        exit()
Buggy python submission (verdict: Runtime Error):
s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print(Rainy)
else:
    print('Sunny')


Fixed submission:
s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int, input().split())
a =[int(input()) for i in range(q)]

point = [k]*n

for i in range(q):
    solver = a[i]-1

    for j in range(0,solver):
        point[j] -= 1

    for j in range(solver+1,n):
        point[j] -= 1

for i in range(n):
    if point[i] > 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
n,k,q = map(int, input().split())
a = [int(input()) for i in range(q)]

point = [0]*n

for i in range(q):
    point[a[i]-1] += 1

for i in range(n):
    if point[i] > q-k:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = [input() for i in range(n)]

for i in range(n):
    s[i] = [s[i][j] for j in range(10)]
    s[i] = collections.Counter(s[i])

same =[]

for dic in s:
    count = 0
    while dic in s:
        s.remove(dic)
        count += 1
    else:
        same.append(count)

ans = 0

for num in same:
    ans += num * (num-1) // 2

print(ans)


Fixed submission:
import collections
n = int(input())

s = ["".join(sorted(input())) for i in range(n)]

a = collections.Counter(s)

ans = 0

for i in a.values():
    ans += i*(i-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = [input() for i in range(n)]

for i in range(n):
    s[i] = [s[i][j] for j in range(10)]
    s[i] = collections.Counter(s[i])

count = 0

for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            count += 1

print(count)


Fixed submission:
import collections
n = int(input())

s = ["".join(sorted(input())) for i in range(n)]

a = collections.Counter(s)

ans = 0

for i in a.values():
    ans += i*(i-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = [input() for i in range(n)]

for i in range(n):
    s[i] = [s[i][j] for j in range(10)]
    s[i] = collections.Counter(s[i])

count = 0

for i in range(n):
    for j in range(n):
        if s[i] == s[j]:
            count += 1

count = (count - n)//2

print(count)



Fixed submission:
import collections
n = int(input())

s = ["".join(sorted(input())) for i in range(n)]

a = collections.Counter(s)

ans = 0

for i in a.values():
    ans += i*(i-1)//2

print(ans)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = float('INF')
    for i in range(l, r):
        for j in raneg(i, r):
            temp = (i * j) % 2019
            if temp < ans:
                ans = temp

print(ans)


Fixed submission:
l, r = map(int, input().split())

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = float('INF')
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            temp = (i * j) % 2019
            if temp < ans:
                ans = temp

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

lb, ub = 0, max(a)
while ub - lb > 1:
    mid = (ub + lb) // 2

    cnt = 0
    for i in range(n):
        cnt += a[i] // mid
        if a[i] % mid != 0:
            cnt += 1
        cnt -= 1

    if cnt <= k:
        ub = mid
    else:
        lb = mid

print(ub)


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

lb, ub = 0, max(a)
while ub - lb > 1:
    mid = (ub + lb) // 2

    cnt = 0
    for i in range(n):
        cnt += a[i] // mid
        if a[i] % mid != 0:
            cnt += 1
        cnt -= 1

    if cnt <= k:
        ub = mid
    else:
        lb = mid

print(ub)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

score = 1
for i in range(k):
    score *= a[i]
ans = [score]

for i in range(k, n):
    score = score * a[i] // a[i-k]
    ans.append(score)

for i in range(n-k):
    if ans[i] < ans[i+1]:
        print("Yes")
    else:
        print("No")


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

for i in range(k, n):
    if a[i-k] < a[i]:
        print("Yes")
    else:
        print("No")

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

score = 1
for i in range(k):
    score *= a[i]
ans = [score]

for i in range(k, n):
    score = score * a[i] // a[i-k]
    ans.append(score)

for i in range(n-k):
    if ans[i] < ans[i+1]:
        print("Yes")
    else:
        print("No")


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

for i in range(k, n):
    if a[i-k] < a[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = []
for i in range(1, 10):
    if 1000 * i - n >= 0:
        ans.append(1000*i - n)

print(min(ans))


Fixed submission:
n = int(input())

ans = []
for i in range(11):
    if 1000 * i - n >= 0:
        ans.append(1000*i - n)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

res = []
for i in range(1, 101):
    if i not in p:
        res.append([abs(i-x), i])

res.sort(key=lambda x:x[0])
print(res[0][1])



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

ans = 0
m = float("inf")
for i in range(-200, 200):
    if i not in p:
        if abs(i-x) < m:
            ans = i
            m = abs(i-x)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(min(41, k)):
    t = [0] * (n+1)
    for j in range(n):
        t[max(0, j-a[j])] += 1
        t[min(j+a[j]+1, n)] -= 1

    for j in range(1, n):
        t[j] += t[j-1]
    a = t[:n]

print(*a)

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

for i in range(min(41, k)):
    t = [0] * (n+1)
    for j in range(n):
        t[max(0, j-a[j])] += 1
        t[min(j+a[j]+1, n)] -= 1

    for j in range(1, n):
        t[j] += t[j-1]
    a = t[:n]

print(*a)
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

for i in range(10**9):
    if i**5 -(X-i)**5 == X:
        print(i, X-i)
        exit()

Fixed submission:
X = int(input())

for i in range(-200, 200):
    for j in range(-200, 200):
        if i**5 -j**5 == X:
            print(i, j)
            exit()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

ans = 0
cnt = defaultdict(int)
for i in range(n):
	ans += cnt[i - a[i]]
	cnt[i + a[i]] += 1

print(ans)


Fixed submission:
from collections import defaultdict

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

memo = defaultdict(int)
ans = 0
for i, a in enumerate(A, 1):
    ans += memo[i - a]
    memo[a + i] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from bisect import bisect_right

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

b = []
c = []
for i in range(n):
	b.append(i + 1 - a[i])
	c.append(i + 1 + a[i])

cnt = defaultdict(list)
for i in range(n):
	cnt[b[i]].append(i)

ans = 0
for i in range(n):
	k = bisect_right(cnt[c[i]], i)
	ans += len(cnt[c[i]][k:])

print(ans)


Fixed submission:
from collections import defaultdict

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

memo = defaultdict(int)
ans = 0
for i, a in enumerate(A, 1):
    ans += memo[i - a]
    memo[a + i] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from bisect import bisect_right

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

b = []
c = []
for i in range(n):
	b.append(i + 1 - a[i])
	c.append(i + 1 + a[i])

cnt = defaultdict(list)
for i in range(n):
	cnt[b[i]].append(i)

ans = 0
for i in range(n):
	k = bisect_right(cnt[c[i]], i)
	ans += len(cnt[c[i]][k:])

print(ans)


Fixed submission:
from collections import defaultdict

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

memo = defaultdict(int)
ans = 0
for i, a in enumerate(A, 1):
    ans += memo[i - a]
    memo[a + i] += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

dp = [[1000 for _ in range(W+1)] for _ in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for y in range(W):
    for x in range(H):
        dp[y+1][x+1] = min(
            dp[y][x+1] + (s[y][x] == '#' and (y == 0 or s[y-1][x] == '.')),
            dp[y+1][x] + (s[y][x] == '#' and (x == 0 or s[y][x-1] == '.'))
        )

print(dp[-1][-1])


Fixed submission:
H, W = map(int,input().split())
board = []
for h in range(H):
    board.append(input())

dp=[[1000 for i in range(W+1)] for j in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for h in range(H):
    for w in range(W):
        dp[h+1][w+1] = min(
            dp[h][w+1] + (board[h][w]=='#' and (h==0 or board[h-1][w]=='.')),
            dp[h+1][w] + (board[h][w]=='#' and (w==0 or board[h][w-1]=='.'))
        )

print (dp[-1][-1])

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

dp = [1000 for _ in range(W+1) for _ in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for y in range(W):
    for x in range(H):
        dp[y+1][x+1] = min(
            dp[y][x+1] + (s[y][x] == '#' and (y == 0 or s[y-1][x] == '.')),
            dp[y+1][x] + (s[y][x] == '#' and (x == 0 or s[y][x-1] == '.'))
        )

print(dp[-1][-1])


Fixed submission:
H, W = map(int,input().split())
board = []
for h in range(H):
    board.append(input())

dp=[[1000 for i in range(W+1)] for j in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for h in range(H):
    for w in range(W):
        dp[h+1][w+1] = min(
            dp[h][w+1] + (board[h][w]=='#' and (h==0 or board[h-1][w]=='.')),
            dp[h+1][w] + (board[h][w]=='#' and (w==0 or board[h][w-1]=='.'))
        )

print (dp[-1][-1])

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

dp = [[float("inf")] * (W+1) for _ in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for y in range(W):
    for x in range(H):
        dp[y+1][x+1] = min(
            dp[y][x+1] + (s[y][x] == '#' and (y == 0 or s[y-1][x] == '.')),
            dp[y+1][x] + (s[y][x] == '#' and (x == 0 or s[y][x-1] == '.'))
        )

print(dp[-1][-1])


Fixed submission:
H, W = map(int,input().split())
board = []
for h in range(H):
    board.append(input())

dp=[[1000 for i in range(W+1)] for j in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for h in range(H):
    for w in range(W):
        dp[h+1][w+1] = min(
            dp[h][w+1] + (board[h][w]=='#' and (h==0 or board[h-1][w]=='.')),
            dp[h+1][w] + (board[h][w]=='#' and (w==0 or board[h][w-1]=='.'))
        )

print (dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, a, b = map(int, input().split(' '))
    cmb = []
    cmb.append(n)

    ans = 0
    for i in range(1, n+1):
        if i == a or i == b:
            pass
        else:
            ans += cmb[i-1]
        cmb.append(cmb[-1]*(n-i)/(i+1))

    print(int(ans%(pow(10,9)+7)))

if __name__ == '__main__':
    main()

Fixed submission:
def mpow(x, n):
    result = 1
    while n != 0:
        if n & 1 == 1:
            result *= x
            result %= 1000000007
        x *= x
        x %= 1000000007
        n >>= 1

    return result

def mcomb(n, k):
    a = 1
    b = 1
    for i in range(k):
        a *= n - i
        a %= 1000000007
        b *= i + 1
        b %= 1000000007

    return a * mpow(b, 1000000005) % 1000000007

def main():
    n, a, b = map(int, input().split())
    
    ans = mpow(2, n) - mcomb(n, a) - mcomb(n, b) - 1

    print(ans%1000000007)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, a, b = map(int, input().split(' '))
    cmb = []
    cmb.append(n)

    ans = 0
    for i in range(1, n+1):
        if i == a or i == b:
            pass
        else:
            ans += cmb[i-1]
        cmb.append(cmb[-1]*(n-i)/(i+1))

    print(int(ans%(pow(10,9)+7)))

if __name__ == '__main__':
    main()

Fixed submission:
def mpow(x, n):
    result = 1
    while n != 0:
        if n & 1 == 1:
            result *= x
            result %= 1000000007
        x *= x
        x %= 1000000007
        n >>= 1

    return result

def mcomb(n, k):
    a = 1
    b = 1
    for i in range(k):
        a *= n - i
        a %= 1000000007
        b *= i + 1
        b %= 1000000007

    return a * mpow(b, 1000000005) % 1000000007

def main():
    n, a, b = map(int, input().split())
    
    ans = mpow(2, n) - mcomb(n, a) - mcomb(n, b) - 1

    print(ans%1000000007)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    is_break = False
    seen = []
    for a in A:
        if a not in seen:
            seen.append(a)
        else:
            is_break = True
            break
    
    if is_break:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()

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

    is_break = False
    seen = set()
    for a in A:
        if a not in seen:
            seen.add(a)
        else:
            is_break = True
            break
    
    if is_break:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    is_break = False
    seen = []
    for a in A:
        if a not in seen:
            seen.append(a)
        else:
            is_break = True
            break:
    
    if is_break:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()

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

    is_break = False
    seen = set()
    for a in A:
        if a not in seen:
            seen.add(a)
        else:
            is_break = True
            break
    
    if is_break:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())

A = [0] * n
B = [0] * n
for i in range(n):
    A[i], B[i] = map(int, input().split())

dp = [float("inf")] * (h+1)
dp[0] = 0

for i in range(h):
    for j in range(n):
        next_index = min(i + A[j], h)
        dp[next_index] = min(dp[next_index], dp[i] + B[j])

print(dp[-1])


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

A = [0] * n
B = [0] * n
for i in range(n):
    A[i], B[i] = map(int, input().split())

dp = [float("inf")] * (h+1)
dp[0] = 0

for i in range(h):
    for j in range(n):
        next_index = min(i + A[j], h)
        dp[next_index] = min(dp[next_index], dp[i] + B[j])

print(dp[-1])