Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
A = []
Index = 0

def getRate(list, int1, int2):
    value = 1
    for i in range(int1, int2):
        value = value * list[i]
    return value

for i in range(N-K+1):
    A.append(getRate(a, i, K + i))

for i in range(len(A)-1):
    if A[i] < A[i+1]:
        print("Yes")
    else:
        print("No")


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

ans = []
flag = 1
for i in range(N):
    if a[i] < a[i + K]:
        print('Yes')
    else:
        print("No")
    flag += 1
    if flag == N-K+1:
        break

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
A = []
Index = 0

def getRate(list, int1, int2):
    value = 1
    for i in range(int1, int2):
        value = value * list[i]
    return value



for i in range(N-K+1):
    A.append(getRate(a, i, K + i))

ans = []

for i in range(len(A)-1):
    if A[i] < A[i+1]:
        ans.append("Yes")
    else:
        ans.append("No")

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

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

ans = []
flag = 1
for i in range(N):
    if a[i] < a[i + K]:
        print('Yes')
    else:
        print("No")
    flag += 1
    if flag == N-K+1:
        break
Buggy python submission (verdict: Time Limit Exceeded):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0]
b = [0]
T = 0
ans = 0

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

for i in range(N+1):
  for j in range(M+1):
    T = a[i] + b[j]
    if T <= K:
      ans = max(ans, (i + j))
    else:
      pass


print(ans)

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

a = [0]
b = [0]
T = 0
ans = 0

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

j = M

for i in range(N+1):
  if a[i] > K:
    break
  while a[i] + b[j] > K:
    j -= 1
  ans = max(ans, i + j)


print(ans)

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

a = [0]
b = [0]
T = 0
ans = []

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

for i in range(N+1):
  for j in range(M+1):
    T = a[i] + b[j]
    if T <= K:
      ans.append(i + j)

    else:
      pass


print(max(ans))

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

a = [0]
b = [0]
T = 0
ans = 0

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

j = M

for i in range(N+1):
  if a[i] > K:
    break
  while a[i] + b[j] > K:
    j -= 1
  ans = max(ans, i + j)


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

s = len(S)

if S != T[:s]:
  print("No")

else:
  if (s + 1) = len(T):
    print("Yes")
  else:
    print("No")


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

s = len(S)

if S != T[:s]:
  print("No")

else:
  if (s + 1) == len(T):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

K = int(input())

ans = 0

for h in range(1, K+1):
  for i in range(1, K+1):
    for j in range(1, K+1):
      ans += math.gcd(h, math.gcd(i, j))

print(ans)

Fixed submission:
from math import gcd

K = int(input())

ans = 0

for h in range(1, K+1):
  for i in range(1, K+1):
    for j in range(1, K+1):
      ans += gcd(h, gcd(i, j))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0

for h in range(1, K+1):
  for i in range(1, K+1):
    for j in range(1, K+1):
      ans += gcd(h, i, j)

print(ans)

Fixed submission:
from math import gcd

K = int(input())

ans = 0

for h in range(1, K+1):
  for i in range(1, K+1):
    for j in range(1, K+1):
      ans += gcd(h, gcd(i, j))

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

A.sort(reverse=True)

if A[M] < 1/(4*M)*sum(A):
    print("No")
else:
    print("Yes")

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

A.sort(reverse=True)

if A[M-1] < 1/(4*M)*sum(A):
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

if N == 0 or K == 1:
    N = 0
elif N == K:
    N = 0
elif N % K == 0:
    N = 0
else:
    while N != 0:
        m = abs(N - K)
        if N < m:
            break
        else:
            N = m

print(N)

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

if N == 0 or K == 1:
    N = 0
elif N == K:
    N = 0
elif N % K == 0:
    N = 0
else:
    N = N % K
    while N != 0:
        m = abs(N - K)
        if N < m:
            break
        else:
            N = m

print(N)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
ABalls = "B" * A
BBalls = "R" * B

Balls = ABalls + BBalls
AB = A + B
NumBBalls = 0

NumBBalls = N//AB * A
M = N%AB

for m in range(M):
  if Balls[m] == "B":
    NumBBalls += 1
  else:
    break

print(NumBBalls)

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

AB = A + B
NumABalls = 0

NumABalls = N//AB * A
M = N%AB

if A - M >= 0:
  NumABalls += M
else:
  NumABalls += A

print(NumABalls)

Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split())
ABalls = ""
BBalls = ""
for a in range(A):
  ABalls += "B" 
for b in range(B):
  BBalls += "R"

Balls = ABalls + BBalls
AB = A + B
NumBBalls = 0

NumBBalls = N//AB * A

M = N%AB

for m in range(M):
  if Balls[m] == "B":
    NumBBalls += 1
  else:
    break

print(NumBBalls)

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

AB = A + B
NumABalls = 0

NumABalls = N//AB * A
M = N%AB

if A - M >= 0:
  NumABalls += M
else:
  NumABalls += A

print(NumABalls)

Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split())
ABalls = ""
BBalls = ""
for a in range(A):
  ABalls += "B" 
for b in range(B):
  BBalls += "R"

Balls = ABalls + BBalls
AB = A + B
NumBBalls = 0

while N > AB:
  N -= AB
  NumBBalls += A

for n in range(N):
  if Balls[n] == "B":
    NumBBalls += 1
  else:
    break

print(NumBBalls)

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

AB = A + B
NumABalls = 0

NumABalls = N//AB * A
M = N%AB

if A - M >= 0:
  NumABalls += M
else:
  NumABalls += A

print(NumABalls)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
S = [input() for i in range(N)]
C = collections.Counter(S)

ans = []
flag = 0

for n in range(len(C)):
    if int(C.most_common()[n][1]) < flag:
        break
    else:
        ans.append(C.most_common()[n][0])
        flag = int(C.most_common()[n][1])

ans.sort()

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

Fixed submission:
import collections

N = int(input())
S = [input() for i in range(N)]
C = collections.Counter(S)
L = C.most_common()

ans = []
flag = 0

for n in range(len(C)):
    if L[n][1] < flag:
        break
    else:
        ans.append(L[n][0])
        flag = (L[n][1])

ans.sort()

for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
ks = list(map(int, input().split()))
k = min(ks)
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if ks[1] == x + y + z:
                ans += 1
            else:
                pass

print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z >=0 and z <= k:
            ans += 1
        else:
            pass
        

print(ans)

Buggy python submission (verdict: Runtime Error):
ks = list(map(int, input().split()))
k = min(ks)
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if s == x + y + z:
                ans += 1
            else:
                pass

print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z >=0 and z <= k:
            ans += 1
        else:
            pass
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if s == x + y + z:
                ans += 1
            else:
                pass

print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z >=0 and z <= k:
            ans += 1
        else:
            pass
        

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc174/tasks/abc174_c
K= int(input(" "))

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B%K==0:
            print(i)
            break
        else:
            B = 10 * B + 7
            i = i + 1

Fixed submission:
#https://atcoder.jp/contests/abc174/tasks/abc174_c
K= int(input())

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B==0:
            print(i)
            break
        else:
            B = (10 * B + 7) % K
            i = i + 1

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc174/tasks/abc174_c

K= int(input(" "))

B= 7

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    i = 1
    while 1:
        i= i+1
        B = 10*B + 7
        if B%K==0:
            print(i)
            break

Fixed submission:
#https://atcoder.jp/contests/abc174/tasks/abc174_c
K= int(input())

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B==0:
            print(i)
            break
        else:
            B = (10 * B + 7) % K
            i = i + 1
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc150/tasks/abc150_a
K= [ ]
K= int(input())

X= [ ]
X= int(input())

if 500*K<X:
    print("No")
elif 500*K==X:
    print("Yes")
elif 500*K>X:
    print("Yes")

Fixed submission:
#https://atcoder.jp/contests/abc150/tasks/abc150_a

K, X= map(int, input().split())

if 500*K<X:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc150/tasks/abc150_a
K= [ ]
K= int(input())

X= [ ]
X= int(input())

if 500*K<X:
    print("No")
else:
    print("Yes")

Fixed submission:
#https://atcoder.jp/contests/abc150/tasks/abc150_a

K, X= map(int, input().split())

if 500*K<X:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc150/tasks/abc150_a
K= int(input())

X= int(input())

if 500*K<X:
    print("No")
else:
    print("Yes")

Fixed submission:
#https://atcoder.jp/contests/abc150/tasks/abc150_a

K, X= map(int, input().split())

if 500*K<X:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc150/tasks/abc150_b
N= int(input())

A= []
s= input()
A= list(s)

#print(A)

add = 0
for i in range(0, N-1):
    if A[i]== 'A' and A[i+1]=='B' and A[i+2]=='C':
        add = add + 1

print(add)

Fixed submission:
#https://atcoder.jp/contests/abc150/tasks/abc150_b
N= int(input())
s= input()

A= []
A= list(s)

#print(A)

add = 0
for i in range(0, N-2):
    if A[i]== 'A' and A[i+1]=='B' and A[i+2]=='C':
        add = add + 1

print(add)

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc150/tasks/abc150_b
N= int(input())

A= []
s= input()
A= list(s)


print(A)

add = 0
for i in range(0, N-1):
    if A[i]== 'A' and A[i+1]=='B' and A[i+2]=='C':
        add = add + 1

print(add)

Fixed submission:
#https://atcoder.jp/contests/abc150/tasks/abc150_b
N= int(input())
s= input()

A= []
A= list(s)

#print(A)

add = 0
for i in range(0, N-2):
    if A[i]== 'A' and A[i+1]=='B' and A[i+2]=='C':
        add = add + 1

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

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
a.sort()
ans=1
b=10**18
for i in a:
    ans*=i
    if ans > b:
        ans=-1
        break
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 == 0:
        break
    if ans > 10 ** 18:
        ans=-1
print(ans)

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
a.sort()
ans=1
b=10**18
for i in a:
    ans*=i
    if ans > b:
        ans=-1
        break
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 == 0:
        break
if ans > 10 ** 18:
    ans=-1
print(ans)

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
a.sort()
ans=1
b=10**18
for i in a:
    ans*=i
    if ans > b:
        ans=-1
        break
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:
    ans=-1
print(ans)

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
a.sort()
ans=1
b=10**18
for i in a:
    ans*=i
    if ans > b:
        ans=-1
        break
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:
    ans=-1
print(ans)

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
a.sort()
ans=1
b=10**18
for i in a:
    ans*=i
    if ans > b:
        ans=-1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input().split())
ans=a//2
if a%2 == 1:
  ans=ans+1
print(ans)


Fixed submission:
a=int(input())
ans=a//2
if a%2 == 1:
  ans=ans+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,r=map(input().split())
if n<10:
  r=r+100*(10-n)
print(r)

Fixed submission:
n,r=map(int,input().split())
if n<10:
  r=r+100*(10-n)
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
ans=0
while n!=0:
  if n//k!=0:
    ans=ans+1
  elif n%k!=0:
    ans=ans+1
print(ans)


Fixed submission:
n,k=map(int,input().split())
ans=0
while n!=0:
  if n//k!=0:
    ans=ans+1
  elif n%k!=0:
    ans=ans+1
  n=n//k
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p = list(map(int,input().split()))
# print(p)
min=300000
ans=0

for i in range(n):
    if i == 0:
        ans+=1
        continue

    for j in range(i):
        # print(p[i],p[j],i,j)
        if p[i] > min:
            break
        elif p[i] < min:
            min = p[i]
        if p[i] > p[j]:
            break
        elif j == i-1:
            ans+=1

print(ans)


Fixed submission:
n=int(input())
p = list(map(int,input().split()))
# print(p)
min=p[0]
ans=0

for i in range(n):
    if i == 0:
        ans+=1
        continue
    if p[i] > min:
        continue
    if p[i] < min:
        min=p[i]
        ans+=1

print(ans)

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

for i in range(n):
    if i == 0:
        ans+=1
        continue

    for j in range(i):
        # print(p[i],p[j],i,j)
        if p[i] > p[j]:
            break
        elif j == i-1:
            ans+=1

print(ans)


Fixed submission:
n=int(input())
p = list(map(int,input().split()))
# print(p)
min=p[0]
ans=0

for i in range(n):
    if i == 0:
        ans+=1
        continue
    if p[i] > min:
        continue
    if p[i] < min:
        min=p[i]
        ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
a=0
b=0

list=[]

for i in range(k):
    list.append(s)

if len(list) < n:
    for i in range(n-len(list)):
        list.append(s-1)

for i in list:
    print(i,end=" ")

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

a = 0
ans = 0

if h < w:
    a = w
else:
    a = h

ans = n // a
# int(ans)
if n % a > 0:
    ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
h=(int)input()
w=(int)input()
n=(int)input()

if h < w:
    a =w
else:
    a=h

ans=n/a
if n%a > 0:
    ans+=1

print(ans)

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

a = 0
ans = 0

if h < w:
    a = w
else:
    a = h

ans = n // a
# int(ans)
if n % a > 0:
    ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
h=input()
w=input()
n=input()

if h < w:
    a =w
else:
    a=h

ans=n/a
if n%a > 0:
    ans+=1

print(ans)

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

a = 0
ans = 0

if h < w:
    a = w
else:
    a = h

ans = n // a
# int(ans)
if n % a > 0:
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
a=0
b=0
if s % 2 == 1:
    a=(s-1)/2
    b=a+1
else:
    a=s/2
    b=s/2

if a==b:
    a-=1
    b+=1

a=int(a)
b=int(b)

list=[]
while k!=0:
    if k == 1:
        list.append(s)
        k-=1
    elif k >= 2:
        list.append(a)
        list.append(b)
        k-=1
    print(list,k)

if len(list) < n:
    for i in range(n-len(list)):
        list.append(s-1)

for i in list:
    print(i,end=" ")


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

list=[]

for i in range(k):
    list.append(s)

if len(list) < n:
    for i in range(n-len(list)):
        if s == 1:
            list.append(s+1)
        else:
            list.append(s-1)

for i in list:
    print(i,end=" ")

Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
a=0
b=0
if s % 2 == 1:
    a=(s-1)/2
    b=a+1
else:
    a=s/2
    b=s/2

a=int(a)
b=int(b)

list=[]
while k!=0:
    if k == 1:
        list.append(s)
        k-=1
    elif k >= 2:
        list.append(a)
        list.append(b)
        k-=1
    print(list,k)

if len(list) < n:
    for i in range(n-len(list)):
        list.append(s-1)

for i in list:
    print(i,end=" ")


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

list=[]

for i in range(k):
    list.append(s)

if len(list) < n:
    for i in range(n-len(list)):
        if s == 1:
            list.append(s+1)
        else:
            list.append(s-1)

for i in list:
    print(i,end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())

for i in range(K):
    if A != 0:
        A -= 1
    elif B != 0:
        B -= 1
    else:
        pass

print("{} {}".format(A,B))

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

if A <= K :
    K -= A
    A = 0
    if B <= K :
        K -= B
        B = 0
    else:
        B -= K
else:
    A -= K

print("{} {}".format(A,B))

Buggy python submission (verdict: Runtime Error):
A,B,K = input().split()

for i in range(K):
    if A != 0:
        A -= 1
    elif B != 0:
        B -= 1
    else:
        pass

print(A+" "+B)

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

if A <= K :
    K -= A
    A = 0
    if B <= K :
        K -= B
        B = 0
    else:
        B -= K
else:
    A -= K

print("{} {}".format(A,B))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print(6-a-b)

Fixed submission:
a=int(input())
b=int(input())
print(6-a-b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a,b=input().split()
str=""
for i in range(n):
  str+=a[i]+b[i]
  
 print(str)

Fixed submission:
n=int(input())
a,b=input().split()
str=""
for i in range(n):
    str+=a[i]+b[i]
print(str)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
p = 0
for n in range(N):
  for m in range(n+1, N):
    p += X[n]*X[m]
  if p >= 10**9 + 7:
     p = p % (10**9 + 7)
      
      #while p >= 10**9 + 7:
        #p -= 10**9 + 7
      
print(p)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
p = 0
s = sum(X)
for n in range(N):
  s -= X[n] 
  s = s % (10**9 + 7)
  p += s * X[n]
  p = p % (10**9 + 7)

print(p)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
p = 0
for n in range(N):
  for m in range(n+1, N):
    p += X[n]*X[m]
  if p >= 10**9 + 7:
    while p >= 10**9 + 7:
      p -= 10**9 + 7
      
print(p)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
p = 0
s = sum(X)
for n in range(N):
  s -= X[n] 
  s = s % (10**9 + 7)
  p += s * X[n]
  p = p % (10**9 + 7)

print(p)

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
p = 0
for n in range(N):
  for m in range(n+1, N):
    p += X[n]*X[m]
    if p >= 10**9 + 7:
  while p >= 10**9 + 7:
    p -= 10**9 + 7
      
print(p)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
p = 0
s = sum(X)
for n in range(N):
  s -= X[n] 
  s = s % (10**9 + 7)
  p += s * X[n]
  p = p % (10**9 + 7)

print(p)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
p = 0
for n in range(N):
  for m in range(n+1, N):
    p += X[n]*X[m]
    if p >= 10**9 + 7:
      while p >= 10**9 + 7:
        p -= 10**9 + 7
      
print(p)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
p = 0
s = sum(X)
for n in range(N):
  s -= X[n] 
  s = s % (10**9 + 7)
  p += s * X[n]
  p = p % (10**9 + 7)

print(p)
Buggy python submission (verdict: Runtime Error):
A = map(int, input().split(" "))
print([10, 0][A[0] < A[1]])

Fixed submission:
A = list(map(int, input().split(" ")))
print([10, 0][A[0] < A[1]])
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split())).sorted()
print(a[0]*a[1]/2)


Fixed submission:
a = sorted(list(map(int,input().split())))
print(int(a[0]*a[1]/2))
Buggy python submission (verdict: Runtime Error):
print(["NO","YES"][x in input()])

Fixed submission:
print(["NO","YES"][input() in "357"])