Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

s = input()
for i in range(len(s)):
	for j in range(i+1, len(s)):
		c = Counter(s[i:j+1])
		if len(s[i:j+1]) < c.most_common()[0][1]*2:
			print(i+1, j+1)
			break
	else:
		continue
	break
else:
	print(-1, -1)




Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

s = input()

dic = defaultdict(list)

for i, x in enumerate(s, 1):
	dic[x].append(i)

for lis in dic.values():
	for i in range(len(lis)-1):
		if lis[i+1] <= lis[i]+2:
			print(lis[i], lis[i+1])
			break
	else:
		continue
	break
else:
	print(-1, -1)
Buggy python submission (verdict: Runtime Error):
 

Copy
Copy
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A = LIST()
if A.sort() == [5, 5, 7]:
	print("YES")
else:
	print("NO")

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A = LIST()
 
if all(x in A for x in [5,7]) and sum(A) == 17:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

"""
lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

"""

N, K = MAP()
D = LIST()

while 1:
	if set(list(str(N))) & set(D) == set():
		print(N)
		break
	N += 1

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

"""
lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

"""

N, K = MAP()
D = LIST()

while 1:
	if set(list(str(N))) & set(D) == set():
		print(N)
		break
	N += 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = list(map(int, input().split()))

mod = (10**9) +7

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        t = (lis[i]*lis[j])
        ans += t

print(ans%mod)

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

mod = 10**9+7

s = sum(lis)
tmp = 0
for i in lis:
    tmp += i**2

print(((s*s - tmp)//2) % mod)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find(x)
    return -root[x]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))

print(ans)

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

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

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find(x)
    return -root[x]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))

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

t = sum(lis[:k])

 
for i in range(k, n):
    a = sum(lis[i-k+1:i+1])
    
    if a > t:
        print('Yes')
    else:
        print('No')
    
    t = a
    a = 0

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

 
for i in range(k, n):
    l = lis[i-k]
    r = lis[i]
    if r > l:
        print('Yes')
    else:
        print('No')

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

t = 1
for i in range(k):
    t *= lis[i]

for i in range(k, n):
    a = 1
    for j in range(i-k+1, i+1):
        a *= lis[j]
    
    if a > t:
        print('Yes')
    else:
        print('No')
    
    t = a
    a = 1

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

 
for i in range(k, n):
    l = lis[i-k]
    r = lis[i]
    if r > l:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())

lis = [0] * (10000+1)

s  = n**0.5

for i in range(1, s):
    for j in range(1, s):
        for k in range(1, s):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= 10001:
                if len(set(tmp)) == 1:
                    lis[t-1] = 1
                elif len(set(tmp)) == 2:
                    lis[t-1] = 3
                else:
                    lis[t-1] = 6

for i in range(n):
    print(lis[i])

Fixed submission:
n = int(input())

lis = [0] * (n+1)


for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= n:
                lis[t] += 1

for i in range(1,n+1):
    print(lis[i])
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

if k >= sum(a) + sum(b):
    print(n+m)
    exit()

if n > m:
    b += [1001001001]*(n-m)
else:
    a += [1001001001]*(m-n)

nlis = []
for i in range(n+m):
    if a[0] < b[0]:
        nlis.append(a[0])
        a.remove(a[0])
    else:
        nlis.append(b[0])
        b.remove(b[0])
t = 0
while k >= 0:
    k -= nlis[t]
    t += 1

print(t-1)

Fixed submission:
n, m, k = map(int,input().split())
a = [0] + list(map(int,input().split()))
b = [0] + list(map(int,input().split()))

for i in range(1, n+1):
    a[i] += a[i-1]
    
for j in range(1, m+1):
    b[j] += b[j-1]
    
ans = 0
bc = m

for ac in range(n+1):
    if a[ac] > k:
        continue
    
    while a[ac] + b[bc] > k:
        bc -= 1
        
    ans  = max(ans, ac+bc)

print(ans)

Buggy python submission (verdict: Runtime Error):
n, m, k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

cnt = 0
while k > 0:
    if a == []:
        a = [1001001001]
    if b == []:
        a = [1001001001]
    if a[0] < b[0]:
        if k - a[0] < 0:
            print(cnt)
            exit()
        k -= a[0]
        cnt += 1
        a.remove(a[0])
    else:
        if k - b[0] < 0:
            print(cnt)
            exit()
        k -= b[0]
        cnt += 1
        b.remove(b[0])

print(cnt)

Fixed submission:
n, m, k = map(int,input().split())
a = [0] + list(map(int,input().split()))
b = [0] + list(map(int,input().split()))

for i in range(1, n+1):
    a[i] += a[i-1]
    
for j in range(1, m+1):
    b[j] += b[j-1]
    
ans = 0
bc = m

for ac in range(n+1):
    if a[ac] > k:
        continue
    
    while a[ac] + b[bc] > k:
        bc -= 1
        
    ans  = max(ans, ac+bc)

print(ans)
Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())
lis = list(map(int,input().split()))
q = int(input())
total = sum(lis)

nlis = [0] * 10001

for i in lis:
    nlis[i-1] += 1

for i in range(q):
    b, c = map(int,input().split())
    total = total -(b*nlis[b-1]) + (c*nlis[b-1])
    nlis[c-1] += nlis[b-1]
    nlis[b-1] = 0
    print(total)
    
    


Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
q = int(input())
total = sum(lis)

nlis = [0] * 100002

for i in lis:
    nlis[i-1] += 1

for i in range(q):
    b, c = map(int,input().split())
    total = total -(b*nlis[b-1]) + (c*nlis[b-1])
    nlis[c-1] += nlis[b-1]
    nlis[b-1] = 0
    print(total)
Buggy python submission (verdict: Runtime Error):
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

kyo = abs(b - a)
ti = v - w

if w >= v:
    print("NO")
    exit()


if round(kyo / ti) <= t:
    print("YES")
else:
    print("NO")


Fixed submission:
s = input()

print(s[:3])
Buggy python submission (verdict: Runtime Error):
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

kyo = abs(b - a)
ti = abs(v -w)

if kyo == 0:
    print("YES")
    exit()

if w > v or kyo % ti != 0:
    print("NO")
    exit()


if kyo / ti <= t:
    print("YES")
    exit()

print("NO")

Fixed submission:
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

kyo = abs(b - a)
ti = v - w

if w >= v:
    print("NO")
    exit()


if kyo / ti <= t:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
 
n = int(input())
lis = list(map(int, input().split()))
 
ans = reduce(mul, lis)
 
if ans > 10**18:
    print("-1")
else:
    print(ans)

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

print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
 
n = int(input())
lis = list(map(int, input().split()))
 
ans = reduce(mul, lis)
 
if ans > 10**18:
    print("-1")
else:
    print(ans)

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

if 0 in lis:
    print(0)
    exit()

ans = 1
for i in lis:
    ans *= i
    if ans >= 10**18:
        break

if ans > 10**18:
    print("-1")
else:
    print(ans)

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

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

ans = reduce(mul, lis)

if ans > 10**18:
    print("-1")
else:
    print(ans)

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

if 0 in lis:
    print(0)
    exit()

ans = 1
for i in lis:
    ans *= i
    if ans >= 10**18:
        break

if ans > 10**18:
    print("-1")
else:
    print(ans)

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

ans = 1
for i in lis:
    ans *= i
    
if ans > 10**18:
    print("-1")
else:
    print(ans)


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

if 0 in lis:
    print(0)
    exit()

ans = 1
for i in lis:
    ans *= i
    if ans >= 10**18:
        break

if ans > 10**18:
    print("-1")
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

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

k = int(input())

cnt = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
            cnt += gcd(i,j,m)
            

print(cnt)

Fixed submission:
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
k = int(input())
 
cnt = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
            cnt += gcd(i,j,m)
            
 
print(cnt)
Buggy python submission (verdict: Runtime Error):
スコード 

Copy
Copy
N, R = map(int, input().split())
 
if N > 10:
  print(R)
else:
  ans = R - (100*(10-R))
  print(ans)

Fixed submission:
N, R = map(int, input().split())
 
if N > 10:
  print(R)
else:
  ans = R + (100*(10-N))
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
numlist = list(map(int, input().split()))

maxlist = sum(numlist[0:K])
max_num = 0
for i in range(N-K+1):
  a = sum(numlist[i:i+K])
  if a >= maxlist:
    maxlist = a
    max_num = i

definelist = numlist[max_num:max_num+K]
expected = 0
for j in definelist:
  dice = list(range(1, j+1))
  p = 1/len(dice)
  expected += sum(p*x for x in dice)

print(expected)

Fixed submission:
import itertools

n, k = map(int, input().split())
lis = list(map(int,input().split()))

exlis = []


for i in lis:
    a = (1+i)/2
    exlis.append(a)


nlis = list(itertools.accumulate(exlis))


ans  = nlis[k-1]
for j in range(n-k):
    tmp = nlis[j+k] - nlis[j]
    ans = max(ans, tmp)

print(ans)

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

maxlist = sum(numlist[0:K])
max_num = 0
for i in range(N-K+1):
  a = sum(numlist[i:i+K])
  if a >= maxlist:
    maxlist = a
    max_num = i

definelist = numlist[max_num:max_num+K]
expected = 0
for j in definelist:
  dice = list(range(1, j+1))
  ex = 0
  p = 1/len(dice)

  for x in dice:
    px = p*x
    ex += px
  expected += ex

print(expected)

Fixed submission:
import itertools

n, k = map(int, input().split())
lis = list(map(int,input().split()))

exlis = []


for i in lis:
    a = (1+i)/2
    exlis.append(a)


nlis = list(itertools.accumulate(exlis))


ans  = nlis[k-1]
for j in range(n-k):
    tmp = nlis[j+k] - nlis[j]
    ans = max(ans, tmp)

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

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

counter = 0

while H > 0:
  for i in sa:
    H = H - sa
    counter += 1

if counter >= len(sa):
  print("YES")
else:
  print("NO")

Fixed submission:
H, A = map(int, input().split())

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

for i in sa:
  H = H - i

if H <= 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n  =int(input())
lis = list(map(int, input().split()))

total = 0
for i in range(n):
    tmp = lis[i]
    flag = 1
    for j in range(i):
        if tmp > lis[j]:
            flag = 0
            break
    if flag:
        total += 1
        
print(total)

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

total = 0
mini = lis[0]
for i in range(n):
    mini = min(mini, lis[i])
    if mini == lis[i]:
        total += 1
    
print(total)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

def lcm(x, y):
    return (x*y)//gcd(x,y)
    
tmp = lcm(a, b)
print(tmp)

Fixed submission:
x = int(input())

ans = 0

for i in range(x, 100004):
    tmpf = 1
    for j in range(2, int(i**0.5)):
        if i % j == 0:
            tmpf = 0
            break
    if tmpf == 1:
        ans = i
        break
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x*y)//math.gcd(x,y)
    
tmp = lcm(a, b)
print(tmp)

Fixed submission:
from fractions import gcd

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

def lcm(x, y):
    return (x*y)//gcd(x,y)
    
tmp = lcm(a, b)
print(tmp)

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

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

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

Fixed submission:
from fractions import gcd

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

def lcm(x, y):
    return (x*y)//gcd(x,y)
    
tmp = lcm(a, b)
print(tmp)
Buggy python submission (verdict: Runtime Error):
x = int(input())

lis = [100, 101, 102, 103, 104, 105]

if x < 100:
    print(0)
else:
    c = x//100
    for i in range(1<<c):
        tmp = 0
        for j in range(c):
            if ((i >> j) & 1):
                tmp += lis[j]
        if tmp == x:
            print(1)
            exit()
print(0)

Fixed submission:
x = int(input())

flag = 0
if x >= 2000:
    print(1)
    exit()
else:
    for i in range(20):
        for j in range(20):
            for k in range(20):
                for l in range(20):
                    for m in range(20):
                        for n in range(20):
                            if i*100+j*101+k*102+l*103+m*104+n*105 == x:
                                flag = 1
                                print(1)
                                exit()
if flag != 1:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n, k ,q  =map(int, input().split())

lis = []
for _ in range(q):
    lis.append(int(input()))
    
ori = k - q
for i in range(n):
    if ori + lis.count(i+1) > 0:
        print("Yes")
    else:
        print("No")



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

lis = [k-q] * n
for _ in range(q):
    tmp = int(input())
    lis[tmp - 1] += 1

for i in lis:
    if i > 0:
        print("Yes")
    else:
        print("No")

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

lis = []
for _ in range(q):
    lis.append(int(input()))
    
ori = k - q
for i in range(n):
    if ori + lis.count(i+1) > 0:
        print("Yes")
    else:
        print("No")



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

lis = [k-q] * n
for _ in range(q):
    tmp = int(input())
    lis[tmp - 1] += 1

for i in lis:
    if i > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

lis = [i for i in range(1, n+1)]
print(sum(lis[:-1]))

Fixed submission:
n = int(input())

print((n*(n-1)//2))
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())

lis = []
for _ in range(n):
    lis.append(int(input()))
    
m = max(lis)

for i in range(n):
    if lis[i] == m:
        tlis = copy.deepcopy(lis)
        tlis.remove(lis[i])
        print(max(tlis))
    else:
        print(m)

Fixed submission:
import copy

n = int(input())

lis = []
for _ in range(n):
    lis.append(int(input()))
    
slis = sorted(copy.deepcopy(lis), reverse=True)
    
m = max(lis)
s = sorted(slis, reverse=True)
s.remove(m)
sm = max(s)


for i in range(n):
    if lis[i] != m:
        print(m)
    else:
        print(sm)

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

n = int(input())

lis = []
for _ in range(n):
    lis.append(int(input()))
    
for i in range(n):
    tlis = copy.deepcopy(lis)
    tlis.remove(tlis[i])
    print(max(tlis))

Fixed submission:
import copy

n = int(input())

lis = []
for _ in range(n):
    lis.append(int(input()))
    
slis = sorted(copy.deepcopy(lis), reverse=True)
    
m = max(lis)
s = sorted(slis, reverse=True)
s.remove(m)
sm = max(s)


for i in range(n):
    if lis[i] != m:
        print(m)
    else:
        print(sm)

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

n = int(input())

lis = []
for _ in range(n):
    lis.append(int(input()))
    
for i in range(n):
    tlis = copy.deepcopy(lis)
    tlis.remove(tlis[i])
    print(max(tlis))

Fixed submission:
import copy

n = int(input())

lis = []
for _ in range(n):
    lis.append(int(input()))
    
slis = sorted(copy.deepcopy(lis), reverse=True)
    
m = max(lis)
s = sorted(slis, reverse=True)
s.remove(m)
sm = max(s)


for i in range(n):
    if lis[i] != m:
        print(m)
    else:
        print(sm)