Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
tmp = input()
if tmp = "0":
  print("1")
else:
  print("0")

Fixed submission:
tmp = input()
if tmp =="0":
  print("1")
else:
  print("0")
Buggy python submission (verdict: Runtime Error):
if int(input()) >=30:
  print("Yes")
if else:
  print("No")

Fixed submission:
if int(input()) >=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 1
ll = [min(l[:i+1]) for i in range(N)]
for i in range(1,N):
  if ll[i-1] > l[i]:
    ans+=1
print(ans)


Fixed submission:
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 1
ll = list()
ll.append(l[0])
for i in range(1,N):
    ll.append(min(ll[i-1],l[i]))
for i in range(1,N):
  if ll[i-1] > l[i]:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 0
for i in range(N):
  for j in range(i+1):
    if l[j] < l[i]:
      break
  else:
    ans+=1
print(ans)


Fixed submission:
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 1
ll = list()
ll.append(l[0])
for i in range(1,N):
    ll.append(min(ll[i-1],l[i]))
for i in range(1,N):
  if ll[i-1] > l[i]:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
a = [int(e) for e in input().split()]

my_sum = 0
for i in range(n-1):
#    print(a[0:n-1-i])
 #   print(a[i+1:n])
    b = np.array(a[0:n-1-i])
    c = np.array(a[i+1:n])
    my_sum += np.dot(b,c)

#sum = 0
#for i in range(n-1):
#    for j in range(i+1, n):
#       sum += a[i] * a[j]

res = my_sum % (10**9 + 7)

print(res)


Fixed submission:
n = int(input())
a = [int(e) for e in input().split()]

my_sum = [0]
#print(my_sum)

tmp = 0
c = 0
for i in a:
    my_sum.append(my_sum[c]+i)
    c += 1

#print(my_sum)

my_sum2 = 0
length = len(my_sum)

c = 0
for i in a:
    my_sum2 += i * (my_sum[length-1] - my_sum[c+1])
    c += 1

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(e) for e in input().split()]

sum = 0
for i in range(n-1):
    for j in range(i+1, n):
       sum += a[i] * a[j]

res = sum % (10**9 + 7)

print(res)


Fixed submission:
n = int(input())
a = [int(e) for e in input().split()]

my_sum = [0]
#print(my_sum)

tmp = 0
c = 0
for i in a:
    my_sum.append(my_sum[c]+i)
    c += 1

#print(my_sum)

my_sum2 = 0
length = len(my_sum)

c = 0
for i in a:
    my_sum2 += i * (my_sum[length-1] - my_sum[c+1])
    c += 1

print(my_sum2 % (10**9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
def abs_min(current, move):
    f = current+move
    b = current-move
    if abs(f) <= abs(b):
        return f
    else:
        return b
    
nums = [int(e) for e in input().split()]
current = nums[0]
num = nums[1]
move = nums[2]

for i in range(num):
    current = abs_min(current, move)

print(abs(current))


Fixed submission:
nums = [int(e) for e in input().split()]
current = nums[0]
num = nums[1]
move = nums[2]


current = abs(current)

res = current // move

if res >= num:
    print(current - move*num)
else:
    current = current - move * res
    num -= res
    if num%2 == 0:
        print(current)
    else:
        print(abs(current-move))

Buggy python submission (verdict: Time Limit Exceeded):
def abs_min(current, move):
    f = current+move
    b = current-move
    if abs(f) <= abs(b):
        return f
    else:
        return b
    
nums = [int(e) for e in input().split()]
current = nums[0]
num = nums[1]
move = nums[2]

#print(current)
for i in range(num):
    current = abs_min(current, move)
    #print(current)

print(abs(current))


Fixed submission:
nums = [int(e) for e in input().split()]
current = nums[0]
num = nums[1]
move = nums[2]


current = abs(current)

res = current // move

if res >= num:
    print(current - move*num)
else:
    current = current - move * res
    num -= res
    if num%2 == 0:
        print(current)
    else:
        print(abs(current-move))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
K=[int(n) for n in input().split()]

total=0
for i in range(N):
  total+=K[i]*sum(K[i+1:])
print(total %(10**9+7))

Fixed submission:
N=int(input())
K=[int(n) for n in input().split()]
S=sum(K)
total=0
for i in range(N):
  S-=K[i]
  total+=K[i]*S
print(total %(10**9+7))
Buggy python submission (verdict: Runtime Error):
(b1,g1,r1)=input().split()
(b,g,r)=(int(b1),int(g1),int(r1))
k=int(input())
flg=0
for i in range(K):
  if ( b> g > r):
    flg = 1
    break
  else:
    if not g > r :
      g *= 2
    elif not b > b:
      b *= 2

if flg == 1:
  print ("Yes")
else:
  print ("No")
  
    
  


Fixed submission:
(r1,g1,b1)=input().split()
(r,g,b)=(int(r1),int(g1),int(b1))
k=int(input())
flg=0
for i in range(k):
  if not g > r :
    g *= 2
  elif not b > g:
    b *= 2

if ( b > g > r):
  print ("Yes")
else:
  print ("No")
Buggy python submission (verdict: Time Limit Exceeded):
# 1行目
p_str=input().split()
(N,K)=[int(n) for n in p_str]
# 2行目
p_str=input().split()
p_int=[int(n) for n in p_str]
(A,B)=(1,1)
for i in range(N-K):
  (A,B)=(1,1)
  for j in range(K):
    B += p_int[i+j]
  for j in range(K):
    A += p_int[i+j+1]
#  print(B,A,i)
  if B < A :
    print("Yes")
  else:
    print("No")
    


Fixed submission:
# 1行目
p_str=input().split()
(N,K)=[int(n) for n in p_str]
# 2行目
p_str=input().split()
p_int=[int(n) for n in p_str]
(A,B)=(1,1)
for i in range(N-K):
  B=p_int[i]
  A=p_int[i+K]
  #  print(B,A,i)
  if B < A :
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
# 1行目
p_str=input().split()
(N,K)=[int(n) for n in p_str]
# 2行目
p_str=input().split()
p_int=[int(n) for n in p_str]
(A,B)=(1,1)
for i in range(N-K):
  (A,B)=(1,1)
  for j in range(K):
    B *= p_int[i+j]
  for j in range(K):
    A *= p_int[i+j+1]
#  print(B,A,i)
  if B < A :
    print("Yes")
  else:
    print("No")
    

Fixed submission:
# 1行目
p_str=input().split()
(N,K)=[int(n) for n in p_str]
# 2行目
p_str=input().split()
p_int=[int(n) for n in p_str]
(A,B)=(1,1)
for i in range(N-K):
  B=p_int[i]
  A=p_int[i+K]
  #  print(B,A,i)
  if B < A :
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
i = 0
for x in range(a, b+1):
  for y in range(c, c+1):
    x * y = z
    if z >= i:
      i = z
print(i)
    


Fixed submission:
a, b, c, d = map(int, input().split())
ans = a * c
if a * d > ans:
    ans = a * d
if b * c > ans:
    ans = b * c
if b * d > ans:
    ans = b * d
print(ans)
Buggy python submission (verdict: Runtime Error):
D, T, S = map(int(),input().split())
print('YES') if T * S >= D else print('No') 

Fixed submission:
D, T, S = map(int,input().split())
print('Yes') if T * S >= D else print('No')
Buggy python submission (verdict: Runtime Error):
S = list(input())

if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)

Fixed submission:
s = input()
 
if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)

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

for i in range(1, 4):
  c = "R" * i
  if c in s:
    ans = i
    
print(ans)
  


Fixed submission:
s = input()
 
if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)

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

for i in range(1, 4):
  c = "R" * i
  if c in s:
    ans = c
    
print(ans)
  


Fixed submission:
s = input()
 
if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)

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

for i in range(1, 4):
  c = "R" * i
  if c in s:
    ans = c
    
print(ans)
  

Fixed submission:
s = input()
 
if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = 0
w = 0
t = 0
r = 0
for _ in range(N):
    if input() == 'AC':
        a += 1
    elif input() == 'WA':
        w += 1
    elif input() == 'TLE':
        t += 1
    else:
        r += 1
print('AC x '+str(a))
print('WA x '+str(w))
print('TLE x '+str(t))
print('RE x '+str(r))


Fixed submission:
N = int(input())
a = 0
w = 0
t = 0
r = 0
S = []
for _ in range(N):
    S.append(str(input()))

for s in S:
    if s == 'AC':
        a += 1
    elif s == 'WA':
        w += 1
    elif s == 'TLE':
        t += 1
    else:
        r += 1
print('AC x '+str(a))
print('WA x '+str(w))
print('TLE x '+str(t))
print('RE x '+str(r))
Buggy python submission (verdict: Runtime Error):
A = input()
print('A') if A.issuper() else print('a')
  

Fixed submission:
A = input()
print('A') if A.isupper() else print('a')
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 > pow(10, 18):
    print(-1)
else:
    print(ans)

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

ans = 1
for i in A:
    ans *= i
    if ans > pow(10, 18):
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
x = intZ(input())

print(0 if x else 1)


Fixed submission:
x = int(input())

print(0 if x else 1)
Buggy python submission (verdict: Runtime Error):
inputs = map(int, input().split())

results = []
for i in (0, 1):
  for j in (2, 3):
    results.append(inputs[i] * inputs[j])

print(max(results))


Fixed submission:
inputs = [int(d) for d in input().split()]

results = []
for i in (0, 1):
  for j in (2, 3):
    results.append(inputs[i] * inputs[j])

print(max(results))

Buggy python submission (verdict: Runtime Error):
inputs = map(int, input().split())

results = []
for i in (0, 1):
  for j in (2, 3):
    reults.append(inputs[i] * inputs[j])

print(max(results))


Fixed submission:
inputs = [int(d) for d in input().split()]

results = []
for i in (0, 1):
  for j in (2, 3):
    results.append(inputs[i] * inputs[j])

print(max(results))
Buggy python submission (verdict: Runtime Error):
a = input()

if a.islower() == True:
  print('a')
else:
  print('A)

Fixed submission:
a = input()
 
if a.islower() == True:
  print('a')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans=''

for i in range(1, 99):
	if N <= 26 ** i:
      N -= 1
      for j in range(i):
        ans += chr(ord('a') + N % 26)
        N //= 26
      break
    else:
      N -= 26 ** i

print(ans[::-1]) # reversed

Fixed submission:
N = int(input())
ans=''

for i in range(1, 99):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += chr(ord('a') + N % 26)
      N //= 26
    break
  else:
    N -= 26 ** i

print(ans[::-1]) # reversed
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(int, input().split())

L = []
for i in range(N-1):
  L.append(0)

for i in range(N-1):
  L[A[i]] += 1

for j in range(N-1):
  print(L[j])

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

L = []
for i in range(N):
  L.append(0)

for i in range(N-1):
  L[A[i]-1] += 1

for j in range(N):
  print(L[j])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()

L = []
F = 0

for i in range(N):
  if A[i] not in L:
    L.append(A[i])
  else:
    print('NO')
    F = 1
    break
    
if F == 0:
  print('YES')

Fixed submission:
N = int(input())
seq = input().split()
 
if len(seq) != len(set(seq)):
  print('NO')
else:
  print('YES')

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

L = []

for i in range(N):
  if A[i] not in L:
    L.append(A[i])
    if i == N-1:
      print('YES')
  else:
    print('NO')
    break
    

Fixed submission:
N = int(input())
seq = input().split()
 
if len(seq) != len(set(seq)):
  print('NO')
else:
  print('YES')
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = input().split()

At = 0
for i in range(N):
  At += A[i]
  
if At >= H:
  print('Yes')
else:
  print('No')

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

At = 0
for i in range(N):
  At += int(A[i])
  
if At >= H:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
T = input().split()

a = T[0]
b = T[1]

A = int(a * int(b))
B = int(b + int(a))

if A > B:
  print(A)
else:
  print(B)
  
print(B)

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

A = int(a * int(b))
B = int(b * int(a))

if A > B:
  print(A)
else:
  print(B)

Buggy python submission (verdict: Runtime Error):
a, b = map(str, input().split())

A = int(a * int(b))
B = int(b + int(a))

if A > B:
  print(A)
else:
  print(B)

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

A = int(a * int(b))
B = int(b * int(a))

if A > B:
  print(A)
else:
  print(B)

Buggy python submission (verdict: Runtime Error):
a, b = input().split()

A = int(a * int(b))
B = int(b + int(a))

if A > B:
  print(A)
else:
  print(B)

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

A = int(a * int(b))
B = int(b * int(a))

if A > B:
  print(A)
else:
  print(B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)
  
F = 0

A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)
  
#フラグ
F = 0

#答え
A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)

#フラグ
F = 0

#答え
A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)

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

L = []
for i in range(N):
  P = int(input())
  L.append(P)

F = 0

for i in range(1, N):
  P = L[i]
  for j in range(0, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
      
  if F = 1:
    A += 1
    
print(A)
    
      


      

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)
Buggy python submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())

S = input()
A = []

for i in range(len(S)):
  B = AL.index(S[i])+N
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Fixed submission:
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = int(input())
 
S = input()
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B -26
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy python submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = 2
 
S = ABCXYZ
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B - 26
  A.append(S[B])
  
for j in range(len(S)):
  print(A[j], end='')

Fixed submission:
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = int(input())
 
S = input()
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B -26
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy python submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())

S = input()
A = []

for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B - 26
  A.append(S[B])
  
for j in range(len(S)):
  print(A[j], end='')

Fixed submission:
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = int(input())
 
S = input()
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B -26
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy python submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())
S = input()

A = ''

for i in range(len(S)):
  B = AL.index(S[i]) + N
  A += AL[B]

print(A)

Fixed submission:
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = int(input())
 
S = input()
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B -26
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')
Buggy python submission (verdict: Runtime Error):
D = int(input())

print(D.count('0'))

Fixed submission:
D = input()
DL = [D[i] for i in range(3)]

print(DL.count('1'))
Buggy python submission (verdict: Runtime Error):
data = input()

flag1 = 0
flag2 = 0

for i in range(3):
  if data[i] = '5':
    flag1 += 1
  elif data[i] = '7':
    flag2 += 1

if flag1 == 1 and flag2 == 2:
  print('YES')
else:
  print('NO')

Fixed submission:
data = input().split()
 
flag1 = 0
flag2 = 0
 
for i in range(3):
  if data[i] == '5':
    flag1 += 1
  elif data[i] == '7':
    flag2 += 1
 
if flag1 == 2 and flag2 == 1:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split())
f = []
for i in range(a, b+1):
  for j in range(c, d+1):
    e = i * j
    f.append(e)
print(max(f))    
  

Fixed submission:
a,b,c,d=list(map(int,input().split()))
x=[a*c,a*d,b*c,b*d]
print(max(x))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int, input().split()))
a = []
b = 0
for i in li:
  a.append(i)
  c = max(a)
  if i < c:
    b = b + c - i
print(b)
    

Fixed submission:
N = int(input())
li = list(map(int, input().split()))
a = 0
b = 0
for i in li:
  if a < i:
    a = i
  if i < a:
    b = b + a - i
print(b)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int, input().split()))
a = []
b = 0
for i in li:
  a.append(i)
  if i < max(a):
    b = b + max(a) - i
print(b)

Fixed submission:
N = int(input())
li = list(map(int, input().split()))
a = 0
b = 0
for i in li:
  if a < i:
    a = i
  if i < a:
    b = b + a - i
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
b = 1
for i in a:
  b = b * i
if b > 1000000000000000000:
  print('-1')
else:
  print(b)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        print("-1")
        break
else:
    print(ans)

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

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        print("-1")
        break
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
L=[int(x) for x in input().split()]
sum=0
product=0
mod=1000000007
for i in range(n):
    sum+=L[i]%mod
for i in range(n-1):
    sum-=(L[i]%mod)
    product+=sum*(L[i]%mod)
print(product)

Fixed submission:
n=int(input())
L=[int(x) for x in input().split()]
sum=0
product=0
mod=1000000007
for i in range(n):
    sum+=L[i]%mod
for i in range(n-1):
    sum-=(L[i]%mod)
    product+=sum*(L[i]%mod)
print(product%mod)

Buggy python submission (verdict: Runtime Error):
L=[int(x) for x in input().split()]
sum=0
product=0
mod=1000000007
for i in range(n):
    sum+=L[i]%mod
for i in range(n-1):
    sum-=(L[i]%mod)
    product+=sum*(L[i]%mod)
print(product)


Fixed submission:
n=int(input())
L=[int(x) for x in input().split()]
sum=0
product=0
mod=1000000007
for i in range(n):
    sum+=L[i]%mod
for i in range(n-1):
    sum-=(L[i]%mod)
    product+=sum*(L[i]%mod)
print(product%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
L=[int(x) for x in input().split()]
sum=0
mod=1000000007
for i in range(n-1):
    for j in range(i+1,n):
        sum+=(L[i]*L[j])%mod
print(sum%mod)


Fixed submission:
n=int(input())
L=[int(x) for x in input().split()]
sum=0
product=0
mod=1000000007
for i in range(n):
    sum+=L[i]%mod
for i in range(n-1):
    sum-=(L[i]%mod)
    product+=sum*(L[i]%mod)
print(product%mod)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
num = 1
for i in a:
    num *= i
if 10**18 < num:
    print(-1)
else:
    print(num)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
num = 1
if 0 in a:
    num = 0
else:
    for i in a:
        num *= i
        if 10**18 < num:
            num = -1
            break
print(num)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
if t.startswich(s):
  print('Yes')
else:
  print('No')
  

Fixed submission:
s = input()
t = input()
if t.startswith(s):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c,k = int(input())
total = a*1 + b*0 - c*1
print(int(total))

Fixed submission:
a,b,c,k = map(int, input().split())
s = 0
if k <= a:
    s += k
else:
    s += a
if 0 < k-(a+b):
    s -= k-(a+b)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
j = -1
num = 0
for i in range(1,n+1):
    if num != n:
        b = a.count(i)
        print(b)
        num += b
    else:
        j = i
        break
if j != -1:
    for h in range(n-j):
        print(0)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a += list(range(1,n+1))
a = Counter(a).most_common()
a.sort()
for i,j in a:
    print(j-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a += list(range(1,n+1))
a = Counter(a).most_common()
a.sort()
for i,j in a:
    print(j-1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import itertools
def gcd(x,y,z):
    xy = math.gcd(x,y)
    xyz = math.gcd(xy,z)
    return xyz
k1 = int(input())
k = list(range(1,k1+1))*3
l = []
for i in itertools.combinations(k,3):
    l.append(i)
l = list(set(l))
num = 0
for h in l:
    t = gcd(h[0],h[1],h[2])
    num += t
print(num)    

Fixed submission:
import math
import itertools
def gcd(x,y,z):
    xy = math.gcd(x,y)
    xyz = math.gcd(xy,z)
    return xyz
k1 = int(input())
k = list(range(1,k1+1))
l = []
for i in itertools.combinations_with_replacement(k,3):
    l.append(i)
num = 0
for h in l:
    t = gcd(h[0],h[1],h[2])
    if h[0] == h[1] == h[2]:
        num += t
    elif h[0] == h[1] or h[1] == h[2] or h[2] == h[0]:
        num += 3*t
    else:
        num += 6*t
print(num)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
w = ("b"*a + "r"*b)*(n//(a+b))
if n%(a+b) <= a:
    w += "b"*(n%(a+b))
else:
    w += "b"*a + "r"*((n%(a+b))-a)
print(w.count('b'))

Fixed submission:
n,a,b = map(int, input().split())
blue = a*(n//(a+b))
if n%(a+b) <= a:
    blue += n%(a+b)
else:
    blue += a
print(blue)

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
w = ("b"*a + "r"*b)*(n//(a+b))
if n%(a+b) <= a:
    w += "b"*(n%(a+b))
print(w.count('b'))

Fixed submission:
n,a,b = map(int, input().split())
blue = a*(n//(a+b))
if n%(a+b) <= a:
    blue += n%(a+b)
else:
    blue += a
print(blue)
Buggy python submission (verdict: Runtime Error):
 = int(input())
s = str(input())
if n%2 == 1:
    print('No')
else:
    if s[:n//2] == s[n//2:]:
        print('Yes')
    else:
        print('No')

Fixed submission:
n = int(input())
s = str(input())
if n%2 == 1:
    print('No')
else:
    if s[:n//2] == s[n//2:]:
        print('Yes')
    else:
        print('No')