Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]

mem = [k - len(a)] * n
for i in range(len(a)):
    mem[a[i]] += 1

for i in range(n):
    if mem[i] > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]

mem = [k - len(a)] * n
for i in range(len(a)):
    mem[a[i]-1] += 1

for i in range(n):
    if mem[i] > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

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

def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]

for i in range(m):
    m -= 0
    a = heapsort(a)
    a[-1] = a[-1] // 2

print(sum(a))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""


Fixed submission:
import heapq

n,m = map(int, input().split())
#a = list(map(int, input().split()))
a = [-int(n) for n in input().split()]

heapq.heapify(a)

for i in range(m):
    tmp = heapq.heappop(a)
    tmp = int(tmp/2)
    heapq.heappush(a,tmp)

print(-sum(a))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""
"""
def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]
"""

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.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))


Fixed submission:
import heapq

n,m = map(int, input().split())
#a = list(map(int, input().split()))
a = [-int(n) for n in input().split()]

heapq.heapify(a)

for i in range(m):
    tmp = heapq.heappop(a)
    tmp = int(tmp/2)
    heapq.heappush(a,tmp)

print(-sum(a))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""
"""
def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]
"""

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.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))


Fixed submission:
import heapq

n,m = map(int, input().split())
#a = list(map(int, input().split()))
a = [-int(n) for n in input().split()]

heapq.heapify(a)

for i in range(m):
    tmp = heapq.heappop(a)
    tmp = int(tmp/2)
    heapq.heappush(a,tmp)

print(-sum(a))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""
"""
def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]
"""
Buggy python submission (verdict: Runtime Error):
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
n=0

for i in range(N-1):
    if H[i] >= H[i+1]:
        n = n+1
    else :
        n = 0
    if n > max:
        max = n

print(max)


Fixed submission:
S = input()
T = input()
ctr = 0

for i in range(len(S)):
    if S[i] == T[i]:
        ctr = ctr+1

print(ctr)
Buggy python submission (verdict: Time Limit Exceeded):
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0

for i in range(N):
    n = 0
    for j in range(i+1,N):
        if H[j-1] >= H[j]:
            n = n+1
        else :
            break
    if n > max:
        max = n

print(max)


Fixed submission:
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
n=0

for i in range(N-1):
    if H[i] >= H[i+1]:
        n = n+1
    else :
        n = 0
    if n > max:
        max = n

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0

for i in range(N):
    n = 0
    for j in range(i+1,N):
        if H[j-1] >= H[j]:
            n = n+1
        else :
            break
    if n > max:
        max = n

print(max)


Fixed submission:
#Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
n=0

for i in range(N-1):
    if H[i] >= H[i+1]:
        n = n+1
    else :
        n = 0
    if n > max:
        max = n

print(max)
Buggy python submission (verdict: Runtime Error):
#ModSum
N = int(input())

print( int(N*(N-1)//2 )

#sum = ( int(N*(N-1)/2) )
#print(sum)


Fixed submission:
#ModSum
N = int(input())

print( (N*(N-1))//2 )

#sum = ( int(N*(N-1)/2) )
#print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
 
S = input()
 
ss = []
flag = True
ans = 0
for i in range(len(S)): ss.append(S[i])
 
while flag:
    length = len(ss)
    tmp_flag = False
    for i in range(length-1):
        if ss[i] != ss[i+1]:
            rm = i
            ans += 2
            tmp_flag = True
            break
    if tmp_flag:
        ss.pop(rm)
        ss.pop(rm)
    else:
        flag = False
    
print(ans)


Fixed submission:
S = input()

ss = []
ans = 0
for i in range(len(S)): ss.append(S[i])

zeros = 0
ones = 0

for i in range(len(ss)):
    if ss[i] == "0":
        zeros += 1
    elif ss[i] == "1":
        ones += 1

ans = 2*min(zeros, ones)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

S = input()

ss = []
flag = True
ans = 0
for i in range(len(S)): ss.append(S[i])

while flag:
    length = len(ss)
    tmp_flag = False
    for i in range(length-1):
        if ss[i] != ss[i+1]:
            rm = i
            ans += 2
            tmp_flag = True
            break
    if tmp_flag:
        ss.pop(rm)
        ss.pop(rm)
    else:
        flag = False
    
print(ans)


Fixed submission:
S = input()

ss = []
ans = 0
for i in range(len(S)): ss.append(S[i])

zeros = 0
ones = 0

for i in range(len(ss)):
    if ss[i] == "0":
        zeros += 1
    elif ss[i] == "1":
        ones += 1

ans = 2*min(zeros, ones)
print(ans)
Buggy python submission (verdict: Runtime Error):
スコード 拡げる

Copy
Copy
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
T=X=Y=0
ans = "Yes"
 
for t,x,y in txy:
  a = (t-T) - (abs(X-x) + abs(Y-y))
  if a % 2 == 0 and abs(X-x) + abs(Y-y) <= t - T:
    T,X,Y = t,x,y
  else:
    ans = "No"
    break
print(ans)

Fixed submission:
N=int(input())
x=y=t=0
flag=True
for i in range(N):
  ti, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  dt = ti-t
  x, y, t = xi, yi, ti
  if dist<=dt and dist%2==dt%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")
Buggy python submission (verdict: Runtime Error):
ans = [''] * len(A)

for i in range(len(op)):
    sum = int(A[0])
    if op[i] == '+':
        sum += int(A[1])
        ans[0] = op[i]
    else:
        sum -= int(A[1])
        ans[0] = op[i]
    for j in range(len(op)):
        if op[j] == '+':
            sum += int(A[2])
            ans[1] = op[j]
        else:
            sum -= int(A[2])
            ans[1] = op[j]
        for k in range(len(op)):
            if op[k] == '+':
                sum += int(A[3])
                ans[2] = op[k]
            else:
                sum -= int(A[3])
                ans[2] = op[k]
            if sum == 7:
                print(A[0]+ans[0]+A[1]+ans[1]+A[2]+ans[2]+A[3]+'=7')
                exit()


Fixed submission:
A = input()

op = ['+', '-']

for i in range(len(op)):
    for j in range(len(op)):
        for k in range(len(op)):
            if eval(A[0]+op[i]+A[1]+op[j]+A[2]+op[k]+A[3]) == 7:
                print(A[0]+op[i]+A[1]+op[j]+A[2]+op[k]+A[3]+'=7')
                exit()
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

tmp = 'UNRESTORABLE' 
ans = []
flag = True

for i in range(len(S)):
    if S[i] == T[0]:
        for j in range(0, len(T)):
            if S[i+j] != T[j] and S[i+j] != '?':
                flag = False
            ans.append(T[j])
    elif len(ans) < len(S):
        if S[i] == '?':
            ans.append('a')
        else:
            ans.append(S[i])

for i in range(len(T)):
    if not T[i] in ans:
        flag = False
if flag:
    for i in range(len(ans)):
        print(ans[i], end='')
    print()
else:
    print(tmp)    


Fixed submission:
S = input()
T = input()

ans = 'UNRESTORABLE' 

def match(k):
    for i in range(len(T)):
        if T[i] != S[i+k] and S[i+k] != '?':
            return False
    return True

def construct(k):
    ans = []
    for i in range(len(S)): ans.append(S[i])
    for i in range(len(T)): ans[i+k] = T[i]
    for i in range(len(S)):
        if ans[i] == '?':
            ans[i] = 'a'
    return ans

for i in range(len(S)-len(T)+1):
    if match(i):
        ans=construct(i)

for i in range(len(ans)):
    print(ans[i], end='')
print()
Buggy python submission (verdict: Runtime Error):
S = input()

for i in range(len(S)):
  if S[i] == 'A' ans S[i+1]:
    print('Yes')
    exit()
print('No')

Fixed submission:
S = input()

for i in range(len(S)):
    if S[i] == 'A' and S[i+1]=='C':
        print('Yes')
        exit()

print('No')

Buggy python submission (verdict: Runtime Error):
S = input()

for i in range(len(S)):
  if S[i] == 'A' ans S[i+1]:
    print('Yes')
    exit()
print('No')

Fixed submission:
S = input()

for i in range(len(S)):
    if S[i] == 'A' and S[i+1]=='C':
        print('Yes')
        exit()

print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

INF = 10**9 + 7

def frac(n):
    ans = n
    while n>1:
        ans *= (n-1)
        n -= 1
    return ans
    # if n<= 1:
    #     return 1
    # return n*frac(n-1)
    
if abs(N-M) > 1:
    print(0)
elif abs(N-M) == 1:
    print(frac(N)*frac(M)%INF)
else:
    print(((frac(N)*frac(M))*2)%INF)


Fixed submission:
from math import factorial as frac

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

INF = 10**9 + 7

if abs(N-M) > 1:
    print(0)
elif abs(N-M) == 1:
    print(frac(N)*frac(M)%INF)
else:
    print(((frac(N)*frac(M))*2)%INF)

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

INF = 10**9 + 7

def frac(n):
    ans = n
    while n>1:
        ans *= (n-1)
        n -= 1
    return ans
    # if n<= 1:
    #     return 1
    # return n*frac(n-1)
    
if abs(N-M) > 1:
    print(0)
elif abs(N-M) == 1:
    print(frac(N)*frac(M)%INF)
else:
    print(((frac(N)*frac(M))*2)%INF)


Fixed submission:
from math import factorial as frac

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

INF = 10**9 + 7

if abs(N-M) > 1:
    print(0)
elif abs(N-M) == 1:
    print(frac(N)*frac(M)%INF)
else:
    print(((frac(N)*frac(M))*2)%INF)
Buggy python submission (verdict: Runtime Error):
ans = [0]*8
leng = 0

for i in range(N):
    if 1 <= A[i] <= 399:
        ans[0] = 1
    elif 400 <= A[i] <= 799:
        ans[1] = 1
    elif 800 <= A[i] <= 1199:
        ans[2] = 1
    elif 1200 <= A[i] <= 1599:
        ans[3] = 1
    elif 1600 <= A[i] <= 1999:
        ans[4] = 1
    elif 2000 <= A[i] <= 2399:
        ans[5] = 1
    elif 2400 <= A[i] <= 2799:
        ans[6] = 1
    elif 2800 <= A[i] <= 3199:
        ans[7] = 1
    else:
        leng += 1

maxi = sum(ans)+leng
mini = sum(ans)

if sum(ans)+leng >= 8:
    maxi = 8
if sum(ans) < 1:
    mini = 1

print(mini, maxi)


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

ans = [0]*8
leng = 0

for i in range(N):
    if 1 <= A[i] <= 399:
        ans[0] = 1
    elif 400 <= A[i] <= 799:
        ans[1] = 1
    elif 800 <= A[i] <= 1199:
        ans[2] = 1
    elif 1200 <= A[i] <= 1599:
        ans[3] = 1
    elif 1600 <= A[i] <= 1999:
        ans[4] = 1
    elif 2000 <= A[i] <= 2399:
        ans[5] = 1
    elif 2400 <= A[i] <= 2799:
        ans[6] = 1
    elif 2800 <= A[i] <= 3199:
        ans[7] = 1
    else:
        leng += 1

mi = sum(ans) if sum(ans) > 0 else 1
print(mi, sum(ans) + leng)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 1
for i in range(1, N+1):
    ans *= i

print(ans%(10**9+7))


Fixed submission:
from math import factorial

N = int(input())

print(factorial(N)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import sys
from sys import stdin

N, k = [int(x) for x in stdin.readline().rstrip().split()]

if K < 2:
    raise Exception('Error!')

sum = K
for i in range(N-1):
    sum = sum*(K-1)

if __name__ == '__main__':
    print(sum)

"""
def myfunc(n, k):
    if n <= 0:
        return k
    n = int(n-1)
    k = k*(k-1)
    return myfunc( n,k )

if __name__ == '__main__':
    print(int(myfunc(N, K)))
"""


Fixed submission:
import sys
from sys import stdin

N, K = [int(x) for x in stdin.readline().rstrip().split()]

if K < 2:
    raise Exception('Error!')

sum = K
for i in range(N-1):
    sum = sum*(K-1)

if __name__ == '__main__':
    print(sum)

"""
def myfunc(n, k):
    if n <= 0:
        return k
    n = int(n-1)
    k = k*(k-1)
    return myfunc( n,k )

if __name__ == '__main__':
    print(int(myfunc(N, K)))
"""

Buggy python submission (verdict: Runtime Error):
import sys
from sys import stdin

N, k = [int(x) for x in stdin.readline().rstrip().split()]

if K < 2:
    raise Exception('Error!')

sum = K
for i in range(N-1):
    sum = sum*(K-1)

if __name__ == '__main__':
    print(sum)

"""
def myfunc(n, k):
    if n <= 0:
        return k
    n = int(n-1)
    k = k*(k-1)
    return myfunc( n,k )

if __name__ == '__main__':
    print(int(myfunc(N, K)))
"""


Fixed submission:
import sys
from sys import stdin

N, K = [int(x) for x in stdin.readline().rstrip().split()]

if K < 2:
    raise Exception('Error!')

sum = K
for i in range(N-1):
    sum = sum*(K-1)

if __name__ == '__main__':
    print(sum)

"""
def myfunc(n, k):
    if n <= 0:
        return k
    n = int(n-1)
    k = k*(k-1)
    return myfunc( n,k )

if __name__ == '__main__':
    print(int(myfunc(N, K)))
"""
Buggy python submission (verdict: Runtime Error):
n=list(input())
if sum(n)%9==0:
  print("Yes")
else:
  print("No")

Fixed submission:
n=input()
ls=[]
for i in n:
    ls.append(int(i))
if sum(ls)%9==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
def inp():
    ls=list(map(int,input().split()))
    return ls
x,n=map(int,input().split())
ls=inp()
ls.sort()
if n==0:
    print(x)
    exit(0)
else:
    ans=0
    d=1000000000
    for i in range(1,101):
        if i in ls:
            continue
        tmp=abs(x-i)
        if tmp<d:
            d=tmp
            ans=i
    print(ans)

Fixed submission:
x,y=map(int,input().split())
if x==1 and x*4>=y and y%2==0 and x*2<=y:
  print('Yes')
elif x*4>= y and y%2==0 and x*2<=y:
    print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
def inp():
    ls=set(map(int,input().split()))
    return ls
x,n=map(int,input().split())
if n==0:
    print(x)
    exit(0)
ls=inp()
ls.sort()
ans=0
d=float('inf')
for i in range(1, 102):
    if i in ls:
        continue
    tmp = abs(x - i)
    if tmp < d:
        d = tmp
        ans = i
print(ans)

Fixed submission:
def inp():
    ls=list(map(int,input().split()))
    return ls
x,n=map(int,input().split())
ls=inp()
ans=0
d=float('inf')
for i in range(102):
    if i in ls:
        continue
    tmp = abs(x - i)
    if tmp < d:
        d = tmp
        ans = i
print(ans)

Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
ls=inp()
ls.sort()
if n==0:
    print(x)
    exit(0)
else:
    a=x-1
    b=x+1
    flag=False
    while(not flag):
        if a not in ls:
            print(a)
            exit(0)
        else:
            a-=1
        if b not in ls:
            print(b)
            exit(0)
        else:
            b+=1

Fixed submission:
def inp():
    ls=list(map(int,input().split()))
    return ls
x,n=map(int,input().split())
ls=inp()
ans=0
d=float('inf')
for i in range(102):
    if i in ls:
        continue
    tmp = abs(x - i)
    if tmp < d:
        d = tmp
        ans = i
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(float,input().split())
a=int(a)
print(math.trunc(a*b))

Fixed submission:
a,b=map(float,input().split())
a=int(a)
print((round(b*100)*a)//100)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ls=list(map(int,input().split()))
copy=[0]*n
for i in range(n):
  copy[ls[i]-1=i+1
for i in copy:
       print(i,end=" ")
  

Fixed submission:
n=int(input())
ls=list(map(int,input().split()))
copy=[0]*n
for i in range(n):
    copy[ls[i]-1]=i+1
for i in copy:
       print(i,end=" ")
Buggy python submission (verdict: Runtime Error):
def main():
    temp = [True] * (10 ** 12)
    temp[0] = False
    temp[1] = False
    for i in range(2, 10 ** 12):
        if temp[i]:
            cnt = 2 * i
            while cnt < 10 ** 12:
                temp[cnt] = False
                cnt += i
    prime = []
    for i in range(10 ** 12):
        if temp[i]:
            prime.append(i)

    n = int(input())
    ans = 0
    for i in prime:
        if i > n ** 0.5 + 1:
            break
        if n % i:
            continue
        div = 0
        tempN = n
        while True:
            cnt = 1
            while tempN % (i ** (2 * cnt)) == 0:
                cnt += 1
            if tempN % (i ** cnt):
                break
            div += cnt
            tempN = tempN // (i ** cnt)
        #print(div)
        if div > 2:
            div = int((div * 2) ** 0.5)
        else:
            div = 1
        #print(i, div, tempN)
        ans += div

    print(ans)
    return

if __name__ == "__main__":
    main()

Fixed submission:
# Contest No.: ABC169
# Problem No.: D
# Solver:      JEMINI
# Date:        20200531

import sys
import heapq

def main():
    temp = [True] * (10 ** 6 + 10)
    temp[0] = False
    temp[1] = False
    for i in range(2, 10 ** 6 + 10):
        if temp[i]:
            cnt = 2 * i
            while cnt < 10 ** 6 + 10:
                temp[cnt] = False
                cnt += i
    prime = []
    for i in range(10 ** 6 + 10):
        if temp[i]:
            prime.append(i)
 
    n = int(input())
    ans = 0
    tempN = n
    for i in prime:
        if i > tempN:
            break
        if tempN % i:
            continue
        div = 0
        while tempN % i == 0:
            tempN = tempN // i
            div += 1
        tempAns = int((div * 2) ** 0.5)
        if tempAns * (tempAns + 1) // 2 > div:
            tempAns -= 1
        #print(tempAns)
        ans += tempAns
    if tempN > 1:
        ans += 1
    print(ans)
    return
 
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = [0] * (n + 1)
loop = int((n/6) ** 1.5) + 1

def f(i, j, k):
    return i ** 2 + j ** 2 + k ** 2 + i*j + j*k + k*i

for i in range(1, loop+1):
    for j in range(1, loop+1):
        for k in range(1, loop+1):
            res = int(f(i, j, k))
            if res <= n:
                ans[res] += 1

for a in ans[1:]:
    print(a)


Fixed submission:
n = int(input())
ans = [0] * (n + 1)
loop = int(n ** .5) + 1

def f(i, j, k):
    return i ** 2 + j ** 2 + k ** 2 + i*j + j*k + k*i

for i in range(1, loop+1):
    for j in range(1, loop+1):
        for k in range(1, loop+1):
            res = int(f(i, j, k))
            if res <= n:
                ans[res] += 1

for a in ans[1:]:
    print(a)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input.split())
c,d=map(int,input.split())
print((c-a)*(d-b))

Fixed submission:
a,b = map(int,input().split())
c,d=map(int,input().split())
print((c-a)*(d-b))
Buggy python submission (verdict: Time Limit Exceeded):
def run():
	N, M = (int(x) for x in input().split())
	i = 2
	result = 1

	while True:
		if M % i == 0 and N * i <= M:
			result = i

		i += 1
		if i * N > M:
			break

	print(result)



if __name__ == '__main__':
	run()

Fixed submission:
def run():
	N, M = (int(x) for x in input().split())
	i = 2
	result = 1

	for i in range(M // N, 0, -1):
		if M % i == 0:
			print(i)
			break



if __name__ == '__main__':
	run()
Buggy python submission (verdict: Runtime Error):
def hoge(t, i):
	global data
	if lists[i][1] > t:
		t = lists[i][1]
	C, S, F = lists[i][0], lists[i][1], lists[i][2]

	return (t // F + 1) * F + C

if __name__ == '__main__':
	N = int(input())
	data = list()

	for i in range(N - 1):
		l = input().split()
		list.append(l)

	for i in range(N):
		t = 0
		for j in range(N-i):
			t = hoge(t,j)
		print(t)



Fixed submission:
def hoge(t, i):
	global data
	C, S, F = int(data[i][0]), int(data[i][1]), int(data[i][2])
	if S > t:
		t = S
	if t % F != 0:
		t += F - t % F
	return t + C

if __name__ == '__main__':
	N = int(input())
	data = list()

	for i in range(N - 1):
		l = input().split()
		data.append(l)

	for i in range(N - 1):
		t = 0
		for j in range(i, N - 1):
			t = hoge(t,j)
		print(t)
	print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += A[i] * sum(A[i + 1:])
    ans %= 1000000007
print(ans)


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

ans = 0
sum_list = sum(A)
for i in range(N):
    ans += A[i] * (sum_list - A[i])
    ans %= 1000000007
    sum_list -= A[i]
print(ans)

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

ans = 0
for i in range(N):
    for j in range(i,N):
        if (i != j):
            ans += (A[i] * A[j])
            ans %= 1000000007
print(ans)

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

ans = 0
sum_list = sum(A)
for i in range(N):
    ans += A[i] * (sum_list - A[i])
    ans %= 1000000007
    sum_list -= A[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# 入力
N,K = list(map(int, input().split()))
A_list = list(map(int, input().split()))

for i in range(N-K):
    score1, score2 = (1,1)
    for j in range(K):
        score1 *= A_list[i+j]
        score2 *= A_list[i+j+1]
    if((score2 - score1) > 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
# 入力
N,K = list(map(int, input().split()))
A_list = list(map(int, input().split()))

for i in range(N-K):
    if((A_list[i+K] - A_list[i]) > 0):
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
# 入力
N,K = list(map(int, input().split()))
A_list = list(map(int, input().split()))

for i in range(N-K):
    score1 = A_list[i] * A_list[i+1] * A_list[i+2]
    score2 = A_list[i+1] * A_list[i+2] * A_list[i+3]
    if((score1 - score2) > 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
# 入力
N,K = list(map(int, input().split()))
A_list = list(map(int, input().split()))

for i in range(N-K):
    if((A_list[i+K] - A_list[i]) > 0):
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
# 入力
N,L = list(map(int, input().split()))
S = []
for _ in range(N):
    S.add(str(input()))

# 出力
print(''.join(sorted(S)))

Fixed submission:
# 入力
N,L = list(map(int, input().split()))
S = []
for _ in range(N):
    S += [str(input())]

# 出力
print(''.join(sorted(S)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
M = 1000000007
sm = 0
for i in range(n):
	for j in range(i+1,n):
		sm = (sm%M + (l[i] * l[j])%M) % M
print(sm)


Fixed submission:
n = int(input())
l = list(map(int,input().split()))
M = 1000000007
sm = 0
for i in l:
	sm = (sm + i)
sms = pow(sm,2)
ss = 0
for i in range(n):	
	ss = (ss + (l[i] * l[i]))
print(((sms - ss)//2)%M)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
l = list(map(int,input().split()))
p1 = 1
for i in range(k):
	p1 *= l[i]
for i in range(k,n):
	p2 = p1
	p2 *= l[i]
	p2 //= l[i-k]
	#print(p1,p2)
	print('Yes' if p2 > p1 else 'No')
	p1 = p2

Fixed submission:
n,k = map(int,input().split())
l = list(map(int,input().split()))
p1 = 0
for i in range(k):
	p1 += l[i]
for i in range(k,n):
	p2 = p1
	p2 += l[i]
	p2 -= l[i-k]
	#print(p1,p2)
	print('Yes' if p2 > p1 else 'No')
	p1 = p2