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... | n = input().split()
n[0] = int(n[0])
n[1] = int(n[1])
if n[1] == 0:
if n[0] == 1:
print("0 0")
if n[0] != 1:
print("-1 -1")
elif n[0] * 9 < n[1]:
print("-1 -1")
else:
i = (n[1] - 1) // 9
q = (n[1] - 1) % 9
mi = 10 ** (n[0] - 1) + q * 10**i
while i > 0:
mi += 9 * 10 **... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER NUMBER IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN 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... | l, d = input().split()
d = int(d)
l = int(l)
total = 0
mini = 0
f = int(d)
if d > 0 and d <= l * 9:
for i in range(l, 0, -1):
if f - 9 > 0 and f - 9 <= l * 9:
f = f - 9
total += 9 * 10 ** (i - 1)
else:
total += f * 10 ** (i - 1)
break
if d >= (l - ... | 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 NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER BIN_OP 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... | m, s = map(int, input().split())
s_tp = [s, s]
m_tp = [m, m]
sm_num = ""
lr_num = ""
for i in range(m):
for j in range(int(not i), 10):
if m_tp[0] == 1:
sm_num += str(s_tp[0])
break
if (s_tp[0] - j) / (m_tp[0] - 1) <= 9 and s_tp[0] - j >= 0:
s_tp[0] -= j
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR ASSIGN VAR LIST VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR 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 = map(int, input().split())
su = s
m2 = m
if m > 1 and s == 0:
print("-1 -1")
exit()
elif s / m > 9:
print("-1 -1")
exit()
elif m == 1 and s == 0:
print("0 0")
exit()
else:
d = 0
while m != 0:
if s > 9:
e = 9
else:
e = s
d += e * 10 **... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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 * 9 < m or m == 0 and n > 1:
print(-1, -1)
else:
k = (m - 1) // 9
if m > 0:
l = (m - 1) % 9 + 1
else:
l = 0
x = 0
y = 0
for i in range(k):
x = x * 10 + 9
if n - k == 1:
x += l * 10**k
elif n - k > 1:
if l >... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR 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... | j = [int(i) for i in input().split(" ")]
leng = j[0]
summ = j[1]
if leng == 1 and summ == 0:
print("0 0")
elif leng * 9 < summ or summ <= 0:
print("-1 -1")
else:
mi = []
ma = []
for i in range(leng):
mi.append(0)
ma.append(0)
i = 0
while summ > 9:
mi[leng - 1 - i] = 9... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | N, s = [int(i) for i in input().split()]
if s > 9 * N or s < 1 and N > 1:
print("-1 -1")
elif s == 9 * N:
print("9" * N + " " + "9" * N)
else:
print()
a = s // 9
b = s % 9
max = "9" * a + str(b) + "0" * (N - 1 - a)
if N == a + 1:
min = str(b) + "9" * a
elif b != 0:
min = ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR STRING BIN_OP STRING VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP 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... | s = input().split()
a = int(s[0])
b = int(s[1])
if b / a > 9 or b / a <= 0:
if a == 1 and b == 0:
print("0", "0")
else:
print("-1", "-1")
else:
k = int((b - 1) / 9)
j = b - 1 - k * 9
n = ""
if a == k + 1:
l = [str(j + 1)] + ["9"] * k
t = l[:]
t.reverse()
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER 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... | X = input().split(" ")
a = int(X[0])
b = int(X[1])
Y = []
Z = []
if b == 0:
if a == 1:
print("0 0")
else:
print("-1 -1")
if b > 9 * a or b < 0:
print("-1 -1")
elif b != 0:
if b < 9 * (a - 1) and b != 0:
b = b - 1
counter = 1
while counter * 9 <= b:
Y.a... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER 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 VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR BIN_OP 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 get_largest(special, length_digits):
actual_digits = len(special)
return special + [0] * (length_digits - actual_digits)
def get_smallest(special, length_digits):
reversed_special = special[::-1]
actual_digits = len(reversed_special)
if length_digits == actual_digits:
return reversed_s... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR RETURN BIN_OP VAR BIN_OP LIST NUMBER BIN_OP VAR VAR FUNC_DEF ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR RETURN VAR VAR NUMBER NUMBER RETURN BIN_OP BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_DEF 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 = map(int, input().split())
if s < 10 and m == 1:
print(s, s)
elif s == 0 and m > 1:
print("-1", "-1")
elif s > 9 * m:
print("-1", "-1")
else:
t = s
x = 0
a = 0
while t > 8:
x = x + 9 * 10 ** (m - a - 1)
t = t - 9
a = a + 1
if t > 0:
x = x + t * 10 **... | 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 NUMBER EXPR FUNC_CALL VAR STRING STRING IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER 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())
M, S = m, s
if s == 0 and m == 1:
print(0, 0)
exit()
if s > 9 * m or s == 0:
print(-1, -1)
exit()
mn = [0] * m
mx = [0] * m
mn[0] = 1
s -= 1
i = m - 1
while s >= 10:
mn[i] = 9
s -= 9
i -= 1
mn[i] += s
i = 0
while S >= 10:
mx[i] = 9
S -= 9
i += 1
m... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER 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... | msStr = input()
mStr = msStr.split()[0]
sStr = msStr.split()[1]
m = int(mStr)
s = int(sStr)
if s == 0 and m > 1 or s > 9 * m:
print("-1 -1")
quit()
def digList2Num(digList):
size = len(digList)
sum = 0
for i in range(size):
sum = sum + digList[i] * 10 ** (size - 1 - i)
return sum
max... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER 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... | n, k = map(int, input().split())
if n > 1 and k == 0 or k > 9 * n:
print("-1 -1")
if n > 1 and k != 0 and k <= 9 * n:
m = k
s1 = ""
for i in range(n):
if m >= 9:
s1 += "9"
m -= 9
else:
s1 += str(m)
m = 0
c = "1"
i = n + 1
for j ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER 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 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()
b = int(a[0])
c = int(a[1])
c1 = c
l1 = []
l2 = []
if c == 0 and b != 1:
print("-1 -1")
elif c > b * 9:
print("-1 -1")
else:
d = 0
for i in range(b):
c -= 9
if c >= 0:
d += 1
else:
break
if c == 0:
for i in range(b):
... | 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 LIST ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF 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 findMin(m, s):
vals = [0] * m
for index in range(m - 1, -1, -1):
if s <= 9:
if s > 0:
vals[index] = s - 1
vals[0] = vals[0] + 1
else:
vals[index] = max(0, vals[index])
s = 0
else:
vals[index] = 9
... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR 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 s == 0 and m > 1 or s > 9 * m:
print("-1", "-1")
exit()
maxn = 0
k = s
for i in range(m):
if i < m - 1 and k >= 10 or i == m - 1 and k == 9:
maxn += 9 * 10**i
k -= 9
elif i < m - 1:
maxn += (k - 1) * 10**i
k -= k - 1
else:
... | 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 STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER 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... | m, s = [int(x) for x in input().split()]
r = ""
rx = ""
if m == 1 and s == 0:
print(0, 0)
elif s == 0 or s > 9 * m:
print(-1, -1)
elif m == 1:
print(s, s)
elif s < 10:
print("1" + "0" * (m - 2) + str(s - 1), str(s) + "0" * (m - 1))
elif s == m * 9:
print("9" * m, "9" * m)
else:
for i in range(10... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING 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 VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING 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... | R = lambda: map(int, input().split())
l, s = R()
ss = (str(s % 9) if s % 9 else "") + "9" * (s // 9)
if not ss:
print("-1 -1" if l > 1 else "0 0")
exit(0)
if len(ss) > l:
print("-1 -1")
else:
if len(ss) < l:
if ss[0] > "1":
smi = "1" + "0" * (l - len(ss) - 1) + str(int(ss[0]) - 1) + ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP VAR NUMBER IF VAR EXPR FUNC_CALL VAR VAR NUMBER STRING STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING 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... | def majmo(x):
x = str(x)
sum = 0
for i in range(len(x)):
sum += int(x[i])
return sum
n, m = map(int, input().split())
if m != 0 and m <= n * 9:
if 9 * (n - 1) < m <= 9 * n:
if n != 1:
minn = 10 ** (n - 1)
maxx = 10**n - 1
r = 0
while ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER IF BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP NUMBER VAR IF VAR NUMBER ASSIGN VAR BIN_OP 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())
l = [1]
for i in range(m - 1):
l.append(0)
if m == 1 and s == 0:
print(0, 0)
elif s == 0 or s > 9 * m:
print(-1, -1)
else:
x = s
s -= 1
for i in range(len(l) - 1, -1, -1):
l[i] += min(9, s)
s -= min(9, s)
z = [0] * m
for i in range(m):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | x = input().split()
m = int(x[0])
s = int(x[1])
if s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
elif s > m * 9:
print("-1 -1")
else:
s1 = s
maxlist = []
for i in range(m):
num = min(9, s1)
maxlist.append(num)
s1 -= num
maxint = 0
for i in r... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1 and s <= 9:
print(s, s)
elif s == 0 or s > 9 * m:
print("-1 -1")
else:
n_9 = s // 9
yu = s % 9
if n_9 == m:
print(m * "9", m * "9")
elif n_9 == m - 1:
if yu == 0:
print("18" + (n_9 - 1) * "9", n_9 * "9" + str(yu))
els... | 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 STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR STRING BIN_OP VAR STRING IF 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... | M, S = map(int, input().split())
if S == 0 and M == 1:
print("0 0")
exit()
elif S == 0 or M * 9 < S:
print("-1 -1")
exit()
m, s = M, S
l = []
if s <= (m - 1) * 9 + 1:
l.append(1)
s -= 1
while len(l) < m:
r = (m - len(l) - 1) * 9
if s <= r:
l.append(0)
else:
l.append(s... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR LIST IF VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR N... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def ma(a, b):
ans = ""
for a in range(a):
ans += str(min(9, b))
b -= min(9, b)
return ans
a, b = map(int, input().split())
if b == 0 or b > 9 * a:
if b:
print(-1, -1)
elif a == 1:
print(0, 0)
else:
print(-1, -1)
else:
q = ma(a, b)
mi = q[::-1]
... | FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR IF VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
res = ""
if m == 1 and s == 0:
print(0, 0)
elif m * 9 < s or s < 1:
print(-1, -1)
elif m > 1:
if s <= 10:
res = "1" + "0" * (m - 2) + str(s - 1)
elif 0 <= s - (m - 1) * 9 <= 9:
res = str(s - (m - 1) * 9) + "9" * (m - 1)
else:
res = (
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER FUNC_CALL 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... | def find_max_min(m, s):
if m == 1:
if s < 10:
return [str(s), str(s)]
else:
return ["-1", "-1"]
if m > 1:
if s < 10:
mini = "1" + "0" * (m - 2) + "{}".format(s - 1)
maxm = "{}".format(s) + "0" * (m - 1)
return [mini, maxm]
... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN LIST FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN LIST STRING STRING IF VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER FUNC_CALL STRING BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL STRING VAR BIN_OP STRING BIN_OP VAR NUMBER RETURN 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... | n1 = input().split()
n = int(n1[0])
s = int(n1[1])
if s > 0 and n * 9 > s:
m = int(s / 9)
my = s % 9
d = n - 1 - m
j = " "
for i in range(m):
j += "9"
j += str(my)
for i in range(d):
j += "0"
if d == 0:
for i in range(m):
j = "9" + j
j = str(my... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR STRING 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... | def solve():
m, s = map(int, input().strip().split())
if s > 9 * m:
print(-1, -1)
elif m == 1 and s == 0:
print(0, 0)
elif s == 0:
print(-1, -1)
else:
lar = [0] * m
sm = [0] * m
sl = s
i = 0
while sl != 0:
if sl >= 9:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR 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... | a, b = [int(i) for i in input().split()]
a1 = a2 = a
b1 = b2 = b
if 9 * a < b:
print("-1 -1")
elif b == 0:
if a == 1:
print("0", "0")
else:
print("-1 -1")
else:
d = ""
e = ""
while a1 > 0:
c = b1
if c >= 9:
c = 9
d += str(c)
a1 -= 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING WHILE VAR NUMBER ASSIGN VAR VAR IF 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... | m, s = map(int, input().split())
dp_max = [([0] * (s + 1)) for i in range(m + 1)]
dp_min = [([-1] * (s + 1)) for i in range(m + 1)]
for i in range(1, min(10, s + 1)):
dp_min[1][i] = i
dp_max[1][i] = i
for i in range(2, m + 1):
for j in range(s + 1):
for d in range(10):
if j - d >= 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR VAR 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... | m, s = map(int, input().split())
c9 = 0
td = 0
flag = 0
if m == 1 and s == 0:
print(s, end=" ")
print(s)
elif s > m * 9 or s < 1:
print("-1 -1")
elif m == 1:
print(s, end=" ")
print(s)
else:
while s >= 9:
s -= 9
c9 += 1
if c9 == m and s == 0:
print("9" * m, end=" ")
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR WH... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | x = input().split()
a = int(x[0])
b = int(x[1])
v = b
v2 = b
v1 = a
if a == 1 and b == 0:
print(f"{0} {0}")
elif b == 0:
print(f"{-1} {-1}")
else:
emon = []
b = v2
while v2:
if b >= 9:
b = b - 9
emon.append(9)
elif b >= 8:
b = b - 8
emo... | 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 EXPR FUNC_CALL VAR NUMBER STRING NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING NUMBER ASSIGN VAR LIST ASSIGN VAR VAR WHILE VAR 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(i) for i in input().split()]
if s > 9 * m or m != 1 and s == 0:
print(-1, -1)
elif m == 1 and s == 0:
print(0, 0)
else:
max1 = min1 = 0
if s <= 9:
if not m == 1:
max1 = str(s) + (m - 1) * "0"
min1 = "1" + (m - 2) * "0" + str(s - 1)
else:
... | ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER 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... | from sys import stdin
n, k = map(int, stdin.readline().rstrip().split(" "))
minimum = 1
maximum = n * 9
if k == 0 and n == 1:
print(0, 0)
elif k > maximum or k < minimum:
print(-1, -1)
elif k == maximum:
print("9" * n, "9" * n)
elif k == minimum:
print("1" + "0" * (n - 1), "1" + "0" * (n - 1))
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR BIN_OP STRING VAR IF VAR VAR EXPR FUNC_CA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1 and s == 0:
print("0 0")
exit()
if s >= 1 and s <= 9 * m:
mn = []
mx = []
for i in range(m):
mn.append(0)
mx.append(0)
mnk = s * 1
mxk = s * 1
mn[0] = 1
mnk -= 1
for i in range(m - 1, -1, -1):
if mnk > 9:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER 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 BIN_OP VAR NUMBER ASSIGN VAR BIN_OP ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def small(m, s):
if s == 0:
if m == 1:
return 0
else:
return -1
if s > 9 * m:
return -1
res = [(0) for i in range(m)]
s -= 1
for i in range(m - 1, 0, -1):
if s > 9:
res[i] = 9
s -= 9
else:
res[i] = s
... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER IF VAR BIN_OP NUMBER VAR RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER BIN_OP VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = [int(i) for i in input().split()]
if m * 9 >= s and s > 0:
if m > s // 9 + 1:
print("1", end="")
k = m - ((s - 1) // 9 + 2)
if k >= 0:
for i in range(k):
print("0", end="")
print((s - 1) % 9, end="")
else:
pass
for i ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER IF VAR BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = (int(x) for x in input().split())
if s == 0:
print("0 0" if m == 1 else "-1 -1")
elif s > m * 9:
print("-1 -1")
else:
maxs = "9" * (s // 9) + (str(s % 9) if s % 9 else "") + "0" * (m - (s + 8) // 9)
mins = maxs[::-1]
if mins[0] == "0":
nzi = mins.index(next(ch for ch in mins if ch != ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER STRING STRING IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP VAR BIN_OP BIN_... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | line = input()
L = line.split()
i = 0
s1 = ""
s2 = ""
n = int(L[0])
m = int(L[1])
if n == 1 and m == 0:
print("0 0")
elif m == 0 or m > 9 * n:
print("-1 -1")
else:
m1 = 9 * n - m
m2 = m
for i in range(n):
if i == 0:
t = min(8, m1)
else:
t = min(9, m1)
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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 functoin():
a = [0] * 105
m, s = map(int, input().split())
if not s:
if m == 1:
print("0 0")
else:
print("-1 -1")
return
for x in range(1, 10):
tmp = s - x
for j in range(m - 1, 0, -1):
if tmp >= 9:
a[j] = 9
... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER 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... | def solve(m, s):
if s == 0:
return (0, 0) if m == 1 else (-1, -1)
if s > 9 * m:
return -1, -1
if s == 1:
return "1" + "0" * (m - 1), "1" + "0" * (m - 1)
maxnum = []
while s > 9:
maxnum.append("9")
s -= 9
maxnum.append(str(s))
n = len(maxnum)
maxnum... | FUNC_DEF IF VAR NUMBER RETURN VAR NUMBER NUMBER NUMBER NUMBER NUMBER IF VAR BIN_OP NUMBER VAR RETURN NUMBER NUMBER IF VAR NUMBER RETURN BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER EXPR FUNC_CALL 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... | l, s = map(int, input().split())
if l == 1 and s == 0:
print(0, 0)
elif l * 9 < s or s == 0:
print(-1, -1)
else:
s1 = s
mx = ""
while s1 != 0:
if s1 > 9:
mx = mx + "9"
s1 -= 9
else:
mx = mx + str(s1)
s1 = 0
else:
leng = len(... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR STRING WHILE VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR STRING VAR NUMBER ASSIGN VAR BIN_OP 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... | d, n = map(int, input().split())
maxa = [0] * d
mina = [0] * d
m = n
if n / d > 9 or n / d == 0:
if d == 1 and n == 0:
print(0, 0)
else:
print(-1, -1)
else:
for i in range(d):
k = 9
while True:
if n - k >= 0:
maxa[i] = str(k)
n -= k... | 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 IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN 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... | import sys
cache = {}
def logging(fun):
def decorated(*args):
result = fun(*args)
print(fun.__name__, args, " -> ", result)
return result
return decorated
def num(m, s):
if m < 1:
return -1, -1
if m == 1:
if s in range(1, 10):
return s, s
... | IMPORT ASSIGN VAR DICT FUNC_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING VAR RETURN VAR RETURN VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER NUMBER IF VAR NUMBER IF VAR FUNC_CALL VAR NUMBER NUMBER RETURN VAR VAR RETURN NUMBER NUMBER IF VAR VAR VAR RETURN VAR VAR VAR ASSIGN VAR VAR 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 = list(map(int, input().split()))
if s == 0:
print("-1 -1") if m > 1 else print("0 0")
exit()
ma = [0] * m
mi = [0] * m
ss = s - 1
for i in range(m):
if s <= 0:
break
ma[i] = 9 if s > 9 else s
s -= ma[i]
if s > 0:
print("-1 -1")
exit()
mi[0] = 1
for i in range(m - 1, -1, -1):
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR VAR NUMBER FUNC_CALL VAR STRING FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR 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... | m, s = map(int, input().split())
if s / m > 9:
maxim = -1
elif s == 0 and m > 1:
maxim = -1
else:
maxim = ""
s_dup = s
while s_dup > 0:
if s_dup >= 9:
s_dup -= 9
maxim += "9"
else:
maxim += str(s_dup)
s_dup = 0
while len(maxim) < m:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR VAR WHILE VAR NUMBER IF VAR NUMBER VAR NUMBER VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR VAR STRING 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... | q = str(input())
q = q.split()
m = int(q[0])
s = int(q[1])
if s == 0 and m != 1 or s > 9 * m:
s = -1
s_ = s
L = []
if s != 0:
L.append(1)
for i in range(m - 1):
L.append(0)
else:
for i in range(m):
L.append(0)
x = 1
while s_ > 1:
d = L[len(L) - x]
while s_ != 1 and d != 9:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL 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... | n, m = tuple(map(int, input().split()))
if m == 0:
if n == 0 or n > 1:
print(-1, -1)
else:
print(0, 0)
elif 9 * n < m:
print(-1, -1)
elif n == 0 and m > 1:
print(-1, -1)
else:
mare = ""
mic = ""
cn = n
cm = m
while cn or cm:
if cm:
if cm > 9:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING 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... | inputlist = list(map(int, input().split()))
m = inputlist[0]
s = inputlist[1]
stop = False
if s == 0 and m != 1:
print("-1 -1")
stop = True
elif s == 0 and m == 1:
print("0 0")
stop = True
elif s > 9 * m:
print("-1 -1")
stop = True
else:
max = ""
steps = 0
while steps != m and stop =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING 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... | n, m = map(int, input().split())
def smal(n, m):
first = m % 9
no9 = m // 9
if no9 < n - 1:
if not first:
first = 9
no9 -= 1
ans = "1" + "0" * (n - no9 - 2) + str(first - 1) + "9" * no9
elif no9 == n - 1:
if not first:
ans = "18" + "9" * (n -... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER IF VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP STRING BIN_OP BIN_OP VAR VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP STRING 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... | inp = list(map(int, input().split()))
big = inp[0]
tot = inp[1]
maxi = []
mini = []
for i in range(big):
maxi.append(0)
mini.append(0)
maxi[0] = 1
mini[0] = 1
sumax = 1
lasti = 0
sumin = 1
if 9 * big < tot or tot < 1 and big > 1:
print("-1 -1")
elif big == 1 and tot == 0:
print("0 0")
else:
while su... | 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 VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN 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... | def find(step):
if m == 1 and s == 0:
return 0
ss = s
res = ""
for i in range(m):
j = 1 if i == 0 else 0
ok = False
c = list(range(j, 10)) if step == -1 else reversed(list(range(j, 10)))
for v in c:
if 0 <= ss - v <= (m - i - 1) * 9:
ok... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR IF NUMBER BIN_OP VAR 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... | line = input()
m = int(line.split()[0])
s = int(line.split()[1])
if s == 0 and m != 1 or s > 9 * m:
print("-1 -1")
elif s == 0 and m == 1:
print("0 0")
else:
k = 0
while s > 9:
s = s - 9
k += 1
i = 0
maxs = 0
t = m
while i < k:
maxs += 9 * 10 ** (t - 1)
i ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER 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 NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR 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... | import sys
input = sys.stdin.readline
m, s = map(int, input().split())
if s == 0 or s > 9 * m:
if s == 0 and m == 1:
print(*[0, 0])
else:
print(*[-1, -1])
exit()
res = m * [0]
ress = m * [0]
res[0] = 1
ress[0] = 1
l = 0
r = m - 1
for i in range(1, s):
if res[l] == 9:
l += 1
... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST NUMBER NUMBER EXPR FUNC_CALL VAR LIST NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN 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())
k = s
r = s
l = []
t = []
def max():
global k
global l
for i in range(0, m):
if k >= 9:
l.append(9)
k = k - 9
elif 1 <= k < 9:
l.append(k)
k = 0
else:
l.append(0)
l = int("".join(list(m... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER AS... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | p = input().split()
m = int(p[0])
s = int(p[1])
min = max = 0
if 9 * m < s:
print("-1 -1")
elif m == 1 and s == 0:
print("0 0")
elif m != 1 and s == 0:
print("-1 -1")
else:
a = s % 9
b = (s - a) / 9
for i in range(m):
if i < b:
min = min + 9 * 10**i
max = max + 9 ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR 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, b = map(int, input().split())
if b > 9 * a:
print("-1" + " " + "-1")
elif b == 0 and a > 1:
print("-1" + " " + "-1")
elif a == 1 or b / a == 9:
print(str(b // a) * a + " " + str(b // a) * a)
else:
mx1 = b // 9
mx2 = b % 9
mx = mx1 * "9" + str(mx2) + (a - mx1 - 1) * "0"
my = mx
y = my.... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING STRING STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING STRING STRING IF VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP 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... | l, s = map(int, input().split())
ma = 0
mi = 0
si = s - 1
maw = [9]
miw = [1] * l
if s == 0 and l != 1 or l == 0:
ma = -1
mi = -1
else:
if s <= 9:
ma = s * 10 ** (l - 1)
elif s > l * 9:
ma = -1
else:
ss = s - 9
for i in range(1, l):
if ss > 9:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER I... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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())
if m == 1 and s == 0:
print(0, 0)
elif s > 9 * m or s == 0:
print(-1, -1)
else:
x = 10 ** (m - 1)
y = 0
for i in range(s - 1):
x = x + 10 ** (i // 9)
for i in range(s):
y = y + 10 ** (m -... | FUNC_DEF 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 NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP 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... | n, Sum = list(map(int, input().split()))
if n == 1 and Sum == 0:
print(0, 0)
elif Sum == 0 or Sum > 9 * n:
print(-1, -1)
else:
l = [0] * n
r = [0] * n
b, p = "", ""
s = Sum
for i in range(n):
if s >= 9:
r[i] = 9
s -= 9
else:
r[i] = s
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR STRING STRING 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... | n, s = map(int, input().split())
if n == 1 and s == 0:
print("0 0")
elif s == 0 or 9 * n < s:
print("-1 -1")
elif n == 1:
print(s, s)
else:
p = s
h = ""
for i in range(n):
if p >= 9:
h += "9"
p -= 9
else:
h += str(p)
p -= p
q = ... | 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 BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | from sys import stdin
lines = list([_f for _f in stdin.read().split("\n") if _f])
def parseline(line):
return list(map(int, line.split()))
lines = list(map(parseline, lines))
m, s = lines[0]
if 9 * m < s or m > 1 and s == 0:
print("-1 -1")
return
if m == 1 and s == 0:
minimum = [0]
else:
minimu... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR NUMBER IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN IF VAR NUMBER VAR NUMBER ASSIGN VAR L... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | class killme(Exception):
@classmethod
def ssss(self):
print(-1, -1)
m, n = map(int, input().split())
try:
if 9 * m < n or n == 0 and m > 1:
raise killme()
else:
nine = n // 9
last = n % 9
if m == 1:
a = n
b = n
elif nine == m:
... | CLASS_DEF VAR FUNC_DEF EXPR FUNC_CALL VAR NUMBER NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR VAR 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... | a, b = map(int, input().split())
min = ""
max = ""
ans = 0
s = b
m = a
if m == 1 and s == 0:
min = 0
max = 0
elif int(s) < 1 or int(s) > 9 * int(m):
min = -1
max = -1
else:
while s > 9:
min += "9"
m -= 1
s -= 9
if m != 0 and s != 0:
if m == 1:
min = st... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHIL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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(sum, num, curr, length, dp):
if sum == 0 and length == 0:
return num
elif sum < 0 or length < 0:
return -1
if sum > 0 and length == 0:
return -2
ans = -1
for i in range(curr, -1, -1):
ans = get_max(sum - i, num * 10 + i, i, length - 1, dp)
if ans !... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN VAR IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR IF VAR NUMBER RETURN VAR IF 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... | def can(m, s):
if s >= 1 and s <= m * 9 or s == 0:
return 1
return 0
m, s = map(int, input().split())
sum = s
max = ""
min = ""
if m == 1 and s >= 0 and s <= 9:
print(s, s)
else:
for i in range(1, m + 1):
for d in range(10):
if (i == 1 and d > 0 or i > 1) and can(m - i, sum... | FUNC_DEF IF VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n = list(map(int, input().split()))
m = int(n[0])
s = int(n[1])
del n
if s != 0 and m * 9 >= s:
snumbers = ["9"] * ((s - 1) // 9)
if m - (s - 1) // 9 == 1:
if s % 9 == 0:
snumbers.append(str("9"))
else:
snumbers.append(str(s % 9))
elif m - (s - 1) // 9 > 1:
sn... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR IF VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP LIST STRING BIN_OP BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR 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... | line = input()
m, s = [int(i) for i in line.split()]
large = 0
tiny = 0
if s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
elif s > 9:
if s > m * 9:
print("-1 -1")
else:
t = 9
p = 9
sl = s
st = s
tiny = 9
for i in range(m):
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR 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... | a, b = map(int, input().split())
h = []
l = []
if b == 0 and a > 1:
print("-1 -1")
elif b > a * 9:
print("-1 -1")
elif a == 1:
if b == 0:
print(0, 0)
elif b > 0 and b < 10:
print(b, b)
else:
print("-1 -1")
elif b == a * 9:
for i in range(a):
l.append(9)
h.... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR 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 main():
m, s = map(int, input().split())
if s > 9 * m or s < 1 and m != 1:
print(-1, -1)
else:
print(
int(10 ** (m - 1) + ((s - 1) % 9 + 1) * 10 ** ((s - 1) // 9) - 1),
10**m - 10 ** (m - (s - 1) // 9 - 1) * (9 - (s - 1) % 9),
)
main() | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER BIN_OP NUMBER BIN_OP BIN_OP 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... | def get_min(sm, ln):
if sm == 0:
return "-1" if ln > 1 else "0"
if sm < 10 and ln == 1:
return str(sm)
elif sm < 10 and ln > 1:
return "1%s%s" % ("0" * (ln - 2), sm - 1)
else:
return "%s%s" % (get_min(sm - 9, ln - 1), 9)
def get_max(sm, ln):
if sm == 0:
retu... | FUNC_DEF IF VAR NUMBER RETURN VAR NUMBER STRING STRING IF VAR NUMBER VAR NUMBER RETURN FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER RETURN BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN BIN_OP STRING FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER FUNC_DEF IF VAR NUMBER RETURN 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 judge(digit, num):
if num == 0:
if digit != 1:
return -1
else:
return str(num)
elif num <= digit:
if num <= 10 and num >= 2:
return "1" + "0" * (digit - 2) + str(num - 1)
elif num == 1:
return "1" + "0" * (digit - 1)
els... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN FUNC_CALL VAR VAR IF VAR VAR IF VAR NUMBER VAR NUMBER RETURN BIN_OP BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN BIN_OP STRING BIN_OP STRING BIN_OP VAR NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER BIN... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def main():
length, sum_of_digits = map(int, input().split())
min_number = max_number = -1
arr = []
if sum_of_digits == 0 and length != 1 or sum_of_digits > length * 9:
print("-1 -1")
return 0
elif length == 1:
print(sum_of_digits, sum_of_digits, sep=" ")
return 0
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR STRING RETURN NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if 9 * m < s or m > 1 and s == 0:
print(-1, -1)
elif m == 1:
print(s, s)
else:
if s % 9 == 0:
big = "9" * (s // 9) + "0" * (m - s // 9)
if s // 9 == m:
small = "9" * m
else:
small = "1" + "0" * (m - 1 - s // 9) + "8" + "9" * (s... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP VAR BIN_OP VAR NUMBER IF 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... | line = [int(k) for k in input().split()]
length = line[0]
dsum = line[1]
maximum = []
minimum = []
if (length == 1) & (dsum == 0):
print("0 0")
elif (dsum < 1) | (dsum > 9 * length):
print("-1 -1")
else:
a = dsum // 9
b = (dsum - 1) // 9
for i in range(a):
maximum.append("9")
if a < leng... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST IF BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP 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... | length, sum = map(int, input().split())
if sum > 9 * length:
print("-1 -1")
elif sum == 0:
if length == 1:
print("0 0")
else:
print("-1 -1")
else:
Max = str(sum) + "0" * (length - 1)
for i in range(1, length):
if sum > 9 * i:
other = sum - 9 * i
Max = ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR 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 BIN_OP FUNC_CALL VAR VAR BIN_OP STRING BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP NUMBER 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... | m, s = map(int, input().split())
if m == 1:
if s == 0:
print("0 0")
elif s > 9:
print("-1 -1")
else:
for i in range(9, 0, -1):
if i <= s:
print(i, i)
break
elif s == 0 and m > 1:
print("-1 -1")
elif 9 * m < s:
print("-1 -1")
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP NUMBER VAR VAR EXPR FUNC_CA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def small(m, s):
if 9 * m < s or s == 0:
return -1
ans = ""
for i in range(1, m + 1):
for j in range(0, 10):
if i == 1 and j == 0:
continue
if 9 * (m - i) >= s - j:
ans += str(j)
s -= j
break
return a... | FUNC_DEF IF BIN_OP NUMBER VAR VAR VAR NUMBER RETURN NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER IF BIN_OP NUMBER BIN_OP VAR VAR BIN_OP VAR VAR VAR FUNC_CALL VAR VAR VAR VAR RETURN VAR FUNC_DEF IF BIN_OP NUMBER VAR VAR VAR NUMBER RE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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 possible(m, s):
return s <= 9 * m and s >= 0
n = list(map(int, input().split()))
m, s = n[0], n[1]
min_remaining_sum = s
max_remaining_sum = s
if s == 0:
if m == 1:
print(0, 0)
sys.exit()
else:
print(-1, -1)
sys.exit()
if not possible(m, s):
print(-1, -... | IMPORT FUNC_DEF RETURN VAR BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, s = map(int, input().split())
s2 = s
ans = [None] * n
if s > 9 * n:
print("-1 -1")
elif s == 0 and n != 1:
print("-1 -1")
else:
s -= 1
for i in range(n - 1, 0, -1):
if s > 9:
ans[i] = 9
s -= 9
else:
ans[i] = s
s = 0
ans[0] = s + 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER AS... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, s = list(map(int, input().split()))
if n != 1 and s == 0 or s > 9 * n:
print(-1, -1)
else:
a = s // 9
b = s % 9
ls = ["9"] * a + [str(b)] * bool(n - a) + ["0"] * (n - a - 1)
if a + 1 >= n:
lt = [str(b)] + ["9"] * a
elif b != 0:
lt = ["1"] + ["0"] * (n - 2 - a) + [str(b - 1)] +... | ASSIGN VAR VAR FUNC_CALL 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 BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP LIST STRING VAR BIN_OP LIST FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0:
print("0 0" if m == 1 else "-1 -1")
exit()
a = "9" * (s // 9)
if s % 9 > 0:
a += f"{s % 9}"
if len(a) > m:
print("-1 -1\n")
exit()
max_ans = a
while len(a) < m:
a = a[:-1] + f"{int(a[-1]) - 1}"
while len(a) < m - 1:
a += "0"
a += "1"
mi... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER STRING STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR VAR WHILE 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(elem) for elem in input().split()]
a = []
for i in range(101):
a.append([-1] * 901)
b = []
for i in range(101):
b.append([-1] * 901)
for j in range(10):
a[1][j] = j
b[1][j] = j
for i in range(2, 101):
for j in range(1, 10):
a[i][j] = 10 ** (i - 1) + j - 1
b[i][j] = b[i - ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR VAR ASSIGN VAR NUMBER 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 = [int(x) for x in input().split()]
if m == 1 and s >= 0 and s <= 9:
x = str(s)
y = str(s)
elif m == 1 and (s < 0 or s > 9):
x = "-1"
y = "-1"
elif m > 1 and (s < 1 or s > 9 * m):
x = "-1"
y = "-1"
else:
a = s - 1
b = 9 * m - s
c = a // 9
d = a % 9
e = b // 9
f = b %... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR STRING ASSIGN VAR STRING 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(i) for i in input().split()]
if s == 0 and m != 1 or s > 9 * m:
print(-1, -1)
else:
a = 10 ** ((s - 1) // 9) * ((s - 1) % 9 + 1) - 1 + 10 ** (m - 1)
b = 10**m - 10 ** (m - (s - 1) // 9 - 1) * (10 - (s - (s - 1) // 9 * 9))
print(int(a), b) | 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 BIN_OP BIN_OP BIN_OP BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER NUMBER BIN_OP 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... | def can(n, s):
return s >= 0 and s <= 9 * n
n, s = [int(x) for x in input().split()]
if n == 1 and s == 0:
print("0 0")
else:
small = ""
sum = s
for i in range(1, n + 1):
for d in range(0, 10):
if i == 1 and d == 0:
continue
if can(n - i, s - d):
... | FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER IF FUNC_CALL 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 min_n(m, s, n):
n += pow(10, m - 1)
s -= 1
i = 0
while s > 0:
if s > 9:
n += 9 * pow(10, i)
s -= 9
i += 1
else:
n += s * pow(10, i)
s -= s * pow(10, i)
i += 1
return n
def max_n(m, s, n):
i = m - 1
... | FUNC_DEF VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR NUMBER VAR BIN_OP VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER WHI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | st = input().split()
a = int(st[0])
b = int(st[1])
if b == 0:
if a == 1:
print("0 0")
else:
print("-1 -1")
elif 9 * a < b:
print("-1 -1")
else:
mini = int(10 ** (a - 1))
aux = b
b -= 1
i = 0
while b > 9:
mini += 9 * 10**i
i += 1
b -= 9
mini += ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR 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())
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
s2 = s
s3 = s
low = ""
high = ""
if s == 0 and m != 1 or s > m * 9:
print("-1 -1")
else:
for digit in range(m):
if digit == m - 1:
low = str(s2) + low
elif... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF 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... | L = 105
maxi = [0] * L
for x in range(1, L):
maxi[x] = maxi[x - 1] + 9
def ok(su, dl):
return su >= 0 and su <= maxi[dl]
def maly(su, dl, p):
if dl == 1:
return su
for cyf in range(p, 10):
if ok(su - cyf, dl - 1):
return cyf * 10 ** (dl - 1) + maly(su - cyf, dl - 1, 0)
... | ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF RETURN VAR NUMBER VAR VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP 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... | def solve(var_length, var_sum):
smallest = ""
largest = ""
small_sum = var_sum - 1
for i in range(var_length - 1):
if small_sum > 9:
smallest += "9"
small_sum -= 9
else:
smallest += str(small_sum)
small_sum = 0
smallest += str(small_sum... | FUNC_DEF ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | length, summ = [int(x) for x in input().split()]
if summ == 0 and length == 1:
print(0, 0)
elif summ > length * 9 or summ == 0:
print(-1, -1)
else:
maxx = [0] * length
temp_sum = summ
i = 0
while temp_sum > 0:
if temp_sum <= 9:
maxx[i] = temp_sum
break
els... | 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 VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER ASSIGN VAR 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... | line = input()
m, s = line.split()
m = int(m)
s = int(s)
ss = s - 1
a = []
b = []
big = ""
small = ""
if m == 1 and s == 0:
print("0 0")
elif s > 9 * m or s == 0 and m != 1:
print("-1 -1")
else:
for i in range(m):
n = min(s, 9)
if n >= 0:
a.append(n)
else:
a.a... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CAL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0 or s > 9 * m:
if s == 0 and m == 1:
print("0 0")
else:
print("-1 -1")
else:
sg = sd = s
cmin = cmax = ""
for i in range(m):
c = 1 if i == 0 else 0
g = max(c, sg - 9 * (m - i - 1))
sg -= g
d = min(9, sd)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR ASSIGN VAR VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP 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... | n, s = map(int, input().split())
a = []
flag = 0
chck = 0
for i in range(n):
chck += 9
if s == 0:
if n == 1:
print(0, 0)
flag = 1
else:
flag = 1
print(-1, -1)
if chck < s and flag == 0:
print(-1, -1)
flag = 1
for i in range(n):
if len(str(s)) > 1:
z = 9
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR 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... | m, s = map(int, input().split())
if s > int(9 * m):
res = "-1 -1"
elif s == 0:
if m == 1:
res = "0 0"
else:
res = "-1 -1"
else:
small = [0] * m
s_temp = s
for i in range(m - 1, -1, -1):
x = min(9, s)
if x == 0:
j = i + 1
while not small[j]:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR STRING IF VAR NUMBER IF VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER 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())
if m * 9 < s or s == 0 and m > 1:
print("-1 -1")
else:
s2 = s - 1
m2 = m
res1 = ""
res2 = ""
while m:
res1 += str(min(9, s))
s = max(0, s - 9)
if m == 1:
s2 += 1
res2 = str(min(9, s2)) + res2
s2 = max(0, s2 - 9)... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING WHILE VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0:
if m == 1:
print("0 0")
else:
print("-1 -1")
elif m * 9 < s:
print("-1 -1")
else:
a = [(0) for i in range(m)]
a[m - 1] = 1
cnt = s - 1
for i in range(m):
while cnt > 0 and a[i] < 9:
a[i] += 1
cnt -= 1... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR W... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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())
y = m
t = ""
if m == 0:
print(-1, -1)
elif s == 0 and m > 1:
print(-1, -1)
elif s > m * 9:
print(-1, -1)
else:
t = ""
while m:
if s - 9 > 0:
t += "9"
s -= 9
m -= 1
elif s - 9 == 0:
t += "9"
m... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING WHILE VAR IF BIN_OP VAR NUMBER NUMBER VAR STRING ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.