Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools

input = sys.stdin.readline
MOD = 1000000007

N = int(input())

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

dic = {}

b = []
for i in range(len(A)):
    dic[i+1] = A[i]
    b.append(i+1)

dic_sorted = sorted(dic.items(),key=lambda x:x[1])



c = list(itertools.combinations(b,2))

res = 0
for i in c:
    if (dic[i[1]] + dic[i[0]]) == abs(i[0] - i[1]):
        res+=1

print(res)



Fixed submission:
#import sys
import numpy as np

#input = sys.stdin.readline
MOD = 1000000007


N = int(input())

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

M = {}
res = 0
for i in range(len(A)):
    if (A[i]+i) not in M:
        M[A[i]+i] = 1
    else:
        M[A[i]+i] +=1
    
    if (i - A[i]) in M:
        res+=M[i-A[i]]

print(res)
Buggy python submission (verdict: Runtime Error):
N = input()

for i in range(len(N)):
	if N[i] =='7':
    	print("Yes")
       	exit()

print("No")

Fixed submission:
N = input()
 
for i in range(len(N)):
	if N[i] =='7':
		print("Yes")
		exit()
 
print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

input = sys.stdin.readline


N = int(input())

S = input()

color =list("RGB")

#色がRGBの３色ないとき
for x in color:
    if x not in S:
        print(0)
        exit()

r = 0
g = 0
b = 0
for i in range(len(S)):
    if S[i] == color[0]:
        r+=1
    elif S[i] == color[1]:
        g+=1
    elif S[i] == color[2]:
        b+=1

all = r*g*b

sub = 0
for i in range(N):
    for j in range(i+1,N):
        k = 2*j - i
        #kがN以上の位置にある
        if k >= N:
            continue

        #同じ色がある
        if S[i] == S[j] or S[j] == S[k] or S[k] == S[i] :
            continue
        sub+=1

print(all - sub)
        




Fixed submission:
import sys

input = sys.stdin.readline


N = int(input())

S = input()

color =list("RGB")

#色がRGBの３色ないとき
for x in color:
    if x not in S:
        print(0)
        exit()

r = 0
g = 0
b = 0
for i in range(len(S)):
    if S[i] == color[0]:
        r+=1
    elif S[i] == color[1]:
        g+=1
    elif S[i] == color[2]:
        b+=1

all = r*g*b

sub = 0
for i in range(N):
    for j in range(i+1,N):
        k = 2*j - i
        #kがN以上の位置にある
        if k >= N:
            continue

        #同じ色がある
        if S[i] == S[j] or S[j] == S[k] or S[k] == S[i] :
            continue
        sub+=1

print(all - sub)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools 
import math
import itertools 
import sys

input = sys.stdin.readline


N = int(input())

S = input()

color =list("RGB")

#色がRGBの３色ないとき
for x in color:
    if x not in S:
        print(0)
        exit()

r = 0
g = 0
b = 0
for i in range(len(S)):
    if S[i] == color[0]:
        r+=1
    elif S[i] == color[1]:
        g+=1
    elif S[i] == color[2]:
        b+=1

all = r*g*b

sub = 0
for i in range(N):
    for j in range(i+1,N):
        k = 2*j - i
        #kがN以上の位置にある
        if k >= N:
            continue

        #同じ色がある
        if S[i] == S[j] or S[j] == S[k] or S[k] == S[i] :
            continue
        sub+=1

print(all - sub)
        




Fixed submission:
import sys

input = sys.stdin.readline


N = int(input())

S = input()

color =list("RGB")

#色がRGBの３色ないとき
for x in color:
    if x not in S:
        print(0)
        exit()

r = 0
g = 0
b = 0
for i in range(len(S)):
    if S[i] == color[0]:
        r+=1
    elif S[i] == color[1]:
        g+=1
    elif S[i] == color[2]:
        b+=1

all = r*g*b

sub = 0
for i in range(N):
    for j in range(i+1,N):
        k = 2*j - i
        #kがN以上の位置にある
        if k >= N:
            continue

        #同じ色がある
        if S[i] == S[j] or S[j] == S[k] or S[k] == S[i] :
            continue
        sub+=1

print(all - sub)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

input = sys.stdin.readline

H,W = map(int,input())

if H*W%2 == 0:
    print(int(H*W/2))
else:
    print(int(H*W)/2+1)

Fixed submission:
import numpy as np
import sys

input = sys.stdin.readline

H,W = map(int,input().split())

if H == 1 or W == 1:
    print(1)
else:
    if H*W%2 == 0:
        print(H*W//2)
    else:
        print(H*W//2+1)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())


print( (n-1)*n/2+(m-1)*m/2)


Fixed submission:
s = input()

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        print("Yes")
        exit()

print("No")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

x = a/0.08

y = b/0.1


judge = 0

for i in range(10):
    for j in range(10):
        x = (a+i/10)/0.08
        y = (b+j/10)/0.10
        if x == y:
            judge = 1
            print(int(x))
            exit(1)


if judge == 0:
    print(-1)




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


judge = 0
for i in range(1,1001):
    if  int(i*0.08) == a and int(i*0.1) == b:
        judge = 1
        print(i)
        break

if judge == 0:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

n = int(input())

#y = []
#for i in range(n):
#    x = input()
#    y.append(x)
#
#print(y)
#print(y[0].split())
for i in range(n):
    x = input()
    if int(x[0]) == 1:
        s = s[::-1]
    else:
        x = x.split()
        if int(x[1]) == 1:
            s = x[2] + s

        else:
            s = s + x[2]


print(s)

Fixed submission:
import numpy as np
import sys

input = sys.stdin.readline

S = input()
Q = int(input())

left = []
right = []
rev = False

for i in range(Q):
    l = input().split()
    if l[0] == '1':
        rev = not rev
    else:
        if (l[1] == '1' and not rev) or (l[1] == '2' and rev):
            left.append(l[2])
        else:
            right.append(l[2])

S = ''.join(left[::-1]) + S + ''.join(right)

if rev:
    print(S[::-1].replace('\n',''))
else:
    print(S.replace('\n',''))
Buggy python submission (verdict: Runtime Error):

a = list(list(map(int,input().split())) for _ in range(3))

N = int(input())

b = list(int(input()) for _ in range(N))


ax = [[0]*3]*3

for k in range(N):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[k]:ax[i][j]= 1


for i in range(3):
    xcnt = 0
    ycnt = 0
    for j in range(3):
        if ax[i][j] == 1:xcnt +=1
        if ax[j][i] == 1:ycnt +=1


xxcnt = 0
for i in range(3):
    if ax[i][i] == 1:xxcnt+=1

for i in range(3):
    if ax[3-i][i] == 1:xycnt+=1

for i in range(3):
    if ax[i][3-i] == 1:yxcnt+=1

if xcnt == 3 or ycnt == 3 or xxcnt == 3 or xycnt == 3 or yxcnt == 3:
    print("Yes")

else:
    print("No")



Fixed submission:
# -*- coding:utf-8 -*-
A = []
bingo = 0
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

n = int(input())

for i in range(n):
    b = int(input())
    for ai in A:
        if b in ai:
            ai[ai.index(b)] = None

for i in range(3):
    if A[i] == [None, None, None]:
        bingo = 1

    if [A[0][i], A[1][i], A[2][i]] == [None, None, None]:
        bingo = 1

if [A[0][0], A[1][1], A[2][2]] == [None, None, None] or [A[0][2], A[1][1], A[2][0]] == [None, None, None]:
    bingo = 1

print("Yes") if bingo == 1 else print("No")
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())

ans_a = max(0,a-k)

if( ans_a == 0):
    ans_b = max(0, b-(k-a))


print("{0} {1}".format(ans_a,ans_b))
    

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

ans_a = 0
ans_b = b
ans_a = max(0,a-k)

if( ans_a == 0):
    ans_b = max(0, b-(k-a))


print("{0} {1}".format(ans_a,ans_b))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

print(max(c-(a-b),0)

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

print(max(c-(a-b),0))
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())

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

ans = a[0]
for i in range(1,len(a)):
    ans = math.gcd(ans,a[i])


print(ans)




Fixed submission:
import fractions

n = int(input())

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

ans = a[0]
for i in range(1,len(a)):
    ans = fractions.gcd(ans,a[i])


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

import numpy as np
import sys

input = sys.stdin.readline

s = int(input())

ans = 1

while s != 4:
    if s%2 :
        s = s/2
    else:
        s = 3*s + 1
    
    ans+=1


print(ans+3)


Fixed submission:

import numpy as np
import sys

input = sys.stdin.readline

s = int(input())

if s == 1 :
    n = 2
elif s == 2:
    n = 1
else:
    n = 3

ans = 1

while s != 4:
    if s%2 == 0 :
        s = s/2
    else:
        s = 3*s + 1
    
    
    ans+=1


print(ans+n)
Buggy python submission (verdict: Runtime Error):
S = input()

key = list("keyence")

k = 0
f = True
cnt = 0
for i in range(len(S)):
    if S[i] == key[k]:
        f = True
        k+=1
    else:
        if f :
            cnt+=1
        f = False
        

if cnt >1 or k != len(key):
    print("NO")
else:
    print("YES")

Fixed submission:
S = input()

key = list("keyence")
target = 'keyence'

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[0:i]+S[j:]

        if tmp == target and not flg:
            print("YES")
            flg = True
            break

if not flg:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8
a = input()

b = []
n = 0
J = 0
flag = True
for i in range(len(a)):
    b.append(a[i])
c = b

while(flag):
    for i in range(len(b) - 1) :
        if( c[i] == 'B' and c[i + 1] == 'W'):
            c[i] = 'W'
            c[i + 1] ='B'
            n+=1
            J += 1
        else:
            pass
    if(J==0):flag = False
    J = 0


print(n)



Fixed submission:
#coding: utf-8
a = input()

b = []
w = []
for i in range(len(a)):
    b.append(a[i])

for i in  range(len(a)):
    if (b[i] == 'W') :
        w.append(i)

n = 0
for i in range(len(w)):
    n += w[i] - i

print(n)
Buggy python submission (verdict: Time Limit Exceeded):
N,s = input().split()
S = int(s)
a = []
for i in range(int(N)):
    a.append(int(input()))

a.sort()

mindiff = 1000000000

for i in range(int(N)-(S - 1)):
    v = 0
    for j in range(int(S)-1):
        v += a[i+j+1]-a[i+j]
        if i%3 == 0 and mindiff < v:break

    if mindiff > v: mindiff = v

print(mindiff)



Fixed submission:
N,s = input().split()
S = int(s)
a = []
for i in range(int(N)):
    a.append(int(input()))

a.sort()

mindiff = 1000000000

for i in range(int(N)-(S - 1)):
    v = a[i+S-1]-a[i]

    if mindiff > v: mindiff = v

print(mindiff)

Buggy python submission (verdict: Time Limit Exceeded):
N,s = input().split()
S = int(s)
a = []
for i in range(int(N)):
    a.append(int(input()))

a.sort()

mindiff = 10000000000

for i in range(int(N)-(S - 1)):
    v = 0
    for j in range(int(S)-1):
        v += a[i+j+1]-a[i+j]
        if mindiff < v:break

    if mindiff > v: mindiff = v

print(mindiff)





Fixed submission:
N,s = input().split()
S = int(s)
a = []
for i in range(int(N)):
    a.append(int(input()))

a.sort()

mindiff = 1000000000

for i in range(int(N)-(S - 1)):
    v = a[i+S-1]-a[i]

    if mindiff > v: mindiff = v

print(mindiff)

Buggy python submission (verdict: Time Limit Exceeded):
N,s = input().split()
S = int(s)
a = []
for i in range(int(N)):
    a.append(int(input()))

a.sort()

diff = []

for i in range(int(N)-(S - 1)):
    v = 0
    for j in range(int(S)-1):
        v += a[i+j+1]-a[i+j]

    diff.append(v)

print(min(diff))





Fixed submission:
N,s = input().split()
S = int(s)
a = []
for i in range(int(N)):
    a.append(int(input()))

a.sort()

mindiff = 1000000000

for i in range(int(N)-(S - 1)):
    v = a[i+S-1]-a[i]

    if mindiff > v: mindiff = v

print(mindiff)
Buggy python submission (verdict: Runtime Error):
s = input()

k = int(input())

ichi = -1
for i in s:
    if int(i) == 1:
        ichi = ichi +1
    else:
        break



if ichi >= k:
    print(1)
else:
    print(s[ichi+1])

        


Fixed submission:
s = input()

k = int(input())

ichi = 0
for i in s:
    if int(i) == 1:
        ichi = ichi +1
    else:
        break


if ichi >= k:
    print(1)
else:
    print(s[ichi])
Buggy python submission (verdict: Runtime Error):
a = map(int,input().split())

if a%2 == 0:
    print(a)
else:
    print(a*2)


Fixed submission:
a = list(map(int,input().split()))
b = int(a[0])
if b %2 == 0:
    print(b)
else:
    print(b*2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

b = 10000000
for i in range(100):
    sum = 0
    for j in range(n):
        sum = sum + abs(a[j] - (i + n))

    if sum < b:
        c = i
        b = sum


print(c)




Fixed submission:
n = int(input())

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


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

a.sort()

x=a[int(int(len(a))/2)]

ans = 0
for i in range(len(a)):
    ans =ans+ abs(a[i]-x)

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

h,w = map(int,input().split())

s = [ list(input()) for i in range(h)]
s = np.array(s)

dy = [-1,0,1,0]
dx = [0,-1,0,1]

ans =True

for i in range(0,h):
    for j in range(0,w):
        flag = False
        if s[i][j] == '#' :
            for k in range(4):
                y = i+dy[k]
                x = i+dx[k]
                if  x < 0 or x >=w or y >= h or y < 0 :continue
#                print(x,y)
                if s[x][y] == '#':
                    flag = True

        if flag :ans = False


if ans :print("No")
else:print("Yes")




Fixed submission:
h, w = list(map(int, input().split()))
s = ['.'*(w+2)]

for i in range(h):
	s.append('.'+input()+'.')
s.append('.'*(w+2))

ans = True

for i in range(1, h+1):
	for j in range(1, w+1):
		if s[i][j]=='#':
			if s[i-1][j]=='.' and s[i+1][j]=='.' and s[i][j-1]=='.' and s[i][j+1]=='.':
				ans = False

print('Yes' if ans else 'No')

Buggy python submission (verdict: Runtime Error):
import numpy as np

h,w = map(int,input().split())

s = [ list(input()) for i in range(h)]
s = np.array(s)

dy = [-1,0,1,0]
dx = [0,-1,0,1]

print(s.shape)
ans =True

for i in range(0,h):
    for j in range(0,w):
        flag = False
        if s[i][j] == '#' :
            for k in range(4):
                y = i+dy[k]
                x = i+dx[k]
                if  x < 0 or x >=w or y >= h or y < 0 :continue
#                print(x,y)
                if s[x][y] == '#':
                    flag = True

        if flag :ans = False


if ans :print("No")
else:print("Yes")




Fixed submission:
h, w = list(map(int, input().split()))
s = ['.'*(w+2)]

for i in range(h):
	s.append('.'+input()+'.')
s.append('.'*(w+2))

ans = True

for i in range(1, h+1):
	for j in range(1, w+1):
		if s[i][j]=='#':
			if s[i-1][j]=='.' and s[i+1][j]=='.' and s[i][j-1]=='.' and s[i][j+1]=='.':
				ans = False

print('Yes' if ans else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

x = np.array(x)

for i in range(0,n):
    print(int(np.median(np.r_[x[:i],x[i+1:]])))
   # print(x[:i])
   # print(x[i+1:])

Fixed submission:
import numpy as np

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

x = np.array(x)

y = np.sort(x)

left = y[n//2 - 1]
right = y[n//2 ]

for i in range(n):
    if x[i] <= left:
        print(right)
    else:
        print(left)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

x = set(a)

res = 0

for i in x:
    if (a.count(i) >= i):res += (a.count(i) - i)
    else:res += a.count(i)

print(res)

Fixed submission:
from collections import Counter

N = int(input())

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

x = set(a)


res = 0
for k,v in c.items():
    if k <= 100000:
        if (v >= k):res += (v - k)
        else:res += v
    else:
        res+=v


print(res)
#
#
#for i in a:
#    if i > 100000:
#        res+=1
#
#for i in x:
#    if (a.count(i) >= i):res += (a.count(i) - i)
#    else:res += a.count(i)
#
#print(res)
Buggy python submission (verdict: Runtime Error):

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
a = [0]*(10**5+1)
for i in range(N):
    a[int(input())]+=1

res = 0
for i in range(1,10**5+1):
    if a[i]%2:
        res+=1

print(res)



Fixed submission:

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
a = []
for i in range(N):
     a.append(int(readline()))

a.sort()

res = 0
cnt = 1
for i in range(1,N):
    if a[i] == a[i-1]:
        cnt+=1
    else:
        if cnt%2:
            res+=1
        else:
            cnt=1

            

if cnt%2:
    print(res+1)
else:
    print(res)

Buggy python submission (verdict: Runtime Error):

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
a = [0]*(10**5+1)
for i in range(N):
    a[int(readline())]+=1

res = 0
for i in range(1,10**5+1):
    if a[i]%2:
        res+=1

print(res)



Fixed submission:

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
a = []
for i in range(N):
     a.append(int(readline()))

a.sort()

res = 0
cnt = 1
for i in range(1,N):
    if a[i] == a[i-1]:
        cnt+=1
    else:
        if cnt%2:
            res+=1
        else:
            cnt=1

            

if cnt%2:
    print(res+1)
else:
    print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

input = sys.stdin.readline

S = input()

S = sorted(S[:-1])

alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']


s = 0
for t in S:
    if t == alpha[s] :
        s+=1


if s == len(alpha):
    print("None")
else:
    print(alpha[s])

Fixed submission:
import numpy as np
import sys

input = sys.stdin.readline

S = input()

S = sorted(list(set(S[:-1])))


alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']


j = 0
for i in range(len(alpha)):
    if  S[j]== alpha[i] :
        if len(S)-1 != j:j+=1
    else:
        print(alpha[i])
        exit()


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

Fixed submission:
a=int(input())
x=list(map(int, input().split()))
ans=1
x.sort()
for i in range(a):

	if x[i]!=1 and x[i]!=0:
		ans=ans*x[i]
	if ans>10**18:
		break
	if x[i]==0:
		ans=0
		break
if ans>10**18:
	print(-1)
else:
	print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=list(map(int, input().split()))
print((a*b)//1)

Fixed submission:
a,b=list(map(float, input().split()))
a=int(a)
b=round(b*100)
print((a*b)//100)
Buggy python submission (verdict: Time Limit Exceeded):
a = list(map(int, input().split()))
b = list(map(int, input().split()))

b.sort(reverse=True)
x=a[1]
y=a[0]
if x>=y:
	print(0)
else:
	for i in range(x):
		del b[0]
	print(sum(b))

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

b.sort()
x=a[1]
y=a[0]
if x>=y:
	print(0)
else:
	z=y-x
	b=b[0:z]
	print(sum(b))
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

x=int(input())
a=list(map(int, input().split()))
ans=0
if x==1:
	print(1)
else:
	chk=lcm(a[0],a[1])
	for i in range(x):
		chk=lcm(chk,a[i])
	for i in range(x):
		ans=(ans+(chk//a[i]))%(10**9+7)
	print(ans)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

x=int(input())
a=list(map(int, input().split()))
ans=0
if x==1:
	print(1)
else:
	chk=lcm(a[0],a[1])
	for i in range(x):
		chk=lcm(chk,a[i])
	for i in range(x):
		ans=ans+(chk//a[i])
	print(ans%(10**9+7))

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

x=int(input())
a=list(map(int, input().split()))
ans=0
chk=lcm(a[0],a[1])
for i in range(x):
	chk=lcm(chk,a[i])
for i in range(x):
	ans=ans+(chk//a[i])
print(ans%(10**9+7))

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

x=int(input())
a=list(map(int, input().split()))
ans=0
if x==1:
	print(1)
else:
	chk=lcm(a[0],a[1])
	for i in range(x):
		chk=lcm(chk,a[i])
	for i in range(x):
		ans=ans+(chk//a[i])
	print(ans%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
a=list(map(int, input().split()))

ans=0
p=0

while p!=len(a):
	if a[p]==p+1:
		p=p+1
	else:
		del a[p]
		ans=ans+1
if p==0:
	if len(a)!=0:
		print(0)
	else:
		print(-1)
else:
	print(ans)

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

ans=0
p=0

for i in range(x):
	if a[i]==p+1:
		p=p+1
	else:
		ans=ans+1

if p==0:
	print(-1)
else:
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
y=list(map(int, input().split()))

y.sort()

a=0
b=0
c=0
ans=0
for i in range(x):
	a=y[i]
	for j in range(i+1,x):
		b=y[j]
		for k in range(j+1,x):
			c=y[k]
			if a+b>c:
				ans=ans+1
			else:
				break
print(ans)

Fixed submission:
import bisect
x=int(input())
y=list(map(int, input().split()))
 
y.sort()
 
a=0
b=0
c=0
ans=0
for i in range(x):
	a=y[i]
	for j in range(i+1,x):
		b=y[j]
		c=bisect.bisect_left(y,a+b)
		ans=ans+c-j-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,y=list(map(int, input().split()))
z=list(map(int, input().split()))
t=0
for i in range(y):
	t=z.index(max(z))
	z[t]=z[t]//2
print(sum(z))

Fixed submission:
import heapq
x,y=list(map(int, input().split()))
z=list(map(int, input().split()))
z = list(map(lambda x: x*(-1), z))
heapq.heapify(z)
for i in range(y):
	k=heapq.heappop(z)
	heapq.heappush(z, -(-k//2))
z = list(map(lambda x: x*(-1), z))
print(sum(z))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a=int(input())
c=[0]*a
d=[0]*10
x=0
for i in range(a):
	e=input()
	for j in range(10):
		d[j]=e[j]
	d.sort()
	c[i]=d[0]+d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+d[7]+d[8]+d[9]

for k in range(0,a):
	for l in range(k+1,a):
		if c[k]==c[l]:
			x=x+1
print(x)

Fixed submission:
import numpy as np
from collections import Counter
a=int(input())
c=[0]*a
d=[0]*10
x=0
y=a
z=0
for i in range(a):
	e=input()
	for j in range(10):
		d[j]=e[j]
	d.sort()
	c[i]=d[0]+d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+d[7]+d[8]+d[9]

mycounter = Counter(c)
lst=[]
for e in mycounter.items():
    lst.extend(e)
for t in range(1,len(lst),2):
	k=lst[t]
	z=int(z+(k*(k-1)/2))
print(z)
Buggy python submission (verdict: Runtime Error):
x=int(input())
y=int(input())
z=int(input())
if x==1:
	print('Hello World')
else:
	print(y+z)

Fixed submission:
x=int(input())
if x==1:
	print('Hello World')
else:
	y=int(input())
	z=int(input())
	print(y+z)
Buggy python submission (verdict: Runtime Error):
x=input()
x=list(x)
t=0
k=0
while t==0:
	if x[k]!="1":
		t=x[k]
	k=k+1
print(t)

Fixed submission:
x=input()
m=int(input())
x=list(x)

if len(x)<m:
	m=len(x)
t=1
for i in range(m):
	if x[i]!='1' and t==1:
		t=x[i]
t=int(t)
print(t)

Buggy python submission (verdict: Runtime Error):
x=input()
x=list(x)
t=0
k=0
while t==0:
	if x[k]!="1":
		t=x[k]
	k=k+1
t=int(t)
print(t)

Fixed submission:
x=input()
m=int(input())
x=list(x)

if len(x)<m:
	m=len(x)
t=1
for i in range(m):
	if x[i]!='1' and t==1:
		t=x[i]
t=int(t)
print(t)
Buggy python submission (verdict: Runtime Error):
10 11a = [int(i) for i in input().split()]
b=a[0]
c=a[1]
x=c-b
print(round((x+1)*x/2)-c)

Fixed submission:
a = [int(i) for i in input().split()]
b=a[0]
c=a[1]
x=c-b
print(round((x+1)*x/2)-c)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
ans=0
while ans==0:
	for i in range(a):
		if b[i]%10!=0 and sum(b)%10==0:
			ans=sum(b)-b[i]
			break
print(ans)

Fixed submission:
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
ans=sum(b)
d=0
for i in range(a):
	if b[i]%10!=0 and sum(b)%10==0 :
		ans=sum(b)-b[i]
		d=1
		break
if d==1 or ans%10!=0:
	print(ans)
else:
	print(0)