Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

mx = []

for i in range(N-K+1):
    mx.append(sum(p[i:i+K]))

print((max(mx)+K)/2)

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

S = [0]
E = []

for i in range(0, N):
    S.append(S[i]+p[i])

for i in range(0, N-K+1):
    E.append(S[i+K]-S[i])


print((max(E)+K)/2)

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

E = []
mx = 0

for i in range(N-K+1):
    a = (sum(p[i:i+K])+K)/2
    if a>mx:
        mx=a

print(mx)

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

S = [0]
E = []

for i in range(0, N):
    S.append(S[i]+p[i])

for i in range(0, N-K+1):
    E.append(S[i+K]-S[i])


print((max(E)+K)/2)

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

E = []

for i in range(N-K+1):
    E.append((sum(p[i:i+K])+K)/2)

print(max(E))

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

S = [0]
E = []

for i in range(0, N):
    S.append(S[i]+p[i])

for i in range(0, N-K+1):
    E.append(S[i+K]-S[i])


print((max(E)+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
s = 0

L = sorted(L)

for i in range(0, N-2):
	for j in range(i+1, N-1):
		for k in range(j+1, N):
			if L[k]<L[i]+L[j]:
				s += 1
			else:
				break
			
print(s)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split()))
s = 0

L = sorted(L)

for c in reversed(range(2, N)):
	for b in reversed(range(1, c)):
		a = bisect.bisect_right(L, L[c]-L[b])
		if a<b:
			s += b-a
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
s = 0

nL = sorted(L)

for i in range(0, N-2):
	for j in range(i+1, N-1):
		s += sum(x<nL[i]+nL[j] for x in nL[j+1:])
		
print(s)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split()))
s = 0

L = sorted(L)

for c in reversed(range(2, N)):
	for b in reversed(range(1, c)):
		a = bisect.bisect_right(L, L[c]-L[b])
		if a<b:
			s += b-a
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
s = 0
for i in range(0, N-2):
	for j in range(i+1, N-1):
		for k in range(j+1, N):
			if L[i]<L[j]+L[k]:
				if L[j]<L[k]+L[i]:
					if L[k]<L[i]+L[j]:
						s += 1
print(s)

Fixed submission:
import bisect

N = int(input())
L = list(map(int, input().split()))
s = 0

L = sorted(L)

for c in reversed(range(2, N)):
	for b in reversed(range(1, c)):
		a = bisect.bisect_right(L, L[c]-L[b])
		if a<b:
			s += b-a
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

for i in range(M):
    A[A.index(max(A))] //= 2

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))

heapq.heapify(A)

for _ in range(M):
    mn = heapq.heappop(A)
    heapq.heappush(A, -mn//2*(-1))

print(-sum(A))

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

for i in range(M):
    A[A.index(max(A))] //= 2

print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))

heapq.heapify(A)

for _ in range(M):
    mn = heapq.heappop(A)
    heapq.heappush(A, -mn//2*(-1))

print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

n = len(s)

res = [0]*n

for i in range(n):
	c = 0
	r = 0
	m = 0
	while True:
		if s[i+m] == 'R':
			r = 1
			m += 1
		else:
			if r:
				res[i+m-c%2] += 1
				break
			r = 0
			m += -1
		c += 1

print(' '.join(map(str, res)))

Fixed submission:
s = input()

n = len(s)

res = [0]*n

swi = 'R'

r = [-1]*n
l = [-1]*n

for i in range(n):
	if s[i] == 'L':
		if l[i-1] == -1:
			l[i] = 0
		else:
			l[i] = l[i-1]+1

for i in reversed(range(n)):
	if s[i] == 'R':
		if r[i+1] == -1:
			r[i] = 0
		else:
			r[i] = r[i+1]+1
			
for i in range(n):
	if s[i] == 'L':
		res[i-l[i]-l[i]%2] += 1
	else:
		res[i+r[i]+r[i]%2] += 1

print(' '.join(map(str, res)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(n):
    b = a.pop()
    ans *= b

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


Fixed submission:
N = int(input())
ans = 1
A = [int(i) for i in input().split()]
ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
if 0 in A:
    ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
ans = 1
A = [int(i) for i in input().split()]
ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
if 0 in A:
    ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
l = []
for i in range(n):
    if s[i] not in l:
        l.append(s[i])
print(len(l))

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
ss = set(s)
print(len(ss))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
l = []
for i in range(n):
    if s[i] not in l:
        l.append(s[i])
print(len(l))

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
ss = set(s)
print(len(ss))
Buggy python submission (verdict: Runtime Error):
nm = list(map(int,input().split()))
n,m = nm[0],nm[1]
a = list(map(int,input().split()))
sam = sum(a)
ans = n - sam
if ans >= 0:
    print(ans)
else:
    print(-1)

Fixed submission:
import math
r = int(input())
ans = 2 * r * math.pi
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd([i,j,k])

print(ans)

Fixed submission:
n = input()
if n[0] == "7" or n[1] == "7" or n[2] == "7":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += gcd([i,j,k])

print(ans)

Fixed submission:
import math
from functools import reduce

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

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += gcd([i,j,k])

print(ans)

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

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd([i,j,k])

print(ans)

Fixed submission:
import math
from functools import reduce

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

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += gcd([i,j,k])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
import math

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

l = [0] * max(a)
for i in range(n):
    l[a[i] - 1] += 1 


for i in range(n):
    l1 = l[:]
    ans = 0
    l1[a[i] - 1] -= 1
    for j in range(len(l)):
        ans += l1[j] * (l1[j] - 1) / 2
    print(math.floor(ans))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0 for _ in range(max(a) + 1)]
for x in a:
    b[x] += 1
c = sum([x * (x-1) // 2 for x in b])
for i in range(n):
    print(c -(b[a[i]]-1))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
import math

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

l = [0] * max(a)
for i in range(n):
    l[a[i] - 1] += 1 


for i in range(n):
    l1 = l[:]
    ans = 0
    l1[a[i] - 1] -= 1
    for j in range(len(l)):
        ans += l1[j] * (l1[j] - 1) / 2
    print(math.floor(ans))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0 for _ in range(max(a) + 1)]
for x in a:
    b[x] += 1
c = sum([x * (x-1) // 2 for x in b])
for i in range(n):
    print(c -(b[a[i]]-1))
Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

X = int(input())
done = False
while not done:
    a = make_divisors(X)
    if len(a) == 2:
        done = True
        c = X
    else:
        X += 1
       

print(c)


Fixed submission:
a = input().split()
S = a[0]
T = a[1]

print(T,end="")
print(S)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
A1 = A - K
if A1 < 0:
    B1 = A1 + B
    A1 = 0
    if B1 < 0:
        B1 = 0

print(A1,end=" ")
print(B1)

Fixed submission:
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
A1 = A - K
B1 = B
if A1 < 0:
    B1 = A1 + B
    A1 = 0
    if B1 < 0:
        B1 = 0

print(A1,end=" ")
print(B1)

Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
for i in range(K):
    if A >= 1:
        A -= 1
    elif B >= 1:
        B -= 1
    else:
        pass
print(A,end=" ")
print(B)


Fixed submission:
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
A1 = A - K
B1 = B
if A1 < 0:
    B1 = A1 + B
    A1 = 0
    if B1 < 0:
        B1 = 0

print(A1,end=" ")
print(B1)

Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
for i in range(K):
    if A >= 1:
        A -= 1
    elif B >= 1:
        B -= 1
    else:
        pass
print(A,end=" ")
print(B)


Fixed submission:
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
A1 = A - K
B1 = B
if A1 < 0:
    B1 = A1 + B
    A1 = 0
    if B1 < 0:
        B1 = 0

print(A1,end=" ")
print(B1)
Buggy python submission (verdict: Runtime Error):
choice = [1,2,3]
internal = list(map(int,input().split()))
choice.remove(internal[0])
choice.remove(internal[1])
print(choice[0])




Fixed submission:
internal = [int(input()) for i in range(2)]

a = internal[0] + internal[1]
b = 6
c = b - a
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
nk = list(map(int,input().split()))
n,k= nk[0],nk[1]
h = list(map(int,input().split()))
dp = [0] * (n)
if n >= k:
    for i in range(k):#初期条件の定義
        dp[i] = abs(h[i] - h[0])
    for l in range(n-k):#漸化式の定義
        lis = []
        for m in range(k):
            lis.append(dp[l+m] + abs(h[l+k]-h[l+m]))
        dp[l+k] = min(lis)
    print(dp[n-1])
else:#n < k
    print(abs(h[n-1]-h[0]))

Fixed submission:
nk = list(map(int,input().split()))
n,k= nk[0],nk[1]
h = list(map(int,input().split()))
dp = [0] * (n)
if n >= k:
    for i in range(k):#初期条件の定義
        dp[i] = abs(h[i] - h[0])
    for l in range(n-k):#漸化式の定義
        lis = []
        for m in range(k):
            lis.append(dp[l+m] + abs(h[l+k]-h[l+m]))
        dp[l+k] = min(lis)
    print(dp[n-1])
else:#n < k
    print(abs(h[n-1]-h[0]))

Buggy python submission (verdict: Runtime Error):
nk = list(map(int,input().split()))
n,k= nk[0],nk[1]
h = list(map(int,input().split()))
dp = [0] * (n)
for i in range(k):#初期条件の定義
    dp[i] = abs(h[i] - h[0])
for l in range(n-k):#漸化式の定義
    lis = []
    for m in range(k):
        lis.append(dp[l+m] + abs(h[l+k]-h[l+m]))
    dp[l+k] = min(lis)
print(dp[n-1])


Fixed submission:
nk = list(map(int,input().split()))
n,k= nk[0],nk[1]
h = list(map(int,input().split()))
dp = [0] * (n)
if n >= k:
    for i in range(k):#初期条件の定義
        dp[i] = abs(h[i] - h[0])
    for l in range(n-k):#漸化式の定義
        lis = []
        for m in range(k):
            lis.append(dp[l+m] + abs(h[l+k]-h[l+m]))
        dp[l+k] = min(lis)
    print(dp[n-1])
else:#n < k
    print(abs(h[n-1]-h[0]))
Buggy python submission (verdict: Runtime Error):
"""everything has a cost!"""

from math import *
import random, functools, collections, sys

__author__ = 'p7x'


# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
# sys.stderr = open('err.txt', 'w')


if __name__ == '__main__':
    n = int(input())
    print(a + a**2 + a**3)


Fixed submission:
"""everything has a cost!"""

from math import *
import random, functools, collections, sys

__author__ = 'p7x'


# sys.stdin = open('in.txt', 'r')
# sys.stdout = open('out.txt', 'w')
# sys.stderr = open('err.txt', 'w')


if __name__ == '__main__':
    n = int(input())
    print(n + n**2 + n**3)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> count_e(n, 0);
    vector<int> count_e_sum(n + 1, 0);
    vector<int> count_w(n, 0);
    vector<int> count_w_sum(n + 1, 0);

    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
        {
            count_e[i]++;
        }
        else if (s[i] == 'W')
        {
            count_w[i]++;
        }
        count_e_sum[i + 1] = count_e_sum[i] + count_e[i];
        count_w_sum[i + 1] = count_w_sum[i] + count_w[i];
    }

    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        ans[i] = count_w_sum[i] + count_e_sum[n] - count_e_sum[i + 1];
    }

    int answer = *min_element(begin(ans), end(ans));

    cout << answer;
}

Fixed submission:
N = int(input())
S = input()
int_s = [0] * N
cum_sum_w = [0] * (N + 1)
cum_sum_e = [0] * (N + 1)
answers = [0] * N
for i in range(N):
    if (S[i] == 'W'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_w[i + 1] = cum_sum_w[i] + int_s[i]
for i in range(N):
    if (S[i] == 'E'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_e[i + 1] = cum_sum_e[i] + int_s[i]
for i in range(N):
    answers[i] = cum_sum_w[i] + (cum_sum_e[N] - cum_sum_e[i + 1])
print(min(answers))

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> count_e(n, 0);
    vector<int> count_e_sum(n + 1, 0);
    vector<int> count_w(n, 0);
    vector<int> count_w_sum(n + 1, 0);

    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
        {
            count_e[i]++;
        }
        else if (s[i] == 'W')
        {
            count_w[i]++;
        }
        count_e_sum[i + 1] = count_e_sum[i] + count_e[i];
        count_w_sum[i + 1] = count_w_sum[i] + count_w[i];
    }

    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        ans[i] = count_w_sum[i] + count_e_sum[n] - count_e_sum[i + 1];
    }

    int answer = *min_element(begin(ans), end(ans));

    cout << answer;
}

Fixed submission:
N = int(input())
S = input()
int_s = [0] * N
cum_sum_w = [0] * (N + 1)
cum_sum_e = [0] * (N + 1)
answers = [0] * N
for i in range(N):
    if (S[i] == 'W'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_w[i + 1] = cum_sum_w[i] + int_s[i]
for i in range(N):
    if (S[i] == 'E'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_e[i + 1] = cum_sum_e[i] + int_s[i]
for i in range(N):
    answers[i] = cum_sum_w[i] + (cum_sum_e[N] - cum_sum_e[i + 1])
print(min(answers))
Buggy python submission (verdict: Runtime Error):
n = int(input())
apple = eval(input().replace(" ", "*"))
print(apple if apple <= 10**18 else -1)

Fixed submission:
n = int(input())
apple = list(map(int, input().split()))
if 0 in apple:
    print(0)
else:
    cat = 1
    for i in apple:
        cat *= i
        if cat > 10**18:
            break
        else:
            pass
    print(cat if cat <= 10**18 else -1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
apple = list(map(int, input().split()))
cat = 1
for i in apple:
    cat *= i
print(cat if cat <= 10**18 else -1)

Fixed submission:
n = int(input())
apple = list(map(int, input().split()))
if 0 in apple:
    print(0)
else:
    cat = 1
    for i in apple:
        cat *= i
        if cat > 10**18:
            break
        else:
            pass
    print(cat if cat <= 10**18 else -1)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(x) for x in input().split())

B = []
A = list(int(x) for x in input().split())

for i in range(m):
    j, k = (int(x) for x in input().split())
    C = [j, k]
    B.append(C)

count = 0

for i in range(1, n + 1):
    D = []
    for l in B:
        if i in l:
            for a in l:
                D.append(a)
        else:
            pass
    if len(D) == 0:
        count += 1
    else:
        b = set(D)
        apple = list(b)
        apple.remove(i)
        E = []
        for cat in apple:
            dog = A[cat - 1]
            E.append(dog)
        if A[i - 1] > max(E):
            count += 1
        else:
            pass
print(count)

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


ans = [1] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if hs[a] < hs[b]:
        ans[a] = 0
    elif hs[a] == hs[b]:
        ans[a] = 0
        ans[b] = 0
    else:
        ans[b] = 0

print(sum(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(x) for x in input().split())

B = []
A = list(int(x) for x in input().split())

for i in range(m):
    j, k = (int(x) for x in input().split())
    C = [j, k]
    B.append(C)

count = 0

for i in range(1, n + 1):
    D = []
    for l in B:
        if i in l:
            for a in l:
                D.append(a)
        else:
            pass
    if len(D) == 0:
        count += 1
    else:
        b = set(D)
        apple = list(b)
        apple.remove(i)
        E = []
        for cat in apple:
            dog = A[cat - 1]
            E.append(dog)
        if A[i - 1] > max(E):
            count += 1
        else:
            pass
print(count)

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


ans = [1] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if hs[a] < hs[b]:
        ans[a] = 0
    elif hs[a] == hs[b]:
        ans[a] = 0
        ans[b] = 0
    else:
        ans[b] = 0

print(sum(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(x) for x in input().split())

B = []
A = list(int(x) for x in input().split())

for i in range(m):
    j, k = (int(x) for x in input().split())
    C = [j, k]
    B.append(C)

count = 0

for i in range(1, n + 1):
    D = []
    for l in B:
        if i in l:
            for a in l:
                D.append(a)
        else:
            pass
    b = set(D)
    apple = list(b)
    if len(apple) == 0:
        count += 1
    else:
        apple.remove(i)
        E = []
        for cat in apple:
            dog = A[cat - 1]
            E.append(dog)
        if A[i - 1] > max(E):
            count += 1
        else:
            pass
print(count)

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


ans = [1] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if hs[a] < hs[b]:
        ans[a] = 0
    elif hs[a] == hs[b]:
        ans[a] = 0
        ans[b] = 0
    else:
        ans[b] = 0

print(sum(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
apple = list(map(int, input().split()))
cat = []
count = 0
for i in range(n - 1):
    if apple[i] <= apple[i + 1]:
        cat.append(apple[i])
    else:
        cat.append(apple[i] - 1)
if cat[-1] >= apple[-1] + 1:
    cat.append(-2)
else:
    cat.append(apple[-1] + 1)
for i in range(n - 1):
    if cat[i] <= cat[i + 1]:
        pass
    else:
        count = 1
        break    
print("Yes" if count == 0 else "No")

Fixed submission:
n = int(input())
apple = list(map(int, input().split()))
apple.reverse()
count = 0
for i in range(n - 1):
    if apple[i] >= apple[i + 1]:
        pass
    elif apple[i] + 1 == apple[i + 1]:
        apple[i + 1] = apple[i + 1] - 1
    else:
        count = 1
        break
print("Yes" if count == 0 else "No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
apple = []
for _ in range(n):
    apple.append(int(input()))
for i in range(n):
    orange = apple[0:i] + apple[i+1:n+1]
    print(max(orange))

Fixed submission:
n = int(input())
apple = []
for _ in range(n):
    apple.append(int(input()))
big = max(apple)
orange = [big for i in range(n)]
num = apple.index(big)
del apple[num]
cat = max(apple)
orange[num] = cat
for i in orange:
    print(i)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
import math
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // (c * d // math.gcd(c, d))
ycd = b // (c * d // math.gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))

Fixed submission:
a, b, c, d = map(int, input().split())
from fractions import gcd
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // ((c * d) // gcd(c, d))
ycd = b // ((c * d) // gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
import math
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // (c * d // math.gcd(c, d))
ycd = b // (c * d // math.gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))

Fixed submission:
a, b, c, d = map(int, input().split())
from fractions import gcd
xc = (a-1)//c
yc = b//c
xd = (a-1)//d
yd = b//d    
xcd = (a - 1) // ((c * d) // gcd(c, d))
ycd = b // ((c * d) // gcd(c, d))

print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
apple = []

number = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in number:
    if i - n > 0:
        apple.append(i)
    else:
        pass

print(min(apple))

Fixed submission:
n = int(input())
apple = []

number = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in number:
    if i - n >= 0:
        apple.append(i)

print(min(apple))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())))
b = set(a)
count = 0
for i in b:
    j = a.count(i)
    if j < i:
        count += j
    else:
        k = j - i
        count += k
print(count)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(set(a))
count = 0
z = 0
for i in b:
    if i > n:
        count += n-z
        break
    else:
        j = a.count(i)
        if j < i:
            count += j
            z += j
        else:
            count += j-i
            z += j
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())))
b = set(a)
count = 0
for i in b:
    j = a.count(i)
    if j < i:
        count += j
    else:
        k = j - i
        count += k
print(count)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(set(a))
count = 0
z = 0
for i in b:
    if i > n:
        count += n-z
        break
    else:
        j = a.count(i)
        if j < i:
            count += j
            z += j
        else:
            count += j-i
            z += j
print(count)