Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def solve():
    from operator import itemgetter

    turns = tuple(map(int, input().split()))[1]
    cardsList = sorted(list(map(int, input().split())))

    turnsList = [tuple(map(int, input().split())) for _ in range(turns)]
    for chances, num in sorted(turnsList, key=itemgetter(1), reverse=True):
        for i in range(chances):
            if num > cardsList[i]:
                cardsList[i] = num
            elif i == 0:
                return print(sum(cardsList))
            else:
                break
        cardsList.sort()
    print(sum(cardsList))
solve()

Fixed submission:
def solve():
    takaYear, defaultFee = map(int, input().split())
    if takaYear <= 5:
        print(0)
    elif takaYear <= 12:
        print(defaultFee//2)
    else:
        print(defaultFee)
solve()
Buggy python submission (verdict: Runtime Error):
def solve():
    maxCards, gates = map(int, input().split())
    gateRanges = [tuple(map(int, input().split())) for i in range(gates)]

    for i, permitRange in enumerate(gateRanges):
        if i == 0:
            activeBegin, activeEnd = permitRange
            continue
        begin, end = permitRange
        if not (begin <= activeEnd and end >= activeBegin):
            print(0)
            break
        else:
            activeBegin, activeEnd = max(activeBegin, begin), min(activeEnd, end)
    else:
        if (maxCards < activeBegin):
            return print(0)
        ans = min(activeEnd, maxCards) - activeBegin + 1
    print(ans)
solve()

Fixed submission:
def solve():
    maxCards, gates = map(int, input().split())
    gateRanges = [tuple(map(int, input().split())) for i in range(gates)]

    for i, permitRange in enumerate(gateRanges):
        if i == 0:
            activeBegin, activeEnd = permitRange
            continue
        begin, end = permitRange
        if not (begin <= activeEnd and end >= activeBegin):
            return print(0)
        else:
            activeBegin, activeEnd = max(activeBegin, begin), min(activeEnd, end)
    else:
        if (maxCards < activeBegin):
            return print(0)
        ans = min(activeEnd, maxCards) - activeBegin + 1
    print(ans)
solve()

Buggy python submission (verdict: Runtime Error):
def solve():
    maxCards, gates = map(int, input().split())
    gateRanges = [tuple(map(int, input().split())) for i in range(gates)]

    for i, permitRange in enumerate(gateRanges):
        if i == 0:
            activeBegin, activeEnd = permitRange
            continue
        begin, end = permitRange
        if not (begin <= activeEnd and end >= activeBegin):
            print(0)
            break
        else:
            activeBegin, activeEnd = max(activeBegin, begin), min(activeEnd, end)
    else:
        if (maxCards < activeBegin):
            return print(0)
        print(activeBegin, activeEnd)
        ans = min(activeEnd, maxCards) - activeBegin + 1
    print(ans)
solve()

Fixed submission:
def solve():
    maxCards, gates = map(int, input().split())
    gateRanges = [tuple(map(int, input().split())) for i in range(gates)]

    for i, permitRange in enumerate(gateRanges):
        if i == 0:
            activeBegin, activeEnd = permitRange
            continue
        begin, end = permitRange
        if not (begin <= activeEnd and end >= activeBegin):
            return print(0)
        else:
            activeBegin, activeEnd = max(activeBegin, begin), min(activeEnd, end)
    else:
        if (maxCards < activeBegin):
            return print(0)
        ans = min(activeEnd, maxCards) - activeBegin + 1
    print(ans)
solve()
Buggy python submission (verdict: Runtime Error):
def solve():
	unknownDate = input()
	datePre = int(unknownDate[:2])
	datePos = int(unknownDate[2:])
	
	isPreMightMonth = (0 < datePre <= 12)
	isPostMightMonth = (0 < datePos <= 12)
	
	if isPreMightMonth and isPostMightMonth:
		print('AMBIGUOUS')
	elif isPreMightMonth and (not isPostMightMonth):
		print('MMYY')
	elif (not isPreMightMonth) and isPostMightMonth:
		print('YYMM')
	else:
		print('NA')
 solve()

Fixed submission:
def solve():
	unknownDate = input()
	datePre = int(unknownDate[:2])
	datePos = int(unknownDate[2:])
	
	isPreMightMonth = (0 < datePre <= 12)
	isPostMightMonth = (0 < datePos <= 12)
	
	if isPreMightMonth and isPostMightMonth:
		print('AMBIGUOUS')
	elif isPreMightMonth and (not isPostMightMonth):
		print('MMYY')
	elif (not isPreMightMonth) and isPostMightMonth:
		print('YYMM')
	else:
		print('NA')
solve()
Buggy python submission (verdict: Runtime Error):
def solve():
	diceSurfaces, winBorder = [int(x) for x in input().split()]
	diceProbability = (1 / diceSurfaces)
	ans = 0
	for score in range(1, diceSurfaces + 1):
		if score >= winBorder:
			ans += diceProbability
			continue 
		needNum  = math.ceil((winBorder) / score)
		needWins = math.ceil(math.log2(needNum))
		ans += diceProbability * ((1/2) ** needWins)
	print(ans)
solve()

Fixed submission:
import math

def solve():
	diceSurfaces, winBorder = [int(x) for x in input().split()]
	diceProbability = (1 / diceSurfaces)
	ans = 0
	for score in range(1, diceSurfaces + 1):
		if score >= winBorder:
			ans += diceProbability
			continue 
		needNum  = math.ceil((winBorder) / score)
		needWins = math.ceil(math.log2(needNum))
		ans += diceProbability * ((1/2) ** needWins)
	print(ans)
solve()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys


def main():
    _ = sys.stdin.readline()
    arr = []
    for line in sys.stdin:
        num = line.rstrip()
        if num in arr:
            arr.remove(num)
        else:
            arr.append(num)
    print(len(arr))


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

import sys


def main():
    _ = sys.stdin.readline()
    arr = set()
    for line in sys.stdin:
        num = line.rstrip()
        if num in arr:
            arr.remove(num)
        else:
            arr.add(num)
    print(len(arr))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(1,N):
  sum += i
print(sum)


Fixed submission:
N = int(input())
sum = 0
for i in range(1,N+1):
    sum = sum + i
print(sum)
Buggy python submission (verdict: Runtime Error):
import itertools

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

s = list(reversed(input()))
n = len(s)
mod = 10 ** 9 + 7
digits=[0]*n

for i in range(n):
    digits[i] = (10 ** i) % 13


cache = [[-1]*13 for _ in range(n+1)]

def solve(pos, now):
    if pos >= n:
        return 1 if now == 5 else 0
    res = cache[pos][now]
    if res >= 0:
        return res
    res = 0
    if s[pos] == '?':
        for i in range(10):
            m = (now + i * digits[pos]) % 13
            res += solve(pos + 1, m)
    else:
        d = ord(s[pos]) - ord('0')
        m = (now + d * digits[pos]) % 13
        res += solve(pos + 1, m)
    res %= mod
    cache[pos][now] = res

    return res

for i in range(n-1,0,-1):
    solve(0,0)

print(solve(0, 0))

Fixed submission:
import itertools

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

s = input()
n = len(s)
mod = 10 ** 9 + 7

dp = [[0]*13 for _ in range(n+1)]
dp[0][0]=1

for i in range(n):
    c = -1 if s[i] == '?' else ord(s[i]) - ord('0')
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki*10+j)%13] += dp[i][ki]
    for j in range(13):
        dp[i+1][j] %= mod

res = dp[n][5]

print(res)

Buggy python submission (verdict: Runtime Error):
import itertools

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

s = list(reversed(input()))
n = len(s)
mod = 10 ** 9 + 7
digits=[0]*n

for i in range(n):
    digits[i] = (10 ** i) % 13


cache = [[-1]*13 for _ in range(n+1)]

def solve(pos, now):
    if pos >= n:
        return 1 if now == 5 else 0
    res = cache[pos][now]
    if res >= 0:
        return res
    res = 0
    if s[pos] == '?':
        for i in range(10):
            m = (now + i * digits[pos]) % 13
            res += solve(pos + 1, m)
    else:
        d = ord(s[pos]) - ord('0')
        m = (now + d * digits[pos]) % 13
        res += solve(pos + 1, m)
    res %= mod
    cache[pos][now] = res

    return res

for i in range(n-1,0,-1):
    solve(0,0)

print(solve(0, 0))

Fixed submission:
import itertools

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

s = input()
n = len(s)
mod = 10 ** 9 + 7

dp = [[0]*13 for _ in range(n+1)]
dp[0][0]=1

for i in range(n):
    c = -1 if s[i] == '?' else ord(s[i]) - ord('0')
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki*10+j)%13] += dp[i][ki]
    for j in range(13):
        dp[i+1][j] %= mod

res = dp[n][5]

print(res)
Buggy python submission (verdict: Runtime Error):
input()
ps = map(int, input().split())

def count(ps):
    if len(ps) <= 2:
        return 0
    qs = sorted(ps[0:3])
    res = 1 if qs[1] == ps[1] else 0
    return res + count(ps[1:])

print(count(ps))


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

def count(ps):
    if len(ps) <= 2:
        return 0
    qs = sorted(ps[0:3])
    res = 1 if qs[1] == ps[1] else 0
    return res + count(ps[1:])

print(count(ps))
Buggy python submission (verdict: Runtime Error):

N, L = map(int, input())

t = map(lambda i: L + i, range(N))

targ = sum(t)
res = 0
for c in t:
    now = targ - c
    if m > abs(targ - now):
        m = abs(targ - now)
        res = now

print(res)

Fixed submission:

N, L = map(int, input().split())

t = list(map(lambda i: L + i, range(N)))

targ = sum(t)
m = 10000000000000
res = 0
for c in t:
    now = targ - c
    if m > abs(targ - now):
        m = abs(targ - now)
        res = now

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

import math

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

cd = c * d // math.gcd(c, d)

res_b = b - b // c - b // d + b // cd
a -= 1
res_a = a - a // c - a // d + a // cd


print(res_b - res_a)


Fixed submission:

def gcd(x, y):
    while x % y > 0:
        x, y = y, x % y
    return y

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

cd = c * d // gcd(c, d)

res_b = b - b // c - b // d + b // cd
a -= 1
res_a = a - a // c - a // d + a // cd

print(res_b - res_a)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
xs = [int(input()) for _ in range(m)]

broken = [False] * (n + 1)
for x in xs:
    broken[x] = True

cache = [-1] * (n + 1)

def solve(pos, n, broken, cache):
    if pos > n or broken[pos]:
        return 0
    if pos == n:
        return 1
    res = cache[pos]
    if res >= 0:
        return res
    res = solve(pos+1, n, broken, cache) + solve(pos+2, n, broken, cache)
    cache[pos] = res = res % 1000000007
    return res

print(solve(0,n,broken,cache))


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

broken = [False] * (n + 1)
for x in xs:
    broken[x] = True

cache = [-1] * (n + 1)

def solve(pos, n, broken, cache):
    if pos > n or broken[pos]:
        return 0
    if pos == n:
        return 1
    res = cache[pos]
    if res >= 0:
        return res
    res = solve(pos+1, n, broken, cache) + solve(pos+2, n, broken, cache)
    cache[pos] = res = res % 1000000007
    return res

for tmp in range(n,0,-1):
    solve(tmp,n,broken,cache)

print(solve(0,n,broken,cache))
Buggy python submission (verdict: Runtime Error):


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

n,k = getints()
vs = getints()

res = 0
for take in range(0, k + 1):
    sute = k - take
    for from_left in range(0, take+1):
        from_right = k - from_left
        value = []
        for i in range(0, from_left):
            value.append(vs[i])
        for i in range(-1, -from_right, -1):
            value.append(vs[i])
        value = list(sorted(value, reverse=True))
        for i in range(sute):
            if value and value[-1] < 0:
                value.pop()
        tmp = 0 if not value else sum(value)
        res = max(res, tmp)
print(res)


Fixed submission:


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

n,k = getints()
vs = getints()

res = 0
for take_operation in range(0, k + 1):
    sute_operation = k - take_operation
    if take_operation > n:
        continue
    for take_from_left in range(0, take_operation+1):
        take_from_right = take_operation - take_from_left
        item_values = []
        for i in range(0, take_from_left):
            item_values.append(vs[i])
        for i in range(0, take_from_right):
            item_values.append(vs[n - 1 - i])
        item_values = list(sorted(item_values, reverse=True))
        for i in range(sute_operation):
            if item_values and item_values[-1] < 0:
                item_values.pop()
        tmp = 0 if not item_values else sum(item_values)
        res = max(res, tmp)
print(res)

Buggy python submission (verdict: Runtime Error):


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

n,k = getints()
vs = getints()

res = 0
for take in range(0, k + 1):
    sute = k - take
    for from_left in range(0, take+1):
        from_right = k - from_left
        value = []
        for i in range(0, from_left):
            value.append(vs[i])
        for i in range(-1, -from_right, -1):
            value.append(vs[i])
        value = list(sorted(value, reverse=True))
        for i in range(sute):
            if value and value[-1] < 0:
                value.pop()
        tmp = 0 if not value else sum(value)
        res = max(res, tmp)
print(res)


Fixed submission:


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

n,k = getints()
vs = getints()

res = 0
for take_operation in range(0, k + 1):
    sute_operation = k - take_operation
    if take_operation > n:
        continue
    for take_from_left in range(0, take_operation+1):
        take_from_right = take_operation - take_from_left
        item_values = []
        for i in range(0, take_from_left):
            item_values.append(vs[i])
        for i in range(0, take_from_right):
            item_values.append(vs[n - 1 - i])
        item_values = list(sorted(item_values, reverse=True))
        for i in range(sute_operation):
            if item_values and item_values[-1] < 0:
                item_values.pop()
        tmp = 0 if not item_values else sum(item_values)
        res = max(res, tmp)
print(res)
Buggy python submission (verdict: Runtime Error):

n,k=map(int,input().split())
s=input()
s = s[:k-1]+str(s[k]).lower()+s[k+1:]
print(s)

Fixed submission:

n,k=map(int,input().split())
s=input()
k=k-1
s = s[:k]+str(s[k]).lower()+s[k+1:]
print(s)
Buggy python submission (verdict: Runtime Error):

import collections
import itertools

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

##* graph
##pre graph
m,lst,nxt,to=0,[],[],[]

def init_graph(node_count, edge_count):
    global lst,nxt,to
    lst = [-1 for _ in range(node_count)]
    nxt = [0  for _ in range(edge_count)]
    to  = [0  for _ in range(edge_count)]

# bidirection
def add_edge(u, v):
    global m
    nxt[m], lst[u], to[m], m = lst[u], m, v, m + 1
    nxt[m], lst[v], to[m], m = lst[v], m, u, m + 1

# bidirection weight
def add_edge(u, v, w):
    global m
    nxt[m], lst[u], to[m], m = lst[u], m, (v, w), m + 1
    nxt[m], lst[v], to[m], m = lst[v], m, (u, w), m + 1

def traverse(u):
    m = lst[u]
    while m != -1:
        yield m
        m = nxt[m]


n = getint()
init_graph(n, 2 * n)

for _ in range(n - 1):
    u, v, w = getints()
    add_edge(u - 1, v - 1, w)

def get_distance(u, dist, d):
    dist[u] = d
    for m in traverse(u):
        v, w = to[m]
        if dist[v] >= 0:
            continue
        get_distance(v, dist, d + w)

dist = [-1]*n
get_distance(0, dist, 0)


for i in range(n):
    print(dist[i] % 2)

Fixed submission:

import collections
import itertools

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

##* graph
##pre graph
m,lst,nxt,to=0,[],[],[]

def init_graph(node_count, edge_count):
    global lst,nxt,to
    lst = [-1 for _ in range(node_count)]
    nxt = [0  for _ in range(edge_count)]
    to  = [0  for _ in range(edge_count)]

# bidirection
def add_edge(u, v):
    global m
    nxt[m], lst[u], to[m], m = lst[u], m, v, m + 1
    nxt[m], lst[v], to[m], m = lst[v], m, u, m + 1

# bidirection weight
def add_edge(u, v, w):
    global m
    nxt[m], lst[u], to[m], m = lst[u], m, (v, w), m + 1
    nxt[m], lst[v], to[m], m = lst[v], m, (u, w), m + 1

def traverse(u):
    m = lst[u]
    while m != -1:
        yield m
        m = nxt[m]


n = getint()
init_graph(n, 2 * n)

for _ in range(n - 1):
    u, v, w = getints()
    add_edge(u - 1, v - 1, w)

def get_distance(u, dist):
    dist[u] = 0
    stk = [(u, 0)]
    while stk:
        v, d = stk[-1]
        stk.pop()
        for m in traverse(v):
            vv, w = to[m]
            if dist[vv] >= 0:
                continue
            dist[vv] = d + w
            stk.append((vv, d + w))


dist = [-1]*n
get_distance(0, dist)

# print(dist)


for i in range(n):
    print(dist[i] % 2)
Buggy python submission (verdict: Runtime Error):

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

res = 0
for k in range(1,10000):
    now = k * a
    if now < t:
        res += b

print(res)        



Fixed submission:

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

res = 0
t = t + 1
for k in range(1,10000):
    now = k * a
    if now < t:
        res += b

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

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

n=getint()
a=getints()
inf = 1 << 60

cache=[[-inf] * 2 for _ in range(n)]

def solve(pos, minus):
    if pos == n - 1:
        return -a[pos] if minus else a[pos]
    res = cache[pos][minus]
    if res > -inf:
        return res
    now = a[pos] if minus == 0 else -a[pos]
    res1 =  now + solve(pos + 1, 0)
    res2 = -now + solve(pos + 1, 1)
    res  = max(res1, res2)
    cache[pos][minus] = res
    return res

res = solve(0, 0)
print(res)

Fixed submission:
import itertools

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

n=getint()
a=getints()
inf = 1 << 60

cache=[[-inf] * 2 for _ in range(n)]

def solve(pos, minus):
    if pos == n - 1:
        return -a[pos] if minus else a[pos]
    res = cache[pos][minus]
    if res > -inf:
        return res
    now = a[pos] if minus == 0 else -a[pos]
    res1 =  now + solve(pos + 1, 0)
    res2 = -now + solve(pos + 1, 1)
    res  = max(res1, res2)
    cache[pos][minus] = res
    return res

for i in range(n-1,-1,-1):
    solve(i, 0)
    solve(i, 1)

res = solve(0, 0)
print(res)
Buggy python submission (verdict: Runtime Error):

but=list(map(int,input()))
but = sorted(but)
res = but[-1]
but = sorted(but)
res += but[-1]
print(res)


Fixed submission:

but=list(map(int,input().split()))
but = sorted(but)
res = but[-1]
but[-1] -= 1
but = sorted(but)
res += but[-1]
print(res)

Buggy python submission (verdict: Runtime Error):

but=map(int,input())
but = sorted(but)
res = but[-1]
but = sorted(but)
res = but[-1]
print(res)


Fixed submission:

but=list(map(int,input().split()))
but = sorted(but)
res = but[-1]
but[-1] -= 1
but = sorted(but)
res += but[-1]
print(res)
Buggy python submission (verdict: Runtime Error):

xs = [int(input()) for _ in range(5)]
k = int(input())

ok = True
for x in xs:
    for y in ys:
        if abs(x-y) > k:
            ok = False

print("Yay!" if ok else ":(")

Fixed submission:

xs = [int(input()) for _ in range(5)]
k = int(input())

ok = True
for x in xs:
    for y in xs:
        if abs(x-y) > k:
            ok = False

print("Yay!" if ok else ":(")
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input())

cnt = 0
for i in range(1, max(a,b)+1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        print(i)
        break


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

cnt = 0
for i in range(max(a,b)+1, 0, -1):
    if (a % i == 0) and (b % i == 0):
        cnt += 1
    if cnt == k:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):

y,m,d=map(int, input().split())


heisei = False
heisei = heisei or y < 2019
heisei = heisei or y == 2019 and m < 4
heisei = heisei or y == 2019 and m == 4 and d <= 30

print("Heisei" if heisei else "TBD")


Fixed submission:

y,m,d=map(int, input().split('/'))


heisei = False
heisei = heisei or y < 2019
heisei = heisei or y == 2019 and m < 4
heisei = heisei or y == 2019 and m == 4 and d <= 30

print("Heisei" if heisei else "TBD")

Buggy python submission (verdict: Runtime Error):

y,m,d=input().split()

heisei = False:
heisei = heisei or y < 2019:
heisei = heisei or y == 2019 and m < 4
heisei = heisei or y == 2019 and m == 4 and d <= 30:

print("Heisei" if heisei else "TBD")


Fixed submission:

y,m,d=map(int, input().split('/'))


heisei = False
heisei = heisei or y < 2019
heisei = heisei or y == 2019 and m < 4
heisei = heisei or y == 2019 and m == 4 and d <= 30

print("Heisei" if heisei else "TBD")
Buggy python submission (verdict: Runtime Error):

n=int(input())
s=[input().split() for _ in range(n)]
res = 0.0
for v, c in s:
    v = v if c == 'JPY' else v * 380000.0
    res += v
print(res)

Fixed submission:

n=int(input())
s=[input().split() for _ in range(n)]
res = 0.0
for v, c in s:
    v = float(v)
    v = v if c == 'JPY' else v * 380000.0
    res += v
print(res)
Buggy python submission (verdict: Runtime Error):

n=int(input())
temp,a=map(int,input().split())
hs=map(int,input().split())

t=list(map(lambda h: temp-h*0.006, hs))
t=list(enumerate(t,1))

def solve(best,a,t):
    if not t:
        return best[0]
    if abs(best[1] - a) < abs(t[0][1] - a):
        return solve(best, a, t[1:])
    else:
        return solve(t[0],a,t[1:])

print(solve(t[0],a,t[1:]))


Fixed submission:

n=int(input())
temp,a=map(int,input().split())
hs=map(int,input().split())

t=list(map(lambda h: temp-h*0.006, hs))
t=list(enumerate(t,1))

def solve(best,a,t):
    if not t:
        return best[0]
    if abs(best[1] - a) < abs(t[0][1] - a):
        return solve(best, a, t[1:])
    else:
        return solve(t[0],a,t[1:])

min_diff = 100000000
res = 0
for i in range(len(t)):
    if min_diff > abs(t[i][1] - a):
        min_diff = abs(t[i][1] - a)
        res = i + 1


print(res)

Buggy python submission (verdict: Runtime Error):

n=int(input())
t,a=map(int,input().split())
hs=map(int,input().split())

t=list(map(lambda h: t-h*0.006, hs))
t=list(enumerate(t,1))

def solve(best,a,t):
    if not t:
        return best[0]
    if abs(best[1] - a) < abs(t[0][1] - a):
        return solve(best, a, t[1:])
    else:
        return solve(t[0],a,t[1:])

print(solve(t[0],a,t[1:]))


Fixed submission:

n=int(input())
temp,a=map(int,input().split())
hs=map(int,input().split())

t=list(map(lambda h: temp-h*0.006, hs))
t=list(enumerate(t,1))

def solve(best,a,t):
    if not t:
        return best[0]
    if abs(best[1] - a) < abs(t[0][1] - a):
        return solve(best, a, t[1:])
    else:
        return solve(t[0],a,t[1:])

min_diff = 100000000
res = 0
for i in range(len(t)):
    if min_diff > abs(t[i][1] - a):
        min_diff = abs(t[i][1] - a)
        res = i + 1


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

n=int(input())
for x in range(n, 1000):
    if set(list(x)) == 1:
        print(x)
        break
        

Fixed submission:

n=int(input())
for x in range(n, 1000):
    if len(set(list(str(x)))) == 1:
        print(x)
        break
Buggy python submission (verdict: Runtime Error):

x =map(int,input())
x = sorted(x, reverse=True)

print(x[0] * 10 + x[1] + x[2])


Fixed submission:

x =map(int,input().split())
x = sorted(x, reverse=True)

print(x[0] * 10 + x[1] + x[2])