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 = [int(i) for i in input().split()]
num = [(9) for i in range(m)]
def max_number(num, s):
total_sum = sum(num)
i = 1
while total_sum > s:
num[-i] -= 1
total_sum -= 1
if num[-i] == 0:
i += 1
return num
def min_number(num, s):
aux_num = num[::-1]
if aux... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR NUMBER IF VAR NUMBER NUMBER FOR VAR FUNC_CALL 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 s == 0:
if m == 1:
print(0, 0)
else:
print(-1, -1)
else:
txt = ""
mm = m
while m > 0:
m -= 1
if s >= 9:
s -= 9
txt += "9"
else:
txt += str(s)
s -= s
mintxt = txt[-1::-1]
... | 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 STRING ASSIGN VAR VAR WHILE VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR STRING VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER IF 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... | mp = map(int, input().split(" "))
s, m = list(mp)
ans = [(0) for i in range(s)]
if s * 9 < m or m < 1 and s > 1:
print("-1 -1")
else:
big = 0
n = m
for i in range(s - 1, -1, -1):
if m > 9:
ans[i] = 9
else:
ans[i] = m
m -= ans[i]
big = "".join(map(str, ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN VAR 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())
min = [(0) for x in range(101)]
max = [(0) for x in range(101)]
if s == 0 and m != 1:
print("-1 -1")
elif 9 * m < s:
print("-1 -1")
else:
temp = s
pos = m
while s > 0:
if s > 9:
min[pos] = 9
s -= 9
else:
min[pos] = ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR NUMBER IF VAR NUMBER ASSIGN 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... | def get_max_number(m, s):
max_number = 0
for i in range(m):
new_digit = min(9, s)
max_number = 10 * max_number + new_digit
s -= new_digit
if s or len(str(max_number)) != m:
max_number = -1
return max_number
def get_min_number(m, s):
if s == 0:
return 0 if m ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR VAR VAR IF VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER RETURN VAR FUNC_DEF IF VAR NUMBER RETURN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR 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... | def least(n, m, s):
if m == 0 and s == 0:
return n
if n == "":
beg = 1
else:
beg = 0
if m * 9 < s:
return ""
for i in range(beg, 10):
ans = least(n + str(i), m - 1, s - i)
if ans != "":
return ans
def most(n, m, s):
if m == 0 and s ==... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN VAR IF VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER VAR RETURN STRING FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR IF VAR STRING RETURN VAR FUNC_DEF IF VAR NUMBER 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... | m, S = map(int, input().split())
s = S
if m == 1 and 0 <= S <= 9:
print(S, S)
elif s == 0 or s > 9 * m:
print(-1, -1)
else:
mn = [0] * m
mn[0] = 1
s -= 1
for i in range(m - 1, -1, -1):
if s > 0:
if mn[i] + s > 9:
mn[i] = 9
s -= 9
el... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR 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... | ms = input().split(" ")
m = int(ms[0])
s = int(ms[1])
if s == 0 and m > 1 or m == 0 or s > 9 * m:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
nums1, nums2 = [], []
min_s, max_s = s, s
for i in range(m, 0, -1):
k = 1
if i != m:
k = 0
if min_s > k + 9 ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER 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 VAR LIST LIST ASSIGN VAR VAR 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 = list(map(int, input().split()))
if m == 1 and s == 0:
print(0, 0)
elif m == 1 and s == 1:
print(1, 1)
elif m * 9 < s:
print(-1, -1)
elif s == 0:
print(-1, -1)
else:
arr = [1] + [0] * (m - 1)
arr2 = [0] * m
k = arr[::-1]
n = -1
while sum(k) < s:
n += 1
k[n] = 9
... | 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 NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST 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 9 * m < s:
print(*[-1, -1])
elif s == 0 and m > 1:
print(*[-1, -1])
elif s == 0:
print(0, 0)
else:
a, b = [0] * m, [0] * m
a[0] = 1
r = s
s -= 1
for i in range(0, m):
for j in range(1, 10):
if r != 0:
b[i] += 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR LIST NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSI... |
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... | qhy = input()
a, b = [int(i) for i in qhy.split()]
maxn = []
minn = []
if b == 0 and a != 1:
print("-1 -1")
elif 9 * a < b:
print("-1 -1")
else:
t = 0
m = b
for i in range(a):
if m > 9:
t = 9
m = m - t
maxn.append(t)
else:
t = m
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP 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... | n, s = [int(i) for i in input().split()]
def pos(n, s):
if s >= 0 and s <= 9 * n:
return True
return False
if n == 1:
if s > 9:
print(-1, -1)
else:
print(s, s)
elif s == 0:
if n == 1:
print(0, 0)
else:
print(-1, -1)
else:
temp = s
minn = ""
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN NUMBER RETURN NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER 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 ASSI... |
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 > 9 * m:
print("-1", "-1")
else:
a = s // 9
b = s % 9
if a == 0:
if m == 1:
print(b, end=" ")
print(b)
else:
print("1", end="")
for i in range(m - 2):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING STRING IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUN... |
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 or s > 9 * m:
print(-1, -1)
else:
big = ""
bs = s
small = ""
ss = s
for i in range(m):
if bs >= 9:
big += "9"
bs -= 9
else:
big += str(bs)
bs = 0
if i <= m - 2:
... | 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_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF 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, s = map(int, input().split(" "))
s0 = s
list1 = []
list2 = []
if s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
elif s > 9 * m:
print("-1 -1")
elif m == 1:
print(s, s, sep=" ")
else:
for i in range(m):
if s >= 9:
list1.append("9")
s -= 9
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR STRING FOR VAR FUNC_CALL VAR VAR IF 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 = input().split()
m = int(a[0])
s = int(a[1])
nein = s // 9
r = s % 9
if s == 0 and m == 1:
print(0, 0)
elif s == 0 and m > 1:
print(-1, -1)
elif nein > m:
print(-1, -1)
elif nein == m and r > 0:
print(-1, -1)
elif nein == m and r == 0:
b = 0
for i in range(m):
b += 9 * 10**i
print... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR 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... | [m, s] = list(map(int, input().split()))
mlist = [0] * m
mlist[0] = s
if s == 0 and m > 1 or s > m * 9:
smallest = str(-1)
biggest = str(-1)
else:
first0 = m
for i in range(1, m):
if mlist[i - 1] > 9:
mlist[i - 1], mlist[i] = 9, mlist[i - 1] - 9
if mlist[i] == 0:
... | ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER 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... | def f0(m, s):
n = [(0) for x in range(m)]
n[0] = 1
s -= 1
for i in range(m - 1, -1, -1):
if s == 0:
break
if s < 10:
n[i] += s
break
else:
n[i] = 9
s -= 9
n = [str(x) for x in n]
return "".join(n)
def f1(m, s):... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER VAR VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR RETURN FUNC_CALL STRING VAR FUNC_DEF ASSIGN VAR NUMBER VAR 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 = map(int, input().split())
zuida = 0
zuixiao = 0
weishu = m
qiuhe = s
if s == 0 and m > 1:
print("-1 -1")
elif m == 1 and s == 0:
print("0 0")
elif s > 9 * m:
print("-1 -1")
else:
while s > 9:
zuida = zuida + 9 * 10 ** (m - 1)
s = s - 9
m = m - 1
zuida = zuida + s * 10 ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING WHILE VAR NUMBER ASSIGN VAR BIN_OP 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 = map(int, input().split())
mx, mn = "", ""
if m == 1 and not s:
print(0, 0)
exit()
if not s or 9 * m < s:
print(-1, -1)
exit()
curs = s
for i in range(m):
l = curs - (m - i - 1) * 9
if l <= 0:
if i == 0:
mn += "1"
curs -= 1
else:
mn += "0... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING STRING IF VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP 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... | n, s = map(int, input().split())
s1 = s
s2 = s
maxs = ""
mins = ""
maxcount = 0
mincount = 0
if s < 1 or n * 9 < s:
if n == 1 and s == 0:
print("0 0")
else:
print("-1 -1")
else:
while s1 > 0:
if s1 >= 9:
s1 -= 9
maxcount += 1
maxs = maxs + "9"
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER BIN_OP VAR NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING WHILE VAR NUMBER IF VAR NUMBER VAR NUMBER VAR 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... | data = input().split()
m, s = int(data[0]), int(data[1])
if m == 1 and 0 <= s <= 9:
print(s, s)
elif m >= 2 and 1 <= s <= m * 9:
num1 = ""
s1 = s
for i in range(1, 10):
if 0 <= s1 - i <= (m - 1) * 9:
num1 += str(i)
s1 -= i
break
for j in range(2, m):
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF NUMBER BIN_OP VAR VAR BIN_OP BIN_OP 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())
nine = int(s / 9)
shengyu = s - nine * 9
Max = ""
Min = ""
if s > 9 * m:
Max = -1
Min = -1
print(Min, Max)
elif s == 9 * m:
while m > 0:
Max = Max + str(9)
Min = Min + str(9)
m = m - 1
print(Min, Max)
elif s == 0 and m == 1:
Max = 0
Mi... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR BIN_OP NUMBER VAR WHILE VAR NUMBER ASSIGN 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, s = map(int, input().split())
if s > m * 9 or s == 0 and m > 1:
max = str(-1)
min = str(-1)
else:
a = 0
while s > 9 * (a + 1):
a += 1
max = "9" * a + str(s - 9 * a) + "0" * (m - a - 1)
if "0" in max:
if "1" in max:
min = "1" + "0" * (m - a - 1) + "9" * a
el... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR FUNC_CALL VAR BIN_OP VAR BIN_OP 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... | n, m = map(int, input().split())
max = 0
min = 0
if m == 0 and n != 1 or m > 9 * n:
print(-1, -1)
elif n == 1 and m == 0:
print(0, 0)
else:
min = 10 ** (n - 1)
for i in range(m - 1):
a = i // 9
min += 10**a
max = 0
for i in range(m):
b = n - 1 - i // 9
max += 10**... | 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 NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP 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... | __author__ = "user"
m, s = map(int, input().split())
if s == 0 and m > 1 or s > 9 * m:
min_num = max_num = -1
elif m == 1:
min_num = max_num = s
else:
nns1 = s // 9
d = s % 9
max_num = "9" * nns1
if nns1 != m:
max_num += str(d) + "0" * (m - nns1 - 1)
if s <= (m - 1) * 9:
nns2... | ASSIGN VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING VAR IF VAR VAR VAR BIN_OP FUNC_CALL VAR VAR BIN_OP STRING 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... | def main():
m, s = map(int, input().split())
s1 = s
if s == 0 and m == 1:
print(0, 0)
elif s < 1 or s > 9 * m:
print("-1 -1")
else:
probmax = [0] * m
for i in range(m - 1):
if s1 > 9:
probmax[i] = 9
s1 -= 9
probmax[-... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR 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 = input().split()
m = int(m)
s = int(s)
zx = -1
min = a = aa = ""
if s > 9 * m:
print("-1 -1")
if s <= 0 and m != 1:
print("-1 -1")
if m == 1 and s == 0:
print("0 0")
elif s <= 9 * m and (s > 0 or m == 1):
c = int(s / 9)
for i in range(c):
a += "9"
max = a + str(s - 9 * c)
while... | 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 VAR STRING 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 IF VAR BIN_OP NUMBER 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... | n, s = map(int, input().split())
minR = (s + 8) // 9
if minR > n or s == 0 and n > 1:
print(-1, -1, end=" ")
else:
minZnac = int(str(s % 9) + "9" * (s // 9))
lenMin = len(str(minZnac))
if lenMin < n:
minZnac -= 10 ** (lenMin - 1)
lenMin = len(str(minZnac))
print(1, "0" * (n - 1 -... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF 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... | l = input().split()
n, s = int(l[0]), int(l[1])
a = b = []
if 1 <= s <= 9 * n:
a = [9] * (s // 9)
if s % 9:
a += [s % 9]
d = n - len(a)
if d:
a += [0] * d
b = a[::-1]
b[0] = 1
b[d] -= 1
else:
b = a[::-1]
a = "".join(map(str, a))
b = "".join(map... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR LIST IF NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR LIST BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP LIST 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... | def ss(n, m):
if m > n * 9:
return "-1 -1"
if m < n:
if m == 0:
if n == 1:
return "0 0"
else:
return "-1 -1"
slist = ["9"] * ((m - 1) // 9) + [str((m - 1) % 9)]
if len(slist) == n:
k = int(slist.pop())
slist.append(s... | FUNC_DEF IF VAR BIN_OP VAR NUMBER RETURN STRING IF VAR VAR IF VAR NUMBER IF VAR NUMBER RETURN STRING RETURN STRING ASSIGN VAR BIN_OP BIN_OP LIST STRING BIN_OP BIN_OP VAR NUMBER NUMBER LIST FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR 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... | m, s = [int(i) for i in input().split()]
output1 = ""
output2 = ""
if s == 0:
if m != 1:
print("-1 -1")
elif m == 1:
print("0 0")
elif m * 9 < s:
print("-1 -1")
elif s <= 9:
if m == 1:
output1 += str(s)
output2 += str(s)
print(output2, output1)
elif m != 1:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXPR 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... | m, s = map(int, input().split())
if m > 1 and s == 0 or m == 1 and s > 9 or s > m * 9:
print(-1, -1)
else:
s1 = s
st = ["0"] * m
i = m - 1
while s1 > 9:
st[i] = "9"
i -= 1
s1 -= 9
st[0] = "1"
s1 -= 1
st[i] = str(int(st[i]) + s1)
ans1 = int("".join(st))
s2 ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER 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... | a, b = input().split()
a = int(a)
b = int(b)
if b > 9 * a or b == 0 and a > 1:
print(-1, -1)
elif b == 0 and a == 1:
print(0, 0)
else:
x = 10 ** (a - 1)
y = 0
i = 0
k = b - 1
while k > 0:
if k > 9:
k -= 9
x += 9 * 10**i
i += 1
else:
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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... | a = input().split()
if int(a[0]) * 9 < int(a[1]):
print("%d %d" % (-1, -1))
elif int(a[1]) == 0 and int(a[0]) != 1:
print("%d %d" % (-1, -1))
elif int(a[1]) == 0 and int(a[0]) == 1:
print("%d %d" % (0, 0))
else:
d = ["0" for i in range(int(a[0]))]
b = int(a[1]) // 9
c = int(a[1]) % 9
for i i... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP STRING NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL 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())
a = [[]] * (m + 1)
b = [[]] * (m + 1)
for i in range(m + 1):
a[i] = ["-1"] * (s + 1)
b[i] = ["-1"] * (s + 1)
for j in range(1, min(s, 9) + 1):
a[1][j] = str(j)
b[1][j] = str(j)
for i in range(2, m + 1):
a1 = a[i - 1]
b1 = b[i - 1]
for j1 in range(s + 1):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST LIST BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST LIST BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP LIST STRING BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP LIST STRING BIN_OP VAR NUMBER FOR 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... | while True:
try:
def solution(m, s):
if s == 0 and m == 1:
print(0, 0)
elif s == 0 or s > 9 * m:
print("-1 -1")
else:
indx = [0] * 100
indx[0] = 1
ts = s - 1
tlc = m - 1
... | WHILE NUMBER FUNC_DEF IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER WHILE VAR NUMBER VAR VAR NUMBER VAR 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... | [m, s] = list(map(int, input().strip().split()))
if s == 0 and m > 1 or s > 9 * m:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
largest, smallest = ["0"] * m, ["0"] * m
s1, s2 = s, s
for idx in range(m):
largest[idx] = str(min(s1, 9))
s1 -= int(largest[idx])
smallest... | ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR BIN_OP LIST STRING VAR BIN_OP LIST STRING VAR ASSIGN VAR VAR VAR VAR 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... | def get(m, s):
lis_1 = ["0" for i in range(m)]
lis_2 = ["0" for i in range(m)]
s_1 = s
for i in range(m):
if s >= 9:
lis_1[i] = "9"
s -= 9
else:
lis_1[i] = str(s)
break
s = s_1
if s > (m - 1) * 9:
lis_2 = [str(s - (m - 1) * ... | FUNC_DEF ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR STRING VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR IF VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST 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... | a = input().split()
num = int(a[0])
s = int(a[1])
def getmin(x, y):
c = [(0) for j in range(0, x)]
su = y
for i in range(0, x):
if su > 9:
c[x - i - 1] = 9
su = su - 9
else:
if i == x - 1:
c[0] = su
else:
c[0] ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP 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... | a, b = list(map(int, input().split()))
if b > a * 9:
print("-1 -1")
elif b == 0:
if a == 1:
print("0 0")
else:
print("-1 -1")
elif a == 1:
print(b, b)
elif b <= 9:
print(1, end="")
print("0" * (a - 2), end="")
print(b - 1, b, end="")
print("0" * (a - 1))
elif a * 9 == b:
... | 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 IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP 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... | m, s = input().split()
m, s = int(m), int(s)
if 9 * m < s or m > 1 and s == 0:
print("-1 -1")
elif m == 1 and s == 0:
print("0 0")
else:
x = int(s / 9)
y = s % 9
if y == 0:
if x == m:
print(str(9) * m, str(9) * m)
else:
print(
"1" + str(0) * (m... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER IF VAR VAR 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... | n, m = map(int, input().split())
mx = ""
mn = [0] * 109
o = 0
def f(x, sz):
for i in range(sz):
x += "0"
return x
if m == 0 and n == 1:
print("0 0")
exit()
if m == 0 or m > n * 9:
print("-1 -1")
exit()
k = m
for i in range(9, 0, -1):
while k - i >= 0:
k -= i
mx +=... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR VAR VAR STRING RETURN VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING E... |
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 = input().split()
a = int(a)
b = int(b)
f = b
if a == 1 and b <= 9:
print(b, end=" ")
print(b)
exit()
if a > 1 and b == 0:
print(-1, end=" ")
print(-1)
exit()
if 9 * a < b:
print(-1, end=" ")
print(-1)
exit()
if 9 * (a - 1) > b:
c = 1
else:
c = b - 9 * (a - 1)
b = b - c
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL 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... | n, m = map(int, input().split())
if n == 1 and m <= 9 * n:
print(str(m) + " " + str(m))
elif m == 0 or m > 9 * n:
print("-1 " + "-1")
else:
a = m // 9
b = m % 9
if a == 0:
x = str(b) + (n - 1) * "0"
elif m == 9 * n:
x = n * "9"
else:
x = a * "9" + str(b) + (n - 1 - a)... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP STRING STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF 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 = list(map(int, input().split()))
cs = s
if s == 0 and m > 1 or s > m * 9:
print("-1 -1")
else:
largest = [0] * m
i = 0
while i < m:
x = min(9, s)
largest[i] = x
s = s - x
i = i + 1
smallest = largest[::-1]
s = cs
if s > 0 and smallest[0] == 0:
i ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN 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... | q = input().split()
le = int(q[0])
su = int(q[1])
i = 10 ** (le - 1)
ma = 0
mi = 0
ri = 0
if su == 0 and le != 1:
print("-1 -1")
elif su > 9 * le:
print("-1 -1")
elif le == 1 and su == 0:
print("0 0")
elif su <= 9:
print(i + su - 1, i * su)
else:
q = int(su / 9)
p = su % 9
if q == le:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF 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... | x = input()
y = x.split()
n = int(y[0])
summ = int(y[1])
maxlist = list()
if summ > n * 9:
print("-1 -1")
elif n > 1 and summ == 0:
print("-1 -1")
elif n == 1 and summ == 0:
print("0 0")
else:
for i in range(9):
nn = 9 - i
while summ >= int(nn):
summ -= int(nn)
ma... | 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 IF VAR BIN_OP VAR NUMBER 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 FOR VAR 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 = map(int, input().strip().split())
s1, s2 = s, s
l = [(0) for x in range(m)]
l1 = [(0) for x in range(m)]
for i in range(m):
if s <= 0:
break
for j in range(9, 0, -1):
if s >= j:
l[i] = j
s -= j
break
for i in range(m):
if s1 <= 0:
break
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR 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... | m, s = map(int, input().split())
def maximum(m, s):
a = s // 9
if s - 9 * a > 0:
max_num = "9" * a + str(s - 9 * a) + "0" * (m - a - 1)
else:
max_num = "9" * a + "0" * (m - a)
return max_num
if m == 1 and s == 0:
print("0", "0")
elif 1 <= s <= 9 * m:
c = maximum(m, s)
d =... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR BIN_OP STRING BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING VAR BIN_OP STRING 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... | line = input()
m = int(line.split(" ")[0])
s = int(line.split(" ")[1])
max = 0
min = 0
if m > 1:
if s != 0:
if s < 9 * m:
a = s // 9
b = s % 9
for i in range(1, a + 1):
max = max + 9 * 10**i
max = max + b
max = max * 10 ** (m - a - ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER IF VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR 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... | import sys
input = sys.stdin.readline
def inlt():
return list(map(int, input().split()))
min_map = {}
max_map = {}
def sum_of_digits(digit):
digit_sum = 0
while digit:
rem = digit % 10
digit_sum += rem
digit //= 10
return digit_sum
def min_helper(l, s):
if l == 0:
... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FUNC_DEF ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER RETURN VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER 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... | shuru = input()
pieces = shuru.split()
a = int(pieces[0])
b = int(pieces[1])
minn = ""
yiyong = 0
if b < 0 or b > 9 * a:
print("-1 -1")
elif b == 0 and a == 1:
print("0 0")
elif b == 0 and a != 1:
print("-1 -1")
elif b >= 9 * (a - 1) + 1:
minn = str(b - 9 * (a - 1))
for i in range(0, a - 1):
... | 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 STRING ASSIGN VAR NUMBER IF VAR NUMBER 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 STRIN... |
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 or m == 1 and s > 9:
print(-1, -1)
elif s == 9 * m:
print("9" * m, "9" * m)
elif m == 1:
print(s, s)
else:
r = s
i = 0
a = [0] * m
b = [0] * m
while i < m:
for j in range(9, 0, -1):
l = s - j
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR BIN_OP STRING VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN 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... | st = input()
st = [int(i) for i in st.strip().split()]
ln, sm = st[0], st[1]
summa = sm
mn = []
while len(mn) < ln:
if summa - 9 >= 0:
mn.append(9)
summa = summa - 9
else:
mn.append(summa)
summa = 0
if sum(mn) == sm and len(mn) == ln:
big = [str(j) for j in mn] if mn[0] != 0 ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF 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 = map(int, input().split())
minres = []
maxres = []
if s == 0 and m > 1:
maxres = ["-1"]
minres = ["-1"]
if m and s:
if s <= 9:
maxres = [str(s)] + (m - 1) * ["0"]
elif 9 * m > s:
maxres = ["9"] * (s // 9) + [str(s % 9)] + (m - (s // 9 + 1)) * ["0"]
elif 9 * m == s:
maxr... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER ASSIGN VAR LIST STRING ASSIGN VAR LIST STRING IF VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP LIST FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER LIST STRING IF BIN_OP NUMBER VAR VAR 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... | m, s = map(int, input().split())
if m == 1 and s == 0:
print("0 0")
elif m > 1 and s == 0:
print("-1 -1")
elif s > 9 * m:
print("-1 -1")
else:
sum_min = s - 1
k = 0
Min_suff = []
while sum_min > 0 or k < m:
if sum_min > 9:
Min_suff = [9] + Min_suff
sum_min -= ... | 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 IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER VAR VAR 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(0, 0)
exit()
if m * 9 < s or s == 0:
print(-1, -1)
exit()
l = [9] * m
i = 0
f = 0
x = 9 * m
while i < len(l) and f == 0 and x != s:
if l[i] == 1 and i == 0:
i = i + 1
elif l[i] == 0:
i = i + 1
else:
l[i] = l... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP 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... | x, y = map(int, input().split())
if 9 * x < y:
print(-1, -1)
exit(0)
if y == 0:
if x != 1:
print(-1, -1)
else:
print(0, 0)
exit(0)
mx = [0] * x
v = y
for n in range(x):
p = 9
if v > 9:
v -= p
else:
p = v
v = 0
mx[n] += p
mx.sort(reverse=True)
m... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FOR VAR 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... | m, s = map(int, input().split())
maxi = []
mini = []
line = []
if s > 9 * m:
print("-1", "-1")
elif m > 1 and s == 0:
print("-1", "-1")
elif m == 1:
print(s, s)
else:
s_ = s
while s > 9:
maxi.append(str(9))
s -= 9
else:
maxi.append(str(s))
if len(maxi) == m:
p... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR 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 = input().split()
m = int(m)
s = int(s)
if s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
exit()
sumdigits = int(s - 1)
arr = [1]
for i in range(m - 1):
arr.append(0)
for i in reversed(range(m)):
tmp = min(9 - arr[i], sumdigits)
arr[i] += tmp
sumdigits -= tmp
if su... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR 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 STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR BIN_OP 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... | m, n = [int(x) for x in input().split(" ")]
if n < 1 and m == 1:
print(0, 0)
elif n > 9 * m or n < 1:
print(-1, -1)
else:
n2 = n
biggest = ""
while n > 0:
biggest += str(min(9, n))
n -= 9
biggest += "0" * (m - len(biggest))
smallest = ""
while n2 > 0:
smallest = s... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING 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 ASSIGN VAR VAR ASSIGN VAR STRING WHILE VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR BIN_OP STRING 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 isPossible(s, m):
return s >= 0 and s <= 9 * m
def findMinimun(m, s):
num = 0
for index in range(m, 0, -1):
flag = True
for digit in range(10):
if index == m and digit == 0 and m > 1:
continue
if isPossible(s - digit, index - 1):
... | FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR IF VAR R... |
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(" ")]
x = a[0]
y = a[1]
if y > 9 * x:
print("-1 -1")
elif y == 0:
if x == 1:
print("0 0")
else:
print("-1 -1")
else:
larg = []
for i in range(x):
if 9 <= y:
larg.append(9)
y -= 9
else:
larg.append(... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF NUMBER VAR EXPR FUNC_CALL 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 s == 0:
if m == 1:
print("0 0\n")
else:
print("-1 -1\n")
exit()
temp = "9" * (s // 9)
if s % 9:
temp += f"{s % 9}"
if len(temp) > m:
print("-1 -1\n")
exit()
maximum = temp
while len(maximum) < m:
maximum += "0"
while len(temp) < m:
temp... | 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 EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR 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:
if m == 1:
print(0, 0)
else:
print(-1, -1)
elif s > 9 * m:
print(-1, -1)
else:
nines, mod = divmod(s - 1, 9)
min_number = ""
if nines < m - 1:
min_number = "1" + "0" * (m - nines - 2) + str(mod) + "9" * nines
else:
m... | 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 IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING IF VAR BIN_OP VAR NUMBER ASSIGN 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... | length, total = map(int, input().strip().split(" "))
if total > 9 * length or total == 0:
if length == 1 and total == 0:
print(0, 0)
else:
print(-1, -1)
else:
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
ans = ""
i = len(l) - 1
tota = 0
while i >= 0:
if total >= total - i >= 0:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR STRING ASSIGN 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... | r = input().split()
length = int(r[0])
digit = int(r[1])
digitc = int(r[1])
le = 0
m = []
ans1 = 0
ans2 = 0
if length == 1 and digit <= 9 * length:
print(digit, digit)
elif digit == 0 or digit > 9 * length:
print("-1 -1")
else:
while le != length:
if digitc >= 9:
m.append(9)
... | ASSIGN VAR FUNC_CALL 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 NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUN... |
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, k = map(int, input().split())
A = list(str(k // m) * m)
A = list(map(int, A))
A[-1] += k % m
B = A[:]
if 9 * m < k or sum(A) == 0 and len(A) > 1:
print(-1, -1)
else:
c = m - 1
a = 0
while a != c and a < m and c >= 0 and a < c:
if a == 0:
if A[0] - 1 == 0:
a += 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER BIN_OP VAR VAR ASSIGN VAR VAR IF BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER 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 = map(int, input().split())
def validate(m, s):
if m == 1 and s < 10:
return s
elif s == 0:
return -1
elif 9 * m < s:
return -1
return None
def prep_max(m, s):
r = validate(m, s)
if r is not None:
return r
len_9 = s // 9
len_0 = m - len_9
retu... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN VAR IF VAR NUMBER RETURN NUMBER IF BIN_OP NUMBER VAR VAR RETURN NUMBER RETURN NONE FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NONE RETURN VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR RETURN 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... | L = input().split()
m = int(L[0])
n = int(L[1])
def mi(a, b):
c = [(0) for j in range(0, a)]
for i in range(0, a):
if b > 9:
c[a - 1 - i] = 9
b = b - 9
else:
if i == a - 1:
c[0] = b
else:
c[0] = 1
c... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR 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... | def smallest(m, s):
if m == 1 and s == 0:
return 0
x = 10 ** (m - 1)
y = str(x)
z = []
for i in y:
z.append(int(i))
i = m - 1
while i >= 0:
if z[i] == 9:
i -= 1
if sum(z) == s:
a = ""
for i in range(len(z)):
... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR STRING 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] = [int(_) for _ in input().split()]
if m == 1:
if s == 0:
ans = ["0", "0"]
elif s > 9:
ans = ["-1", "-1"]
else:
ans = [str(s), str(s)]
elif s > m * 9 or s == 0:
ans = ["-1", "-1"]
else:
lis = []
lis.extend([9] * (s // 9))
if s % 9 != 0:
lis.append(s % 9... | ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER ASSIGN VAR LIST STRING STRING IF VAR NUMBER ASSIGN VAR LIST STRING STRING ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR LIST STRING STRING ASSIGN VAR LIST 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, n = (int(i) for i in input().split())
if n == 0 and m != 1 or n > 9 * m:
print(-1, -1)
else:
maxnum = ""
n1 = n
for i in range(m):
maxnum += str(min(n1, 9))
n1 -= min(n1, 9)
minnum = ""
if n >= m:
for i in range(m - 1):
minnum += str(min(n - 1, 9))
... | 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_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING IF VAR VAR FOR VAR 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... | n, m = map(int, input().split())
if n == 1 and m == 0:
print(0, 0)
elif 1 <= m <= 9 * n:
su = m
ma = ""
for i in range(n):
if su > 9:
ma += "9"
su -= 9
else:
ma += str(su)
su = 0
su = m - 1
mi = ""
for i in range(n - 1):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR 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... | a = map(int, input().split())
b = list(a)
m = b[0]
s = b[1]
c = []
d = []
x = ""
n = ""
if s == 0 and m != 1 or s > 9 * m:
print(-1, -1)
else:
for i in range(m):
if s >= 9:
c.append(9)
s -= 9
else:
c.append(s)
s = 0
for i in range(m):
x... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR 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... | import sys
m, s = list(map(lambda x: int(x), input().split()))
temp_s = s
if m == 1 and s == 0:
print(0, 0)
sys.exit(0)
def can(m, s):
return s >= 0 and m * 9 >= s
def can_max(m, s):
return s >= 0
answer = ""
for i in range(0, m):
for d in range(0, 10):
if (i > 0 or d > 0 or m == 1 an... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_DEF RETURN VAR NUMBER BIN_OP VAR NUMBER VAR FUNC_DEF RETURN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR FO... |
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, c = [int(i) for i in input().split()]
if c / m > 9:
print(-1, -1)
elif c == 0 and m > 1:
print(-1, -1)
elif c == 0 and m == 1:
print(0, 0)
else:
l = [(0) for i in range(m)]
l[0] = 1
s = c
s -= 1
j = m - 1
while s != 0 and j >= 0:
if l[j] < 9 and s != 0:
l[j] +=... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER 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 NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR VAR 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... | n, m = list(map(int, input().split()))
if m > n * 9:
print(-1, -1)
elif m == 0 and n > 1:
print(-1, -1)
elif n == 1 and m == 0:
print(0, 0)
else:
m1 = m
large = [0] * n
for i in range(n):
if m >= 9:
m -= 9
large[i] = 9
else:
large[i] = m
... | 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 NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR 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... | import sys
m, s = map(int, sys.stdin.readline().split())
s2 = s
if m == 1 and s == 0:
max = min = 0
elif s > m * 9 or m != 1 and s == 0:
max = min = -1
else:
l = [str(0)] * m
for i in range(m):
if s > 9:
l[i] = str(9)
s -= 9
else:
l[i] = str(s)
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR NUMBER 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 > 9 * m:
print(-1, -1)
elif s == 0 and m > 1:
print(-1, -1)
elif s == 0 and m == 1:
print(0, 0)
else:
maxn = []
for i in range(m):
if s > 9:
maxn.append(9)
s = s - 9
elif s != 0:
maxn.append(s)
s = ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR 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 NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL 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... | a, b = map(int, input().split())
if a == 1 and b == 0:
print("0 0")
elif b > a * 9 or b == 0:
print("-1 -1")
else:
x = [0] * a
x[0] += 1
c = b
c -= 1
counter = -1
while c:
add = min(c, 9)
x[counter] += add
c -= add
counter -= 1
print("".join(map(str, x... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER 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 = list(map(int, input().split()))
mini = []
maxi = []
for i in range(m):
mini.append(0)
maxi.append(9)
mini[0] = 1
min_sum = 1
max_sum = 9 * m
if m == 1 and s == 0:
print("0 0")
elif s < min_sum or s > max_sum:
print("-1 -1")
else:
for i in range(m - 1, -1, -1):
maxi[i] -= min(max_sum -... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR 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... | d, s = list(map(int, input().split()))
maxsum = 9 * d
minsum = 1
flag = 1
maxl = list()
minl = list()
if d <= 0 or 9 * d < s or d > 1 and s == 0:
flag = 0
elif d == 1:
maxl.append(s)
minl.append(s)
else:
nine = s // 9
for _ in range(nine):
maxl.append(9)
minl.append(9)
if nine < ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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, s = map(int, input().split())
if s == 0 and a > 1 or s > 9 * a:
print(-1, -1)
else:
maxx = ""
s1 = s
for i in range(a):
if s1 >= 9:
s1 -= 9
maxx += "9"
else:
maxx += str(s1)
s1 -= s1
minn = ""
if s == 0:
minn = 0
else... | 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 NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR STRING VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING IF VAR NUMBER ASSIGN VAR NUMBER 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... | n = 0
m, s = map(int, input().split())
if m * 9 - 8 >= s and m > 2 and s >= 10:
s -= 10
m -= 2
while m * 9 - 9 >= s and m > 2 and s > 8:
s -= 9
m -= 2
n += 1
if m * 9 - 9 < s:
mini = "1" + "0" * n + str(s - m * 9 + 9) + (m + n) * "9"
maxi = "9" * (m + n) + str(s -... | ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER WHILE BIN_OP BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR BIN_OP 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())
num_min = [1]
num_max = [9]
for i in range(m - 1):
num_min.append(0)
num_max.append(9)
if s > 0:
i = 0
while i < m:
if sum(num_min) < s:
while sum(num_min) < s and i < m:
if s - sum(num_min) >= 9:
num_min[-1 - i] = ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF FUNC_CALL VAR VAR VAR WHILE FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP 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 = [int(i) for i in input().split()]
if s <= 0 or s > 9 * m:
if s == 0 and m == 1:
print(0, 0)
else:
print(-1, -1)
else:
if s % 9 != 0:
rem = s // 9
positions_available = m - rem
if positions_available >= 2:
tot_remain = s % 9
s = "1" + "0"... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP 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... | m, s = (int(i) for i in input().split())
if m > 1 and s < 1 or s > 9 * m:
print("-1 -1")
exit()
else:
k = s
ns = ""
for i in range(m - 1, -1, -1):
n = max(0, k - 9 * i)
if n == 0 and i == m - 1 and k != 0:
n = 1
ns += str(n)
k -= n
k = s
nd = ""
... | 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_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR 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... | def Biggest(m, s):
ans = 0
if m == 1 and s == 0:
return 0
for i in range(m):
ans = ans * 10 + min(9, s)
if s > 9:
s -= 9
else:
s = 0
if ans == 0 or s != 0:
return -1
else:
return ans
def Smallest(m, s):
ans = ""
if m =... | FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER RETURN VAR FUNC_DEF ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER RETURN STRING IF 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... | m, s = map(int, input().split())
keeps = s
keepm = m
if s > 9 * m:
print("-1 -1")
elif m == 1 and s < 10:
print(s, s)
elif m == 1 and s > 9:
print("-1 -1")
elif m > 1 and s == 0:
print("-1 -1")
elif m > 1 and s < 10:
maxnum = s * 10 ** (m - 1)
minnum = 1 * 10 ** (m - 1) + (s - 1)
print(minnu... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER 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... | def solve(m, s):
if (m, s) == (1, 0):
ret = "0 0"
elif s > 9 * m or s == 0:
ret = "-1 -1"
else:
mxs = [1] + [0] * (m - 1)
mns = [1] + [0] * (m - 1)
i, j = -1, 0
while s > 1:
if mns[i] >= 9:
i -= 1
if mxs[j] >= 9:
... | FUNC_DEF IF VAR VAR NUMBER NUMBER ASSIGN VAR STRING IF VAR BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR NUMBER IF VAR VAR NUMBER VAR NUMBER 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... | line = input().split()
m = int(line[0])
S = int(line[1])
if S == m * 9:
print("9" * m + " " + "9" * m)
elif int(line[1]) <= 0 or int(line[1]) > 9 * m:
if m == 1 and S == 0:
print("0 0")
else:
print("-1 -1")
elif m == 1:
print("{} {}".format(S, S))
elif S <= 9:
x = "{}".format(S) + "0... | 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 VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING VAR IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER BIN_OP NUMBER VAR IF VAR NUMBER VAR 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... | n, k = map(int, input().split())
if n == 1 and k == 0:
print(0, 0)
elif k > n * 9 or n < 1 or k < 1:
print("-1 -1")
else:
a = k // 9
b = k % 9
biggest = str(9) * a + str(b) + str(0) * (n - a - 1)
smallest = str(1) + str(0) * (n - a - 2) + str(b - 1) + str(9) * a
if b == 0:
biggest = ... | 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 BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER 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... | def findSmallest(m, s):
if s == 0:
if m == 1:
print("0", end=" ")
else:
print("-1", end=" ")
return
if s > 9 * m:
print("-1", end=" ")
return
res = [(0) for i in range(m + 1)]
s -= 1
for i in range(m - 1, 0, -1):
if s > 9:
... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR STRING STRING RETURN IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING STRING RETURN ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN 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... | n, m = map(int, input().split())
s = s1 = ""
c = m - 1
d = n - 1
while d > 0:
if c >= 9:
s = "9" + s
d -= 1
c -= 9
else:
s = str(c) + s
d -= 1
c -= c
if c == 0:
s = "1" + s
else:
s = str(c + 1) + s
c = m
d = n
while n > 0:
if c >= 9:
s1 += "9"
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP STRING VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER VAR VAR IF VAR NUMBER ASSIGN 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... | lnums = input()
nums = []
nums = lnums.split()
ln = int(nums[0])
sum = int(nums[1])
flag = True
if sum > 9 * ln:
flag = False
elif sum == 0:
if ln == 1:
min = sum
max = sum
else:
flag = False
elif sum < 10:
if ln == 1:
min = sum
max = sum
else:
max = i... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR 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()))
if M == 1 and S == 0:
print("0 0")
exit(0)
if M > 1 and S == 0 or S > 9 * M:
print(-1, end=" ")
else:
s = S
res = ""
for i in range(M - 1):
next = min(9, s - 1)
s -= next
res = str(next) + res
res = str(max(s, 1)) + res
print... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER STRING ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN 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... | n, sumi = [i for i in list(map(int, input().split()))]
sdf = [(9) for i in range(n)]
if sumi == 0 and n != 1:
print(str(-1) + " " + str(-1))
elif sumi == 0 and n == 1:
print(str(0) + " " + str(0))
elif sumi > n * 9:
print(str(-1) + " " + str(-1))
else:
i = 0
curr = 9 * n
while sumi < curr:
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR NUMBER STRING FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR NUMBER STRING 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... | a = [int(i) for i in input().split()]
l = a[0]
s = a[1]
if l == 1 and s < 10:
x = str(s)
y = str(s)
elif s == 0 or s > 9 * l:
x = "-1"
y = "-1"
else:
m = int(s / 9)
n = s % 9
if l == m:
x = m * "9"
y = m * "9"
if l == m + 1:
if n == 0:
x = "18" + (l - ... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.