Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def judge_prime(num):
    FLAG = True
    
    for i in range(2, int(np.sqrt(num))+1):
        if (num%i == 0):
            FLAG = False
    
    if (num == 2):
        FLAG = True
    
    return(FLAG)

X = int(input())

while (True):
    flag = judge_prime(X)
    
    if (flag):
        break
    
    X += 1

print(X)

Fixed submission:
import numpy as np

def judge_prime(num):
    FLAG = True
    
    for i in range(2, int(np.sqrt(num))+1):
        if (num%i == 0):
            FLAG = False
    
    if (num == 2):
        FLAG = True
    
    return(FLAG)

X = int(input())

while (True):
    flag = judge_prime(X)
    
    if (flag):
        break
    
    X += 1

print(X)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
An = list(map(int, input().split()))
order = []

for i in range(N):
    print( An.index(i+1)+1 ,end=" ")

Fixed submission:
N = int(input())
An = list(map(int, input().split()))
ans = [0] * N

for i, num in enumerate(An):
    ans[num-1] = i+1

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

def convert_bagOfWords(S):
    BOW = [0 for i in range(26)]

    for s in S:
        num = (ord(s) - ord('a')) % 26
        BOW[num] += 1
    
    return(BOW)

N = int(input())
bow_vec = []
N_anagram = [0] * N
new_words = []

for i in range(N):
    bow_vec.append(convert_bagOfWords(input()))

for i in range(N):
    # if (new_words.any(bow_vec[i]) == True):
    if (sum(s == bow_vec[i] for s in new_words) > 0):
        index = new_words.index(bow_vec[i])
        N_anagram[index] += 1
    
    else:
        new_words.append(bow_vec[i])

N_anagram = [i+1 for i in N_anagram if (i > 0)]

answer = 0

for i in N_anagram:
    answer += math.factorial(i) / (2 * math.factorial(i - 2))

print(int(answer))

Fixed submission:
N = int(input())
l = []

for i in range(N):
    l.append(''.join(sorted(input())))

l.sort()
count = ans = 0

for i in range(N-1):
    if (l[i] == l[i+1]):
        count += 1
        ans += count
    else:
        count = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
mini = mod = 2019

for i in range(L, R+1):
    for j in range(i+1, R+1):
        mod = (i * j) % 2019
        mini = min(mini, mod)
        
        if (mini == 0):
            break

print(mini)

Fixed submission:
L, R = map(int, input().split())
mini = mod = 2019

for i in range(L, R+1):
    for j in range(i+1, R+1):
        mod = (i * j) % 2019
        mini = min(mini, mod)
        
        if (mini == 0):
            print(mini)
            exit()
        
print(mini)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
mini = mod = 2019

for i in range(L, R+1):
    for j in range(i+1, R+1):
        mod = (i * j) % 2019
        mini = min(mini, mod)

print(mini)

Fixed submission:
L, R = map(int, input().split())
mini = mod = 2019

for i in range(L, R+1):
    for j in range(i+1, R+1):
        mod = (i * j) % 2019
        mini = min(mini, mod)
        
        if (mini == 0):
            print(mini)
            exit()
        
print(mini)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

DP = [-1 for i in range(N+1)]
stair = [0 for i in range(N+1)]
DP[0] = DP[1] = 1
stair[0] = stair[1] = 1
MOD = 10**9 + 7

for i in range(M):
    index = int(input())
    stair[index] = 0
    DP[index] = 0

def DP_top_down(num):

    if (DP[num] == 0): # broken
        return(0)

    elif (DP[num] == 1): # done
        answer = stair[num]
    
    else:
        answer = DP_top_down(num-2) + DP_top_down(num-1)
        stair[num] = answer # I forgot this operation!
        DP[num] = 1        

    return(answer)

answer = DP_top_down(N)
print(answer%MOD)

Fixed submission:
N, M = map(int, input().split())
DP = [1 for i in range(N+1)]
MOD = 10**9 + 7

for i in range(M):
    DP[int(input())] = 0

for i in range(2,N+1):
    
    if (DP[i] != 0):
        DP[i] = DP[i-1] + DP[i-2]
print(DP[N]%MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
Left = []
Right = []

for i in range(Q):
    l, r = map(int, input().split())
    Left.append(l)
    Right.append(r)

def search_AC(left, right):
    String = S[left - 1 :right]
    count = 0
    
    for i in range(len(String)-1):
        if (String[i] == 'A' and String[i + 1] == 'C'):
            count += 1
        
    return (count)

for i in range(Q):
    answer = search_AC(Left[i], Right[i])
    print(answer)

Fixed submission:
N, Q = map(int, input().split())
S = input()
S_con = [0 for i in range(len(S))]

def convert_N_AC():
    
    for i in range(1, len(S)):
        tmp = 0
        if (S[i - 1 : i + 1] == 'AC'):
            tmp = 1
        S_con[i] += tmp + S_con[i-1]

convert_N_AC()

for i in range(Q):
    l, r = map(int, input().split())
    answer = S_con[r - 1] - S_con[l - 1]
    print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N_ken, M_hon = map(int, input().split())
ab = []
yen = 0
hon = M_hon

for i in range(N_ken):
    tmp = list(map(int, input().split()))
    ab.append(tmp)

ab.sort()

while (hon > 0):
    
    tmp = min(hon, ab[0][1])
    yen += ab[0][0] * tmp
    
    hon -= tmp
    ab.remove(min(ab))

print(yen)

Fixed submission:
N_ken, M_hon = map(int, input().split())
ab = []
yen = 0
hon = 0

for i in range(N_ken):
    tmp = list(map(int, input().split()))
    ab.append(tmp)

ab.sort()

for a, b in ab:
    tmp = min(M_hon - hon, b)
    yen += tmp * a
    hon += tmp
    
    if (hon == M_hon):
        break

print(yen)

Buggy python submission (verdict: Time Limit Exceeded):
N_ken, M_hon = map(int, input().split())
A_en = []
B_hon = []
yen = 0
hon = M_hon

for i in range(N_ken):
    a, b = map(int, input().split())
    A_en.append(a)
    B_hon.append(b)

while (hon > 0):
    index = A_en.index(min(A_en))
    tmp = min(hon, B_hon[index])
    yen += A_en[index] * tmp
    
    hon -= tmp
    A_en.remove(A_en[index])
    B_hon.remove(B_hon[index])

print(yen)

Fixed submission:
N_ken, M_hon = map(int, input().split())
ab = []
yen = 0
hon = 0

for i in range(N_ken):
    tmp = list(map(int, input().split()))
    ab.append(tmp)

ab.sort()

for a, b in ab:
    tmp = min(M_hon - hon, b)
    yen += tmp * a
    hon += tmp
    
    if (hon == M_hon):
        break

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

A, B, K_ban = map(int, input().split())

gc = math.gcd(A, B)
ctr = 1

while (gc > 0):

    if (A % gc == 0 and B % gc == 0):
        
        if (ctr == K_ban):
            print(gc)
            break
        else:
            ctr += 1
    
    gc -= 1

Fixed submission:
import fractions

A, B, K_ban = map(int, input().split())

gc = fractions.gcd(A, B)
ctr = 1

while (gc > 0):

    if (A % gc == 0 and B % gc == 0):
        
        if (ctr == K_ban):
            print(gc)
            break
        else:
            ctr += 1
    
    gc -= 1
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
num = 0

for i in range(len(S)):
    num = int(S[i])
    if (num != 1):
        num = i
        break

if (S[0] == '1'):
    ans = S[num]
else:
    ans = S[0]

print(ans)

Fixed submission:
S = input()
K = int(input())
num = 0

for i in range(len(S)):
    num = int(S[i])
    if (num != 1):
        num = i
        break

if (S[0] == '1' and K - 1 < num):
    ans = 1
elif (S[0] == '1'):
    ans = S[num]
else:
    ans = S[0]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
mini, maxi, K_ban = map(int, input().split())

num_list = [i for i in range(mini, maxi + 1)]

if (maxi - mini + 1 > 2 * K_ban):
    num_list = num_list[:K_ban] + num_list[-K_ban:]


[print(n) for n in num_list]

Fixed submission:
mini, maxi, K_ban = map(int, input().split())

if (maxi - mini + 1 <= 2 * K_ban):
    ans = [i for i in range(mini, maxi + 1)]

else:
    left = [i for i in range(mini, mini + K_ban)]
    right = [i for i in range(maxi - K_ban + 1, maxi + 1)]
    
    ans = left + right
    

[print(n) for n in ans]

Buggy python submission (verdict: Time Limit Exceeded):
mini, maxi, K_ban = map(int, input().split())

num_list = [i for i in range(mini, maxi + 1)]

if (maxi - mini + 1 <= 2 * K_ban):
    ans = num_list
else:
    ans = num_list[:K_ban] + num_list[-K_ban:]


[print(n) for n in ans]

Fixed submission:
mini, maxi, K_ban = map(int, input().split())

if (maxi - mini + 1 <= 2 * K_ban):
    ans = [i for i in range(mini, maxi + 1)]

else:
    left = [i for i in range(mini, mini + K_ban)]
    right = [i for i in range(maxi - K_ban + 1, maxi + 1)]
    
    ans = left + right
    

[print(n) for n in ans]

Buggy python submission (verdict: Time Limit Exceeded):
mini, maxi, K_ban = map(int, input().split())

num_list = [i for i in range(mini, maxi + 1)]

if (maxi - mini + 1 <= 2 * K_ban):
    ans = num_list
else:
    ans = num_list[:K_ban] + num_list[-K_ban:]

for i in range(len(ans)):
    print(ans[i])

Fixed submission:
mini, maxi, K_ban = map(int, input().split())

if (maxi - mini + 1 <= 2 * K_ban):
    ans = [i for i in range(mini, maxi + 1)]

else:
    left = [i for i in range(mini, mini + K_ban)]
    right = [i for i in range(maxi - K_ban + 1, maxi + 1)]
    
    ans = left + right
    

[print(n) for n in ans]
Buggy python submission (verdict: Runtime Error):
s_17 = input()
# print(s_17)
s_17[3] = 8
print(*s_17)

Fixed submission:
s_17 = list(input())
s_18 = ''

for s in range(len(s_17)):
    if (s == 3):
        s_18 += '8'
    else:
        s_18 += s_17[s]

print(s_18)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sequence = list(map(int, input().split()))
sequence.sort()

cnt = 0
pos = 0

while (pos < N):
    
    cur_value = sequence[pos]
    tmp_cnt = sequence.count(cur_value)
    
    if (tmp_cnt < cur_value):
        cnt += tmp_cnt
    else:
        cnt += tmp_cnt - cur_value
    
    pos += tmp_cnt

print(cnt)

Fixed submission:
import collections

N = int(input())
sequence = list(map(int, input().split()))
CTR = collections.Counter(sequence).most_common()
ans = 0

for i in range(len(CTR)):
    cnt = CTR[i][1]
    obj = int(CTR[i][0])

    if (obj > cnt):
        ans += cnt
    
    else:
        ans += cnt - obj
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
times = [int(input()) for i in range(N)]

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (math.gcd(gcdd, num))


print(gcdd)

Fixed submission:
import fractions

N = int(input())
times = [int(input()) for i in range(N)]

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (fractions.gcd(gcdd, num))


print(gcdd)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
l = []
r = []
for i in range(m):
    a,b = map(int,input().split())
    l.append(a)
    r.append(b)
count = 0
for i in range(1,n+1):
        if l[m-1] <= i <= r[0]: 
            count += 1
for i in range(n):
    for j in range(m):
        l.append(1)
print(count)

Fixed submission:
n,m = map(int,input().split())
l = []
r = []
for i in range(m):
    a,b = map(int,input().split())
    l.append(a)
    r.append(b)
count = 0
ma = max(l)
mi = min(r)
for i in range(1,n+1):
        if ma <= i <= mi: 
            count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
m = n
for i in range(n + 1):
    counts = s[:i].count("#") + s[i:].count(".")
    if m > counts:
        m = counts
        
print(m)

Fixed submission:
n = int(input())
s = list(input())
m = n
counts = s[:].count(".")
m = min(n,counts)
for i in range(n):
    counts += s[i].count("#") - s[i].count(".")
    if m > counts:
        m = counts
        
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
m = n
for i in range(n + 1):
    if m > s[:i].count("#") + s[i:].count("."):
        m = s[:i].count("#") + s[i:].count(".")
        
print(m)

Fixed submission:
n = int(input())
s = list(input())
m = n
counts = s[:].count(".")
m = min(n,counts)
for i in range(n):
    counts += s[i].count("#") - s[i].count(".")
    if m > counts:
        m = counts
        
print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lists = [int(input()) for i in range(5)]
city = [0,0,0,0,0]
time = 0
phase = 1

while sum(city) < n*5:
    for i in range(phase):
        city[i] = min(n,city[i] + lists[i])
        for j in range(5):
            if city[j] > 0:
                phase = max(phase,j+2)
    time += 1

print(time)

Fixed submission:
import math
n = int(input())
lists = [int(input()) for i in range(5)]

print(math.ceil(n/min(lists)) + 4)

Buggy python submission (verdict: Runtime Error):
n = int(input())
lists = [int(input()) for i in range(5)]
city = [0,0,0,0,0]
time = 0
phase = 1

while sum(city) < 25:
    for i in range(phase):
        city[i] = min(5,city[i] + lists[i])
        for j in range(5):
            if city[j] > 0:
                phase = max(phase,j+2)
    time += 1

print(time)

Fixed submission:
import math
n = int(input())
lists = [int(input()) for i in range(5)]

print(math.ceil(n/min(lists)) + 4)

Buggy python submission (verdict: Runtime Error):

n = int(input())
lists = [int(input()) for i in range(5)]
city = [0,0,0,0,0]
time = 0
phase = 1

while sum(city) < 25:
    for i in range(phase):
        city[i] = min(5,city[i] + lists[i])
        for j in range(5):
            if city[j] > 0:
                phase = max(phase,j+2)
    time += 1

print(time)

Fixed submission:
import math
n = int(input())
lists = [int(input()) for i in range(5)]

print(math.ceil(n/min(lists)) + 4)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = map(int,input().split())
print("Yes" if sum(l) - max(l) > max(l) else "No")

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
print("Yes" if sum(l) - max(l) > max(l) else "No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for i in range(n)]
print("Yes" if (sum(l) - max(l)) > max(l) else "No")

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
print("Yes" if sum(l) - max(l) > max(l) else "No")

Buggy python submission (verdict: Runtime Error):

n = int(input())
l = [int(input()) for i in range(n)]
print("Yes" if sum(l) - max(l) > max(l) else "No")

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
print("Yes" if sum(l) - max(l) > max(l) else "No")
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input())
print(c-a)

Fixed submission:
a,b,c = sorted(map(int,input().split()))
print(c-a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = 1
for i in range(1,n):
    for j in range(2,n):
        if i**j <= n:
            c = max(c,i**j)
print(c)

Fixed submission:
n = int(input())
c = 1
for i in range(1,n):
    for j in range(2,n):
        if i**j <= n:
            c = max(c,i**j)
        else:
            break
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = 1
for i in range(1,n+1):
    for j in range(2,n+1):
        if i**j <= n:
            c = max(c,i**j)
print(c)

Fixed submission:
n = int(input())
c = 1
for i in range(1,n):
    for j in range(2,n):
        if i**j <= n:
            c = max(c,i**j)
        else:
            break
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
sys.setrecursionlimit(100000)
def lcm(x,y):
    return x/fractions.gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM/i
  
print(int(ans)%1000000007)


Fixed submission:
import sys
import fractions
sys.setrecursionlimit(100000)
def lcm(x,y):
    return x//fractions.gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM//i
  
print(int(ans)%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
sys.setrecursionlimit(100000)
def lcm(x,y):
    return x/fractions.gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM/i
  ans %= 1000000007
  
print(int(ans))


Fixed submission:
import sys
import fractions
sys.setrecursionlimit(100000)
def lcm(x,y):
    return x//fractions.gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM//i
  
print(int(ans)%1000000007)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
def gcd(x,y):
  if y==0:
      return x
  return gcd(y,x%y)
def lcm(x,y):
    return x/gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM/i
  ans %= 1000000007
  
print(int(ans))


Fixed submission:
import sys
import fractions
sys.setrecursionlimit(100000)
def lcm(x,y):
    return x//fractions.gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM//i
  
print(int(ans)%1000000007)

Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
  if y==0:
      return x
  return gcd(y,x%y)
def lcm(x,y):
    return x/gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM/i
  ans %= 1000000007
  
print(int(ans))


Fixed submission:
import sys
import fractions
sys.setrecursionlimit(100000)
def lcm(x,y):
    return x//fractions.gcd(x,y)*y

n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
  LCM = lcm(LCM,i)
ans=0
for i in a:
  ans += LCM//i
  
print(int(ans)%1000000007)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
ans = []
for i in range(len(s)-len(t)):
    S = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if t[j] == S[j]:
            cnt += 1
    ans.append(cnt)

a = ans.index(max(ans))
b = s[a:a+len(t)]
count = 0
for k in range(len(t)):
    if t[k] != b[k]:
        count += 1
print(count)
    

Fixed submission:
s = input()
t = input()
ans = []
for i in range(len(s)-len(t)+1):
    S = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if t[j] == S[j]:
            cnt += 1
    ans.append(cnt)

a = ans.index(max(ans))
b = s[a:a+len(t)]
count = 0
for k in range(len(t)):
    if t[k] != b[k]:
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

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

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

Fixed submission:
num = int(input())

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

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

ans = 1
for i in value:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit()
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

value = input().split(" ")

ans = 1
for i in range(num):
    ans *= int(value[i])
    
if ans > 10 ** 18:
    ans = -1
    
print(ans)

Fixed submission:
num = int(input())

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

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

ans = 1
for i in value:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit()
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

value = input().split(" ")

ans = 1
for i in range(num):
    ans *= int(value[i])
    if ans > 10 ** 18:
        ans = -1
    
print(ans)

Fixed submission:
num = int(input())

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

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

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

for i in range(1,n+1):
    b = a.count(i)
    print(b)

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
for i in range(1,n+1):
    print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())

if k == 1:
    print(0)
    exit()
while n >= abs(n-k):
    n = abs(n-k)
    
print(n)

Fixed submission:
n, k = map(int,input().split())
print(min(n%k, k - n%k))
Buggy python submission (verdict: Runtime Error):
N = int(input())
X1 = list(map(int, input().split()))
ans = []
if N == 1:
    print(0)
    exit()
    
for p in range(min(X1), max(X1)):
    num = 0
    for i in range(N):
        num += (X1[i] - p)*(X1[i] - p)
        
    ans.append(int(num))


print(min(ans))

Fixed submission:
N = int(input())
X1 = list(map(int, input().split()))
ans = []
if N == 1:
    print(0)
    exit()
    
if min(X1) == max(X1):
    print(0)
    exit()
    
for p in range(min(X1), max(X1)):
    num = 0
    for i in range(N):
        num += (X1[i] - p)*(X1[i] - p)
        
    ans.append(int(num))

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
X1 = list(map(int, input().split()))
ans = []
for p in range(min(X1), max(X1)):
    poi = 0
    for i in range(N):
        poi += (X1[i] - p)*(X1[i] - p)
        
    ans.append(int(poi))


print(min(ans))

Fixed submission:
N = int(input())
X1 = list(map(int, input().split()))
ans = []
if N == 1:
    print(0)
    exit()
    
if min(X1) == max(X1):
    print(0)
    exit()
    
for p in range(min(X1), max(X1)):
    num = 0
    for i in range(N):
        num += (X1[i] - p)*(X1[i] - p)
        
    ans.append(int(num))

print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
health = list(map(int,input().split()))
s_health = sorted(health,reverse=True)
if n <= k:
    print(0)
    exit()
    
for i in range(k):
    del s_health[0]

print(sum(s_health))

Fixed submission:
n,k = map(int,input().split())
health = list(map(int,input().split()))
s_health = sorted(health)
if n <= k:
    print(0)
    exit()

print(sum(s_health[:n-k]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n):
    if min(l[:i+1]) == l[i]:
        count += 1
print(count)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = l[0]
count = 1
for i in range(1,n):
    if m > l[i]:
        count += 1
        m = l[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
ans = 10**10
for i in range(n):
    ans = min(ans,(abs(sum(s[:i]) - sum(s[i:]))))
print(ans)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 2020202020
a = 0
b = sum(s)
for i in range(n):
    a += s[i]
    b -= s[i]
    ans = min(ans,abs(a-b))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(map(int,input().split()))
ans = []
for i in range(n):
    ans.append(abs(sum(s[:i]) - sum(s[i:])))
print(min(ans))

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 2020202020
a = 0
b = sum(s)
for i in range(n):
    a += s[i]
    b -= s[i]
    ans = min(ans,abs(a-b))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
for i in range(n):
    ans = l.index(i+1)
    print(ans + 1,end=" ")

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = {}
for i in range(n):
    ans[a[i]] = i + 1
s = [ans[i+1] for i in range(n)]
print(*s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int,input().split()))
ans = 0
for i in range(n):
    cnt = 0
    for j in range(i,n-1):
        if h[j] >= h[j+1]:
            cnt += 1
        else:
            break
    ans = max(ans,cnt)
print(ans)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
ans = 0
cnt = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt += 1
    else:
        cnt = 0
    ans = max(ans,cnt)
print(ans)