message
stringlengths
2
20.2k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
757
108k
cluster
float64
4
4
__index_level_0__
int64
1.51k
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,776
4
211,552
Yes
output
1
105,776
4
211,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,777
4
211,554
Yes
output
1
105,777
4
211,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,778
4
211,556
Yes
output
1
105,778
4
211,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,779
4
211,558
Yes
output
1
105,779
4
211,559
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,780
4
211,560
No
output
1
105,780
4
211,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,781
4
211,562
No
output
1
105,781
4
211,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,782
4
211,564
No
output
1
105,782
4
211,565
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond t...
instruction
0
105,783
4
211,566
No
output
1
105,783
4
211,567
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,257
4
212,514
Tags: binary search, brute force, math, ternary search Correct Solution: ``` from math import ceil a = int(input()) for i in range(a): # n - days before deadline, d - days for the program to work n, d = map(int, input().split()) if d <= n: print("YES") else: counter = 1 current_n...
output
1
106,257
4
212,515
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,258
4
212,516
Tags: binary search, brute force, math, ternary search Correct Solution: ``` import os,sys from io import BytesIO, IOBase def ii(): return int(input()) def si(): return input() def mi(): return map(int,input().split()) def li(): return list(mi()) import math for i in range(ii()): n,d=mi() if d<=n: pr...
output
1
106,258
4
212,517
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,259
4
212,518
Tags: binary search, brute force, math, ternary search Correct Solution: ``` def arr_inp(): return [int(x) for x in stdin.readline().split()] from sys import stdin from math import ceil for i in range(int(input())): n, d = arr_inp() if n == d: print('YES') else: a, b, c, mi = 0, d, 2,...
output
1
106,259
4
212,519
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,260
4
212,520
Tags: binary search, brute force, math, ternary search Correct Solution: ``` import math #print(math.ceil(4.0)) t = int(input()) for i in range(0, t): n, d = map(int, input().split()) k = int(math.sqrt(d)) x = d #print("k=",k) if n <= k: x = min(x, int(n + 1 + math.ceil(d / (n + 1))-1) ) ...
output
1
106,260
4
212,521
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,261
4
212,522
Tags: binary search, brute force, math, ternary search Correct Solution: ``` import collections import math local = False if local: file = open("A.txt", "r") def inp(): if local: return file.readline().rstrip() else: return input().rstrip() def ints(): return [int(_) for _ in inp().s...
output
1
106,261
4
212,523
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,262
4
212,524
Tags: binary search, brute force, math, ternary search Correct Solution: ``` import io import os from collections import Counter, defaultdict, deque def solve(N, D): x = int((D + 0.25) ** 0.5 - 0.5) for i in range(max(0, x - 10), x + 10): days = i + D // (i + 1) if D % (i + 1) != 0: ...
output
1
106,262
4
212,525
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,263
4
212,526
Tags: binary search, brute force, math, ternary search Correct Solution: ``` import math T=int(input()) for iT in range(T): n,d=[int(i) for i in input().split()] x=int(math.sqrt(d))-1 temp=x+math.ceil(d/(x+1)) print("YES" if (temp<=n or d==1 )else "NO") ```
output
1
106,263
4
212,527
Provide tags and a correct Python 3 solution for this coding contest problem. Adilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results. Fortunately, Adilbek ...
instruction
0
106,264
4
212,528
Tags: binary search, brute force, math, ternary search Correct Solution: ``` '''input 3 1 1 4 5 5 11 ''' # A coding delight from sys import stdin, stdout import gc gc.disable() input = stdin.readline import math def check(num): return num + math.ceil(d/(num + 1)) <= n # main starts t = int(input().strip()) for _...
output
1
106,264
4
212,529
Provide tags and a correct Python 3 solution for this coding contest problem. Reforms have started in Berland again! At this time, the Parliament is discussing the reform of the calendar. To make the lives of citizens of Berland more varied, it was decided to change the calendar. As more and more people are complainin...
instruction
0
107,267
4
214,534
Tags: *special, number theory Correct Solution: ``` F = {} def f(k): if not k in F: s, i, j = 0, 4, 4 while i <= k: s += i * f(k // i) i += j + 1 j += 2 F[k] = (k * (k + 1)) // 2 - s return F[k] def g(k): s, i, j = 0, 4, 4 while i <= k: ...
output
1
107,267
4
214,535
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Reforms have started in Berland again! At this time, the Parliament is discussing the reform of the calendar. To make the lives of citizens of Berland more varied, it was decided to change the c...
instruction
0
107,268
4
214,536
No
output
1
107,268
4
214,537
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,546
4
215,092
Tags: greedy Correct Solution: ``` import sys import math as mt import bisect #input=sys.stdin.readline #t=int(input()) t=1 def solve(): i,j,ans=0,0,0 ind=[0]*(n) suma,ex=1,0 j=0 for i in range(n): if j<n and ind[i]==0: while j<n: if l[j]-l[i]+...
output
1
107,546
4
215,093
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,547
4
215,094
Tags: greedy Correct Solution: ``` n, m, k = map(int, input().split()) a = map(int, input().split()) a = list(sorted(a)) s = [] r = 0 for x in a: if len(s) and s[0] < x - m + 1: del s[0] if len(s) < k - 1: s.append(x) else: r += 1 print(r) ```
output
1
107,547
4
215,095
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,548
4
215,096
Tags: greedy Correct Solution: ``` from sys import stdin, exit, setrecursionlimit from collections import deque from string import ascii_lowercase from itertools import * from math import * input = stdin.readline lmi = lambda: list(map(int, input().split())) mi = lambda: map(int, input().split()) si = lambda: input().s...
output
1
107,548
4
215,097
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,549
4
215,098
Tags: greedy Correct Solution: ``` import sys,os,io from sys import stdin from math import log, gcd, ceil from collections import defaultdict, deque, Counter from heapq import heappush, heappop from bisect import bisect_left , bisect_right import math alphabets = list('abcdefghijklmnopqrstuvwxyz') def isPrime(x): ...
output
1
107,549
4
215,099
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,550
4
215,100
Tags: greedy Correct Solution: ``` import sys input = sys.stdin.readline from collections import * n, m, k = map(int, input().split()) a = list(map(int, input().split())) t = [0]*(10**6+100) for ai in a: t[ai] = 1 now = 0 ans = 0 for i in range(10**6+100): now += t[i] if i>=m: now -= t[...
output
1
107,550
4
215,101
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,551
4
215,102
Tags: greedy Correct Solution: ``` n, m, k=[int(x) for x in input().split()] alarms=[int(x) for x in input().split()] alarms.sort() al2=[] cont=0 for i in range(len(alarms)): al2.append(alarms[i]) if len(al2)>=k and al2[-1]-al2[len(al2)-k]<m: al2.pop() cont+=1 print(cont) ...
output
1
107,551
4
215,103
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,552
4
215,104
Tags: greedy Correct Solution: ``` n, m, k = (int(x) for x in input().split()) ns = set((int(x) for x in input().split())) from collections import deque span = deque((0 for i in range(m))) kk = 0 res = 0 mm = -1 while len(ns) > 0: mm += 1 x = span.popleft() if x == 1: kk -= 1 if mm not in ns: ...
output
1
107,552
4
215,105
Provide tags and a correct Python 3 solution for this coding contest problem. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which it rings. Every alarm clock begins ringing at ...
instruction
0
107,553
4
215,106
Tags: greedy Correct Solution: ``` from collections import deque n,m,k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a = sorted(a) a = deque(a) first = - 10e7 r = deque([]) s = 0 result = 0 while n > 0: e = a[0] c = e - m + 1 while r != deque([]): if r[0] < c: ...
output
1
107,553
4
215,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,554
4
215,108
Yes
output
1
107,554
4
215,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,555
4
215,110
Yes
output
1
107,555
4
215,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,556
4
215,112
Yes
output
1
107,556
4
215,113
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,557
4
215,114
Yes
output
1
107,557
4
215,115
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,558
4
215,116
No
output
1
107,558
4
215,117
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,559
4
215,118
No
output
1
107,559
4
215,119
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,560
4
215,120
No
output
1
107,560
4
215,121
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer ai — number of minute after midnight in which...
instruction
0
107,561
4
215,122
No
output
1
107,561
4
215,123
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,578
4
215,156
Tags: dp Correct Solution: ``` import sys n, m, k = map(int, input().split()) table = [input() for _ in range(n)] dp = [0]*(k+1) for a in table: one = [] for i in range(m): if a[i] == '1': one.append(i) if not one: continue ni = len(one) subdp = [10**9] * (ni+1) ...
output
1
107,578
4
215,157
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,579
4
215,158
Tags: dp Correct Solution: ``` R = lambda: map(int, input().split()) n, m, k = R() cls = [list(i for i, x in enumerate(map(int, input())) if x) for _ in range(n)] dp = [[n * m] * (k + 1) for i in range(n + 1)] dp.append([0] * (k + 1)) for i in range(n): row = cls[i] c2l = [m + 1] * (m + 1) c2l[0] = row[-1] ...
output
1
107,579
4
215,159
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,580
4
215,160
Tags: dp Correct Solution: ``` def min_sub_array(day, k): if not day: return [0] * (k + 1) n = len(day) best = [float('inf')] * (n + 1) best[0] = 0 best[1] = 1 for size in range(2, n + 1): for i in range(n + 1 - size): best[size] = min(best[size], day[i + size - 1] - ...
output
1
107,580
4
215,161
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,581
4
215,162
Tags: dp Correct Solution: ``` import queue intput = lambda:map(int, input().split()) N, M, K = intput() ht = [[] for _ in range(N)] for _ in range(N): day = input() ht[_] = [i for i in range(M) if day[i] == '1'] # req[i][j] -- required hours for day i if j lessons skipped # dp[i][j] -- required hours up to d...
output
1
107,581
4
215,163
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,582
4
215,164
Tags: dp Correct Solution: ``` import sys input = sys.stdin.readline def int_array(): return list(map(int, input().strip().split())) def float_array(): return list(map(float, input().strip().split())) def str_array(): return input().strip().split() from collections import Counter import math import bisect from co...
output
1
107,582
4
215,165
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,583
4
215,166
Tags: dp Correct Solution: ``` n, m, k = input().split(' ') n = int(n) m = int(m) k = int(k) ind = [] pre = [] for _ in range(n): s = input() ind.append([]) for i, c in enumerate(s): if c == '1': ind[-1].append(i) for i in range(n): pre.append([]) for j in range(k + 1): ...
output
1
107,583
4
215,167
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,584
4
215,168
Tags: dp Correct Solution: ``` import math #import math #------------------------------warmup---------------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer ...
output
1
107,584
4
215,169
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during each Berland day, and each lesson at the universi...
instruction
0
107,585
4
215,170
Tags: dp Correct Solution: ``` n, m, k = map(int, input().split()) DATA = [input() for i in range(n)] #dp[n_day][used_cost] #ans = min(dp[n_day][used_cost] for used_cost in range(k + 1)) #dp[n_day][used_cost] := min(dp[n_day - 1][prev_cost] + cost(pay used_cost - prev_cost in n_day) for prev_cost in range(used_cost + ...
output
1
107,585
4
215,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during ea...
instruction
0
107,586
4
215,172
No
output
1
107,586
4
215,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during ea...
instruction
0
107,587
4
215,174
No
output
1
107,587
4
215,175
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during ea...
instruction
0
107,588
4
215,176
No
output
1
107,588
4
215,177
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university. There are m working hours during ea...
instruction
0
107,589
4
215,178
No
output
1
107,589
4
215,179
Provide tags and a correct Python 3 solution for this coding contest problem. Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345...
instruction
0
108,314
4
216,628
Tags: implementation Correct Solution: ``` #!/bin/python3 n = int(input()) if len(str(n)) == 1: print(1) else: c = '{:<0{}d}'.format(1, int(len(str(n)))) c = int(c) print(((c+n)-(n%c))-n) ```
output
1
108,314
4
216,629
Provide tags and a correct Python 3 solution for this coding contest problem. Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345...
instruction
0
108,315
4
216,630
Tags: implementation Correct Solution: ``` x = input() a = 10**(len(x)-1) if int(x) < 10: print(1) else: print(((a - int(x[1:])))) ```
output
1
108,315
4
216,631
Provide tags and a correct Python 3 solution for this coding contest problem. Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345...
instruction
0
108,316
4
216,632
Tags: implementation Correct Solution: ``` s=input() if len(s)==1:print(1) else:print((10**(len(s)-1))-(int(s[1:]))) ```
output
1
108,316
4
216,633
Provide tags and a correct Python 3 solution for this coding contest problem. Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345...
instruction
0
108,317
4
216,634
Tags: implementation Correct Solution: ``` n = input() res = str(int(n[0])+1) for i in range(0, len(n)-1): res += '0' print(int(res)-int(n)) ```
output
1
108,317
4
216,635