TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq
N, M =map(int, input().split())
A = [[] for i in range(10**5+1)]

for i in range(M):
    a, b = map(int,input().split())
    A[a].append(-b)

work_cand = []
sum = 0

for i in range(M+1):
    add_jobs = A[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            heapq.heappush(work_cand, j)
    if len(work_cand) == 0:
        continue
    sum += heapq.heappop(work_cand)
ans = -(sum)
print(ans)

import heapq
N, M =map(int, input().split())
A = [[] for i in range(10**5+1)]
 
for i in range(N):
    a, b = map(int,input().split())
    if a > m:
        continue
    A[a].append(-b)
 
work_cand = []
sum = 0
 
for i in range(M+1):
    add_jobs = A[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            heapq.heappush(work_cand, j)
    if len(work_cand) == 0:
        continue
    sum += heapq.heappop(work_cand)
ans = -(sum)
print(ans)

N, M =map(int, input().split())
A = [[] for i in range(10**5+1)]

for i in range(M):
    a, b = map(int,input().split())
    A[a].append(-b)

work_cand = []
sum = 0

for i in range(M+1):
    add_jobs = A[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            heapq.heappush(work_cand, j)
    sum += heapq.heappop(work_cand)
ans = -(sum)
print(ans)

import heapq
N, M =map(int, input().split())
A = [[] for i in range(10**5+1)]
 
for i in range(N):
    a, b = map(int,input().split())
    if a > M:
        continue
    A[a].append(-b)
 
work_cand = []
sum = 0
 
for i in range(M+1):
    add_jobs = A[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            heapq.heappush(work_cand, j)
    if len(work_cand) == 0:
        continue
    sum += heapq.heappop(work_cand)
ans = -(sum)
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
from heapq import heappop,heappush
from collections import defaultdict
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab_sort = sorted(ab,key=lambda x:x[0])
h_queue = []
j = 0
ans = 0
for i in range(1,m+1):
    while (j < n) and (ab_sort[j] <= i):
        heappush(h_queue,ab_sort[j])
        j += 1
    if len(h_queue):
        ans -= heappop(h_queue)
print(ans)




from heapq import heappop,heappush
from collections import defaultdict
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab_sort = sorted(ab,key=lambda x:x[0])
h_queue = []
j = 0
ans = 0
for i in range(1,m+1):
    while (j < n) and (ab_sort[j][0] <= i):
        heappush(h_queue,-ab_sort[j][1])
        j += 1
    if len(h_queue) :
        ans -= heappop(h_queue)
print(ans)


Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq

N, M = map(int, input().split())
income = [[] for _ in range(M+1)]  
for _ in range(N):
    a, b = map(int, input().split())
    if a <= M:
        income[a].append(-b)


ans = 0
tmp = []
for rest_days in range(1, M+1):
    tmp += income[rest_days]
    heapq.heapify(tmp)
    if tmp:
        ans += heapq.heappop(tmp)

print(-ans)v

import heapq

N, M = map(int, input().split())
income = [[] for _ in range(M+1)]  
for _ in range(N):
    a, b = map(int, input().split())
    if a <= M:
        income[a].append(-b)


ans = 0
tmp = []
heapq.heapify(tmp)

for rest_days in range(1, M+1):
    for x in income[rest_days]:
        heapq.heappush(tmp, x)
    if tmp:
        ans += heapq.heappop(tmp)

print(-ans)

Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())
data = getSomeInputListInt(n)

data_list = [[0] for _ in range(m)]

for i in range(n):
    if data[i][0]-1 < n:
        data_list[data[i][0]-1].append(-data[i][1])

heap_list = []
heapq.heapify(heap_list)

ans = 0
for i in range(0, m):
    heap_list.extend(data_list[i])
    heapq.heapify(heap_list)
    a = heapq.heappop(heap_list)
    ans += a

print(-ans)

import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())
data = getSomeInputListInt(n)

data_list = [[0] for _ in range(m)]

for i in range(n):
    if data[i][0]-1 < m:
        data_list[data[i][0]-1].append(-data[i][1])

heap_list = []
heapq.heapify(heap_list)
# heapq.heapify(data_list)

ans = 0
for j in range(m):
    for i in range(len(data_list[j])):
        heapq.heappush(heap_list, data_list[j][i])
    a = heapq.heappop(heap_list)
    ans += a

print(-ans)

Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
# -*- coding: utf-8 -*-

def my_sort(word):
    sorted_word_list = sorted(word)
    sorted_word = ""
    for letter in sorted_word_list:
        sorted_word += letter
    return sorted_word

n = int(input())
words = {}
for i in range(n):
    word = my_sort(input())
    if word in words.keys():
        words[word] += 1
    else:
        words[word] = 0

print(sum(words.values()))


# -*- coding: utf-8 -*-

import heapq


class MaxHeap:
    def __init__(self, li):
        self.heap = [-e for e in li]
        heapq.heapify(self.heap)

    def push(self, val):
        heapq.heappush(self.heap, -val)

    def pop(self):
        return -heapq.heappop(self.heap)

    def __len__(self):
        return len(self.heap)


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

ab.sort()

h = MaxHeap([])

i = 0
ans = 0
for day in range(1, m + 1):
    while i < n and ab[i][0] <= day:
        h.push(ab[i][1])
        i += 1
    if len(h) == 0:
        continue
    ans += h.pop()

print(ans)


Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
ab = sorted(ab, key= lambda x:(x[0]))

from heapq import heappush,heappop

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

hq = []
j = 0
ans = 0

for i in range(m):
  while j<n and ab[j][0] <= i+1:
    heappush(hq,-ab[j][1])
    j+=1
  if len(hq)>0:
    ans += -heappop(hq)
    
print(ans)    

from heapq import heappush,heappop

n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key= lambda x:(x[0]))

hq = []
j = 0
ans = 0

for i in range(m):
  while j<n and ab[j][0] <= i+1:
    heappush(hq,-ab[j][1])
    j+=1
  if len(hq)>0:
    ans += -heappop(hq)
    
print(ans)    

Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq
n,m=map(int,input().split())
t=[[0] for _ in range(m)]
for i in range(n):
    a,b=map(int,input().split())
    if a>m:
        continue
    t[a-1].append(b)
h=[]
for i in range(m):
    t[i].sort(reverse=True)
    for j in range(min(len(t[i]),m-i)):
            h.append(-t[i][j])
print(h)
heapq.heapify(h)
ans=0
for i in range(m):
    ans+=-heapq.heappop(h)
print(ans)

import heapq
n,m=map(int,input().split())
t=[[] for _ in range(m+1)]
for i in range(n):
    a,b=map(int,input().split())
    if a>m:
        continue
    t[a].append(b)
ans=0
h=[]
for l in t:
    for i in l:
        heapq.heappush(h,-i)
    if h:
        ans-=heapq.heappop(h)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    Ans += -heapq.heappop(h)

print(Ans)


# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
Wlist = []
for i in range(N):
    A, B = map(int, input().split())
    Wlist.append([A,B])
Wlist.sort(key=lambda x:x[0])

h = []
Ans = 0
Index = 0
for day in range(1,M+1):
    while Index < N:
        if Wlist[Index][0] <= day:
            heapq.heappush(h, -Wlist[Index][1])
            Index += 1
        else:
            break
    if len(h):
        Ans += -heapq.heappop(h)

print(Ans)


Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
n,m=map(int,input().split())
w=[]
for i in range(n):
  w.append(list(map(int,input().split())))

total = 0
for i in range(m):
  max=0
  max_j=0
  max_day=0
  
  for j in range(len(w)):
    if w[j][0] <= m-i and w[j][1] > max: 
      max = w[j][1]
      max_j=j
      max_day=w[j][0]
    elif w[j][0] <= m-i and w[j][1] == max:
      if w[j][0] > max_day:
        max = w[j][1]
        max_j=j
        max_day=w[j][0]
        
  total = total+max
  if(len(w)>0):
    w.remove(max_j)

print(total)

import sys
readline = sys.stdin.readline

N,M = map(int,readline().split())
from collections import defaultdict
tasks = defaultdict(list)
for i in range(N):
  a,b = map(int,readline().split())
  tasks[a].append(b)
  
import heapq as hq
q = []
ans = 0
for i in range(1, M + 1):
  newtask = tasks[i]
  for t in newtask:
    hq.heappush(q,-t)
  if q:
    ans += -hq.heappop(q)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq
N,M=map(int,input().split())
x={}
for i in range(M+1):
    x[i]=[]
for i in range(N):
    a,b=map(int,input().split())
    if a>=M:
        continue
    x[a].append(-b)
y=[]
an=0
for i in range(M+1):
    for n in x[i]:
        heapq.heappush(y,n)
    try:
        an-=heapq.heappop(y)
    except:
        pass
print(an)

N,M=map(int,input().split())
x=[]
an=0
for i in range(M+1):
    x.insert(i,[])
for i in range(N):
    a,b=map(int,input().split())
    if a<=M:
        x[a].append(b)
y=[]
while n in <=M+1:
    y+=x[n]
    try:
        n=y.count(max(y))
        an+=n*max(y)
        for z in range(n)
            y.remove(max(y))
        n+=1
    except:
        continue
print(an)

import heapq
N,M=map(int,input().split())
x={}
for i in range(M+1):
    x[i]=[]
for i in range(N):
    a,b=map(int,input().split())
    x[a].append(-b)
y=heapq.heapify([])
an=0
for i in range(M+1):
    for n in x[i]:
        heapq.heappush(y,n)
    try:
        an-=heapq.heappop(y)
    except:
        pass
print(an)

import heapq
N,M=map(int,input().split())
x={}
for i in range(M+1):
    x[i]=[]
for i in range(N):
    if i <=M:
        continue
    a,b=map(int,input().split())
    x[a].append(-b)
y=[]
an=0
for i in range(M+1):
    for n in x[i]:
        heapq.heappush(y,n)
    try:
        an-=heapq.heappop(y)
    except:
        pass
print(an)


import heapq
N,M=map(int,input().split())
x={}
for i in range(M+1):
    x[i]=[]
for i in range(N):
    a,b=map(int,input().split())
    if a>M:
        continue
    x[a].append(-b)
y=[]
an=0
for i in range(M+1):
    for n in x[i]:
        heapq.heappush(y,n)
    try:
        an-=heapq.heappop(y)
    except:
        pass
print(an)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import sys

n,m = map(int,input().split())
dic = {}

for i in range(n):
  a,b = map(int,input().split())
  if b in dic:
    pass
  else:
    dic[b] = []
  
  dic[b].append(a)
  
dic = dict(sorted(dic.items(),key=lambda x: -x[0]))

count = 0

for key in dic.keys():
  lst = dic[key]
  lst = sorted(lst,reverse=True)
  for i in lst:
    tmp = i
    if tmp <= m:
      count += key
      m -= 1
      print(key)
      if m == 0:
        print(count)
        sys.exit()
        
print(count)

import heapq

n,m = map(int,input().split())
dic = {}

for i in range(n):
  a,b = map(int,input().split())
  if a in dic:
    pass
  else:
    dic[a] = []
  
  dic[a].append(-b)
  
dic = dict(sorted(dic.items(),key=lambda x: -x[0]))

count = 0

lst = []
for i in range(1,m+1):
  if i in dic.keys():
    for num in dic[i]:
      heapq.heappush(lst, num)
  if len(lst) != 0:
    tmp = heapq.heappop(lst)
    count -= tmp
  

print(count)

Verdicts: Wrong Answer

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
# D - Summer Vacation

_input = list(map(int, input().split()))
n = _input[0]
m = _input[1]
jobs = dict()
for i in range(n):
    __input = list(map(int, input().split()))
    a = __input[0]
    b = __input[1]
    item = jobs[b] if b in jobs else list()
    item.append(a)
    item.sort(reverse=True)
    jobs[b] = item

sorted(jobs.items(), key=lambda j: -j[0])
reward = 0
while m > 0:
    for b, aList in jobs:
        if len(aList) > 0 and m >= aList[0]:
            reward += b
            aList.pop(0)
            jobs[b] = aList
            break
    m -= 1

print(reward)

# D - Summer Vacation ★
from collections import defaultdict
from heapq import heappush, heappop

_input = list(map(int, input().split()))
n = _input[0]
m = _input[1]
jobs = defaultdict(list)


for i in range(n):
    a, b = list(map(int, input().split()))
    if a <= m:
        jobs[a].append(b)



reward = 0
heapsort = []
for daysLeft in range(1, m + 1):
    if daysLeft in jobs:
        for b in jobs[daysLeft]:
            heappush(heapsort, -b)
    if len(heapsort) > 0:
        reward += -heappop(heapsort)
print(reward)

Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
#coding utf-8
import heapq
N,M=map(int,input().split())
AB= [[int(i) for i in input().split()] for i in range(N)]
AB.sort(reverse=True)
work=[]
heapq.heapify(work)
ans=0
for i in range(1,M+1):
  while AB and AB[-1][0] <=i:
      tmp=AB.pop()
      heapq.heappush(work,-tmp[1])
  if work:
    tmp=heapq.heappop(work)
    ans-=tmp

#coding utf-8
import heapq
N,M=map(int,input().split())
AB= [[int(i) for i in input().split()] for i in range(N)]
AB.sort(reverse=True)
work=[]
heapq.heapify(work)
ans=0
for i in range(1,M+1):
  while AB and AB[-1][0] <=i:
      tmp=AB.pop()
      heapq.heappush(work,-tmp[1])
  if work:
    tmp=heapq.heappop(work)
    ans-=tmp
  
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
N,M=map(int,input().split())
s=[]
for i in range(N):
  s.append(list(map(int,input().split())))
a=sorted(s,key=lambda x:x[1],reverse=True)
b=sorted(a,key=lambda x:x[0])
print(b)
date=M-1
d=1
c=0
while date>=0:
  if b[0][0]==d:
    c=c+b[0][1]
  
  
  
  date=date-1
  d=d+1
print(c)

import heapq
n,m=map(int,input().split())
A=[[0]*2for i in range(n)]
for i in range(n):
  A[i]=list(map(int,input().split()))
A=sorted(A)
ans=0
s=[]
j=0
for i in range(m+1):
  while j<n:
    if A[j][0]>i:
      break
    heapq.heappush(s,A[j][1]*(-1))
    j=j+1
  if len(s)==0:
    continue
  ans=ans-heapq.heappop(s)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq
N , M = map(int , input().split())
jobs = [list(map(int , input().split())) for _ in range(N)]
jobs.sort()

q = []
index = 0
ans = 0
for limit in range(1 , M + 1):
    while index < N:
        time =jobs[index][0]
        reward = jobs[index][1]
        if limit >= time:
            heapq.heappush(q , -reward)
            index += 1
        else:
            break
    print(q)
    if len(q) != 0:
        tmp = heapq.heappop(q)
        ans -= tmp

print(ans)


import heapq
N , M = map(int , input().split())
jobs = [list(map(int , input().split())) for _ in range(N)]
jobs.sort()

q = []
index = 0
ans = 0
for limit in range(1 , M + 1):
    while index < N:
        time =jobs[index][0]
        reward = jobs[index][1]
        if limit >= time:
            heapq.heappush(q , -reward)
            index += 1
        else:
            break
    #print(q)
    if len(q) != 0:
        tmp = heapq.heappop(q)
        ans -= tmp

print(ans)


Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
# ABC-137-D
import heapq
N, M = map(int, input().split())
BA = []
for _ in range(N):
    A, B = map(int, input().split())
    BA.append((-1*B, A))
heapq.heapify(BA)

ans = 0
check_M = 1
while check_M <= M:
    try:
        max_B = heapq.heappop(BA)
    except:
        break
    if max_B[1] <= check_M:
        ans += (-1) * max_B[0]
        check_M += 1

print(ans)

# ABC-137-D
import heapq

N, M = map(int, input().split())
day_value = [[] for _ in range(M+1)]

for _ in range(N):
    A, B = map(int, input().split())
    if A <= M:
        day_value[A].append(B)

ans = 0
check_M = 1
BA = []
heapq.heapify(BA)

while check_M <= M:
    for item in day_value[check_M]:
        heapq.heappush(BA, -1*item)
    try:
        max_B = heapq.heappop(BA)
    except:
        check_M += 1
        continue
    ans += (-1) * max_B
    check_M += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq
from sys import stdin

n,m = map(int,stdin.readline().rstrip().split())
jobs = [[] for i in range(m)]

for i in range(n):
    tmp,tmp2 = map(int,stdin.readline().rstrip().split())
    if(tmp>m):
        continue
    jobs[m-tmp].append(tmp2)
print(jobs)
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,-b)
    print(h)
    if(len(h)!=0):
        a = -heapq.heappop(h)
        ans += a
print(ans)

import heapq
from sys import stdin

n,m = map(int,stdin.readline().rstrip().split())
jobs = [[] for i in range(m)]

for i in range(n):
    tmp,tmp2 = map(int,stdin.readline().rstrip().split())
    if(tmp>m):
        continue
    jobs[m-tmp].append(tmp2)
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,-b)
    if(len(h)!=0):
        a = -heapq.heappop(h)
        ans += a
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
import heapq
N , M =map(int,input().split())
L = [[] for _ in range(M + 1)]

for i in range(N):
  a,b = map(int,input().split())
  if a <= M:
    L[a].append(-b)

work = []
heapq.heapify(work)
ans = 0

for i in range(M,-1,-1):
  for j in range(len(L[i])):
    heapq.heappush(work,L[i][j])
    
  if len(work) > 0:
    ans -= heapq.heappop(work)
  
print(ans)

import heapq
N , M =map(int,input().split())
L = [[] for _ in range(M + 1)]

for i in range(N):
  a,b = map(int,input().split())
  if a <= M:
    L[M - a].append(-b)

work = []
heapq.heapify(work)
ans = 0

for i in range(M,-1,-1):
  for j in range(len(L[i])):
    heapq.heappush(work,L[i][j])
  if len(work) > 0:
    ans -= heapq.heappop(work)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.  You can take and complete at most one of these jobs in a day.  However, you cannot retake a job that you have already done.  Find the maximum total reward that you can earn no later than M days from today.  You can already start working today.

Submission attempts (in order):
N, M = map(int, input().split())
case = []
for i in range(N):
    AB = [int(i) for i in input().split()]
    if AB[0] <= M:
        case.append(AB)
    else:
        N -= 1

case.sort(key=lambda x: (-x[1], x[0]))
print(case)

ans = 0
count, shortest = 0, M
for i in range(N):
    if case[i][0] <= M - count or (case[i][0] <= M - (count - 1) and shortest <= M - count):
        shortest = min(shortest, case[i][0])
        count += 1
        ans += case[i][1]

print(ans)


import heapq

N, M = map(int, input().split())
case = sorted([[int(j) for j in input().split()] for i in range(N)], key=lambda x: -x[0])

candidate_queue = []
ans = 0

for i in range(1, M + 1):
    while case:
        if case[-1][0] <= i:
            heapq.heappush(candidate_queue, case.pop(-1)[1] * (-1))
        else:
            break

    if candidate_queue:
        ans += heapq.heappop(candidate_queue) * (-1)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins placed along that edge. Additionally, there is a button on Vertex N.  We will play a game on this graph. You start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins. It takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it. As usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.  When you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.) However, when you end the game, you will be asked to pay T \times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \times P coins, you will have to pay all of your coins instead.  Your score will be the number of coins you have after this payment. Determine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.

Submission attempts (in order):
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
chk = []
for i in range(n):
  a,b =  map(int,input().split())
  if a <= m:
    chk.append((a,b))

from heapq import heappop, heappush
from operator import itemgetter
chk = sorted(chk,key=itemgetter(0),reverse=True)

q = []
ans = 0
for i in range(1, m + 1):
    while chk and chk[-1][0] <= i:
        a,b = chk.pop()
        heappush(q,-b)
    if q:
        ans -= heappop(q)
print(ans)

from collections import deque
def use_path(n,start,es):
    q = deque()
    chk = [False] * n
    q.append(start)
    chk[start] = True
    used = {start}
    while len(q) > 0:
        node = q.popleft()
        for nex in es[node]:
            if not chk[nex]:
                chk[nex] = True
                q.append(nex)
                used.add(nex)
    return used
  
def belman(s,g,n,es):
    d = [10**10] * n
    d[s] = 0
    fin = False
    cnt = 0
    while True:
      update = False
      for p,q,r in es:
        if d[p] != 10**10 and d[q] > d[p] + r:
          d[q] = d[p] + r
          update = True
      cnt += 1
      if not update:
        fin = True
        break
      if cnt > n+1:
          break      
    if fin:
        return max(0,-d[g])
    else:
        return -1   
  
n,m,p = map(int, input().split())

l = [[] for i in range(n)]
r = [[] for i in range(n)]
edges = []

for i in range(m):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    l[a].append(b)
    r[b].append(a)
    edges.append((a,b,-c+p))
    
use_nodes = use_path(n,0,l) & use_path(n,n-1,r)
es = [(a,b,c) for a,b,c in edges if a in use_nodes and b in use_nodes]
print(belman(0,n-1,n,es))


Verdicts: Runtime Error

Accepted
Problem: There is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins placed along that edge. Additionally, there is a button on Vertex N.  We will play a game on this graph. You start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins. It takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it. As usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.  When you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.) However, when you end the game, you will be asked to pay T \times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \times P coins, you will have to pay all of your coins instead.  Your score will be the number of coins you have after this payment. Determine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.

Submission attempts (in order):
print(-1)

print(0)

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,M,P = map(int,readline().split())
ABC = np.array(read().split(),np.int64)

A = ABC[::3]
B = ABC[1::3]
C = ABC[2::3]

C = P-C



INF = 10**18
dist = np.full(N+1,INF,np.int64)
dist[1] = 0
for T in range(N+N+10):
    x = dist[A] + C
    update = (dist[B] > x) & (x < INF//2)
    b = B[update]; x = x[update]
    if T > N:
        dist[b] = -INF
    else:
        ind = x.argsort(); x = x[ind][::-1]; b=b[ind][::-1]
        dist[b] = x

answer = -dist[N]
if answer < 0:
    answer = 0
elif answer == INF:
    answer = -1
print(answer)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins placed along that edge. Additionally, there is a button on Vertex N.  We will play a game on this graph. You start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins. It takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it. As usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.  When you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.) However, when you end the game, you will be asked to pay T \times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \times P coins, you will have to pay all of your coins instead.  Your score will be the number of coins you have after this payment. Determine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.

Submission attempts (in order):
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError


def main():
    N, M, P = map(int, input().split())
    A, B, C = [0] * M, [0] * M, [0] * M
    for i in range(M):
        a, b, c = map(int, input().split())
        A[i], B[i], C[i] = a - 1, b - 1, P - c
    mx = csr_matrix((C, (A, B)), shape=(M, M))
    try:
        dm = bellman_ford(mx, indices=[N - 1])
    except NegativeCycleError:
        return -1
    return max(0, -int(dm[0][N - 1]))


print(main())


from scipy.sparse import csr_matrix, lil_matrix
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError


def main():
    N, M, P = map(int, input().split())
    A, B, C = [0] * M, [0] * M, [0] * M
    v = [set() for _ in range(N)]
    u = [set() for _ in range(N)]
    for i in range(M):
        a, b, c = map(int, input().split())
        A[i], B[i], C[i] = a - 1, b - 1, P - c
        u[a - 1].add(b - 1)
        v[b - 1].add(a - 1)
    vv = set()
    cur = set([N - 1])
    while cur:
        vv |= cur
        cur = set().union(*(v[c] for c in cur)) - vv
    uu = set()
    cur = set([0])
    while cur:
        uu |= cur
        cur = set().union(*(u[c] for c in cur)) - uu
    reachable = vv & uu
    l = {}
    for a, b, c in zip(A, B, C):
        if a in reachable and b in reachable:
            l[(a, b)] = min(c, l.get((a, b), 10 **9))
    AA, BB, CC = [], [], []
    for (a, b), c in l.items():
        AA.append(a)
        BB.append(b)
        CC.append(c)
    mx = csr_matrix((CC, (AA, BB)), shape=(N, N))
    try:
        dm = bellman_ford(mx, indices=[0])
    except NegativeCycleError:
        return -1
    return max(0, -int(dm[0][N - 1]))


print(main())


Verdicts: Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n=int(input())
s=len(str(n))
c=0

for i in range(s-1):
    if i%2==1:
        c+=9*10**(s-i-2)
if s%2==0:
    print(c)
else:
    c+=n-10**(s-1)+1
    print(c)

n=int(input())
s=len(str(n))
c=0
for i in range(s-1):
    if i%2==0:
        c+=9*10**i
if s%2==1:
    c+=n-(10**(s-1)-1)

print(c)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N=input()
ans=0

for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
      ans += 1
print(ans)

n=input()
ans=0
for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)

N=int(input())
ans=0

for i in range(1,n):
  if len(str(i)) % 2 == 1:
      ans += 1
print(ans)

n=input()
ans=0
for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
      ans += 1
print(ans)

n = int(input())
ans = 0

for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    ans += 1

print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n = input()
l = int(len(n))
ans = 0
if l == 1:
    print(n)
else:
    for i in range(1,l):
        if i %2 ==1:
            ans += 9*(10**(i-1))
        else:
            ans = ans 
ans += int(n) - 10**(l-1)
print(ans)
    

n = int(input())

ans = 0
for i in range(1,n+1):
    if len(str(i)) & 1:
        ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n = int(input())
d = 0;aux = n
while(aux>0):
  aux//=10
  d+=1
ans = 0
if(d&1): ans+= d-10**(d-1)+1
if(d>1): ans+=10
if(d>3): ans+=1000
if(d>5): ans+=100000
print(ans)


n = int(input())
d = 0;aux = n
while(aux>0):
  aux//=10
  d+=1
ans = 0

if(d&1): ans+= n-10**(d-1)+1
if(d>1): ans+=9
if(d>3): ans+=999-100+1
if(d>5): ans+=99999-10000+1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N = int(input())
if 10000<=N<=99999:
  print(N-9999+900+9)
elif 1000<=9999:
  print(909)
elif 100<=N<=999:
  print(N-99+9)
elif 10<=N<=99:
  print(9)
elif N==100000:
  print(90909)
else:
  print(N)
  




N = int(input())
if 10000<=N<=99999:
  print(N-9999+909)
elif 1000<=N<=9999:
  print(909)
elif 100<=N<=999:
  print(N-99+9)
elif 10<=N<=99:
  print(9)
elif N==100000:
  print(90909)
else:
  print(N)
  




Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
import io
import sys

MOD = 10 ** 9 + 7


def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
136
'''


def MAIN():
  T_IN()
  A()


def A():
  n = IN_I()

  t = 0
  if n > 9:
    t += 9

  if n > 999:
    t += 900

  if n > 99999:
    t += 90000

  if n <= 9:
    t += n
  elif 99 < n <= 999:
    t += n - 99
  elif 9999 < n <= 99999:
    t += n - 9999

  print(t)
  return None


def B():
  return None


def C():
  return None


MAIN()


import io
import sys

MOD = 10 ** 9 + 7


def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
136
'''


def MAIN():
  # T_IN()
  A()


def A():
  n = IN_I()

  t = 0
  if n > 9:
    t += 9

  if n > 999:
    t += 900

  if n > 99999:
    t += 90000

  if n <= 9:
    t += n
  elif 99 < n <= 999:
    t += n - 99
  elif 9999 < n <= 99999:
    t += n - 9999

  print(t)
  return None


def B():
  return None


def C():
  return None


MAIN()


Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n=int(input())
ans=0
for i in range(1,n+1):
  if len(str(n))%2==1:
    ans+=1
print(ans)


n=int(input())
ans=0
for i in range(1,n+1):
	if len(str(i))%2==1:
		ans+=1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N=int(input())
ans=0
for i in range(1,N+1) :
    if len(str(i))%2==0 :
        ans+=0
        print(ans)
    else :
        ans+=1
        print(ans)
print(ans)
    

N=int(input())
ans=0
for i in range(1,N+1) :
    if len(str(i))%2==0 :
        ans+=0
    else :
        ans+=1
print(ans)
    

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n = int(input())
cnt=0
for i in range(n):
	if len(str(i))%2==1:
		cnt+=1
print(cnt)

n = int(input())
cnt=0
for i in range(1,n+1):
	if len(str(i))%2==1:
		cnt+=1
print(cnt)


Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N = int(input())
i = 0
r = 0
while i < N:
    if len(str(i)) % 2 == 1:
        r += 1
    i += 1
print(r)

N = int(input())
i = 0
r = 0
while i <= N:
    if len(str(i)) % 2 == 1:
        r += 1
    i += 1
print(r)

N = int(input())
i = 1
r = 0
while i <= N:
    if len(str(i)) % 2 == 1:
        r += 1
    i += 1
print(r)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n=int(input())
c=0
for i in range(,n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)

n=int(input())
c=0
for i in range(n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)


Verdicts: Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n =int(input())
print(len([i for i in range(1, n+1) if int(log10(i)+1) % 2 != 0 and i <= n]))

from math import log10
n =int(input())
print(len([i for i in range(1, n+1) if int(log10(i)+1) % 2 != 0 and i <= n]))

Verdicts: Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
#another way:
def count_digits(n):
    d=0
    while(n>0):
        d += 1
        n = n//10
    return d
c=0
for i in range(1,N+1):
    if (count_digits(i)%2==1):
        c += 1
print(c)

N=int(input())
#another way:
def count_digits(n):
    d=0
    while(n>0):
        d += 1
        n = n//10
    return d
c=0
for i in range(1,N+1):
    if (count_digits(i)%2==1):
        c += 1
print(c)


Verdicts: Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N = int(input())
n = len(str(N))

if n==1:
	print(N)
else:
	M = [9,0]*(n//2)			
    M.pop()						
    M = map(str,M)				
    M = int(''.join(M))			
    if n%2==0:
		print(M)
	else:
		M = M + N - 10**n + 1
        print(M)

n=int(input())
l=len(str(n))
res=0
for i in range(1,l,2):
	res += 9*(10**(i-1))
if l%2==1:
	res += n-10**(l-1) +1
print(res)

Verdicts: Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N = int(input())
k = 0
for i in range(1, N+1):
    if 1 =< i < 10:
        k += 1
    if 100 =< i < 1000:
        k += 1
    if 10000 =< i < 100000:
        k += 1
print(k)


N =int(input())
k = 0
for i in range(1, N+1):
    if 1 =< i <10:
        k += 1
    if 100 =< i <1000:
        k += 1
    if 10000 =< i <100000:
        k += 1
print(k)

N = int(input())
k = 0
for i in range(1, N+1):
    if 1 =< i < 10:
        k += 1
    elif 100 =< i < 1000:
        k += 1
    elif 10000 =< i < 100000:
        k += 1
print(k)

N = int(input())
k = 0
for i in range(1, N+1):
    if 1 =< i =< 9:
        k += 1
    elif 100 =< i =< 999:
        k += 1
    elif 10000 =< i =< 99999:
        k += 1
print(k)


N = int(input())
k = 0
for i in range(1, N+1):
    if 1 <= i <= 9:
        k += 1
    elif 100 <= i <= 999:
        k += 1
    elif 10000 <= i <= 99999:
        k += 1
print(k)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
N = int(input())
l = len(str(N))-1
count = 0
for digit in range(l//2+1):
    count += len(range(10**(digit*2), min(10**(digit*2+1), N+1)))

N = int(input())
l = len(str(N))-1
count = 0
for digit in range(l//2+1):
    count += len(range(10**(digit*2), min(10**(digit*2+1), N+1)))
print(count)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n = int(input())

one = n % 10
hund = n // 100
thou = n // 1000
cnt = 0

if  n < 10:
    cnt += n

elif 100 > n >= 10:
    cnt += 9

elif 1000 > n >= 100:
    cnt += (n - 99) + 9

elif 10000 > n >= 1000:
    cnt += 909

elif 100000 > n >= 10000:
    cnt += (n - 9999) + 909

elif n = 100000:
    cnt += 90909

print(cnt)


n = int(input())

one = n % 10
hund = n // 100
thou = n // 1000
cnt = 0

if  n < 10:
    cnt += n

elif 100 > n >= 10:
    cnt += 9

elif 1000 > n >= 100:
    cnt += (n - 99) + 9

elif 10000 > n >= 1000:
    cnt += 909

elif 100000 > n >= 10000:
    cnt += (n - 9999) + 909

elif n == 100000:
    cnt += 90909

print(cnt)



Verdicts: Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
n=int(input())
list=filter(lambda x:x%2==1,range(1,n+1))
print(list.count())

n=int(input())
list=filter(lambda x:x%2==1,range(1,n+1))
print(len(list))


n=int(input())
ans=0
for i in range(1,n+1):
  if len(str(i))%2==1:
    ans=ans+1
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Submission attempts (in order):
    n = int(input())
     
    cnt = 0
    for i in range(1, n+1):
        str_n = str(i)
        if len(str_n) % 2 != 0:
            cnt += 1
            
    print(cnt)

n = int(input())

cnt = 0
for i in range(1, n):
    str_n = str(i)
    print(str_n)
    if len(str_n) % 2 != 0:
        cnt += 1
        
print(cnt)

n = int(input())

cnt = 0
for i in range(1, n):
    str_n = str(i)
    print(str_n)
    if len(str_n) % 2 != 0:
        cnt += 1

n = int(input())
     
cnt = 0
for i in range(1, n+1):
    str_n = str(i)
    if len(str_n) % 2 != 0:
        cnt += 1
            
print(cnt)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted