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... | d, sum = map(int, input().split())
pus = sum
mxs = ""
for i in range(d):
for j in range(9, -1, -1):
if i == d - 1:
if 0 <= sum <= 9:
mxs += str(sum)
break
elif 0 <= (sum - j) / (d - i - 1) <= 9:
mxs += str(j)
sum -= j
br... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR NUMBER IF NUMBER VAR NUMBER VAR FUNC_CALL VAR VAR IF NUMBER BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR 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(x) for x in input().split(" ")]
if m == 1 and s == 0:
print(0, 0)
elif 9 * m < s or s < 1:
print("-1 -1")
else:
smallest = [1] + [0] * (m - 1)
largest = [9] * m
d = s - sum(smallest)
i = -1
while d > 9:
d -= 9
smallest[i] = 9
i -= 1
if d > 0:
... | ASSIGN LIST 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 BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR 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... | n, m = list(map(int, input().split()))
c = n
if n == 1 and m == 0:
print("0 0")
elif 9 * n < m or m < 1:
print("-1 -1")
else:
a = m // 9
b = str(m % 9)
number = []
if n >= 2:
for i in range(1, 10):
if (m - i) / (n - 1) <= 9:
break
n -= 1
m -= i... | ASSIGN VAR 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 STRING IF BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER 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... | k = input().split()
n = int(k[0])
s = int(k[1])
result = []
len = n
sum = s
small_num = 0
small_num_index = 0
if sum > 9 * n or sum == 0 and n > 1:
print("-1 -1")
else:
for i in range(n):
if sum == 0:
result.append(0)
len -= 1
elif sum - 9 > 0:
sum -= 9
... | 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 VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF 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, s = map(int, input().split())
if s == 0 and m == 1:
print(0, 0)
elif s == 0:
print(-1, -1)
elif m * 9 < s:
print(-1, -1)
else:
nums = []
while len(nums) < m:
nums.append(min(9, s))
s = s - min(9, s)
max_nums = [str(i) for i in nums]
max_num = "".join(max_nums)
min_nums... | 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 EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR ASSIGN 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... | import sys
m, s = [int(i) for i in input().split()]
if s < 1:
if m == 1:
print("0 0")
sys.exit(0)
else:
print("-1 -1")
sys.exit(0)
l1 = ""
s1 = s
for i in range(m):
if s1 == 0:
l1 += str(s1)
elif s1 < 9:
l1 += str(s1)
s1 = 0
else:
l1 +... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR NUMBER 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... | def digit(m, s):
return s >= 0 and s <= 9 * m
try:
lowest = ""
highest = ""
a = input().split()
m = int(a[0])
s = int(a[1])
total = s
if not digit(m, s) or s == 0:
if m == 1 and s == 0:
print("0 0")
else:
print("-1 -1")
x = 1 / 0
for ... | FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR IF FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ... |
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 = map(int, input().split())
small = [0] * d
large = [0] * d
small[0] = 1
smallCurrSum = 1
large[0] = min(9, s)
largeCurrSum = large[0]
smallLeft = s - smallCurrSum
largeLeft = s - largeCurrSum
for x in range(d - 1, 0, -1):
small[x] = min(9, smallLeft)
smallLeft -= small[x]
for x in range(1, d):
large[x... | 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 ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR 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... | from sys import stdin, stdout
def main():
length, total = [int(i) for i in stdin.readline().split()]
if length == 1 and total == 0:
stdout.write("0 0\n")
elif total == 0 or total > 9 * length:
stdout.write("-1 -1\n")
else:
arr = []
for i in range(length):
ar... | FUNC_DEF 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 NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP LIST BIN_OP NUMBER VAR NUMBER ASSIGN 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... | n, s = input().split(" ")
n = int(n)
s = int(s)
x = [i for i in range(10)]
x.reverse()
maxi = 0
mini = 0
sum = 0
flag = 0
for i in range(n):
for j in x:
if i == 0 and j == 0:
flag = -1
break
if j <= s - sum and (n - i - 1) * 9 >= s - sum - j:
maxi += 10 ** (n - i ... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER 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... | tamanho, aux = map(int, input().split())
maiorSoma = aux
maiorNumero = ""
while len(maiorNumero) < tamanho:
if maiorSoma > 9:
maiorSoma -= 9
maiorNumero += "9"
elif maiorSoma != 0:
maiorNumero += str(maiorSoma)
maiorSoma = 0
else:
maiorNumero += "0"
if maiorNumero[-1]... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING WHILE FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER VAR STRING IF VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR STRING IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL 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... | m, s = map(int, input().split())
ch = ""
ch1 = ""
x = s
if m * 9 < s or s == 0 and m != 1:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
for i in range(m):
ch += str(min(x, 9))
x -= min(x, 9)
ch1 = ch[::-1]
if ch1.count("0") == 0:
print(ch1, " ", ch, sep="")
e... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER 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()))
smin = s
lstmax = [(0) for i in range(m)]
lstmin = [(0) for i in range(m)]
for i in range(m):
if s == 0:
lstmax[i] = 0
elif s >= 9:
lstmax[i] = 9
s -= 9
else:
lstmax[i] = s
s = 0
if m == 1 and smin == 0:
print(0, 0)
elif s ==... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN 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 ASSIGN VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER 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 = [int(x) for x in input().split()]
sup = [9] * m
inf = [1] + [0] * (m - 1)
diff_lower = s - 1
diff_upper = 9 * m - s
if 9 * m >= s and s != 0:
for i in range(m - 1, -1, -1):
if diff_upper // 9 > 0:
sup[i] = 0
diff_upper = diff_upper - 9
else:
sup[i] = sup[i]... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR IF BIN_OP NUMBER VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER 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 = [int(x) for x in input().split()]
if m == 1 and s == 0:
print(0, 0)
elif s > 9 * m or s == 0 and m != 0:
print(-1, -1)
else:
a = ""
wei = s // 9
for i in range(wei):
a = a + "9"
if s % 9 != 0:
a = a + str(s % 9)
if len(a) < m:
a = a + "0" * (m - len(a))
eli... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR STRING IF 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 = map(int, input().split())
if m == 1 and s < 10:
print(s, s)
elif s == 0 or s > 9 * m:
print(-1, -1)
else:
a = (s - 1) // 9
b = (s - 1) % 9
c = sum(9 * 10**i for i in range(a)) + 10 ** (m - 1) + b * 10 ** min(a, m - 1)
d = sum(9 * 10**i for i in range(m - s // 9, m)) + s % 9 * 10 ** max(
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR 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 BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP 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... | def F1(m, z):
s1 = ""
m1 = 0
z1 = 0
o = 0
while True:
if o == 1:
break
if m1 == m:
if z1 < z:
return "-1"
break
else:
s1 = s1[::-1]
return s1
break
elif z1 + 9 ... | FUNC_DEF ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR NUMBER IF VAR VAR IF VAR VAR RETURN STRING ASSIGN VAR VAR NUMBER RETURN VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR STRING VAR NUMBER VAR NUMBER IF VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR VAR 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... | a, b = list(map(int, input().split()))
if a == 1 and b == 0:
print("0 0")
return
if b == 0 or b > a * 9:
print("-1 -1")
return
ob = b
ans = ""
for x in range(a):
if ob > 9:
ob -= 9
ans += "9"
else:
ans += str(ob)
ob = 0
big = ans
ans = ""
ob = b
ob -= 1
for x in r... | 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 RETURN IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR STRING VAR FUNC_CALL VAR VAR ASSIG... |
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 maxNumber(m, sumLeft):
if sumLeft <= 0:
return -1
maxNumber = [(0) for _ in range(m)]
index = 0
while sumLeft >= 9 and index < len(maxNumber):
maxNumber[index] += 9
sumLeft -= 9
index += 1
if sumLeft > 0 and index >= len(maxNumber):
return -1
elif sumL... | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR FUNC_CALL VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR FUNC_CALL VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR VAR VAR RETURN FUNC_CALL VAR FUNC_CALL STRING 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... | a = input().split()
m = int(a[0])
n = int(a[1])
p = m
u = m
t = n
if n == 0 and m != 1 or n > 9 * m:
print("-1 -1")
elif n == 0 and m == 1:
print("0 0")
else:
l = []
while m > 0 and n > 9:
l.append(9)
n = n - 9
m = m - 1
l.append(n)
if m > 1:
for i in range(0, m -... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR 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 LIST WHILE 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... | L = [int(x) for x in input().split()]
if L[1] > L[0] * 9 or L[1] == 0 and L[0] != 1:
max = -1
else:
a = L[1]
b = L[0] - 1
c = 0
i = 0
while b >= 0:
if a >= 9:
c += 9 * 10**b
a -= 9
b -= 1
else:
c += a * 10**b
a = 0
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER BIN_OP NUMBER VAR 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... | def maxLimitNo(m, s):
if m * 9 < s:
return "-1"
if m > 1 and s == 0:
return "-1"
i = 0
ans = ""
flag = True
while i < m:
if not flag:
i += 1
ans += "0"
continue
num = s - 9
if num >= 0:
ans += "9"
... | FUNC_DEF IF BIN_OP VAR NUMBER VAR RETURN STRING IF VAR NUMBER VAR NUMBER RETURN STRING ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR NUMBER VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR STRING VAR NUMBER IF VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN 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... | def check(m, s):
return 0 <= s <= 9 * m
def solve():
m, s = map(int, input().split())
ans_min, ans_max, remaining = [], [], s
for i in range(m):
for j in range(10):
if (i > 0 or j > 0 or m == 1 and j == 0) and check(
m - i - 1, remaining - j
):
... | FUNC_DEF RETURN NUMBER VAR BIN_OP NUMBER VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP 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... | def can(m, s):
return s >= 0 and s <= 9 * m
s = input().split(" ")
l = int(s[0])
s = int(s[1])
a1 = ""
a2 = ""
s1 = s
s2 = s
if s != 0 and l * 9 >= s or s == 0 and l == 1:
for i in range(l):
if s1 >= 9:
a1 += "9"
s1 -= 9
else:
a1 += chr(s1 + ord("0"))
... | FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR 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... | x, y = map(int, input().split())
listMax = []
m = 0
strMax = ""
if x == 1:
if y > 9:
print("-1", "-1")
else:
print(y, y)
else:
for i in range(0, x):
if y >= 9:
listMax.append(9)
y -= 9
strMax += "9"
m += 1
elif 0 < y < 9:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER VAR STRING VAR NUMBER IF 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... | m, s = map(int, input().split())
if s == 0 and m > 1 or s > m * 9:
print(-1, -1)
else:
big = ["0" for _ in range(m)]
small = ["0" for _ in range(m)]
s1 = s2 = s
for i in range(m):
if s1 > 9:
big[i] = "9"
s1 -= 9
else:
big[i] = str(s1)
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 ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR STRING VAR NUMBER 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
inf = float("inf")
mod, MOD = 1000000007, 998244353
def get_array():
return list(map(int, sys.stdin.readline().strip().split()))
def get_ints():
return map(int, sys.stdin.readline().strip().split())
def input():
return sys.stdin.readline().strip()
digits, s = get_ints()
if s > digits * 9... | IMPORT ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER 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 = map(int, input().split())
if s == 0 and m > 1:
s = -1
ans = ""
ans1 = ""
s1 = s - 1
k = 0
while s > 0:
if s >= 9:
ans += "9"
s -= 9
else:
ans += str(s)
s -= s
t = 0
if len(ans) > 0:
t = 1 if len(ans) < m else 0
ans1 = str(int(ans) - t)
k += t
if len(ans) > ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR 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... | a = list(map(int, input().split()))
m = a[0]
s = a[1]
mx = []
mi = []
for i in range(1, 1 + m):
v = s - (m - i) * 9
if v > 0:
mx.append(v)
s -= v
elif i == 1:
mx.append(1)
s -= 1
else:
mx.append(0)
s = a[1]
for i in range(1, 1 + m):
u = s
if u < 9:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR IF 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... | x, y = input().split()
x = int(x)
y = int(y)
k = 1
if y > x * 9:
print("-1 -1")
elif x == 1 and y < 10 and y != 0:
print("%d %d" % (y, y))
elif y == 0 and x != 1:
print("-1 -1")
elif y == 0 and x == 1:
print("0 0")
else:
s = y // 9
t = y % 9
if t != 0 and s != 0:
Max = "9"
fo... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER 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... | m, s = map(int, input().split())
lmin = [0] * (m - 1)
lmin.insert(0, 1)
sum1 = sum(lmin)
lmax = [9] * m
sum2 = sum(lmax)
x = ""
y = ""
flag = 1
if m == 0:
print(-1, -1)
elif m == 1 and (s >= 0 and s <= 9):
print(s, s)
elif m > 1 and (s >= 1 and s <= m * 9):
if sum1 == s:
for i in lmin:
x... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL 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 ans1(a, b):
if b == 0 and a != 1 or b > 9 * a:
return -1
p = ""
while b > 9:
p = p + "9"
b = b - 9
a = a - 1
if a == 0:
return p
else:
if a >= 2:
p = p + str(b - 1)
a = a - 1
p = p + "0" * (a - 1)
p =... | FUNC_DEF IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR RETURN NUMBER ASSIGN VAR STRING WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR BIN_OP 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... | piece = input().split()
length = int(piece[0])
digit = int(piece[1])
if length > 1 and digit < 1 or digit > 9 * length:
print(-1, -1)
exit()
tempt = ""
a, b = length, digit
for i in range(a):
if b >= 9:
tempt = tempt + "9"
b = b - 9
else:
tempt = tempt + str(b)
b = 0
big ... | ASSIGN VAR FUNC_CALL 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 NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR STRING 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(" "))
c_s = s - 1
if s > m * 9 or s < 1 and m != 1:
print(-1, -1)
elif m == 1:
print(s, s)
else:
mx_c = []
for d in range(9, 0, -1):
while s >= d:
s -= d
mx_c.append(str(d))
for n in range(m - len(mx_c)):
mx_c.append("0")
mn_c... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER WHILE VAR VAR VAR VAR EXPR FUNC_CALL 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... | m, s = map(int, input().split())
minans = []
maxans = []
m1 = 0
m2 = 0
if s > 9 * m:
minans.append(0)
maxans.append(0)
m1, m2 = -1, -1
elif s == 0:
if m == 1:
m1, m2 = 0, 0
else:
m1, m2 = -1, -1
else:
i = 1
num = 1
while num <= 9:
if num + (m - i) * 9 >= s - sum(m... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER 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... | while True:
try:
m, s = [int(i) for i in input().split()]
if s == 0 and m == 1:
print("0 0")
elif s < 1 or s > 9 * m:
print("-1 -1")
else:
if 9 * (m - 1) >= s:
min = [1]
else:
min = [s - 9 * (m - 1)]
... | WHILE NUMBER 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 NUMBER VAR EXPR FUNC_CALL VAR STRING IF BIN_OP NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER 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... | asdf = [int(x) for x in input().split(" ")]
length = asdf[0]
summ = asdf[1]
smallest = 0
largest = 0
if length * 9 < summ:
smallest = -1
largest = -1
elif summ < 1:
if length == 1:
smallest = 0
largest = 0
else:
smallest = -1
largest = -1
else:
smallestDigs = [1]
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST... |
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())
if s == 0 and n != 1:
print("-1", "-1")
elif n * 9 < s:
print("-1", "-1")
else:
a = [0] * n
b = [0] * n
i = 0
while sum(a) != s:
if sum(a) + 9 <= s:
a[i] = 9
else:
a[i] = s - sum(a)
i += 1
i = 0
s -= 1
w... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING STRING IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR 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... | s, m = map(int, input().split())
M = m
S = s
k = ""
max = 9 * s
min = 1
count = 0
dig = [9, 8, 7, 6, 5, 4, 3, 2, 1]
if min <= m <= max:
if m >= dig[0]:
l = dig[0]
else:
l = dig[9 - m]
while m != 0:
k += str(l)
m -= l
if m not in dig:
l = 9
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER IF VAR VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR 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... | n, m = [int(x) for x in input().split()]
if n == 1 and m == 0:
print(0, 0)
elif m < 1 or m > 9 * n:
print(-1, -1)
elif n == 1:
print(m, m)
elif n * 9 == m:
print("9" * n, "9" * n)
else:
t = m // 9
k = m % 9
k2 = k - 1
k = str(k)
k2 = str(k2)
l = n - t - 1
if l > 0:
if... | ASSIGN VAR VAR FUNC_CALL VAR 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 IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR BIN_OP STRING 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... | a, b = map(int, input().split())
if b > a * 9:
print(-1, -1)
elif b == 0 and a == 1:
print(0, 0)
elif a > 1 and b == 0:
print(-1, -1)
else:
s = ""
while b != 0:
if b >= 9:
b = b - 9
s = s + str(9)
elif b >= 8:
b = b - 8
s = s + str(8)
... | 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 VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING WHILE VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER 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... | m, s = [int(x) for x in input().split()]
if s == 0 and m == 1:
print(0, 0)
elif s < 1 or s > m * 9:
print(-1, -1)
else:
n = s
res1 = []
for i in range(0, m):
if s == 0:
res1.append(str(0))
elif s < 9:
res1.append(str(s))
s -= s
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR 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... | def zip_sorted(a, b):
a, b = zip(*sorted(zip(a, b)))
sorted(zip(a, b), key=lambda x: x[1])
return a, b
m, s1 = [int(n1) for n1 in input().split()]
a = ["0"] * m
b = ["0"] * m
s = s1
for i in range(len(a)):
if s >= 9:
a[i] = "9"
s = s - 9
else:
a[i] = str(s)
s = 0
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER RETURN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR VAR FOR VAR FUNC_CALL 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 = [int(i) for i in input().split()]
a = s // 9
p = m - a
b = s % 9
if p == 0 and b == 0:
h = m * [9]
H = m * [9]
min = ""
max = ""
for i in h:
min += str(i)
for j in H:
max += str(j)
elif p == 1 and m != 1:
if b == 0:
h = [1] + [8] + (m - 2) * [9]
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR FOR 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... | n, s = map(int, input().split())
if n == 1 and s < 10:
print(s, s)
elif n == 1 or n * 9 < s or s == 0:
print(-1, -1)
else:
t, r = s, []
for _ in range(n):
r += [min(9, t)]
t -= min(9, t)
a = "".join(map(str, r))
r = r[::-1]
if r[0] == 0:
i = 1
while r[i] == 0:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR LIST FOR VAR FUNC_CALL VAR VAR VAR LIST FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN 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 = map(int, input().split(" "))
smallest, largest = [], []
if s == 0 and m > 1 or m * 9 < s:
print("-1 -1")
exit()
if s == 0 and m == 1:
print("0 0")
exit()
if m * 9 == s:
smallest = largest = ["9"] * (s // 9)
else:
s_small, s_large = s, s
if m % 9 > 0 or s % 9 > 0:
while s_small... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR LIST LIST IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP LIST STRING 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(i) for i in input().split()]
if s > 9:
t = s % 9
n = s // 9
if m > n:
large = int(n * "9" + str(t) + (m - n - 1) * "0")
if m > n + 1 or t == 0:
if t != 0:
small = int("1" + (m - n - 2) * "0" + str(t - 1) + n * "9")
else:
sma... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR STRING FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER STRING IF VAR BIN_OP VAR NUMBER VAR 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... | import sys
def get_ints():
return map(int, sys.stdin.readline().strip().split())
m, s = get_ints()
if s == 0 and m == 1:
print("0 0")
elif s == 0 or s > 9 * m:
print("-1 -1")
elif m == 1:
print(str(s) + " " + str(s))
elif s == 1:
print(str(1) + "0" * (m - 1) + " " + str(1) + "0" * (m - 1))
elif ... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR 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 IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR 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... | import sys
d, s = map(int, sys.stdin.readline().split())
w, h = s + 1, d + 1
m = [[(-1) for x in range(w)] for y in range(h)]
n = [[(-1) for x in range(w)] for y in range(h)]
for i in range(1, min(9, s) + 1):
n[1][i] = m[1][i] = i
n[1][0] = 0
m[1][0] = 0
for i in range(2, d + 1):
for j in range(1, min(9 * i, s... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN 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... | a = list(input().split(" "))
m = int(a[0])
s = int(a[1])
if s == 0 or s > 9 * m:
if m == 1 and s == 0:
print("0 0")
else:
print("-1 -1")
else:
b = m * [0]
c = s // 9
d = s % 9
for i in range(0, c):
b[i] = 9
if c != m:
b[c] = d
e = m * [0]
for i in rang... | ASSIGN VAR FUNC_CALL 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 BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR BIN_OP 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 = input()
a, b = n.split()
if int(b) >= 1 and int(b) <= 9 * int(a) or int(b) == 0 and int(a) == 1:
x = 1
y = 1
c = []
g = []
while x <= int(a):
if int(b) - 9 * x >= 1:
x += 1
else:
d = int(b) - 9 * (x - 1)
if int(a) > x:
c.append(... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR 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... | def can(l, s):
if s >= 0 and s <= 9 * int(l):
return True
else:
return False
l, s = map(int, input().split())
f = s
ans = ""
if can(l, s) == False or s == 0 and l > 1:
print(-1, -1)
exit()
for i in range(l):
for d in range(0, 10):
if (i > 0 or d > 0 or l == 1 and s == 0) an... | FUNC_DEF IF VAR NUMBER VAR BIN_OP NUMBER FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING IF FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR 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 = 1, 0
m, s = [int(x) for x in input().split(" ")]
if s == 0 and m != 1 or m * 9 < s:
print("-1 -1")
exit(0)
target = s
result_max = ""
for i in range(m):
for digit in reversed(range(0, 10)):
if target >= digit:
target -= digit
result_max += str(digit)
break
... | ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER IF VAR 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 = map(int, input().split())
msmallest, slargest = m, s
if s / m > 9 or m > 1 and s == 0:
print("-1 -1")
else:
if s > 9:
totaln = s // 9
s -= 9 * totaln
msmallest -= totaln
else:
totaln = 0
smallest = ""
for i in range(msmallest):
if i == 0 and msmallest >... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR IF BIN_OP VAR VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP NUMBER VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR STR... |
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()
ms = [int(i) for i in ms]
m = ms[0]
s = ms[1]
if s > 9 * m or s == 0 and m != 1:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
numbers = []
for i in range(m):
if s > 9:
numbers.append("9")
s -= 9
else:
numbers.append(st... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF 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... | x, y = map(int, input().split())
a = y // 9
p = "9" * a
q = p + str(y - a * 9) + "0" * (x - (a + 1))
if x == 1 and y == 0:
print(0, 0)
exit()
elif y / 9 > x or x > 1 and y == 0:
print(-1, -1)
exit()
elif y % 9 == 0 and len(q) > x:
r = q[::-1]
r = r.replace(r[0], "")
q = q.replace(q[x], "")
e... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR BIN_OP BIN_OP VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP STRING BIN_OP VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR 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... | z = input().split()
m = int(z[0])
s = int(z[1])
if s > 9 * m:
print(-1, -1)
elif s == 0 and m == 1:
print(0, 0)
elif s < 1:
print(-1, -1)
elif m == 1:
print(s, s)
elif m * 9 == s:
print("9" * m, "9" * m)
else:
maximum = "9" * int(s / 9)
maximum += str(s % 9)
maximum += "0" * (m - int(s /... | 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 NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF 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... | s, m = map(int, input().split())
isTrue = False
if s == 100:
b_low = int("1".ljust(len(str(s)) + s - 3, "0"))
b_high = int("9".ljust(len(str(s)) + s - 3, "9"))
elif s < 10:
b_low = int("1".ljust(len(str(s)) + s - 1, "0"))
b_high = int("9".ljust(len(str(s)) + s - 1, "9"))
else:
b_low = int("1".ljust(... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING BIN_OP BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING BIN_OP BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER STRING IF VAR NUMBER ASSIG... |
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 > m * 9:
print("-1 -1")
elif s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
else:
Max = []
n9 = s // 9
if n9 > 0:
for i in range(n9):
Max.append(9)
others = s - 9 * n9
if others > 0:
Max.appen... | ASSIGN VAR VAR FUNC_CALL VAR 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 LIST ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL 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... | from sys import stderr, stdin
def readInts():
return map(int, stdin.readline().strip().split())
def print_err(*args, **kwargs):
print(*args, file=stderr, **kwargs)
def solve(m, s):
if m == 1 and s == 0:
return "0", "0"
if s == 1:
out = str(10 ** (m - 1))
return out, out
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR VAR VAR VAR FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN STRING STRING IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP VAR NUMBER RETURN VAR VAR FUNC_DEF RETURN FUNC_CALL STRING FUNC_CALL VAR VAR VAR ASSIGN 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 s:
x = [1]
y = [9]
for i in range(m - 1):
x.append(0)
y.append(9)
sx = 1
sy = m * 9
for i in range(1, m, 1):
if abs(sy - s) > 9 and sy - s:
y[m - i] -= 9
sy -= 9
elif sy - s:
y[m - i] -= abs(s... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF 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 ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER IF FUNC_CALL VAR BIN_OP 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 = input().split()
if int(s) == 0 and int(m) == 1:
print("0 0")
elif int(s) < 1 or int(s) > 9 * int(m):
print("-1 -1")
else:
small = pow(10, int(m) - 1)
large = small * 10 - 1
a = sum(map(int, str(small)))
b = sum(map(int, str(large)))
k = 1
d = int(s) - a
while d > 0:
if... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP 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 = map(int, input().split())
if m > 1 and s == 0 or 9 * m < s:
print(-1, -1)
elif s <= 9:
if m >= 2:
print("1" + "0" * (m - 2) + str(s - 1), str(s) + "0" * (m - 1))
else:
print(s, s)
else:
k = s // 9
if k == m:
print("9" * k, "9" * k)
else:
l = s % 9
n... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR VAR BIN_OP STRING 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... | m, s = input("").split()
m = int(m)
s = int(s)
if s > m * 9 or s == 0 and m != 1:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
x, k, p = 0, 0, 1
n = int(10 ** (m - 1))
while s > 9:
p = 10 * p
k = k + 1
x = 9 * n + x
n = 10 ** (m - k - 1)
s = s - 9... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 STRING ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP 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... | def minum(s: int, l: int) -> str:
if s == 0 and l == 1:
return "0"
if s == 0:
return "-1"
res = ""
for i in range(l - 1):
if s > 10:
res = res + "9"
s = s - 9
continue
if s > 1:
res = res + str(s - 1)
s = 1
... | FUNC_DEF VAR VAR IF VAR NUMBER VAR NUMBER RETURN STRING IF VAR NUMBER RETURN STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER 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... | import sys
s, m = map(int, input().split())
maxi = ""
sume = 0
for i in range(1, s + 1):
if m - sume - 9 > s - i:
maxi += "9"
sume += 9
elif i == s:
maxi += str(m - sume)
sume += m - sume
else:
for j in range(9, -1, -1):
if j <= m - sume:
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR STRING VAR NUMBER IF VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER 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())
largest = [9] * m
smallest = [1] + [0] * (m - 1)
largestSum = 9 * m
smallestSum = 1
if s == 0 and m == 1:
print("0 0")
exit()
if not (s >= smallestSum and s <= largestSum):
print("-1 -1")
exit()
for i in range(m)[::-1]:
if largestSum > s:
remaining = largestS... | 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 BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING ... |
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... | inp = input()
s = inp.split()
try:
m = int(s[0])
n = int(s[1])
except:
print("Please enter digits between 1 & 100")
quit()
c9 = 0
text9 = "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
text0 = "000000000000000000000000000000000000000000000000000000... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING STRING 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... | a, b = map(int, input().split())
sm = [0] * a
la = [0] * a
b1 = b
b2 = b
for i in range(a):
la[i] = min(9, b1)
b1 -= min(9, b1)
sm[a - i - 1] = min(9, b2)
b2 -= min(9, b2)
t = 1
if sm[0] == 0:
t = 0
for i in range(1, a):
if sm[i] != 0:
sm[i] -= 1
sm[0] += 1
... | 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 ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER FUNC_CALL VAR NUMBER VAR VAR 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 9 * m >= s and s > 0:
a = ""
b = ""
for i in range(m):
if s >= 9:
a += "9"
s -= 9
else:
a += str(s)
s = 0
if a.count("0") > 0:
b = (
a[: a.find("0") - 1]
+ str(int(a[a.find... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR STRING NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP FUNC_CALL VAR STRING 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... | line = input().split()
m = int(line[0])
s = int(line[1])
if s == 0 and m != 1 or s > 9 * m:
print(-1, -1)
elif m == 1:
print(s, s)
else:
y9 = (9 * m - s) % 9
n9 = (9 * m - s) // 9
re = str(9 - y9)
nmax = "9" * (m - n9 - 1) + re + "0" * n9
if nmax[m - 1] != "0":
nmin = nmax[::-1]
... | ASSIGN VAR FUNC_CALL 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 NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP 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... | a, s = map(int, input().split())
if a == 1 and s == 0:
print(0, 0)
elif s < 1 or 9 * a < s:
print(-1, -1)
else:
ans = ["0"] * a
t = s
for i in range(len(ans) - 1, 0, -1):
if t >= 10:
t -= 9
ans[i] = "9"
else:
ans[i] = str(t - 1)
ans[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 VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR NUMBER 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 = input()
if a == "1 0":
print(int(0), int(0))
else:
b = a.split()
m = int(b[0])
s = int(b[1])
p = m
q = s
r = 0
summax = 0
summin = 0
if s == 0:
print(int(-1), int(-1))
elif s > m * 9:
print(int(-1), int(-1))
else:
while q > 9:
q = q... | ASSIGN VAR FUNC_CALL VAR IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL 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... | m, s = map(int, input().split())
m1, s1 = m, s
a, b = [], []
if m * 9 < s or s == 0 and m != 1:
print("-1 -1")
elif s == 1:
print("1" + "0" * (m - 1), "1" + "0" * (m - 1))
elif m == 1:
print(s, s)
elif m > 1:
if s - 1 < (m - 1) * 9:
b.append("1")
s -= 1
if s % 9 != 0:
b.appen... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR LIST LIST IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER IF VAR NUMBER EXP... |
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 and m == 1:
print(0, 0)
else:
mx = []
i = 9
sm = s
signs = 0
while s:
while s - i >= 0:
mx.append(i)
signs += 1
s -= i
i -= 1
while signs < m:
... | 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 VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR WHILE BIN_OP VAR 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... | m, s = map(int, input().split())
if s == 0 and m != 1 or 9 * m < s:
print(-1, -1)
else:
l = s // 9
k = s % 9
ma = "9" * l
if m - l > 0:
ma = ma + str(k)
ma = ma + "0" * (m - l - 1)
mi = 10 ** ((s - 1) // 9) * ((s - 1) % 9 + 1) - 1 + 10 ** (m - 1)
print(int(mi), ma) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP STRING VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP ST... |
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, summary = map(int, input().split(" "))
def can(m, s):
if s >= 0 and s <= 9 * m:
return True
return False
def searchMin(s, length):
minn = ""
for i in range(length):
for d in range(10):
if (i > 0 or d > 0 or length == 1 and d == 0) and can(
length -... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR 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())
a, b = "", ""
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")
elif m == 1:
print(str(s) + " " + str(s))
else:
if s % 9 == 0:
b = "9" * (s // 9) + "0" * (m - s // 9)
else:
b = "9" * (s // 9) ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING 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 NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR VAR STRING 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()]
if s == 0 and m != 1 or s > m * 9:
print(-1, -1)
exit()
if s == 0 and m == 1:
print(0, 0)
exit()
minans = [1] + [0] * (m - 1)
maxans = [1] + [0] * (m - 1)
tmp = s - 1
for i in range(m - 1, -1, -1):
if tmp >= 9 - minans[i]:
tmp -= 9 - minans[i]
... | ASSIGN VAR VAR FUNC_CALL VAR 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 IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP 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... | m, s = list(map(int, input().split()))
def can(m, s):
return s >= 0 and s <= 9 * m
sum_ = s
min_ = ""
for i in range(m):
for d in range(10):
if (i > 0 or d > 0 or m == 1 and d == 0) and can(m - i - 1, sum_ - d):
min_ += str(d)
sum_ -= d
break
sum_ = s
max_ = ""
fo... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR 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... | n, m = map(int, input().split())
if 1 <= m <= n * 9:
a = [0] * n
j = n - 1
i = m - 1
while j > 0:
if i > 9:
a[j] = 9
i -= 9
else:
a[j] = i
i -= i
j -= 1
a[0] = i + 1
s = [str(i) for i in a]
print("".join(s), end=" ")
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER 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... | S = input().split()
m = int(S[0])
s = int(S[1])
M = []
if s == 0 and m > 1 or 9 * m < s:
print(-1, -1)
else:
for i in range(m):
if s >= 9:
num = 9
else:
num = s
M.append(str(num))
s = s - num
m = m - 1
max = "".join(M)
M.reverse()
if in... | 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 BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR 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... | def generate1(long, sum1):
if 9 * long >= sum1 and sum1 >= 1 or long == 1 and sum1 == 0:
if long == 1 and sum1 >= 1 and sum1 <= 9:
return sum1
elif sum1 > 9:
sum1 -= 9
long -= 1
return generate1(long, sum1) + 9 * pow(10, long)
elif sum1 <= 9:
... | FUNC_DEF IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR IF VAR NUMBER VAR NUMBER VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR VAR BIN_OP NUMBER FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR FUNC_CALL VAR NUMBER VAR RETURN NUMBER FUNC_DEF IF 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())
if m > 1 and s == 0 or m * 9 < s:
print(-1, -1)
elif m == 1 and s == 0:
print(0, 0)
else:
a = []
for i in range(m):
if (s - 9 * i) // 9 > 0:
a.append("9")
else:
a.append(str(s - 9 * i))
a.append("0" * (m - 1 - i))
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR 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 BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING 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... | n, m = map(int, input().strip().split())
num = ""
sumi = m
if n == 1 and m == 0:
print(0, 0)
else:
while sumi:
if sumi >= 9:
num += "9"
sumi -= 9
else:
num += str(sumi)
sumi = 0
if len(num) > n or n == 0 or m == 0:
print(-1, -1)
els... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER WHILE VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR 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... | d, s = [int(x) for x in input().split()]
init_d = d
dic = {}
def f(d, s, dic):
if (d, s) in dic:
return dic[d, s]
if d == 1 and 0 <= s <= 9:
dic[d, s] = s, s
return s, s
if d == 1 and (s < 0 or s > 9):
dic[d, s] = -1, -1
return -1, -1
mini = float("inf")
max... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR DICT FUNC_DEF IF VAR VAR VAR RETURN VAR VAR VAR IF VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR VAR RETURN VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER RETURN NUMBER 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())
ans = []
flag = 0
temp = 0
if s != 0:
while s >= 0 and (s // 9 < m or s // 9 == m and s % 9 == 0) and temp < m:
flag = 1
temp += 1
if s - 9 > 0:
ans.append(9)
s -= 9
else:
ans.append(s)
s = 0
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER WHILE VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL 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... | line = input()
temp = line.split()
m = int(temp[0])
s = int(temp[1])
if s == 0:
if m != 1:
print("-1 -1")
else:
print("0 0")
elif 9 * m < s:
print("-1 -1")
elif m == 1:
print(s, end=" ")
print(s)
else:
s1 = s
a = [(0) for i in range(m)]
b = [(0) for i in range(m)]
i =... | 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 IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING 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... | def solve(m, s):
min_num, max_num = list(), list()
tot = s
for i in range(m):
min_num.append(0)
max_num.append(0)
itr = 0
while itr < m:
max_num[itr] = min(9, tot)
tot -= min(tot, 9)
itr += 1
itr, tot = 0, s
min_num[m - 1] = 1
tot -= 1
while to... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER 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... | def min_len_sum(m, s):
a = [[]] * (m + 1)
for i in range(m + 1):
a[i] = ["-1"] * (s + 1)
for j in range(min(s, 9) + 1):
a[1][j] = str(j)
for i in range(2, m + 1):
a1 = a[i - 1]
a0 = a[i]
for j1 in range(1, s + 1):
if a1[j1] == "-1":
bre... | FUNC_DEF 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 FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR 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 = map(int, input().split(" "))
def greatest(m, s):
if m == 0:
return ""
dig = min(s, 9)
return str(dig) + greatest(m - 1, s - dig)
def smallest(m, s):
dig = max(1, 9 - 9 * m + s)
return str(dig) + greatest(m - 1, s - 1)[::-1]
if 9 * m < s:
print("-1 -1")
quit()
if s == 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF IF VAR NUMBER RETURN STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR VAR RETURN BIN_OP 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... | m, s = map(int, list(input().split()))
if s != 0:
if s < 9 * m:
b = s // 9
c = s % 9
if b == m - 1:
n1 = str(c) + b * "9"
n2 = b * "9" + str(c)
else:
if c != 0:
n1 = "1" + (m - 1 - b - 1) * "0" + str(c - 1) + b * "9"
els... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR STRING FUNC_CALL VAR VAR IF VAR NUMBER ASSIG... |
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()]
minn = maxn = ""
smin = smax = s
def possible(sum, digits):
return sum >= 0 and sum <= 9 * digits
for i in range(m):
for j in range(10):
if possible(smin - j, m - i - 1) and (i > 0 or j > 0 or m == 1 and j == 0):
minn += str(j)
smin -=... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING ASSIGN VAR VAR VAR FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER 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... | n, s = list(map(int, input().split()))
if s != 0:
if n * 9 >= s:
Max = "9" * (s // 9)
if s % 9 != 0:
Max += str(s % 9)
if len(Max) < n:
Max += "0" * (n - len(Max))
Min = list(map(int, Max))
Min.sort()
if Min[0] == 0:
for n in range(... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR BIN_OP STRING BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL 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... | line = input().split()
n = int(line[0])
t = int(line[1])
a = ""
if t > 9 * n or n > 1 and t == 0:
print("-1 -1")
elif n == 1 and t == 0:
print("0 0")
else:
m = int(t / 9)
b = t % 9
if b != 0:
maxa = "9" * m + str(b)
for i in range(n - len(maxa)):
maxa += "0"
else:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING IF VAR BIN_OP NUMBER 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... |
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_smallest(m, s):
n = []
for i in range(m):
if 9 < s:
n.append(9)
s -= 9
else:
n.append(s - 1)
s -= s - 1
n[-1] += 1
return "".join(str(i) for i in n[::-1])
def get_biggest(m, s):
n = []
for i in range(m):
n.append(m... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF NUMBER VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER RETURN FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL 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] = list(map(int, input().split()))
if s == 0 and m > 1 or s > m * 9:
print(-1, -1)
elif m == 1:
print(s, s)
else:
ma = ""
for i in range(s // 9):
ma = ma + "9"
if s % 9 != 0:
ma = ma + str(s % 9)
for i in range(m - len(ma)):
ma += "0"
mi = ""
for i in range(... | ASSIGN LIST VAR VAR FUNC_CALL 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 IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR STRING IF BIN_OP VAR NUMBER 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... | n, s = map(int, input().split())
if n == 1 and s == 0:
print(0, 0)
exit(0)
if s > 9 * n or s == 0:
print(-1, -1)
exit(0)
a = [0] * n
a[0] = 1
ss = 1
ind = n - 1
while ind >= 0:
if s - ss > 9:
ss += 9
a[ind] = 9
else:
if ind == 0:
a[ind] = s - ss + 1
el... | 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 NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER 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... | m, s = map(int, input().split())
max_ = 9 * m
if s == 0 and m > 1 or s > max_:
print(-1, -1)
else:
m2 = m
s2 = s
digits = [1] + [0] * (m - 1)
if s == 0:
digits[0] = 0
else:
s -= 1
m -= 1
while s > 0:
if m == 0:
s += 1
digits[m] = min(9, s)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER VAR NUMBER WHILE 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 = input().split()
a = int(n[0])
b = int(n[1])
c = b
if a > 1 and b < 1 or b > a * 9:
print("-1 -1")
else:
t = 10 ** (a - 1)
b = b - 1
k = 0
w = 0
while b >= 9:
k = 9 + 10 * k
b = b - 9
w = w + 1
k = b * 10**w + k
q = t + k
if c < 9:
p = c * 10 ** (a ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.