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
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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000.
instruction
0
108,318
4
216,636
Tags: implementation Correct Solution: ``` from fractions import gcd # from datetime import date, timedelta from heapq import* import math from collections import defaultdict, Counter, deque from bisect import * import itertools import fractions # import sys # sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 # input = sys.stdin.readline def main(): s = input() if len(s) == 1: print(1) exit() v = 10 ** (len(s) - 1) n = int(s[1:]) print(v - n) if __name__ == '__main__': main() ```
output
1
108,318
4
216,637
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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000.
instruction
0
108,320
4
216,640
Tags: implementation Correct Solution: ``` n = input() print(int(str(int(n[0]) + 1) + '0' * (len(n) - 1)) - int(n)) ```
output
1
108,320
4
216,641
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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000.
instruction
0
108,321
4
216,642
Tags: implementation Correct Solution: ``` n = input() num = int(n) if num < 10: print(1) else: k = (int(n[0]) + 1) * (10 ** (len(n) - 1)) print(k - num) ```
output
1
108,321
4
216,643
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` s = input() n = int(s) if n < 10: print(1) else: k = n // 10**(len(s) - 1) k += 1 k = k * 10**(len(s) - 1) print(k - n) ```
instruction
0
108,322
4
216,644
Yes
output
1
108,322
4
216,645
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` N = input() print((int(N[0])+1)*(10**(len(N)-1))-int(N)) ```
instruction
0
108,323
4
216,646
Yes
output
1
108,323
4
216,647
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` n = str(input()) if len(n)==1: print('1') else: print(int(str(int(n[0])+1)+'0'*(len(n)-1))-int(n)) ```
instruction
0
108,324
4
216,648
Yes
output
1
108,324
4
216,649
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` n = int(input()) i = 0 if n < 10: print(1) else: s = str(n) print(int(str(int(s[0]) + 1) + "0" * (len(s) - 1)) - n) ```
instruction
0
108,325
4
216,650
Yes
output
1
108,325
4
216,651
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` n=list(input()) if len(n)==1: print(1) else: x="1" n.pop(0) x+="0"*len(n) for i in range(len(n)): z="".join(n[i]) print(int(x)-int(z)) ```
instruction
0
108,326
4
216,652
No
output
1
108,326
4
216,653
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` n=input() if len(n)==1: print(1) else: x=int(n[1:]) print((10**len(n)-1)-x) ```
instruction
0
108,327
4
216,654
No
output
1
108,327
4
216,655
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` #lucky year: # no more than 1 non-zero digit # e.g 100 40000 5 #1000000000 def checkNum(n): nonzeros = 0 for i in str(n): if i != "0": nonzeros += 1 if nonzeros <= 1: return True else: return False def nextNum(n): count = n while not(checkNum(count)): count += 1 return count - n print(nextNum(int(input()))) ```
instruction
0
108,328
4
216,656
No
output
1
108,328
4
216,657
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 are not. You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year. Input The first line contains integer number n (1 ≀ n ≀ 109) β€” current year in Berland. Output Output amount of years from the current year to the next lucky one. Examples Input 4 Output 1 Input 201 Output 99 Input 4000 Output 1000 Note In the first example next lucky year is 5. In the second one β€” 300. In the third β€” 5000. Submitted Solution: ``` current = int(input()) cont = True counter = 0 while cont: currentstr = str(current) currentset = set(currentstr) if len(currentset) > 2: counter += 1 current += 1 else: cont = False print(counter) ```
instruction
0
108,329
4
216,658
No
output
1
108,329
4
216,659