Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
mod = 10 ** 9 + 7
n=int(input())
a=list(map(int, input().split(" ")))
temp = 0
for (i, j) in itertools.combinations(a, 2):
  temp += (i * j) % mod
print(temp % mod)

Fixed submission:
import itertools
mod = 10 ** 9 + 7
n=int(input())
a=list(map(int, input().split(" ")))
temp = 0
total = sum(a)
for i in a:
  temp += i * (total - i)
temp //= 2
print(temp % mod)
Buggy python submission (verdict: Time Limit Exceeded):
anum, bnum, time= map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
tempa = [0]
tempb = [0]
total = 0
for i in range(anum):
    tempa.append(tempa[-1] + a[i])
    if total > time:
        break
for i in range(bnum):
    tempb.append(tempb[-1] + b[i])
    if total > time:
        break
maxi = 0
for i in range(anum + 1):
    for j in range(bnum + 1):
        if tempa[i] + tempb[j] <= time:
            if i + j > maxi:
                maxi = i + j
        else:
            break
print(maxi)

Fixed submission:
import bisect
anum, bnum, time= map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
tempa = [0]
tempb = [0]
total = 0
for i in range(anum):
    tempa.append(tempa[-1] + a[i])
    if total > time:
        break
for i in range(bnum):
    tempb.append(tempb[-1] + b[i])
    if total > time:
        break
maxi = 0
starta = bisect.bisect_right(tempa, time) - 1
for i in range(starta, -1, -1):
    startb = bisect.bisect_right(tempb, time - tempa[i]) - 1
    if i + startb > maxi:
        maxi = i + startb
print(maxi)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split(" "))
if n != 0:
  p=list(map(int, input().split(" ")))
else:
  p=[]
lst = list(range(0, x * 2))
for i in p:
  lst.remove(i)
for i in range(x + 2):
  if x - i in lst or x - i < 0:
    print(x - i)
    break
  elif x + i in lst:
    print(x + i)
    break

Fixed submission:
x, n = map(int, input().split(" "))
if n != 0:
  p=list(map(int, input().split(" ")))
else:
  p=[]
lst = list(range(-1, x * 2 + 1))
for i in p:
  if i in lst:
    lst.remove(i)
for i in range(x + 2):
  if x - i in lst or x - i < 0:
    print(x - i)
    break
  elif x + i in lst:
    print(x + i)
    break
Buggy python submission (verdict: Time Limit Exceeded):
n=(int)(input())
a = list(map(int, input().split(" ")))
total = 1
for i in range(n):
  total *= a[i]
print(-1) if total > 10 ** 18 else print(total)

Fixed submission:
n=(int)(input())
a = list(map(int, input().split(" ")))
total = 1
if 0 in a:
  print(0)
else:
  for i in range(n):
    total *= a[i]
    if total > 10 ** 18:
      print(-1)
      break
  else:
    print(total)
Buggy python submission (verdict: Runtime Error):
from decimal import *
a,b=map(float, input().split(" "))
b *= 100
print((int)(Decimal(a)*Decimal(b)/100+0.001))

Fixed submission:
from decimal import *
a,b = map(Decimal, input().split())
print(int(a*b))

Buggy python submission (verdict: Runtime Error):
from decimal import *
a,b=map(float, input().split(" "))
b = Decimal(b) * 100
print((int)(a*b/100))

Fixed submission:
from decimal import *
a,b = map(Decimal, input().split())
print(int(a*b))

Buggy python submission (verdict: Runtime Error):
from decimal import *
a,b=map(float, input().split(" "))
b = Decimal(b) * 100
print((int)(a*b/100))

Fixed submission:
from decimal import *
a,b = map(Decimal, input().split())
print(int(a*b))

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

Fixed submission:
from decimal import *
a,b = map(Decimal, input().split())
print(int(a*b))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split(" "))
tower=list(map(int, input().split(" ")))
road=[list(map(int, input().split(" "))) for i in range(m)]
ans=0
for i in range(1, n + 1):
  for j in range(m):
    if road[j][0] == i:
      if tower[road[j][1]-1] >= tower[i-1]:
        break
    elif road[j][1] == i:
      if tower[road[j][0]-1] >= tower[i-1]:
        break
  else:
    ans += 1
print(ans)

Fixed submission:
n,m=map(int, input().split(" "))
tower=list(map(int, input().split(" ")))
road=[list(map(int, input().split(" "))) for i in range(m)]
kosuu = [0 for i in range(n)]
temp = [0 for i in range(n)]
ans=0
for i in range(m):
  kosuu[road[i][0] - 1] += 1
  kosuu[road[i][1] - 1] += 1
for i in range(m):
  if tower[road[i][0] - 1] > tower[road[i][1] - 1]:
    temp[road[i][0] - 1] += 1
  elif tower[road[i][0] - 1] < tower[road[i][1] - 1]:
    temp[road[i][1] - 1] += 1
count = 0
for i in range(n):
  #print(n)
  if kosuu[i] == temp[i]:
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split(" "))
tower=list(map(int, input().split(" ")))
road=[list(map(int, input().split(" "))) for i in range(m)]
ans=0
for i in range(1, n + 1):
  for j in range(m):
    if road[j][0] == i:
      if tower[road[j][1]-1] >= tower[i-1]:
        break
    elif road[j][1] == i:
      if tower[road[j][0]-1] >= tower[i-1]:
        break
  else:
    ans += 1
print(ans)

Fixed submission:
n,m=map(int, input().split(" "))
tower=list(map(int, input().split(" ")))
road=[list(map(int, input().split(" "))) for i in range(m)]
kosuu = [0 for i in range(n)]
temp = [0 for i in range(n)]
ans=0
for i in range(m):
  kosuu[road[i][0] - 1] += 1
  kosuu[road[i][1] - 1] += 1
for i in range(m):
  if tower[road[i][0] - 1] > tower[road[i][1] - 1]:
    temp[road[i][0] - 1] += 1
  elif tower[road[i][0] - 1] < tower[road[i][1] - 1]:
    temp[road[i][1] - 1] += 1
count = 0
for i in range(n):
  #print(n)
  if kosuu[i] == temp[i]:
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
towers = list(map(int, input().split(" ")))
roads = []
for i in range(m):
    roads.append(list(map(int, input().split(" "))))

total = 0
for i in range(n):
    for j in range(m):
        if roads[j][0] == i + 1:
            if towers[i] <= towers[roads[j][1] - 1]:
                break
        elif roads[j][1] == i + 1:
            if towers[i] <= towers[roads[j][0] - 1]:
                break
    else:
        total += 1
print(total)

Fixed submission:
n,m=map(int, input().split(" "))
tower=list(map(int, input().split(" ")))
road=[list(map(int, input().split(" "))) for i in range(m)]
kosuu = [0 for i in range(n)]
temp = [0 for i in range(n)]
ans=0
for i in range(m):
  kosuu[road[i][0] - 1] += 1
  kosuu[road[i][1] - 1] += 1
for i in range(m):
  if tower[road[i][0] - 1] > tower[road[i][1] - 1]:
    temp[road[i][0] - 1] += 1
  elif tower[road[i][0] - 1] < tower[road[i][1] - 1]:
    temp[road[i][1] - 1] += 1
count = 0
for i in range(n):
  #print(n)
  if kosuu[i] == temp[i]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import itertools
n, m, q = map(int, input().split(" "))
asset = []
for i in range(q):
    asset.append(list(map(int, input().split(" "))))
A = []


max = 0
for a in itertools.product(list(range(1, m + 1)), repeat = n):
    A.append((list(a)))
for i in range(len(A)):
    total = 0
    for j in range(0, n):
        if A[j] <= A[j - 1]:
            continue
    for j in range(q):
        if A[i][asset[j][1] - 1] - A[i][asset[j][0] - 1] == asset[j][2]:
            total += asset[j][3]
    max = total if total > max else max
print(max)

Fixed submission:
import itertools

n,m,q = map(int, input().split(" "))
a,b,c,d = [],[],[],[]
for i in range(q):
  inpu = input()
  a.append((int)(inpu.split(" ")[0]))
  b.append((int)(inpu.split(" ")[1]))
  c.append((int)(inpu.split(" ")[2]))
  d.append((int)(inpu.split(" ")[3]))

balls = list(itertools.combinations_with_replacement(range(1, m + 1), n))
#print(balls)
max = 0
for i in range(len(balls)):
  temp = 0
  for j in range(q):
    if balls[i][b[j] - 1] - balls[i][a[j] - 1] == c[j]:
      temp += d[j]
  if temp > max:
    max = temp
print(max)

Buggy python submission (verdict: Runtime Error):
import itertools
n, m, q = map(int, input().split(" "))
asset = []
for i in range(q):
    asset.append(list(map(int, input().split(" "))))
A = []


max = 0
print (asset)
for a in itertools.product(list(range(1, m + 1)), repeat = n):
    A.append((list(a)))
for i in range(len(A)):
    total = 0
    for j in range(0, n):
        if A[j] <= A[j - 1]:
            continue
    for j in range(q):
        if A[i][asset[j][1] - 1] - A[i][asset[j][0] - 1] == asset[j][2]:
            total += asset[j][3]
    max = total if total > max else max
print(max)


Fixed submission:
import itertools

n,m,q = map(int, input().split(" "))
a,b,c,d = [],[],[],[]
for i in range(q):
  inpu = input()
  a.append((int)(inpu.split(" ")[0]))
  b.append((int)(inpu.split(" ")[1]))
  c.append((int)(inpu.split(" ")[2]))
  d.append((int)(inpu.split(" ")[3]))

balls = list(itertools.combinations_with_replacement(range(1, m + 1), n))
#print(balls)
max = 0
for i in range(len(balls)):
  temp = 0
  for j in range(q):
    if balls[i][b[j] - 1] - balls[i][a[j] - 1] == c[j]:
      temp += d[j]
  if temp > max:
    max = temp
print(max)
Buggy python submission (verdict: Runtime Error):
suuji = list(input())
count = 0
for i in range(0, len(suuji)):
  for j in range(i+3, len(suuji) + 1):
    if (int)(''.join(suuji[i:j])) % 2019 == 0:
      count += 1
print(count)

Fixed submission:
s, w = map(int, input().split(" "))
print("safe" if s > w else "unsafe")
Buggy python submission (verdict: Runtime Error):
import math
tl, ta, al, aa = map(int, input().split(" ")
print("Yes" if math.ceil(al/ta) < math.ceil(tl / aa) else "No")

Fixed submission:
import math
tl, ta, al, aa = map(int, input().split(" "))
print("Yes" if math.ceil(al/ta) - 1 < math.ceil(tl / aa) else "No")
Buggy python submission (verdict: Runtime Error):
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(1, ninnzuu + 1):
    buka[joushi[i] - 1] += 1
for i in range(ninnzuu):
  print(buka[i])

Fixed submission:
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(ninnzuu - 1):
    buka[joushi[i]] += 1
for i in range(1, ninnzuu):
  print(buka[i])
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
txt = ""
for i in range(1, ninnzuu + 1):
    print((str)(joushi.count(i)))

Fixed submission:
ninnzuu = (int)(input())
joushi = list(map(int, input().split(" ")))
buka = [0 for i in range(ninnzuu)]
for i in range(ninnzuu - 1):
    buka[joushi[i]] += 1
for i in range(1, ninnzuu):
  print(buka[i])
print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math
#import itertools
num = (int)(input())
total = 0
#for i, j, k in itertools.product(list(range(1, num + 1)), list(range(1, num + 1)), list(range(1, num + 1))):
#  total += math.gcd(math.gcd(i, j), k)
#print(total)
for i in range(1, num + 1):
  for j in range(1, num + 1):
    for k in range(1, num + 1):
      total += math.gcd(math.gcd(i, j), k)
print(total)

Fixed submission:
import math
num = (int)(input())
total = 0

for i in range(1, num + 1):
  for j in range(1, num + 1):
    sub = math.gcd(i, j)
    for k in range(1, num + 1):
      total += math.gcd(sub, k)
print(total)
Buggy python submission (verdict: Runtime Error):
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = (int)(input())
a = list(map(int, input().split(" ")))
temp = []
for i in range(n):
  temp.append(a.count(i))
  
ans = 0
#print(temp)#各数字の出現回数
for i in range(n):
  if temp[i] >= 2:
    ans += comb(temp[i], 2)
    
#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    kotae = ans - comb(temp[a[i]], 2) + comb(temp[a[i]] - 1, 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print(kotae)

Fixed submission:
n = (int)(input())
a = list(map(int, input().split(" ")))
temp = [0 for i in range(n + 1)]
aaa = sorted(a)
count = 0
for i in range(n - 1):
  if aaa[i] == aaa[i + 1]:
    count+= 1
  else:
    temp[aaa[i]] = count + 1
    count = 0
else:
  if len(a) == 1:
    temp[aaa[0]] = 1
  else:
    temp[aaa[-1]] = count + 1
ans = 0

#---ここまで231ms

#print(temp)#各数字の出現回数
for i in range(n + 1):
  if temp[i] >= 2:
    ans += temp[i] * (temp[i] - 1) / 2
    
#---ここまでで1553ms

#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    #print(temp[a[i]], i)
    kotae = ans - (temp[a[i]] * (temp[a[i]] - 1) / 2) + ((temp[a[i]] - 1) * (temp[a[i]] - 2) / 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print((int)(kotae))

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

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = (int)(input())
a = list(map(int, input().split(" ")))
temp = []
for i in range(n):
  temp.append(a.count(i))
  
ans = 0
#print(temp)#各数字の出現回数
for i in range(n):
  if temp[i] >= 2:
    ans += comb(temp[i], 2)
    
#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    kotae = ans - comb(temp[a[i]], 2) + comb(temp[a[i]] - 1, 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print(kotae)

Fixed submission:
n = (int)(input())
a = list(map(int, input().split(" ")))
temp = [0 for i in range(n + 1)]
aaa = sorted(a)
count = 0
for i in range(n - 1):
  if aaa[i] == aaa[i + 1]:
    count+= 1
  else:
    temp[aaa[i]] = count + 1
    count = 0
else:
  if len(a) == 1:
    temp[aaa[0]] = 1
  else:
    temp[aaa[-1]] = count + 1
ans = 0

#---ここまで231ms

#print(temp)#各数字の出現回数
for i in range(n + 1):
  if temp[i] >= 2:
    ans += temp[i] * (temp[i] - 1) / 2
    
#---ここまでで1553ms

#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    #print(temp[a[i]], i)
    kotae = ans - (temp[a[i]] * (temp[a[i]] - 1) / 2) + ((temp[a[i]] - 1) * (temp[a[i]] - 2) / 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print((int)(kotae))
Buggy python submission (verdict: Time Limit Exceeded):
txt = input()
n = (int)(input())
count = 0
sentou = ""
saigo = ""
for i in range(n):
  temp = input()
  if temp[0] == '1':
    count += 1
  else:
    sec, moji = (int)(temp.split(" ")[1]), temp.split(" ")[2]
    if (sec + count) % 2 == 1:
      sentou = moji + sentou
    else:
      saigo += moji
if count % 2 == 1:
  txt = saigo[::-1] + txt[::-1] + sentou[::-1]
else:
  txt = sentou + txt + saigo
print(txt) 

Fixed submission:
txt = input()
n = (int)(input())
count = 0
sentou = ""
saigo = ""
for i in range(n):
  temp = input()
  if temp[0] == '1':
    count += 1
  else:
    sec, moji = (int)(temp.split(" ")[1]), temp.split(" ")[2]
    if (sec + count) % 2 == 1:
      sentou = moji + sentou
    else:
      saigo += moji
if count % 2 == 1:
  txt = saigo[::-1] + txt[::-1] + sentou[::-1]
else:
  txt = sentou + txt + saigo
print(txt)

Buggy python submission (verdict: Time Limit Exceeded):
txt = input()
n = (int)(input())
count = 0
for i in range(n):
  temp = input()
  if temp[0] == '1':
    count += 1
  else:
    sec, moji = (int)(temp.split(" ")[1]), temp.split(" ")[2]
    if (sec + count) % 2 == 1:
      txt = moji + txt
    else:
      txt += moji
if count % 2 == 1:
  txt = txt[::-1]
print(txt) 

Fixed submission:
txt = input()
n = (int)(input())
count = 0
sentou = ""
saigo = ""
for i in range(n):
  temp = input()
  if temp[0] == '1':
    count += 1
  else:
    sec, moji = (int)(temp.split(" ")[1]), temp.split(" ")[2]
    if (sec + count) % 2 == 1:
      sentou = moji + sentou
    else:
      saigo += moji
if count % 2 == 1:
  txt = saigo[::-1] + txt[::-1] + sentou[::-1]
else:
  txt = sentou + txt + saigo
print(txt)

Buggy python submission (verdict: Time Limit Exceeded):
txt = input()
n = (int)(input())
for i in range(n):
  temp = input()
  if temp[0] == '1':
    txt = txt[::-1]
  else:
    sec, moji = (int)(temp.split(" ")[1]), temp.split(" ")[2]
    if sec == 1:
      txt = moji + txt
    else:
      txt += moji
print(txt)    

Fixed submission:
txt = input()
n = (int)(input())
count = 0
sentou = ""
saigo = ""
for i in range(n):
  temp = input()
  if temp[0] == '1':
    count += 1
  else:
    sec, moji = (int)(temp.split(" ")[1]), temp.split(" ")[2]
    if (sec + count) % 2 == 1:
      sentou = moji + sentou
    else:
      saigo += moji
if count % 2 == 1:
  txt = saigo[::-1] + txt[::-1] + sentou[::-1]
else:
  txt = sentou + txt + saigo
print(txt)
Buggy python submission (verdict: Runtime Error):
import math
print((int)(math.ceil((int)(input())))

Fixed submission:
import math
print((int)(math.ceil((int)(input())/2)))
Buggy python submission (verdict: Time Limit Exceeded):
n=(int)(input())
a = list(input() for i in range(n))
lis = sorted(list(set(a)))
big = [0 for i in range(len(lis))]
maxi = 0
for i in range(len(lis)):
  big[i] = a.count(lis[i])
maxi = max(big)
for i in range(len(lis)):
  if big[i] == maxi:
    print(lis[i])

Fixed submission:
n=(int)(input())
a = sorted(list(input() for i in range(n)))
lis = sorted(list(set(a)))
big = [0 for i in range(len(lis))]
maxi = 0
counter = 1
check = 0
#print(a)
for i in range(len(a) - 1):
  #print(a[i])
  if a[i] == a[i + 1]:
    counter += 1
  else:
    big[check] = counter
    counter = 1
    check += 1
else:
  big[-1] = counter
maxi = max(big)
#print(lis, big)
for i in range(len(lis)):
  if big[i] == maxi:
    print(lis[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=(int)(input())
a = list(input() for i in range(n))
lis = sorted(list(set(a)))
big = []
maxi = 0
for i in lis:
  temp = a.count(i)
  if temp > maxi:
    big = [i]
    maxi = temp
  elif temp == maxi:
    big.append(i)
for i in range(len(big)):
  print(big[i])

Fixed submission:
n=(int)(input())
a = sorted(list(input() for i in range(n)))
lis = sorted(list(set(a)))
big = [0 for i in range(len(lis))]
maxi = 0
counter = 1
check = 0
#print(a)
for i in range(len(a) - 1):
  #print(a[i])
  if a[i] == a[i + 1]:
    counter += 1
  else:
    big[check] = counter
    counter = 1
    check += 1
else:
  big[-1] = counter
maxi = max(big)
#print(lis, big)
for i in range(len(lis)):
  if big[i] == maxi:
    print(lis[i])

Buggy python submission (verdict: Time Limit Exceeded):
n=(int)(input())
a = list(input() for i in range(n))
maxi = 0
big = []
#print(a)
for i in range(n):
  temp = a.count(a[i])
  if temp > maxi:
    big = [a[i]]
    maxi = temp
  elif temp == maxi:
    big.append(a[i])
ans = sorted(list(set(big)))
for i in range(len(ans)):
  print(ans[i])

Fixed submission:
n=(int)(input())
a = sorted(list(input() for i in range(n)))
lis = sorted(list(set(a)))
big = [0 for i in range(len(lis))]
maxi = 0
counter = 1
check = 0
#print(a)
for i in range(len(a) - 1):
  #print(a[i])
  if a[i] == a[i + 1]:
    counter += 1
  else:
    big[check] = counter
    counter = 1
    check += 1
else:
  big[-1] = counter
maxi = max(big)
#print(lis, big)
for i in range(len(lis)):
  if big[i] == maxi:
    print(lis[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, kosuu = map(int, input().split(" "))
a=list(map(int, input().split(" ")))
temp = []
for i in range(n - kosuu + 1):
  temp.append(sum(a[i:i+kosuu]))
print((max(temp) + kosuu) / 2)

Fixed submission:
n, kosuu = map(int, input().split(" "))
a=list(map(int, input().split(" ")))
first = sum(a[:kosuu])
temp = []
temp.append(first)
for i in range(n - kosuu):
  first = first + a[i + kosuu] - a[i]
  temp.append(first)
print((max(temp) + kosuu) / 2)

Buggy python submission (verdict: Time Limit Exceeded):
n, kosuu = map(int, input().split(" "))
a=list(map(int, input().split(" ")))
maxi = 0
for i in range(n - kosuu + 1):
  if maxi < sum(a[i:i+kosuu]):
    maxi = sum(a[i:i+kosuu])
print((maxi + kosuu) / 2)
  

Fixed submission:
n, kosuu = map(int, input().split(" "))
a=list(map(int, input().split(" ")))
first = sum(a[:kosuu])
temp = []
temp.append(first)
for i in range(n - kosuu):
  first = first + a[i + kosuu] - a[i]
  temp.append(first)
print((max(temp) + kosuu) / 2)
Buggy python submission (verdict: Runtime Error):
num=(int)(input())
n=num//100
amari=num%100
if amari / n > 6:
  print(0)
else:
  print(1)

Fixed submission:
num=(int)(input())
n=num//100
amari=num%100
if num <= 99 or amari / n > 5:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=(int)(input())
moji = []
s=input()
for i in itertools.combinations(range(n), 3):
  #print(i)
  moji.append(s[i[0]] + s[i[1]] + s[i[2]])
  #print(moji)
print(len(list(set(moji))))

Fixed submission:
import itertools
n=(int)(input())
moji = list('0123456789')
s=input()
count = 0

for i in itertools.product(moji, repeat=3):
  sousa = list(s)
  try:
    
    n1 = sousa.index(i[0])
    n2 = sousa[n1+1:].index(i[1])+n1+1
    n3 = sousa[n2+1:].index(i[2])+n2+1
    #print(sousa, sousa[n1+1:], sousa[n1+2:])
    count += 1
  except ValueError:
    continue
  #print(i)
  #moji.append(s[i[0]] + s[i[1]] + s[i[2]])
  #print(moji)
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=(int)(input())
moji = []
s=input()
for i in itertools.combinations(range(n), n-3):
  t = list(s)
  #print(i)
  for j in range(n-3):
    del t[i[j]-j]
  moji.append(''.join(t))
print(len(list(set(moji))))

Fixed submission:
import itertools
n=(int)(input())
moji = list('0123456789')
s=input()
count = 0

for i in itertools.product(moji, repeat=3):
  sousa = list(s)
  try:
    
    n1 = sousa.index(i[0])
    n2 = sousa[n1+1:].index(i[1])+n1+1
    n3 = sousa[n2+1:].index(i[2])+n2+1
    #print(sousa, sousa[n1+1:], sousa[n1+2:])
    count += 1
  except ValueError:
    continue
  #print(i)
  #moji.append(s[i[0]] + s[i[1]] + s[i[2]])
  #print(moji)
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=(int)(input())
moji = []
s=input()
for i in itertools.combinations(range(n), n-3):
  t = list(s)
  #print(i)
  for j in range(n-3):
    del t[i[j]-j]
  moji.append(''.join(t))
print(len(list(set(moji))))

Fixed submission:
import itertools
n=(int)(input())
moji = list('0123456789')
s=input()
count = 0

for i in itertools.product(moji, repeat=3):
  sousa = list(s)
  try:
    
    n1 = sousa.index(i[0])
    n2 = sousa[n1+1:].index(i[1])+n1+1
    n3 = sousa[n2+1:].index(i[2])+n2+1
    #print(sousa, sousa[n1+1:], sousa[n1+2:])
    count += 1
  except ValueError:
    continue
  #print(i)
  #moji.append(s[i[0]] + s[i[1]] + s[i[2]])
  #print(moji)
  
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import bisect
n=int(input())
count = 0
a=sorted(list(map(int, input().split(" "))))
for i in range(2,n):
  for j, k in itertools.combinations(a[:i], 2):
    if j + k > a[i]:
      count += 1
print(count)

Fixed submission:
n = int(input())
import bisect
a = sorted(list(map(int, input().split(" "))))
ans = 0
for i in range(1, n-1):
  b = a[:i]
  c = a[i + 1:]
  #print(b, c)
  for j in b:
    ans += bisect.bisect(c, a[i]+j-0.1)
    #print(bisect.bisect(c, a[i]+j-0.1))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import bisect
n=int(input())
count = 0
a=sorted(list(map(int, input().split(" "))))
for i in range(1,n-1):
  b = a[:i]
  c = a[i+1:]
  #print(a[i], b, c)
  for j, k in itertools.product(b,c):
    if a[i] + j > k:
      count += 1
print(count)

Fixed submission:
n = int(input())
import bisect
a = sorted(list(map(int, input().split(" "))))
ans = 0
for i in range(1, n-1):
  b = a[:i]
  c = a[i + 1:]
  #print(b, c)
  for j in b:
    ans += bisect.bisect(c, a[i]+j-0.1)
    #print(bisect.bisect(c, a[i]+j-0.1))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=int(input())
count = 0
a=list(map(int, input().split(" ")))
for ia, ib, ic in itertools.combinations(a, 3):
  if max(ia, ib, ic) < (ia + ib + ic) - max(ia, ib, ic):
    count += 1
print(count)

Fixed submission:
n = int(input())
import bisect
a = sorted(list(map(int, input().split(" "))))
ans = 0
for i in range(1, n-1):
  b = a[:i]
  c = a[i + 1:]
  #print(b, c)
  for j in b:
    ans += bisect.bisect(c, a[i]+j-0.1)
    #print(bisect.bisect(c, a[i]+j-0.1))
print(ans)