Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
li = list(map(int,input().split()))
num=[None]*N
num_ans=[None]*N

for i in range(min(li),max(li)+1):
  num_ans[i]=(li.count(i)*(li.count(i)-1))/2
ans=sum(num_ans)

for k in range(N):
  before=li.count(li[k])*(li.count(li[k])-1)/2
  after=(li.count(li[k])-2)*(li.count(li[k])-1)/2
  print(int(ans-before+after))

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

d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)

Buggy python submission (verdict: Runtime Error):
N=int(input())
li = list(map(int,input().split()))
num=[0]*N
num_ans=[0]*N

for i in range(max(li)+1):
  num[i]=li.count(i)
  num_ans[i]=(num[i]*(num[i]-1))/2
ans=sum(num_ans)

for k in range(N):
  num_k = li.count(li[k])
  before=num_k*(num_k-1)/2
  after=(num_k-2)*(num_k-1)/2
  print(int(ans-before+after))

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

d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)

Buggy python submission (verdict: Runtime Error):
N=int(input())
li = list(map(int,input().split()))
num=[0]*N
num_ans=[0]*N

for i in range(max(li)+1):
  num[i]=li.count(i)
  num_ans[i]=(num[i]*(num[i]-1))/2
ans=sum(num_ans)

for k in range(N):
  li2=(li[:k]+li[k+1:])
  num_k = li.count(li[k])
  before=num_k*(num_k-1)/2
  after=(num_k-2)*(num_k-1)/2
  print(int(ans-before+after))

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

d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)
Buggy python submission (verdict: Runtime Error):
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd

n,m = map(int, input().split())
SCs = [list(map(int, input().split())) for _ in range(m)]

for i in range(10^n):
  X=str(i)
  tf=True
  if len(X)==n:
    for j in SCs:
      if X[j[0]]!=j[1]:
        tf=False
    if tf:
      print(i)
      sys.exit()
print(-1)

Fixed submission:
import sys
n,m = map(int, input().split())
SCs = [list(map(int, input().split())) for _ in range(m)]
for i in range(10**n):
  X=str(i)
  tf=True
  if len(X)==n:
    for j in SCs:
      if X[j[0]-1]!=str(j[1]):
        tf=False
        break
    if tf:#全ループ終わって条件を満たしていれば
      print(i)
      sys.exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd

n,m = map(int, input().split())
SCs = [list(map(int, input().split())) for _ in range(m)]

for i in range(10^n):
  X=str(i)
  tf=True
  if len(X)==n:
    for j in SCs:
      if X[SCs[0]]!=SCs[1]:
        tf=False
    if tf:
      print(i)
      sys.exit()
print(-1)

Fixed submission:
import sys
n,m = map(int, input().split())
SCs = [list(map(int, input().split())) for _ in range(m)]
for i in range(10**n):
  X=str(i)
  tf=True
  if len(X)==n:
    for j in SCs:
      if X[j[0]-1]!=str(j[1]):
        tf=False
        break
    if tf:#全ループ終わって条件を満たしていれば
      print(i)
      sys.exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
#個数が無制限のナップザックの問題(ただし、上限に注意)です(どの魔法を順番に選べば良いなどの制約がないのでナップザックDPを選択しました。)。
#dpの配列にはi番目の要素にモンスターの体力をi減らすために必要な最小の魔力を保存します。
#この配列は個数制限がないことに注意してinfではない要素のみを順に更新していけば良いです。
#また、最終的にモンスターの体力を最小の魔力で0以下にすれば良いので、モンスターの体力をh以上減らせる最小の魔力を求めれば良いです。

h,n=map(int,input().split())
a,b=[],[]
for i in range(n):
    a_sub,b_sub=map(int,input().split())
    a.append(a_sub)
    b.append(b_sub)
inf=10000000000000
ma=max(a)#ダメージの最大値

dp=[inf]*(h+ma)#与えるダメージの最大値を考慮したDP
dp[0]=0#初期値

for i in range(h+1+ma):# 与えるダメージ合計：0ーH+1+maまで
    if dp[i] == inf:#更新してきて、ダメージiになる組み合わせが存在しない場合は飛ばす
        continue
    for j in range(n):    #N個の魔法を試す
        ni = i + a[j] #今の状態から新しく与えた場合のダメージ合計
        if ni<h+ma:#オーバーキルの範囲を超えるなら、無視
            dp[ni] = min(dp[ni], dp[i] + b[j])        #ダメージniを与えるのにより小さい魔力で実現できる場合は更新
print(min(dp[h:]))


Fixed submission:
#個数が無制限のナップザックの問題(ただし、上限に注意)です(どの魔法を順番に選べば良いなどの制約がないのでナップザックDPを選択しました。)。
#dpの配列にはi番目の要素にモンスターの体力をi減らすために必要な最小の魔力を保存します。
#この配列は個数制限がないことに注意してinfではない要素のみを順に更新していけば良いです。
#また、最終的にモンスターの体力を最小の魔力で0以下にすれば良いので、モンスターの体力をh以上減らせる最小の魔力を求めれば良いです。

h,n=map(int,input().split())
a,b=[],[]
for i in range(n):
    a_sub,b_sub=map(int,input().split())
    a.append(a_sub)
    b.append(b_sub)
inf=10000000000000
ma=max(a)#ダメージの最大値

dp=[inf]*(h+1+ma)#与えるダメージの最大値を考慮したDP
dp[0]=0#初期値

for i in range(h+1+ma):# 与えるダメージ合計：0ーH+1+maまで
    if dp[i] == inf:#更新してきて、ダメージiになる組み合わせが存在しない場合は飛ばす
        continue
    for j in range(n):    #N個の魔法を試す
        ni = i + a[j] #今の状態から新しく与えた場合のダメージ合計
        if ni<h+ma:#オーバーキルの範囲を超えるなら、無視
            dp[ni] = min(dp[ni], dp[i] + b[j])        #ダメージniを与えるのにより小さい魔力で実現できる場合は更新
print(min(dp[h:]))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int,input().split()))

c = itertools.combinations(L, 3)
count=0
for i in c:
  c2=list(i)
  max_index=c2.index(max(c2))
  del c2[max_index]
  if max(i)<sum(c2):
    count+=1
print(count)

Fixed submission:
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
for a in range(N):
  for b in range(a+1,N):
    c=bisect.bisect_left(L, L[a]+L[b])#第一条件(終点)
    if b<c:#第2条件（始点）
      ans+=c-b-1     
print(ans)#bisectのインデックスより一個前なら小さい
Buggy python submission (verdict: Runtime Error):
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
A_point=[K]*N
#全体の試合数Q-
for a in A:
  A_point[a]-=1
for aa in A_point:
  if aa<=0:
    print("NO")
  else:
    print("Yes")

Fixed submission:
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
A_point=[0]*N

for a in A:
  A_point[a-1]+=1

for aa in A_point:
  if K-(Q-aa)<=0:
    print("No")
  else:
    print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]

for i in range(N):
  if K-(Q-A.count(i+1))<=0:
    print("No")
  else:
    print("Yes")
          
    
  
  

Fixed submission:
N,K,Q=map(int,input().split())
A=[int(input()) for i in range(Q)]
A_point=[0]*N

for a in A:
  A_point[a-1]+=1

for aa in A_point:
  if K-(Q-aa)<=0:
    print("No")
  else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
S=int(input())
print(sum([i for i in range(S)]))


Fixed submission:
import math
N=int(input())
#print(sum([i for i in range(S)]))
"""
if s%2==0:
  ans=(1+s)*(s/2)
else:
  ans=(1+s)*int(s/2)+(int(s/2)+1)
"""
print(int(N*(N-1)//2))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N=len(S)
ans=[0]*N
index=[]#このインデックスの上に来たら探索終了
mmm=10**100

#あらかじめDPでどのマスにいたらどこに行くかを

for i in range(N-1):
  if (S[i]=="R" and S[i+1]=="L"):
    index.append(i)


    
for i in range(N):
  position=i
  count=0
  while(count<mmm):
    if position in index:
      ans[position+(mmm-count)%2]+=1
      break
    else:
      count+=1
      if S[position]=="R":
        position+=1
      elif S[position]=="L":
        position-=1
print(' '.join(map(str, ans)))

Fixed submission:
S=input()
"""
#最終的にどこかに収束するはず
#Rから出発した人はLがある場所まで進み、あとはLとRで反復
Lも同様

"""
ans=[0]*len(S)
R,L=0,0
points=[]#i,i+1、R,Lの4要素リストが格納
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":#RかLが連続している
        R+=1
    elif S[i]=="L" and S[i+1]=="L":#RかLが連続している
        L+=1
    #みんなが集まるポイント
    elif S[i]=="R" and S[i+1]=="L":
        if ans[i]==0:
            ans[i]=1
        if ans[i+1]==0:
            ans[i+1]=1
        #今まで数えてきたRを足す
        ans[i]+=R//2
        ans[i+1]+=R//2+R%2#余りはもらう
        points=[i,i+1]
        R=0#R区間初期化
    #ここまで数えてきたLを前の数値に足す
    elif S[i]=="L" and S[i+1]=="R":
        if len(points)>0 and L>0:
            ans[points[0]]+=L//2+L%2#余りはもらう
            ans[points[1]]+=L//2
        L=0#L区間初期化
        points=[]
#拾い残し回収
if L>0 and len(points)>0:
    ans[points[0]]+=L//2+L%2#余りはもらう
    ans[points[1]]+=L//2

map = map(str, ans)
print(' '.join(map))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N=len(S)
ans=[0]*N
index=[]#このインデックスの上に来たら探索終了
mmm=10**100
for i in range(N-1):
  if (S[i]=="R" and S[i+1]=="L"):
    index.append(i)

for i in range(N):
  position=i
  count=0
  while(count<mmm):
    if position in index:
      ans[position+(mmm-count)%2]+=1
      break
    else:
      count+=1
      if S[position]=="R":
        position+=1
      elif S[position]=="L":
        position-=1
print(' '.join(map(str, ans)))

Fixed submission:
S=input()
"""
#最終的にどこかに収束するはず
#Rから出発した人はLがある場所まで進み、あとはLとRで反復
Lも同様

"""
ans=[0]*len(S)
R,L=0,0
points=[]#i,i+1、R,Lの4要素リストが格納
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":#RかLが連続している
        R+=1
    elif S[i]=="L" and S[i+1]=="L":#RかLが連続している
        L+=1
    #みんなが集まるポイント
    elif S[i]=="R" and S[i+1]=="L":
        if ans[i]==0:
            ans[i]=1
        if ans[i+1]==0:
            ans[i+1]=1
        #今まで数えてきたRを足す
        ans[i]+=R//2
        ans[i+1]+=R//2+R%2#余りはもらう
        points=[i,i+1]
        R=0#R区間初期化
    #ここまで数えてきたLを前の数値に足す
    elif S[i]=="L" and S[i+1]=="R":
        if len(points)>0 and L>0:
            ans[points[0]]+=L//2+L%2#余りはもらう
            ans[points[1]]+=L//2
        L=0#L区間初期化
        points=[]
#拾い残し回収
if L>0 and len(points)>0:
    ans[points[0]]+=L//2+L%2#余りはもらう
    ans[points[1]]+=L//2

map = map(str, ans)
print(' '.join(map))
Buggy python submission (verdict: Time Limit Exceeded):
N,M= map(int,input().split())
gate=[list(map(int,input().split())) for i in range(M)]
count2=0

for i in range(1,N+1):
  count=0
  for j in gate:
    if j[0]<=i<=j[1]:
      count+=1
    else:
      break
  if count==M:
    count2+=1
print(count2)

Fixed submission:
N,M= map(int,input().split())
gate=[list(map(int,input().split())) for i in range(M)]
count2=0

min1=1
max1=N

for j in gate:
  if j[0]>min1:
    min1=j[0]
  if j[1]<max1:
    max1=j[1]
if max1>=min1:
  print(max1-min1+1)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M= map(int,input().split())
gate=[list(map(int,input().split())) for i in range(M)]
count2=0
for i in range(1,N+1):
  count=0
  for j in gate:
    if j[0]<=i<=j[1]:
      count+=1
  if count==M:
    count2+=1
print(count2)

Fixed submission:
N,M= map(int,input().split())
gate=[list(map(int,input().split())) for i in range(M)]
count2=0

min1=1
max1=N

for j in gate:
  if j[0]>min1:
    min1=j[0]
  if j[1]<max1:
    max1=j[1]
if max1>=min1:
  print(max1-min1+1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[] for _ in range(N)]

for edge in edges:#edge0=u,edge1=v,edge2=w
  u=edge[0]
  v=edge[1]
  w=edge[2]
  A[u-1].append([v-1,w])
  A[v-1].append([u-1,w])
#A[i-1]に頂点iと隣接する頂点とその距離を格納

#depth[i-1]=頂点１から頂点iへの距離
#頂点1への距離は0
depth = [-1] * (N)
depth[0] = 0
#depth[i] = 1から頂点dまでの距離(=depth[d]) + 頂点dからiの距離(=X[1]))で更新可能

def dfs(A,d):
    for X in A[d]:#X[0]:頂点X　X[1]:頂点dから頂点Xの距離
        if depth[X[0]] == -1:#距離が-1ならまだ行っていない
            depth[X[0]] = depth[d] + X[1]
            dfs(A,X[0])#次の隣の頂点へ

dfs(A,0)#頂点0からスタート
for d in depth:
    if d % 2 == 0:
        print(0)
    else:
        print(1)

Fixed submission:
import sys
sys.setrecursionlimit(500*500)
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[] for _ in range(N+1)]
 
for edge in edges:
  A[edge[0]].append([edge[1],edge[2]])
  A[edge[1]].append([edge[0],edge[2]])
  
depth = [-1] * (N+1)
depth[1] = 0
 
def dfs(A,s):
  for v in A[s]:
    if depth[v[0]] == -1:
      depth[v[0]] = depth[s] + v[1]
      dfs(A,v[0])    
dfs(A,1)
for d in depth[1:]:
  if d % 2 == 0:
    print(0)
  else:
    print(1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[] for _ in range(N)]

for edge in edges:#edge0=u,edge1=v,edge2=w
  u=edge[0]
  v=edge[1]
  w=edge[2]
  A[u-1].append([v-1,w])
  A[v-1].append([u-1,w])
#A[i-1]に頂点iと隣接する頂点とその距離を格納

#depth[i-1]=頂点１から頂点iへの距離
#頂点1への距離は0
depth = [-1] * (N)
depth[1] = 0
#depth[i] = 1から頂点dまでの距離(=depth[d]) + 頂点dからiの距離(=X[1]))で更新可能

def dfs(A,d):
    for X in A[d]:#X[0]:頂点X　X[1]:頂点dから頂点Xの距離
        if depth[X[0]] == -1:#距離が-1ならまだ行っていない
            depth[X[0]] = depth[d] + X[1]
            dfs(A,X[0])#次の隣の頂点へ

dfs(A,0)#頂点0からスタート
for d in depth:
    if d % 2 == 0:
        print(0)
    else:
        print(1)

Fixed submission:
import sys
sys.setrecursionlimit(500*500)
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[] for _ in range(N+1)]
 
for edge in edges:
  A[edge[0]].append([edge[1],edge[2]])
  A[edge[1]].append([edge[0],edge[2]])
  
depth = [-1] * (N+1)
depth[1] = 0
 
def dfs(A,s):
  for v in A[s]:
    if depth[v[0]] == -1:
      depth[v[0]] = depth[s] + v[1]
      dfs(A,v[0])    
dfs(A,1)
for d in depth[1:]:
  if d % 2 == 0:
    print(0)
  else:
    print(1)
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える

for i in range(N):
    for j in range(W+1):#重さ0からWまでチェック
        if j-w[i]>=0:#入れてもOKな場合,容量と価値を足す
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
        else:#何も入れずに先に進む
            dp[i+1][j]=dp[i][j]
print(max(set(dp[N])))


Fixed submission:
N=int(input())
h=list(map(int, input().split()))
dp=[0]*N
for i in range(N):
  if i==0:
    dp[i]=0
  elif i==1:
    dp[i]=abs(h[i]-h[i-1])
  else:
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える

for i in range(N):
    for j in range(W+1):#重さ0からWまでチェック
        if j-w[i]>=0:#入れてもOKな場合,容量と価値を足す
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
        else:#何も入れずに先に進む
            dp[i+1][j]=dp[i][j]
print(max(set(dp)))


Fixed submission:
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える

for i in range(N):
    for j in range(W+1):#重さ0からWまでチェック
        if j-w[i]>=0:#入れてもOKな場合,容量と価値を足す
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
        else:#何も入れずに先に進む
            dp[i+1][j]=dp[i][j]
print(dp[N][W])

Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える

for i in range(N):
    for j in range(W+1):#重さ0からWまでチェック
        if j-w[i]>=0:#入れてもOKな場合,容量と価値を足す
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
        else:#何も入れずに先に進む
            dp[i+1][j]=dp[i][j]
print(max(set(dp))


Fixed submission:
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
# dp[i][j](j=0,1,...,W)の値が求まっている状態で、dp[i+1][j]を更新することを考える

for i in range(N):
    for j in range(W+1):#重さ0からWまでチェック
        if j-w[i]>=0:#入れてもOKな場合,容量と価値を足す
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
        else:#何も入れずに先に進む
            dp[i+1][j]=dp[i][j]
print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
#1+2+2+2=7
K=input()
keta=len(K)
#print(K,keta)

for i in range(1<<(keta-1)):#探索数
  ANS=K[0]
  for j in range(keta-1):#調査桁数
    if (i>>j) &1 == 1:#bitがある、つまりプラスが入る場合
      ANS+="+"
    ANS+=K[j+1]
#  print(ANS)
  if eval(ANS)==7:
    print(ANS+"=7")
    break
  

Fixed submission:
#1+2+2+2=7
K=input()
keta=len(K)
#print(K,keta)

for i in range(1<<(keta-1)):#探索数
  ANS=K[0]
  for j in range(keta-1):#調査桁数
    if (i>>j) &1 == 1:#bitがある、つまりプラスが入る場合
      ANS+="+"
    else:
      ANS+="-"
    ANS+=K[j+1]
#  print(ANS)
  if eval(ANS)==7:
    print(ANS+"=7")
    break
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D=map(int,input().split())
def walk(place,D):
    A=place-D
    B=place+D
    if abs(A)>abs(B):
        return B
    else: 
        return A

for i in range(K):
    X=walk(X,D)
print(abs(X))

Fixed submission:
X,K,D=map(int,input().split())
step=-(-abs(X) // D)
if (abs(X)-step*D)>(abs(X)-(step-1)*D):
    step=step-1
if step>=K:
    print(abs(abs(X)-K*D))
else:
    if (K-step)%2==0:
        print(abs(abs(X)-step*D))
    else:
        print(D-abs(abs(X)-step*D))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%2==0 or n%5==0:
    print(-1)
else:
    count=1
    flag=0
    num=7
    while flag==0:
        if num%n==0:
            flag=1
        else:
            num=num*10+7
            count=count+1
print(count)



Fixed submission:
n=int(input())
if n%2==0 or n%5==0:
    print(-1)
else:
    count=1
    flag=0
    num=7
    mod=7%n
    while flag==0:
        if mod==0:
            flag=1
        else:
            mod=(mod*10+7)%n
            count=count+1
    print(count)
Buggy python submission (verdict: Runtime Error):
N=int(input())
souba=list(map(int,input().split()))
urikaiba=list()
money=1000
num=0
for i in range(1,N-1):
    if (souba[i]-souba[i-1])*(souba[i+1]-souba[i])<=0 and ((souba[i]-souba[i-1])!=0 or (souba[i+1]-souba[i])!=0) and (souba[i]-souba[i-1])!=0:
        urikaiba.append(souba[i])
urikaiba.insert(0,souba[0])
urikaiba.append(souba[N-1])
for i in range(len(urikaiba)-1):
    if urikaiba[i+1]-urikaiba[i]>0:
        num=money//urikaiba[i]
        money=money-num*urikaiba[i]
    elif urikaiba[i+1]-urikaiba[i]<0:
        money=money+num*souba[i]
        num=0
if num==0:
    print(money)
else:
    print(money+num*souba[N-1])

Fixed submission:
X=int(input())
if X<=599:
    print(8)
elif X<=799:
    print(7)
elif X<=999:
    print(6)
elif X<=1199:
    print(5)
elif X<=1399:
    print(4)
elif X<=1599:
    print(3)
elif X<=1799:
    print(2)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
for i in range(1,n+1):
    nn=int(math.sqrt(i))
    min=int((nn+1)/math.sqrt(3))
    min1=int((nn+1)/math.sqrt(2))
    count=0
    for x in range(1,min+1):
        for y in range(x,min1+1):
            for z in range(y,nn+1):
                #print(x*x+y*y+z*z+x*y+y*z+z*x)
                if (x*x+y*y+z*z+x*y+y*z+z*x)==i:
                    if x==y and y==z and z==x:
                        count=count+1
                    elif x!=y and y!=z and z!=x:
                        count=count+6
                    else:
                        count=count+3
    print(count)


Fixed submission:
a = list(map(int,input().split()))
answer=int(a[1]/a[2])-int(a[0]/a[2])
if a[0]%a[2]==0:
    answer=answer+1
print(answer)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
for i in range(1,n+1):
    nn=int(math.sqrt(i))
    min=int((nn+1)/3)
    min1=int((nn+1)/2)
    count=0
    for x in range(1,min+1):
        for y in range(x,min1+1):
            for z in range(y,nn+1):
                #print(x*x+y*y+z*z+x*y+y*z+z*x)
                if (x*x+y*y+z*z+x*y+y*z+z*x)==i:
                    if x==y and y==z and z==x:
                        count=count+1
                    elif x!=y and y!=z and z!=x:
                        count=count+6
                    else:
                        count=count+3
    print(count)


Fixed submission:
a = list(map(int,input().split()))
answer=int(a[1]/a[2])-int(a[0]/a[2])
if a[0]%a[2]==0:
    answer=answer+1
print(answer)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
for i in range(1,n+1):
    nn=int(math.sqrt(i))
    min=int((nn+1)/3)
    min1=int((nn+1)/2)
    count=0
    for x in range(1,min+1):
        for y in range(x,min1+1):
            for z in range(y,nn+1):
                #print(x*x+y*y+z*z+x*y+y*z+z*x)
                if (x*x+y*y+z*z+x*y+y*z+z*x)==i:
                    if x==y and y==z and z==y:
                        count=count+1
                    elif x!=y and y!=z and z!=y:
                        count=count+6
                    else:
                        count=count+3
    print(count)


Fixed submission:
a = list(map(int,input().split()))
answer=int(a[1]/a[2])-int(a[0]/a[2])
if a[0]%a[2]==0:
    answer=answer+1
print(answer)
Buggy python submission (verdict: Runtime Error):
nn,kk=map(int,input.split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)



Fixed submission:
nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)

Buggy python submission (verdict: Runtime Error):
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)


Fixed submission:
nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)

Buggy python submission (verdict: Runtime Error):
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
   goukei=gokei+num_value[i]
print(goukei)


Fixed submission:
nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)

Buggy python submission (verdict: Runtime Error):
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
    for k in range(nn-i):
        if num_value[i]>num_value[k]:
            num_value[i],num_value[k]=num_value[k],num_value[i]
goukei=goukei+num_value[i]
print(goukei)



Fixed submission:
nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)

Buggy python submission (verdict: Runtime Error):
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
    goukei=goukei+num_value[kk]
print(goukei)

Fixed submission:
nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)

Buggy python submission (verdict: Runtime Error):
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
    goukei=goukei+num_value[kk]
print(goukei)


Fixed submission:
nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0
res = []

for i in range(1,N) :
    for j in range(1,N) :
        a = i
        b = j
        c = N-a*b
        
        if a*b>=N :
            break
        
        if a*b+c == N :
            count += 1

print(count)

Fixed submission:
N = int(input())
count = 0

for i in range(1,N) :
    count += (N-1)//i

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0

for i in range(1,N) :
    for j in range(1,N) :
        for k in range(1,N) :
            a = i
            b = j
            c = k
            if a*b+c==N :
                count += 1

print(count)

Fixed submission:
N = int(input())
count = 0

for i in range(1,N) :
    count += (N-1)//i

print(count)