message
stringlengths
2
43.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
853
107k
cluster
float64
24
24
__index_level_0__
int64
1.71k
214k
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
853
24
1,706
Tags: implementation Correct Solution: ``` n=int(input()) a=list(map(int,input().split())) k,m,s=n-1,0,0 while True: if k<0 and a[k]!=1: print(max(m,s)) exit() if a[k]==1: s+=1 else: m=max(m,s) s=0 k-=1 ```
output
1
853
24
1,707
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
854
24
1,708
Tags: implementation Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) * 2 cnt = 0 answ = 0 for i in range(2 * n): if a[i]: cnt += 1 else: answ = max(answ, cnt) cnt = 0 print(answ) ```
output
1
854
24
1,709
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
855
24
1,710
Tags: implementation Correct Solution: ``` num=int(input()) a=list(map(int, input().split())) b=[] a+=a #Same list is added to eachother bcz he can take consecutive rests i.e when a[n-1]==1 and a[0]==1 that is he can take rest before work and at end so his rest count increases count=0 i=0 while i<2*num-1: count=0 ...
output
1
855
24
1,711
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
856
24
1,712
Tags: implementation Correct Solution: ``` hours = int(input().strip()) schedule = input().strip().replace(' ', '') schedule = ''.join([schedule, schedule]) schedule = schedule.split('0') print(len(sorted(schedule, key=len)[-1])) ```
output
1
856
24
1,713
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
857
24
1,714
Tags: implementation Correct Solution: ``` f = int(input()) lis = list(map(int, input().split())) * 2 maxi = 0 cont = 0 for i in lis: if(i == 1): cont += 1 if (cont > maxi): maxi = cont else: cont = 0 print(maxi) ```
output
1
857
24
1,715
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
858
24
1,716
Tags: implementation Correct Solution: ``` from itertools import groupby print(max([0] + [sum(1 for _ in g) for k, g in groupby(list(map(int, (input(), input())[1].split(' '))) * 2) if k == 1])) ```
output
1
858
24
1,717
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
859
24
1,718
Tags: implementation Correct Solution: ``` n = int(input()) a = list(map(lambda w: len(w), (''.join(input().split())).split('0'))) ans = max(a) if len(a) > 1: ans = max(ans, a[0]+a[-1]) print(ans) ```
output
1
859
24
1,719
Provide tags and a correct Python 3 solution for this coding contest problem. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where a_i=0 if Polycarp works during the i-th hour of...
instruction
0
860
24
1,720
Tags: implementation Correct Solution: ``` n = int(input()) b = input() b = b+" "+b b = b.split("0") b = [len(x.split()) for x in b] print(max(b)) ```
output
1
860
24
1,721
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
861
24
1,722
Yes
output
1
861
24
1,723
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
862
24
1,724
Yes
output
1
862
24
1,725
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
863
24
1,726
Yes
output
1
863
24
1,727
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
864
24
1,728
Yes
output
1
864
24
1,729
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
865
24
1,730
No
output
1
865
24
1,731
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
866
24
1,732
No
output
1
866
24
1,733
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
867
24
1,734
No
output
1
867
24
1,735
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each day in Berland consists of n hours. Polycarp likes time management. That's why he has a fixed schedule for each day β€” it is a sequence a_1, a_2, ..., a_n (each a_i is either 0 or 1), where ...
instruction
0
868
24
1,736
No
output
1
868
24
1,737
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,149
24
4,298
Tags: implementation, strings Correct Solution: ``` ans = input() while " ," in ans: ans = ans.replace(" ,", ",") ans = ans.replace("...", " ...").replace(",", ", ") for ps, pv in [(" ", " ")]: while ps in ans: ans = ans.replace(ps, pv) for d in "0123456789": ans = ans.replace(". "+d, "."+d) print(ans.stri...
output
1
2,149
24
4,299
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,150
24
4,300
Tags: implementation, strings Correct Solution: ``` #Code by Sounak, IIESTS #------------------------------warmup---------------------------- import os import sys import math from io import BytesIO, IOBase from fractions import Fraction from collections import defaultdict BUFSIZE = 8192 class FastIO(IOBase): ...
output
1
2,150
24
4,301
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,151
24
4,302
Tags: implementation, strings Correct Solution: ``` import sys from itertools import * from math import * def solve(): s = input() # s = input().split(',') res = "" i = 0 numberfound = False spacefound = False while i < len(s): if s[i] == ' ': i+=1 continue ...
output
1
2,151
24
4,303
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,152
24
4,304
Tags: implementation, strings Correct Solution: ``` s=input() while(' ' in s): s=s.replace(' ',' ') while(' ,' in s): s=s.replace(' ,',',') while('. ' in s): s=s.replace('. ','.') s=s.replace(',',', ') s=s.replace('...',' ...') if(s[0]==' '): s=s[1:] if(s[-1]==' '): s=s[:len(s)-1] while(' '...
output
1
2,152
24
4,305
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,153
24
4,306
Tags: implementation, strings Correct Solution: ``` import re s = input().strip() s = re.sub('(\d)\s+(?=\d)', r'\1x', s) s = re.sub('\s', '', s) s = re.sub(',', ', ', s) s = re.sub('\.\.\.', ' ...', s) s = re.sub('^\s|\s$', '', s) s = re.sub('\s\s', ' ', s) s = re.sub('x', ' ', s) print(s) ```
output
1
2,153
24
4,307
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,154
24
4,308
Tags: implementation, strings Correct Solution: ``` ans = input() while " ," in ans: ans = ans.replace(" ,", ",") ans = ans.replace("...", " ...").replace(",", ", ") while " " in ans: ans = ans.replace(" ", " ") for d in "0123456789": ans = ans.replace(". " + d, "." + d) print(ans.strip(), end="") ```
output
1
2,154
24
4,309
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,155
24
4,310
Tags: implementation, strings Correct Solution: ``` from sys import stdin,stdout from math import gcd, ceil, sqrt ii1 = lambda: int(stdin.readline().strip()) is1 = lambda: stdin.readline().strip() iia = lambda: list(map(int, stdin.readline().strip().split())) isa = lambda: stdin.readline().strip().split() mod = 1000000...
output
1
2,155
24
4,311
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. ...
instruction
0
2,156
24
4,312
Tags: implementation, strings Correct Solution: ``` s=input() ans=' '.join(s.split()) ans=ans.replace(', ',',') ans=ans.replace(' ,',',') ans=ans.replace(',',', ') ans=ans.replace('... ','...') ans=ans.replace(' ...','...') ans=ans.replace('...',' ...') if ans[0]==' ': ans=ans[:0]+ans[1:] if ans[-1]==' ': ans=a...
output
1
2,156
24
4,313
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,157
24
4,314
Yes
output
1
2,157
24
4,315
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,158
24
4,316
Yes
output
1
2,158
24
4,317
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,159
24
4,318
Yes
output
1
2,159
24
4,319
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,160
24
4,320
Yes
output
1
2,160
24
4,321
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,161
24
4,322
No
output
1
2,161
24
4,323
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,162
24
4,324
No
output
1
2,162
24
4,325
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,163
24
4,326
No
output
1
2,163
24
4,327
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something els...
instruction
0
2,164
24
4,328
No
output
1
2,164
24
4,329
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,601
24
5,202
Tags: greedy Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) cn, nc = 0, 0 for i in range(n) : if a[i] and (not b[i]) : cn += 1 elif (not a[i]) and b[i] : nc += 1 if not cn : print(-1) else : print((nc + cn) // cn) ```
output
1
2,601
24
5,203
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,602
24
5,204
Tags: greedy Correct Solution: ``` n=int(input()) r = list(map(int, input().split())) b = list(map(int, input().split())) rr=0 bb=0 for i in range(n): if r[i]>b[i]: rr+=1 elif r[i]<b[i]: bb+=1 if rr==0: print('-1') else: print(max(1, bb//rr + 1)) ```
output
1
2,602
24
5,205
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,603
24
5,206
Tags: greedy Correct Solution: ``` import sys import os import time import collections from collections import Counter, deque import itertools import math import timeit import random import string ######################### # imgur.com/Pkt7iIf.png # ######################### def sieve(n): if n < 2: return list() ...
output
1
2,603
24
5,207
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,604
24
5,208
Tags: greedy Correct Solution: ``` n = int(input()) r = list(map(int, input().split())) b = list(map(int, input().split())) nr = nb = 0 for i in range(n): if r[i] and not b[i]: nr += 1 elif not r[i] and b[i]: nb += 1 if not nr: print(-1) exit() ret = 1 while nr * ret <= nb: ret += 1 ...
output
1
2,604
24
5,209
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,605
24
5,210
Tags: greedy Correct Solution: ``` '''def robots(t,q,s): if q == s or sum(q) == 0: return -1 else: lista = [] cont = 0 p = [] l = [] e = 0 for i in range(t): p.append(1) if q[i] == 1: lista.append([1,0,i]) ...
output
1
2,605
24
5,211
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,606
24
5,212
Tags: greedy Correct Solution: ``` for _ in range(1): n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) ans=0 k=0 for i in range(n): if a[i]+b[i]!=2: if a[i]==1: ans+=1 elif b[i]==1: k+=1 if ans==0...
output
1
2,606
24
5,213
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,607
24
5,214
Tags: greedy Correct Solution: ``` import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_numb...
output
1
2,607
24
5,215
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot in the competition ...
instruction
0
2,608
24
5,216
Tags: greedy Correct Solution: ``` t = int(input()) robo = [int(i) for i in input().split()] bionic = [int(i) for i in input().split()] robowin = 0 bionicwin = 0 for i in range(t): if(robo[i] > bionic[i]): robowin += 1 elif(robo[i] < bionic[i]): bionicwin += 1 if(robowin == 0): print(-1) ...
output
1
2,608
24
5,217
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,609
24
5,218
Yes
output
1
2,609
24
5,219
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,610
24
5,220
Yes
output
1
2,610
24
5,221
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,611
24
5,222
Yes
output
1
2,611
24
5,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,612
24
5,224
Yes
output
1
2,612
24
5,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,613
24
5,226
No
output
1
2,613
24
5,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,614
24
5,228
No
output
1
2,614
24
5,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,615
24
5,230
No
output
1
2,615
24
5,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, ...
instruction
0
2,616
24
5,232
No
output
1
2,616
24
5,233
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,734
24
5,468
Tags: implementation Correct Solution: ``` p,d=map(int,input().split()) k=1;ans=p; while(1): if(p-p%10**k-1<p-d or p-p%10**k-1==-1): break elif(p-p%10**k-1>=p-d): ans=p-p%10**k-1 if(p-ans==10**k): ans=p k+=1 print(ans) ```
output
1
2,734
24
5,469
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated t...
instruction
0
2,735
24
5,470
Tags: implementation Correct Solution: ``` a,b=map(int,input().split()) a += 1 n=a k=10 while(True): if ((a%k)>b): break n=a-(a%k) k*=10 print(n-1) ```
output
1
2,735
24
5,471