Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

num_of_R = S.count('R')


num_of_left_R = S[:num_of_R].count('R')
ans = 0
while num_of_R != num_of_left_R:
    ans = ans + 1
    
    left_white_idx = S.find('W')
    right_red_idx  = S.rfind('R')

    S = S[:left_white_idx] + 'R' + S[left_white_idx+1:]
    S = S[:right_red_idx] + 'W' + S[right_red_idx+1:]

    num_of_left_R = S[:num_of_R].count('R')

print(ans)


Fixed submission:
N = int(input())
S = input()

ans = 0
while True:
    left_white_idx = S.find('W')
    right_red_idx  = S.rfind('R')

    if left_white_idx == -1 or right_red_idx == -1 or left_white_idx > right_red_idx:
        break

    # 左のRの連続とW　Rと右のWの連続を切り取った文字列に更新
    S = S[left_white_idx+1:right_red_idx]

    ans = ans + 1

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

length = int(input())
As = list(map(int, input().split()))

As.sort()

# indexを数値と紐づけるために+1増やした数にする
check = np.zeros(10**6+1)

answer = 0

# 与えられた数列の小さいものから順にループ
for i in range(length):
    if check[As[i]] == 0:
        # 与えられた数値の倍数すべてに1を立てる
        # checkは0始まりのため、0と倍数要素に1が立つ
        check[::As[i]] = 1
        
        # 同じ数字が複数ある場合はカウントさせない
        if As[i] != As[i + 1]:
            answer = answer + 1

print(answer)

Fixed submission:
import numpy as np

length = int(input())
As = list(map(int, input().split()))

As.sort()

# indexを数値と紐づけるために+1増やした数にする
check = np.zeros(10**6+1)

answer = 0

# 与えられた数列の小さいものから順にループ
for i in range(length):
    if check[As[i]] == 0:
        # 与えられた数値の倍数すべてに1を立てる
        # checkは0始まりのため、0と倍数要素に1が立つ
        check[::As[i]] = 1
        
        # checkリストが0の状態で数列の最後であればanswerへの加算は確定
        # また、同じ数字が複数ある場合はカウントさせない
        if  i == (length - 1) or  As[i] != As[i + 1]:
                answer = answer + 1

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

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

answer = functools.reduce(operator.mul, A)

if answer > 1000000000000000000:
    print('-1') 
else:
    print(answer)

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

if A.count(0) >= 1:
    print(0)
    exit()

answer = 1
for _ in A:
    answer *= _
    if answer > 1000000000000000000:
        print('-1') 
        exit()

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
answer = 1
for _ in A:
    answer = answer * _

if answer > 1000000000000000000:
    print('-1') 
else:
    print(answer)

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

if A.count(0) >= 1:
    print(0)
    exit()

answer = 1
for _ in A:
    answer *= _
    if answer > 1000000000000000000:
        print('-1') 
        exit()

print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = 1
for _ in range(N):
    A = A * int(input())

print(A)

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

if A.count(0) >= 1:
    print(0)
    exit()

answer = 1
for _ in A:
    answer *= _
    if answer > 1000000000000000000:
        print('-1') 
        exit()

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
num_of_employee = int(input())
employeenos = list(map(int, input().split()))

for i in range(1, num_of_employee + 1):
    print(employeenos.count(i))


Fixed submission:
import collections

num_of_employee = int(input())
employeenos = list(map(int, input().split()))

c = collections.Counter(employeenos)
for i in range(1, num_of_employee + 1):
    print(c[i])

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

bossenos = set(employeenos)
output = [0] * (len(employeenos) + 1)
for boss in bossenos:
    output[boss - 1] = employeenos.count(boss)

for _ in output:
    print(_)

Fixed submission:
import collections

num_of_employee = int(input())
employeenos = list(map(int, input().split()))

c = collections.Counter(employeenos)
for i in range(1, num_of_employee + 1):
    print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K = int(input())

total = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K + 1):
            total = total + np.gcd.reduce([i, j, k])

print(total)

Fixed submission:
import math
import collections

K = int(input())

# intで初期化するため0が返る
cnt = collections.defaultdict(int)
for i in range(1, K + 1):
    for j in range(1, K + 1):
        key = math.gcd(i, j)
        # 最大公約数をkeyにし、同じ最大公約数の出現回数を保持
        cnt[key] = cnt[key] + 1

total = 0
for k in range(1, K + 1):
    for key in cnt.keys():
        # 出現済みの最大公約数との最大公約数を取り、出現回数分を加算する
        total = total + math.gcd(k, key) * cnt[key]

print(total)
Buggy python submission (verdict: Runtime Error):
N, num_of_blue, num_of_red = map(int, input().split())

num_of_repetition = (N // (num_of_blue + num_of_red))
remainder_s = N % (num_of_blue + num_of_red)
base_s ='b' * num_of_blue + 'r' * num_of_red
count_b = num_of_blue * num_of_repetition + base_s[0:remainder_s].count('b')

print(count_b)

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

num_of_repetition = (N // (num_of_blue + num_of_red))
remainder_s = N % (num_of_blue + num_of_red)

count_b = num_of_blue * num_of_repetition + min(num_of_blue, remainder_s)

print(count_b)

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

num_of_repetition = (N // (num_of_blue + num_of_red)) + 1
S = ('b' * num_of_blue + 'r' * num_of_red) * num_of_repetition

print(S[0:N].count('b'))

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

num_of_repetition = (N // (num_of_blue + num_of_red))
remainder_s = N % (num_of_blue + num_of_red)

count_b = num_of_blue * num_of_repetition + min(num_of_blue, remainder_s)

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

answer = 0
for i in range(N):
    if min(Ps[:i + 1]) >= Ps[i]:
        answer = answer + 1

print(answer)

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

answer = 0
min_num = 2 * 10 ** 5 + 1
for p in Ps:
    min_num = min(p, min_num)
    if min_num >= p:
        answer = answer + 1

print(answer)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
c=0
cc=0
for i in a:
   c+=1
    if c%2==0:
      continue
    if i%2!=0:
      cc+=1
print(cc)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
c=0
cc=0
for i in a:
  c+=1
  if c%2==0:
    continue
  if i%2!=0:
    cc+=1
print(cc)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = [int(i) for i in input().split()]
aa = copy.deepcopy(a)
c=0
for ind_,i in enumerate(a):
  f=0
  for ind_2,j in enumerate(aa):
    if ind_==ind_2:
      continue
    if i<j:
      continue
    if i%j==0:
      f=1
      break
  if f==0:
    c+=1
print(c)

Fixed submission:

N=int(input())
A=list(map(int,input().split()))
dp=[False]*(10**6+1)
A.sort()
ans=0
before_ = -1
for i in A:
  if dp[i]==False:
    for j in range(2*i,10**6+1,i):
      dp[j]=True
  if before_ == i:
      dp[i]=True
  before_=i

for i in A:
  if dp[i]==False:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,v = map(float,input().split())
b,w = map(float,input().split())
t = float(input())

if a<b:
    if b+w*t <= a+v*t:
        print('YES')
    else:
        print('NO')
else:
    if a-v*t <=	b-w*t:
		print('YES')
    else:
		print('NO')

Fixed submission:
a,v = map(float,input().split())
b,w = map(float,input().split())
t = float(input())

if a<b:
    if b+w*t <= a+v*t:
      print('YES')
    else:
      print('NO')
else:
    if a-v*t <=	b-w*t:
      print('YES')
    else:
      print('NO')

Buggy python submission (verdict: Runtime Error):
a,v = map(float,input().split())
b,w = map(float,input().split())
t = float(input())

if a<b:
    if b+w*t <= a+v*t:
        print('YES')
    else:
        print('NO')
else:
    if a-v*t <=	b-w*t:
	print('YES')
    else:
	print('NO')



Fixed submission:
a,v = map(float,input().split())
b,w = map(float,input().split())
t = float(input())

if a<b:
    if b+w*t <= a+v*t:
      print('YES')
    else:
      print('NO')
else:
    if a-v*t <=	b-w*t:
      print('YES')
    else:
      print('NO')
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
nn = [0]*n
for _ in range(k):
    d = int(input())
    a = [int(i) for i in input().split()]
    for	j in a:
	nn[j-1]	+= 1
c=0
for i in nn:
   if i==0:
       c+=1
print(c)

Fixed submission:
n,k = map(int,input().split())
nn = [0]*n
for _ in range(k):
    d = int(input())
    a = [int(i) for i in input().split()]
    for j in a:
        nn[j-1] += 1
c=0
for i in nn:
   if i==0:
       c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b	= map(int,input().split())

    if h[a-1] <	h[b-1]:
		nn[a-1]=0
    else:
		nn[b-1]=0

print(sum(nn))

Fixed submission:
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] ==h[b-1]:
        nn[a-1]=0
        nn[b-1]=0
    elif h[a-1] < h[b-1]:
        nn[a-1]=0
    else:
        nn[b-1]=0

print(sum(nn))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b	= map(int,input().split())

    if h[a-1] <	h[b-1]:
	nn[a-1]=0
    else:
	nn[b-1]=0

print(sum(nn))

Fixed submission:
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] ==h[b-1]:
        nn[a-1]=0
        nn[b-1]=0
    elif h[a-1] < h[b-1]:
        nn[a-1]=0
    else:
        nn[b-1]=0

print(sum(nn))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [[-1]]*n

for i in range(m):
    a,b = map(int,input().split())
    nn[a-1].append(b-1)
    nn[b-1].append(a-1)
c=0
for i	in range(n):
    f=0
    for k in nn[i]:
	if k==-1:continue
        if h[i] < k:
            f=1
    if f==0:
	c+=1
print(c)


Fixed submission:
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] ==h[b-1]:
        nn[a-1]=0
        nn[b-1]=0
    elif h[a-1] < h[b-1]:
        nn[a-1]=0
    else:
        nn[b-1]=0

print(sum(nn))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [[-1]]*n

for i in range(m):
    a,b = map(int,input().split())
    nn[a-1].append(b-1)
    nn[b-1].append(a-1)
c=0
for i	in range(n):
    f=0
    for k in nn[i]:
	if k==-1:continue
        if h[i] < k:
            f=1
    if f==0:
	c+=1
print(c)


Fixed submission:
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] ==h[b-1]:
        nn[a-1]=0
        nn[b-1]=0
    elif h[a-1] < h[b-1]:
        nn[a-1]=0
    else:
        nn[b-1]=0

print(sum(nn))
Buggy python submission (verdict: Runtime Error):
x = int(input())
a = []
for i in range(80):
    a.append(i**5)

for i in range(79):
    for j in range(i+1,80):
        if a[i]-a[j]==x:
            A=i
            B=j
            break
        elif -a[i]-a[j]==x:
            A=-i
            B=j
            break
        elif -a[i]+a[j]==x:
            A=-i
            B=-j
            break
        elif a[i]+a[j]==x:
            A=i
            B=-j
            break
print('%d %d'%(A,B))


Fixed submission:
x = int(input())
a = []
for i in range(1000):
    a.append(i**5)

for i in range(999):
    for j in range(i+1,1000):
        if a[i]-a[j]==x:
            A=i
            B=j
            break
        elif -a[i]-a[j]==x:
            A=-i
            B=j
            break
        elif -a[i]+a[j]==x:
            A=-i
            B=-j
            break
        elif a[i]+a[j]==x:
            A=i
            B=-j
            break
print('%d %d'%(A,B))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]

l = []
c=0
for i in s:
    if i not in l:
        l.append(i)
        c+=1
print(c)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]

import collections

c = collections.Counter(s)

print(len(c.keys()))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]

l = []
c=0
for i in s:
    if i not in l:
        l.append(i)
	c+=1
print(c)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]

import collections

c = collections.Counter(s)

print(len(c.keys()))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

import math



d=0
s = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            d = math.gcd(a,b)
            s+=math.gcd(d,c)

            d=0
print(s)

Fixed submission:
k = int(input())

import math
d=0
e=0
f=0
s = 0
ss=0
sss=0
for a in range(1,k+1):
    for b in range(1,k+1):
        e+=1
        d = math.gcd(a,b)

        for c in range(e,k+1):
#            print(a,b,c)                                                      
            if f==0:
                ss+=math.gcd(d,c)
#                print(a,b,c)                                                  
                f+=1
            else:
                s+=math.gcd(d,c)

        d=0
        s *=2
        s+=ss
        sss+=s
        s=0
        ss=0
        f=0
    e=0
print(sss)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(i) for i in input().split()]

max = 0
j = n-k+1
s = []
for i in range(j):
    if max < sum(p[i:i+k]):
        s = p[i:i+k]
        max = sum(p[i:i+k])

def summ(i):
    return i*(i+1)/2

ss = 0


for i in s:
    ss += summ(i)/i

print(ss)

Fixed submission:
n,k = map(int,input().split())
p = [int(i) for i in input().split()]


j = n-k
s = p[0:k]
max = sum(s)
su = max

for i in range(j):
    t = su+p[i+k]
    u = t-p[i]
    if max < u:
        max = t-p[i]
        s = p[i+1:i+1+k]

    su = u

def summ(i):
    return i*(i+1)/2

ss = 0


for i in s:
    ss += summ(i)/i

print(ss)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(i) for i in input().split()]

max = 0
j = n-k+1
s = []
for i in range(j):
    if max < sum(p[i:i+k]):
        s = p[i:i+k]
        max = sum(p[i:i+k])

def summ(i):
    s = 0
    for j in range(1,i+1):
        s += j
    return s

ss = 0
for i in s:
    ss += summ(i)/i

print(ss)

Fixed submission:
n,k = map(int,input().split())
p = [int(i) for i in input().split()]


j = n-k
s = p[0:k]
max = sum(s)
su = max

for i in range(j):
    t = su+p[i+k]
    u = t-p[i]
    if max < u:
        max = t-p[i]
        s = p[i+1:i+1+k]

    su = u

def summ(i):
    return i*(i+1)/2

ss = 0


for i in s:
    ss += summ(i)/i

print(ss)
Buggy python submission (verdict: Runtime Error):
s = input()
b = s[0]
cou = 0
if len(s)==2:
    if s[0]=='>' and s[1] =='<':
        print(2)
        exit()

lis = []
for i in s:
    if b ==i:
        if i=='<':
            cou-=1
        else:
            cou+=1
    else:
        lis.append(cou)
        b = i
        if b=='<':
            cou =-1
        else:
            cou = 1
lis.append(cou)
l = len(lis)
sum = 0

for i in range(0,l,2):
    if i+1 == l and (i+1)%2==1:
        a = abs(lis[i])
        sum += a*(a+1)//2
        break
    a = abs(lis[i])
    b = abs(lis[i+1])

    if a < b:
		sum += b*(b+1)//2
		sum += (a-1)*a//2
    else:
        sum += a*(a+1)//2
        sum += (b-1)*b//2        
print(sum)

Fixed submission:
s = input()
b = s[0]
cou = 0


lis = []
for i in s:
    if b ==i:
        if i=='<':
            cou-=1
        else:
            cou+=1
    else:
        lis.append(cou)
        b = i
        if b=='<':
            cou =-1
        else:
            cou = 1
lis.append(cou)
l = len(lis)
sum = 0
if s[0]=='<':
    for i in range(0,l,2):
        if i+1 == l and (i+1)%2==1:
            a = abs(lis[i])
            sum += a*(a+1)//2
            break
        a = abs(lis[i])
        b = abs(lis[i+1])

        if a < b:
            sum += b*(b+1)//2
            sum += (a-1)*a//2
        else:
            sum += a*(a+1)//2
            sum += (b-1)*b//2
else:
    a = abs(lis[0])
    sum += a*(a+1)//2
    for i in range(1,l,2):
        if i+1 == l and (i+1)%2==0:
            a = abs(lis[i])
            sum += a*(a+1)//2
            break
        a = abs(lis[i])
        b = abs(lis[i+1])

        if a < b:
            sum += b*(b+1)//2
            sum += (a-1)*a//2
        else:
            sum += a*(a+1)//2
            sum += (b-1)*b//2

print(sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()                                                          
    return divisors
def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。      
    # ref = random.choice(arr)                                                 
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

a = quick_sort(make_divisors(n))

if len(a)//2==0:
    x = len(a)//2-1
else:
    x = len(a)//2
xx = a[x]
yy= n//xx

print(xx-1+yy-1)

Fixed submission:
import numpy as np
n = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()                                                          
    return divisors

a = np.sort(make_divisors(n))
#print(a)                                                                      
if len(a)//2==0:
    x = len(a)//2-1
else:
    x = len(a)//2

xx = a[x]
yy= n//xx

print(xx-1+yy-1)

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()                                                          
    return divisors
def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。      
    # ref = random.choice(arr)                                                 
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

a = quick_sort(make_divisors(n))
x = len(a)//2-1
y = x+1
xx = a[x]
yy= a[y]
print(xx-1+yy-1)

Fixed submission:
import numpy as np
n = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()                                                          
    return divisors

a = np.sort(make_divisors(n))
#print(a)                                                                      
if len(a)//2==0:
    x = len(a)//2-1
else:
    x = len(a)//2

xx = a[x]
yy= n//xx

print(xx-1+yy-1)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
tap = 0
num = 1
if b == 1:
    print(tap)
    exit()
tap += 1

while True:
    num = num + a - 1
    if b <= num:
        break
    else:
        tap += 1

print(tap)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
max = -1
move = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        move += 1
    else:
        if max < move:
            max = move
        move = 0
if max < move:
    print(move)
else:
    print(max)
Buggy python submission (verdict: Runtime Error):
    n = int(input())
    count = (n-1)*n//2
    print(count)

Fixed submission:
n = int(input())
count = (n-1)*n//2
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = 0
if n==0:
    print(count)
    exit()
else:
    for i in range(n-1):
        count += i+1
print(count)

Fixed submission:
n = int(input())
count = (n-1)*n//2
print(count)
Buggy python submission (verdict: Runtime Error):
S = input()

a = S[0]
a_count = 0
b_count = 0

for i in S:
    if i==a:
        a_count += 1
    else:
        b = i
for i in S:
    if i==b:
        b_count +=1

if a_count == 2 and b_count == 2:
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()

a = S[0]
b = 'b'
a_count = 0
b_count = 0

for i in S:
    if i==a:
        a_count += 1
    else:
        b = i
for i in S:
    if i==b:
        b_count +=1

if a_count == 2 and b_count == 2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
P,Q,R = map(int,input().split())

a = P + Q
b = Q + R
c = R + P

if a > b and a > c:
  print('a')
elif b > c:
  print('b')
else
  print('c')

Fixed submission:
P,Q,R = map(int,input().split())

a = P + Q
b = Q + R
c = R + P

if b > a and c > a:
  print(a)
elif b > c:
  print(c)
else:
  print(b)
Buggy python submission (verdict: Runtime Error):
S = input()

if S <= '2019/04/30':
  print('Heisei')
else:
  print(TBD)

Fixed submission:
S = input()

if S <= "2019/04/30":
    print("Heisei")
else:
    print("TBD")
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = [int(num) for num in input().split(" ")]

mod_value = 10**9 + 7

total = 0
for i in range(len(a)-1):
    target_value = 0
    for j in range(i+1, len(a)):
        target_value += a[j]
    total += a[i] * target_value 
print(total%mod_value)


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

mod_value = 10**9 + 7

sum = 0
total = 0
for i in reversed(range(1, len(a))):
    sum += a[i]
    total += a[i-1] * sum

print(total%mod_value)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = [int(num)% (10**9 + 7)  for num in input().split(" ")]

total = 0
for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        total += (a[i]*a[j])
print(total% (10**9 + 7))


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

mod_value = 10**9 + 7

sum = 0
total = 0
for i in reversed(range(1, len(a))):
    sum += a[i]
    total += a[i-1] * sum

print(total%mod_value)

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

total = 0
for i in range(len(a)):
    for j in range(i+1, len(a)):
        total += (a[i]*a[j])
print(total% (10**9 + 7))


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

mod_value = 10**9 + 7

sum = 0
total = 0
for i in reversed(range(1, len(a))):
    sum += a[i]
    total += a[i-1] * sum

print(total%mod_value)

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

total = 0
for i in range(len(a)):
    for j in range(i+1, len(a)):
        total += (a[i]*a[j]) % (10**9 + 7)
print(total% (10**9 + 7))


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

mod_value = 10**9 + 7

sum = 0
total = 0
for i in reversed(range(1, len(a))):
    sum += a[i]
    total += a[i-1] * sum

print(total%mod_value)