description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m < s / 9:
print(-1, -1)
elif s == 0 and m == 1:
print(0, 0)
elif s == 0:
print(-1, -1)
else:
q = s // 9
r = s - q * 9
mul = m - (q + 1)
if mul < 0:
maxx = [9] * q
else:
maxx = [9] * q + [r] + [0] * (m - (q + 1))
if maxx[-1] != 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split(" "))
if s == 0 and m == 1:
print("0" + " " + "0")
elif s == 0 and m != 1:
print("-1" + " " + "-1")
elif s > m * 9:
print("-1" + " " + "-1")
else:
l = []
while s > 9:
l.append(9)
s -= 9
l.append(s)
l = l + [0] * (m - len(l))
minimum = l[::-1]... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING STRING STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING STRING STRING IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING STRING STRING ASSIGN VAR LIST WHI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = list(map(int, input().split()))
if s > m * 9 or m != 1 and s == 0:
print("-1 -1")
elif m == 1 and s <= 9:
print(s, s)
else:
a = [9] * (s // 9)
if s % 9 > 0:
a += [s % 9]
l = len(a)
if l == m:
a.sort()
b = list(reversed(a))
print(*a, sep="", end=" ")
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR LIST BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1 and s == 0:
print(0, 0)
elif 9 * m < s or s < 1 and m > 1:
print(-1, -1)
else:
l = [0] * m
scopy = s
for i in range(m):
if s < 0:
break
k = min(9, s)
l[i] = str(k)
s = s - k
max_val = "".join(l)
l1 = ["0"]... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1 and s == 0:
print(0, 0)
return
if s == 0 and m > 1 or s > m * 9:
print(-1, -1)
else:
n = (s - 1) // 9
if n == m - 1:
print(s - n * 9, "9" * n, sep="", end=" ")
print("9" * n, s - n * 9, sep="")
else:
print("1", "0" * (m - n - 2),... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER RETURN IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER BI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
temp = m
m = s
s = temp
numbers = [9] * s
difference = 9 * s - m
low = ""
high = ""
i = 0
if s == 0 or m == 0:
if s == 1:
print(0, 0)
else:
print(-1, -1)
elif 9 * s < m:
print(-1, -1)
else:
while i < len(numbers):
if difference >= 9:
n... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(x) for x in input().split()]
def mini(m, s):
num = ["0" for i in range(m)]
m -= 1
while s > 9:
num[m] = "9"
s -= 9
m -= 1
if s > 0:
if m != 0:
num[m] = str(s - 1)
num[0] = "1"
else:
num[m] = str(s)
return "".jo... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR STRING VAR FUNC_CALL VAR VAR VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR STRING VAR NUMBER VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER STRING ASSIGN VAR VAR FUNC_CALL VAR VAR RETUR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | temparr = input()
temparr = temparr.split()
numofdigit = int(temparr[0])
totalsum = int(temparr[1])
smalltotalsum = int(temparr[1])
getfinalaaa = ""
def check(digit, sumleft, strs):
if digit == 0 and sumleft > 0:
return -1
if digit == 0 and sumleft == 0:
return strs
if sumleft < 0:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR NUMBER RETURN VAR IF VAR NUMBER RETURN NUMBER IF VAR BIN_OP NUMBER VAR RETURN ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n = str(input()).split()
l = int(n[0])
s = int(n[1])
if s == 0:
if l == 1:
print(0, 0)
quit()
else:
print(-1, -1)
quit()
if l * 9 < s:
print(-1, -1)
quit()
def mx(l, s):
x = s
r = ""
for i in range(0, l):
if x == 0:
r = r + "0"
el... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
a = m * [0]
a[0] = 1
sum = 1
temp = 0
while sum < s and s > 0 and m * 9 >= s:
if a[temp] < 9:
a[temp] = a[temp] + 1
sum = sum + 1
else:
temp += 1
for i in range(m):
a[i] = str(a[i])
max = "".join(a)
a = m * [0]
a[0] = 1
sum = 1
temp = m - 1
wh... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER BIN_OP VAR NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s1 = list(map(int, input().split()))
if s1 == 0 and m > 1 or m * 9 < s1:
print("-1 -1")
else:
a = list(0 for i in range(m))
a[0] = 1
s = s1 - 1
for i in range(m):
if s <= 9:
a[m - i - 1] = s
s = 0
if s == 0:
break
if s > 9:
a... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
min_num = 1
max_num = 2
if s == 0 and m > 1 or s > 9 * m:
print("-1 -1")
elif s == 0:
print("0 0")
elif s <= 9:
min_num = 1 * 10 ** (m - 1) + s - 1
max_num = s * 10 ** (m - 1)
print(min_num, max_num)
else:
min_list = [1] + [0] * (m - 1)
max_list = [9] + [0] *... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def find_length_sum_digits(m, s):
if m * 9 < s or s == 0 and m != 1:
return "-1 -1"
min_n = find_min(m, s)
max_n = find_max(m, s)
return min_n + " " + max_n
def find_min(m, s):
min_n = ""
length = m - 1
while length != 0:
for i in range(9, -1, -1):
if 1 <= s - i... | FUNC_DEF IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER RETURN STRING ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN BIN_OP BIN_OP VAR STRING VAR FUNC_DEF ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF NUMBER BIN_OP VAR VAR BIN_OP ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
s1 = s
if m == 1:
if s > 9:
print(-1, -1)
else:
print(s, s)
elif s > m * 9 or s < 1:
print(-1, -1)
else:
s1 -= 1
popa = ["0"] * m
popa[0] = "1"
for i in range(m):
if s1 < 9:
popa[m - 1 - i] = str(int(popa[m - 1 - i]) + s1)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER STRING FOR VAR FUNC_CALL VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s <= 9 * m:
if m > 1 and s == 0:
print(-1, -1)
elif m == 1:
print(s, s)
elif s == 1:
val = pow(10, m - 1)
print(val, val)
else:
li = [0] * m
li[0] = 1
li[m - 1] = s - 1
i = m - 1
while i > 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | s, m = map(int, input().split())
if m == 0 or m > 9 * s:
if s == 1 and m == 0:
print("0 0")
else:
print("-1 -1")
else:
max = "9" * (m // 9) + (str(m % 9) if m % 9 != 0 else "")
min = list(max)
min.reverse()
if len(max) == s:
min = "".join(min)
else:
max += "0"... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR EXPR FU... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | line = input()
a, b = [int(i) for i in line.split()]
if b == 0 and a > 1 or b > 9 * a:
print("-1 -1")
else:
nummax = ""
numnin = ""
for i in range(a):
digit = min(9, b)
b = b - digit
nummax += str(digit)
nummin = nummax[::-1]
if nummin[0] == "0":
count = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | line = str(input()).split()
length = int(line[0])
sum_digit = int(line[1])
sum_digit2 = sum_digit
A = []
B = []
C = []
if sum_digit == 1:
A.append("1")
for i in range(length - 1):
A.append("0")
print("".join(A), "".join(A))
elif sum_digit != 0 and length * 9 >= sum_digit:
while sum_digit >= 9:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL S... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def maxn(n, s):
p = list("0" * n)
i = 0
while s:
if s < 10:
p[i] = str(s)
s = 0
else:
p[i] = "9"
s -= 9
i += 1
return p
n, s = [int(x) for x in input().split()]
if n > 1 and s == 0 or s > 9 * n:
print("-1 -1")
else:
p = ma... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR NUMBER WHILE VAR IF VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR STRING VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
k = 1
if s == 0 and m == 1:
print(s, s)
exit()
elif s == 0:
print(-1, -1)
exit()
if s // 9 + int(s % 9 != 0) > m:
print(-1, -1)
exit()
smax = []
for i in range(s // 9):
smax.append(9)
if s % 9 != 0:
smax.append(s % 9)
k = 0
for i in range(m - s // 9 - int... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1 and s == 0:
print("0 0")
exit()
if m * 9 < s or s == 0:
print(str(-1) + " " + str(-1))
exit()
max_n = ""
t = s
for _ in range(m):
n = min(t, 9)
max_n += str(n)
t -= n
min_n_r = ""
t = s
for i in range(m):
n = min(t, 9)
t -= n
if t == 0 a... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR NUMBER STRING FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
n = ""
t = ""
if s == 0 and m == 1:
n, t = 0, 0
elif s >= 1 and s <= 9 * m:
if s // 9 == m:
n, t = "9" * m, "9" * m
elif s // 9 == m - 1:
if s % 9 > 0:
n += str(s % 9) + "9" * (m - 1)
else:
n += "1" + "8" + "9" * (m - 2... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR IF BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP STRING VAR BIN_OP STRING VAR IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | line = input()
M, S = line.split()
m = int(M)
s = int(S)
hi = ""
if m == 1 and s == 0:
print(0, 0)
elif m * 9 < s or s == 0:
print(-1, end=" ")
print(-1)
elif m == 1:
print(s, s)
else:
t = s % 9
k = s // 9
if t == 0:
if k == m:
print(int("9" * k), end=" ")
pri... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | num = [int(i) for i in input().split()]
maxi = []
if num[0] != 1 and num[1] == 0 or num[1] > 9 * num[0]:
print("-1 -1")
else:
for j in range(num[0]):
maxi.append(min(9, num[1]))
num[1] -= min(9, num[1])
mini = maxi[::-1]
if mini[0] == 0 and num[0] != 1:
for k in range(0, num[0]):... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
def high(num_digits, total):
if num_digits * 9 < total or total == 0 and num_digits > 1:
return -1
if total < 10 and total >= 0:
lst = ["0"] * (num_digits - 1)
return str(total) + "".join(lst)
else:
return "9" + high(num_digits - 1, total - ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST STRING BIN_OP VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL STRING VAR RETURN BIN_OP STRING FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, m = map(int, input().split())
if m <= 0:
if n == 1:
print(0, 0)
else:
print(-1, -1)
else:
a = 9 * n
if m > a:
print(-1, -1)
else:
s = int("1" + "0" * (n - 1))
k = m
m = m - 1
t = 1
s = ""
for i in reversed(range(0, n)):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | import sys
def validate(i, m, s):
if i == 0 and s == 0 and m > 1:
return False
return 0 <= s <= m * 9
def solve(input_path=None):
if input_path is None:
f = sys.stdin
else:
f = open(input_path, "r")
n, s = map(int, f.readline().split())
golds = list()
if validate(... | IMPORT FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER VAR BIN_OP VAR NUMBER FUNC_DEF NONE IF VAR NONE ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR NUMBER VAR VAR ASSIGN VAR VAR ASSIGN VAR S... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | ms = input().split()
m = int(ms[0])
s = int(ms[1])
def go(b, m, s):
if s >= 10:
b.append(9)
go(b, m - 1, s - 9)
elif m == 1:
b.append(s)
elif m > 1:
b.append(s - 1)
for i in range(m - 2):
b.append(0)
b.append(1)
a = []
b = []
if 9 * m >= s >= 1... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | from sys import stdin
a = [int(i) for i in stdin.readline().split()]
max_number = ""
min_number = ""
if a[1] > 9 * a[0] or a[0] > 1 and a[1] == 0:
print(-1, -1)
elif a[0] == 1:
print(a[1], a[1])
else:
nines = (a[1] - 1) // 9
if nines > 0:
for i in range(nines):
min_number += "9"
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER BIN_OP NUMBER VAR NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER IF VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, s = tuple(map(int, input().split()))
def biggest(n, s):
if s == 0 and n > 1 or s > 9 * n:
return -1
else:
res = ""
while s != 0:
res += str(min(9, s))
s -= min(9, s)
res += "0" * (n - len(res))
return res
def smallest(n, s):
if s == 0 and n ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR RETURN NUMBER ASSIGN VAR STRING WHILE VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP STRING BIN_OP VAR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF IF VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, s = tuple(map(int, input().split(" ")))
x = n * [0]
if s == 0 and n != 1 or s / n > 9:
print("-1 -1")
exit()
elif s == 0 and n == 1:
print("0 0")
exit()
for i in range(n):
if s < 9:
x[i] = s
break
else:
x[i] = 9
s -= 9
x.sort(reverse=True)
largest = 0
for i in ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR LIST NUMBER IF VAR NUMBER VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, sm = input().strip().split(" ")
n = int(n)
sm = int(sm)
por1 = sm // 9
por = por1
ost = sm % 9
if ost != 0:
por += 1
if por > n or por <= 0 and n > 1:
print("-1 -1")
elif por == n:
print(ost + (1 + por1 - por) * 9, end="")
for i in range(n - 1):
print(9, end="")
print(end=" ")
for i i... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP B... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
low = [0] * m
high = [0] * m
if s <= 0 or s > 9 * m:
low = high = -1
else:
t = s - 1
low[0] = 1
for i in range(1, m + 1):
if t > 9:
low[-i] += 9
t -= 9
else:
low[-i] += t
t = 0
low = int("".join(map(str,... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER VAR VAR NUMBER VAR NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def check(l, s):
return 0 <= s <= l * 9
l, s = map(int, input().split())
x = s
a = l
minn = ""
a = s
for i in range(l):
for d in range(0, 10):
if (i > 0 or d > 0 or l == 1 and d == 0) and check(l - i - 1, s - d):
minn += str(d)
s -= d
break
maxx = ""
for i in range(... | FUNC_DEF RETURN NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER BIN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
temp = s
largest = [-1] * m
for i in range(m):
if temp >= 9:
largest[i] = 9
temp -= 9
else:
largest[i] = temp
temp = 0
tempTwo = s - 1
smallest = [0] * m
smallest[0] = 1
for i in range(m - 1, 0, -1):
if tempTwo < 0:
break
elif temp... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CAL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def find_max(num_of_digits, sum_of_digits):
if sum_of_digits == 0:
if num_of_digits == 1:
return 0
else:
return -1
if sum_of_digits > 9 * num_of_digits:
return -1
T = [[(0) for i in range(sum_of_digits + 1)] for j in range(num_of_digits + 1)]
for i in rang... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER IF VAR BIN_OP NUMBER VAR RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
D = [([-1] * (s + 1)) for i in range(m + 1)]
D[1][0] = 0
for i in range(1, min(s + 1, 10)):
D[1][i] = i
for i in range(2, m + 1):
for j in range(1, s + 1):
if j < 9 * i + 1:
if D[i - 1][j] == -1:
D[i][j] = D[i][j - 1] + 1
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
def small(m, s):
if s == 0:
if m == 1:
return 0
else:
return -1
if s > 9 * m:
return -1
a = [(0) for i in range(m + 1)]
s = s - 1
for i in range(m - 1, 0, -1):
if s > 9:
a[i] = 9
s = s ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER IF VAR BIN_OP NUMBER VAR RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0 and m > 1:
print("-1 -1")
else:
Min, Max = "", ""
t = s
while len(Max) < m:
if t > 9:
Max += "9"
t -= 9
else:
Max += chr(t + ord("0"))
t -= t
if t > 0:
print("-1 -1")
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR STRING STRING ASSIGN VAR VAR WHILE FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR STRING VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0 and m > 1 or s > m * 9:
print(-1, -1)
exit()
mi = 0
ma = 0
t = s
s -= 1
for i in range(m):
if i < m - 1:
a = min(9, s)
s -= a
mi += a * 10**i
else:
mi += (s + 1) * 10 ** (m - 1)
for i in range(m):
b = min(9, t)
ma += b * ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, n = [int(i) for i in input().split()]
if m == 1 and n == 0:
print("0 0")
elif n == 0 or m * 9 < n:
print("-1 -1")
else:
a = (n - 1) // 9
b = str((n - 1) % 9)
d = str(int(b) + 1)
if a + 1 == m:
list_min = [d]
for i in range(m - 1):
list_min.append("9")
else:... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | p = []
m = []
max1 = str()
min1 = str()
x, y = map(int, input().split())
for i in range(x):
p.append(str(0))
if y == 0 and x != 1 or 9 * x < y:
print("-1 -1")
elif x == 1 and y == 0:
print(y, y)
elif x == 1:
print(y, y)
else:
if y % x == 0 and y % 9 == 0 and y / x % 9 == 0:
for i in range(x)... | ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
smallestnum = int("1" + "0" * (m - 1))
if m == 1:
smallestnum = 0
bigestnum = int("9" * m)
smallnum = smallestnum
bignum = bigestnum
ninesum = s - 1
if m == 1:
ninesum = s
nines = []
while True:
if ninesum < 0:
smallnum = -1
break
if ninesum == 0:... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST WHILE NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, k = map(int, input().split())
if n == 1 and k == 0:
print("0 0")
exit()
if k == 0 or 9 * n < k:
print("-1 -1")
elif k <= 9 and n == 1:
print(k, k)
elif k > 9:
t = k // 9
res = "9" * min(t, n)
if n == t and k - 9 * min(t, n) == 0:
print(res, res)
else:
mn = 0
di... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING FUNC_CALL V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
if s > 9 * m or s < 1 and m > 1:
print("-1", "-1")
else:
t = s
u = s
num = ""
num_k = ""
for i in range(m):
if t >= 9:
t -= 9
num += str(9) + " "
num_k += str(9)
else:
num += str(t) + " "
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP FUNC_CALL VAR NUMBER STRING VAR FUNC_CALL VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1:
if 0 <= s <= 9:
print(s, s)
else:
print(-1, -1)
elif m * 9 == s:
print("9" * m, "9" * m)
elif 1 <= s <= 9 * m:
a = ""
a += "9" * (s // 9)
a += str(s % 9)
a += "0" * (m - len(a))
b = ""
if 1 <= s <= 9 * (m - 1) + 1:
b... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR BIN_OP STRING VAR IF NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR STRING VAR BIN_OP STRING BIN_OP VAR NUMBER VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a, b = map(int, input().split())
if a == 1 and b == 0:
print("0 0")
elif b < 1 or b > 9 * a:
print("-1 -1")
else:
c = 9 * a - b
n = 0
int(n)
while True:
if c < 9:
break
else:
c -= 9
n += 1
pass
x = 0
y = 0
if n >= 1:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR WHILE NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER AS... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = list(map(int, input().split()))
n = s
_max = 0
if s != 0 and s / 9 <= m:
for i in range(m):
if s > 9:
_max += 9
_max *= 10
s -= 9
else:
_max += s
_max *= 10 ** (m - 1 - i)
break
_min = 0
k = 1
for i in range(m... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR VAR VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CAL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
if s == 0 and m != 1 or 9 * m < s:
print("-1 -1")
elif m == 1 and s == 0:
print("0 0")
else:
mx = ""
ms = s
while ms != 0:
if ms > 9:
mx += "9"
ms -= 9
else:
mx += str(ms)
ms = 0
mx += "0" * ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR WHILE VAR NUMBER IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR BIN_O... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
s0 = s
if m > 1 and s < 1 or s > m * 9:
print(-1, -1)
exit()
for i in range(1, m + 1):
if i == 1 and s - 1 <= 9 * (m - 1) and s != 0:
print("1", end="")
s -= 1
continue
temp = max(0, s - 9 * (m - i))
print(temp, end="")
s -= temp
s... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)
def read_int():
return int(stdin.readline())
def read_ints():
return [int(x) for x in stdin.readline().split()]
def read_str():
return input()
def read_strs():
return [x for x in stdin.readline().split()]
l... | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | cnt, digsum = [int(x) for x in input().strip().split(" ")]
if digsum == 0 and cnt == 1:
print("0 0")
elif 0 < digsum <= 9 * cnt:
max_list = []
max_sum = digsum
min_list = []
min_sum = digsum
for x in range(cnt):
if max_sum > 9:
max_list.append(9)
max_sum -= 9
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | inputs = [int(i) for i in input().split()]
ll = inputs[0]
sod = inputs[1]
mn = -1
mx = -1
if ll == 1 and sod < 10:
print("{} {}".format(sod, sod))
elif sod == 0:
print("-1 -1")
elif ll < sod / 9:
print("-1 -1")
elif ll == sod / 9:
c = "9" * ll
print("{} {}".format(c, c))
else:
for smallnr in ran... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | line = input().split()
n = int(line[0])
s = int(line[1])
list = []
b = 0
c = 0
if s > 9 * n:
print(-1, -1)
elif s == 0 and n == 1:
print(0, 0)
elif s == 0 and n != 1:
print(-1, -1)
else:
for i in range(n):
if s >= 9:
s -= 9
list.append(9)
b += 1
elif s... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR N... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def prov(n, s):
if s == 0:
if n == 1:
return 1
else:
return 0
elif n * 9 < s:
return 0
else:
return 2
def prov2(s):
i = 0
f = 0
while i < len(s):
if s[i] != 0:
f = 1
break
i += 1
if f == 1 and 0... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR NUMBER NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBER NUMBER RETURN VAR FUNC_D... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | digit, total = map(int, input().split())
if total == 0 and digit == 1:
print(0, 0)
elif total == 0 or total > 9 * digit:
print(-1, -1)
else:
nine = total // 9
rem = total % 9
if rem != 0:
mx = "9" * nine + str(rem)
else:
mx = "9" * nine
mx = mx + "0" * (digit - len(mx))
i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING VAR FUNC_CALL VAR VAR ASSIGN VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, m = map(int, input().split())
if m == 0 and n != 1 or m > 9 * n:
print("-1 -1")
elif m == 0 and n == 1:
print("0 0")
else:
ans_max = ""
while m:
if m >= 9:
m -= 9
ans_max += "9"
else:
ans_max += str(m)
m = 0
ans_max += "0" * (n - len... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING WHILE VAR IF VAR NUMBER VAR NUMBER VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR BIN_OP STRING BIN_OP VAR FUNC_C... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | s = input().split()
m = int(s[0])
tot = int(s[1])
ans = []
if m == 1 and tot == 0:
print("0 0")
exit()
for i in range(m):
if tot <= 9:
ans.append(tot)
tot = 0
else:
ans.append(9)
tot = tot - 9
if ans[0] == 0 or tot > 0:
print("-1 -1")
exit()
if ans[m - 1] == 0:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | line = input()
m, s = [int(i) for i in line.split()]
s_max = s
s_min = s
if m * 9 < s:
print(-1, -1)
elif s == 0:
if m == 1:
print(0, 0)
else:
print(-1, -1)
else:
min = ""
max = ""
for i in range(m):
if s_max - 9 <= 0:
max += str(s_max)
s_max = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
if m == 1 and s == 0:
print("0 0")
elif s == 0 or s > m * 9:
print("-1 -1")
else:
o = []
p = []
a = s // 9
b = s % 9
if b > 0:
for i in range(a):
o.append(str(9))
o.append(str(b))
for i in range(m - a - 1):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a = [int(x) for x in input().split()]
safer = a[1]
mini = 0
maxi = 0
last_not_nime = 0
for x in range(a[0]):
if a[1] > 9:
maxi += 10 ** (a[0] - x - 1) * 9
a[1] -= 9
else:
if a[1] != 0:
last_not_nime = a[0] - x
maxi += 10 ** (a[0] - x - 1) * a[1]
a[1] = 0
if ma... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER NUMBER VAR BIN_OP BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER IF VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a = input().split()
num = int(a[1])
c = int(a[0])
m = 0
s = []
n = []
output = []
if num == 0:
if c == 1:
print(0, 0)
else:
print(-1, -1)
if num > 9 * c:
print(-1, -1)
if 0 < num <= 9 * c:
while num >= 9:
s.append("9")
num -= 9
c -= 1
m += 1
if num > 0... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NU... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, l = input().split(" ")
l = int(l)
n = int(n)
if n == 1 and l == 0:
print("0 0")
elif l > n * 9 or l == 0:
print(-1, -1)
else:
mx = {
(0): 0,
(1): 0,
(2): 0,
(3): 0,
(4): 0,
(5): 0,
(6): 0,
(7): 0,
(8): 0,
(9): 0,
}
fo... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | import sys
def largest(n, s):
ans = ""
if s < 10:
return str(s) + "0" * (n - 1)
if s >= 10:
ans = "9" * (s // 9)
if s % 9 != 0:
ans += str(s % 9)
ans += "0" * (n - len(ans))
return ans
def smallest(n, s):
if s == 1:
return "1" + "0" * (n - 1)
ans = "1"... | IMPORT FUNC_DEF ASSIGN VAR STRING IF VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR BIN_OP STRING BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP STRING BIN_OP VAR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF IF VAR NUMBER RETURN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | x = input().split()
m = int(x[0])
s = int(x[1])
if s > 9 * m:
print("-1 -1")
elif s == 0 and m > 1:
print("-1 -1")
elif m == 1 and s == 0:
print("0 0")
else:
a = s // 9
q = "9" * a + str(s - 9 * a) * min(1, m - a) + "0" * (m - a - 1)
if s > (m - 1) * 9:
p = str(s - a * 9) * (m - a) + "9"... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | A = input().split()
m = int(A[0])
s = int(A[1])
if m == 1:
if s >= 10:
print(-1, -1)
else:
print(s, s)
elif s > 9 * m or s == 0:
print(-1, -1)
else:
k = s // 9
l = s % 9
q = (s - 1) % 9
a = 0
b = 0
if l != 0:
if 9 * m > s > 9 * (m - 1):
for i in ra... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = (int(x) for x in input().split())
if m == 1 and s == 0:
print(0, 0)
exit()
if s < 1 or s > m * 9:
print(-1, -1)
exit()
s1 = s
for i in range(m):
d = max(s1 - (m - i - 1) * 9, 1 if i == 0 else 0)
s1 -= d
print(d, end="")
print(" ", end="")
s2 = s
for i in range(m):
d = min(s2, 9)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP BIN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(x) for x in input().split()]
def imax(m, s):
if s > 9 * m:
return -1
elif s == 0:
if m == 1:
return 0
else:
return -1
else:
k = s // 9
l = s - k * 9
if l == 0:
return (10**k - 1) * 10 ** (m - k)
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR BIN_OP NUMBER VAR RETURN NUMBER IF VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP NUMBER BIN_OP VAR V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
remainder_str = str(s % 9) if s % 9 > 0 else ""
min_num = remainder_str + "9" * (s // 9)
max_num = "9" * (s // 9) + remainder_str
if len(min_num) == 0:
min_num = max_num = 0 if m == 1 else -1
elif len(min_num) > m:
min_num = max_num = -1
elif len(min_num) < m:
min_num = (
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP VAR NUMBER VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER IF FUNC_CALL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
s1 = s
s2 = s
list1 = [0] * m
if s == 0 and m != 1:
print(-1, -1)
if s > 9 * m and m != 1:
print(-1, -1)
if s != 0 and s <= 9 * m and m != 1:
for i in range(m):
for t in range(10):
if t <= s1:
list1[i] = t
s1 = s1 - list1[i... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR VAR NUMBER FOR VAR FUNC_CALL VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a, b = map(int, input().split())
output1 = ""
backupb = b
output2 = ""
if b <= 0 and a != 1 or b > a * 9:
print("-1 -1")
elif a == 1 and b == 0:
print(0, 0)
else:
for i in range(a):
output1 = output1 + str(min(9, b))
if b - 9 > 0:
b = b - 9
else:
b = 0
b =... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = input().split()
m = int(m)
s = int(s)
if 9 * m < s:
print("-1 -1")
elif s == 0 and m != 1:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
i = 2
A = []
s1 = s - 1
while i <= m:
if s1 >= 9:
A.extend([9])
s1 -= 9
i += 1
elif ... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER WHILE V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | [m, s] = [int(s) for s in input().split()]
a = [(0) for i in range(m)]
b = [(0) for i in range(m)]
sa = s
i = m - 1
while i >= 0:
if sa > 9:
a[i] = 9
sa = sa - 9
else:
a[i] = sa
sa = 0
i -= 1
fail = sa > 0
if not fail:
if m > 1 and a[0] == 0:
a[0] = 1
foun... | ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if 9 * m < s or s == 0 and m > 1:
print(-1, -1)
elif s == 0:
print(0, 0)
else:
dig9 = (s - 1) // 9
redun = s - 9 * dig9
if dig9 <= m - 2:
mini = "1" + (m - 2 - dig9) * "0" + str(redun - 1) + dig9 * "9"
else:
mini = str(redun) + dig9 * "9"
maxi... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def numbers(l, s):
if l == 1 and s > 9 or s == 0 and l > 1:
return "-1 -1"
if l == 1 and s < 10:
return str(s) + " " + str(s)
max = []
s1 = s
for i in range(l):
if s1 >= 9:
max.append(9)
s1 -= 9
else:
max.append(s1)
s1 -... | FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN STRING IF VAR NUMBER VAR NUMBER RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR IF VAR NUMBER RETURN S... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = input().split(" ")
m = int(m)
s = int(s)
if s == 0:
if m == 1:
print("0 0")
exit()
a = [1]
while len(a) < m:
a.append(0)
b = [9] * m
diff = sum(b) - s
if diff < 0:
print("-1 -1")
exit()
i = m - 1
while diff > 0:
if diff >= 9:
b[i] -= 9
i -= 1
else:
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER WHILE FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP FUNC_CALL VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
lm = sum([9] * m)
if s < 1 and m != 1 or s > lm:
print(-1, -1)
else:
mx = int(s / 9)
mx2 = int(s % 9)
l = [9] * mx
if mx2 > 0:
l.append(mx2)
if len(l) < m:
for i in range(len(l), m):
l.append(0)
l2 = l[::-1]
if l2[0] == 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def maximal(m, s):
if s > 9 * m:
return "*"
if s == 0:
if m == 1:
return str(0)
else:
return "*"
if m == 1:
if s in range(0, 10):
return str(s)
else:
return "*"
elif s < 10:
return str(s * 10 ** (m - 1))
... | FUNC_DEF IF VAR BIN_OP NUMBER VAR RETURN STRING IF VAR NUMBER IF VAR NUMBER RETURN FUNC_CALL VAR NUMBER RETURN STRING IF VAR NUMBER IF VAR FUNC_CALL VAR NUMBER NUMBER RETURN FUNC_CALL VAR VAR RETURN STRING IF VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER RETURN BIN_OP FUNC_CALL VAR NUMBER F... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, m = map(int, input().split())
if m == 1:
x = "1" + "0" * (n - 1)
print(x, x)
elif m == 0:
if n == 1:
print(0, 0)
else:
print(-1, -1)
elif m <= 9:
if n == 1:
print(m, m)
else:
y = str(m) + "0" * (n - 1)
z = "1" + "0" * (n - 2) + str(m - 1)
print(... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_O... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
def find(rev=False):
if m == 1 and s == 0:
return 0
sum, result = s, ""
for i in range(m):
j = 1 if i == 0 else 0
ok = False
for v in range(j, 10) if rev else reversed(range(j, 10)):
if (m - i - 1) * 9 >= sum - v >= 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR VAR VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP BIN_OP BIN_O... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def maxgen(m, s):
ans = [(0) for i in range(m)]
for i in range(m):
if s >= 9:
ans[i] = 9
s = s - 9
else:
ans[i] = s
break
return ans
m, s = list(map(int, input().split()))
if m == 1 and s == 0:
print(0, 0)
elif s < 1 or s > 9 * m:
pri... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | len, sm = map(int, input().split())
sm1 = sm
if sm == 0 and len > 1:
print("-1 -1")
exit()
if sm > len * 9:
print("-1 -1 ")
exit()
maxi = ""
for i in range(len):
if sm == 0:
maxi += "0"
continue
elif sm >= 9:
sm -= 9
maxi += "9"
else:
maxi += str(sm)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING IF VAR NUMBER VAR NUMBER VAR STRING VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
list1 = ["0"] * m
list2 = ["0"] * m
list1[-1] = "1"
list2[0] = "1"
if m == 1 and s == 0:
print("0 0")
exit()
if m * 9 < s or s == 0:
print("-1 -1")
elif m * 9 == s:
list1 = ["9"] * m
print("".join(list1), "".join(list1))
exit()
elif m == 1:
print(s, s)
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER STRING ASSIGN VAR NUMBER STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def maxn(a, b):
ans = ""
if b < 9:
ans += str(b)
ans += "0" * (a - 1)
else:
ans += "9"
b = b - 9
a = a - 1
if a > 0:
d = b // 9
os = b % 9
ans += "9" * d
if os % 9 != 0:
ans += str(os)
... | FUNC_DEF ASSIGN VAR STRING IF VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP STRING BIN_OP VAR NUMBER VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP STRING VAR IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR IF BIN_O... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | ms = input().split()
m = int(ms[0])
s = int(ms[1])
if m * 9 < s or s == 0 and m > 1:
print("-1 -1")
elif s == 0:
print("0 0")
else:
min9 = (s - 1) // 9
minx = s - 1 - min9 * 9
max9 = s // 9
maxx = s - max9 * 9
if min9 + 2 <= m:
minNum = "1" + "0" * (m - 2 - min9) + str(minx) + "9" * ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASS... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split(" "))
smll, lrg = 0, 0
if s == 0 and m == 1:
smll, lrg = 0, 0
elif s > m * 9 or s == 0 and m != 0:
smll, lrg = -1, -1
else:
s1 = s
smll = ""
nines = 0
while s1 > 9:
smll += "9"
nines += 1
s1 -= 9
smll += str(s1)
smll += "0" * (m - len... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR NUMBER VAR STRING VAR NUMBER VAR NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | l, s = list(map(int, input().split()))
if s > 9 * l or s < 1 and l != 1:
maxm = -1
minm = -1
else:
r = s % 9
q = s // 9
maxm = str(9) * q + "0" * (l - q)
maxm = int(maxm) + int(r * 10 ** (l - q - 1))
minm = int(str(r) + str(9) * q)
minm = minm - 10 ** (len(str(minm)) - 1)
minm = 10 *... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR NUMBER VAR BIN_OP STRING BIN_OP VAR VAR ASSIGN VAR BIN_OP FUNC_CALL V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | __author__ = "Utena"
l, v0 = list(map(int, input().split()))
if v0 > l * 9:
print("-1 -1")
elif v0 == 0:
if l == 1:
print("0 0")
else:
print("-1 -1")
else:
a = ""
v = v0
for i in range(l):
if i < l - 1:
x = min(9, v - 1)
a = "%d" % x + a
... | ASSIGN VAR STRING ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
else:
maxi = ""
mini = ""
for i in range(m):
k = str(min(9, s))
maxi += k
s -= int(k)
if s > 0:
print("-1 -1")
else:
x = list(maxi[::-1])
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING A... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | import sys
n, s = map(int, input().split())
if s == 0 or 9 * n < s:
if s == 0 and n == 1:
print(0, 0)
else:
print(-1, -1)
sys.exit()
mi = 10 ** (n - 1)
x = s - 1
for i in range(n):
if x > 9:
mi += 10**i * 9
x -= 9
else:
mi += 10**i * x
break
ma = 0
x ... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER BIN_OP NUMBER VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split(" ")]
smallest = 10 ** (m - 1)
largest = 10**m - 1
small_sum = 1
large_sum = 9 * m
if s == 0 and m == 1:
print(0, 0)
elif small_sum > s or large_sum < s:
print(-1, -1)
else:
i = 0
while small_sum < s:
smallest += 10**i * min(s - small_sum, 9)
small_s... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | l = [int(i) for i in input().split()]
result = []
refer = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
if l[0] * 9 < l[1]:
print(-1, -1)
elif l[0] != 1 and l[1] == 0:
print(-1, -1)
else:
for i in range(10):
while l[1] >= refer[-(i + 1)]:
l[1] = l[1] - refer[-(i + 1)]
result.append(refer[-(... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = input().split()
m = int(m)
s = int(s)
x = 1
min1 = max1 = 0
if s > 9 * m or m > 1 and s == 0:
print(-1, -1)
else:
if m == 1 and s == 0:
min1 = max1 = 0
else:
n9 = int(s / 9)
s = s % 9
m = m - n9
if s == 0:
if m == 0:
for i in range(n... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, n = map(int, input().split())
s = n
res1 = [(0) for i in range(m)]
res2 = [0] * m
if n > 9 * m or s < 1 and m != 1:
print(-1, end=" ")
print(-1, end="")
else:
s = n - 1
for i in range(m - 1, 0, -1):
if s > 9:
res1[i] = 9
s = s - 9
else:
res1[i] = s
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(x) for x in input().split()]
if s == 0 and m > 1:
print("-1 -1")
exit(0)
max_lim = m * 9
if s > max_lim:
print("-1 -1")
exit(0)
smallest = ""
largest = ""
if m == 1:
smallest = str(s)
largest = smallest
elif s < 10:
smallest = "1" + "0" * (m - 2) + str(s - 1)
largest = str(s)... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def largest(m, s):
if m == 0 and s == 0:
return True, ""
if s >= 0 and s <= 9 * m:
for digit in range(9, -1, -1):
flag, gen = largest(m - 1, s - digit)
if flag:
return True, str(digit) + gen
return False, ""
else:
return False, ""
def... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR VAR IF VAR RETURN NUMBER BIN_OP FUNC_CALL VAR VAR VAR RETURN NUMBER STRING RETURN NUMBER STRING FUNC_DEF IF VAR NUMBER VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0 and m > 1:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
nmax = ""
nmin = ""
ts = s
for i in range(m - 1):
if ts > 9:
nmin = "9" + nmin
ts -= 9
else:
nmin = chr(ts + 47) + nmin
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP STRING VAR VAR NUMBER ASSIGN VAR BIN_O... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, j = map(int, input().split())
p = j % 9
q = j // 9
if n < q or n == q and p != 0 or j == 0 and n != 1:
print("-1 -1")
elif n == 1 and j == 0:
print("0 0")
elif p == 0 and q == n:
print("9" * q, "9" * q)
else:
t = j % 9
w = j // 9
if n > w + 1:
t = t - 1
if t < 0:
t... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR BIN_OP STRING VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m != 1 and s == 0 or s > 9 * m:
print("-1 -1")
else:
rem = s
i = m - 1
maxi = 0
while i >= 0:
maxi += min(rem, 9) * 10**i
rem -= min(rem, 9)
i -= 1
rem = s - 1
mini = 0
for j in range(0, m - 1):
mini += min(max(0, rem), ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | string = input()
numbers = string.split()
m = int(numbers[0])
s = int(numbers[1])
if s < 1 and m != 1 or s > m * 9:
smallest = "-1"
largest = "-1"
else:
digits = []
if m == 1:
n = 0
total = 0
else:
n = 10 ** (m - 1)
total = 1
for x in str(n):
digits.append... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR LIST IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.