description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = list(map(int, input().split()))
t = s
if m == 1 and s == 0:
print("0 0")
elif s <= sum([int(i) for i in "9" * m]) and s > 0:
z = list(str(10 ** (m - 1)))
k = -1
for i in range(m):
if s > 9:
z[k] = "9"
s -= 9
elif z[k] != z[0]:
if s - 1 > 0:
... | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP STRING VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN 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... | inp = input().split(" ")
m = int(inp[0])
s = int(inp[1])
s_max = s
s_min = s
max_val = ""
min_val = ""
if s == 0 and m != 1 or m * 9 < s:
max_val = -1
min_val = -1
m = 0
for i in range(m):
if s_max >= 9:
max_val += "9"
s_max -= 9
else:
max_val += str(s_max)
s_max -= s... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR 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... | n, m = map(int, input().split())
ma = ""
mas = m
mi = ""
mis = m
done = False
for i in range(n):
for j in range(9, (not bool(i)) - 1 if i != n - 1 else -1, -1):
if 0 <= mas - j <= (n - i - 1) * 9:
ma += str(j)
mas -= j
break
else:
break
for j in range(not ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF NUMBER BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP 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... | a = input().split()
m = int(a[0])
z = int(a[0])
s = int(a[1])
x = int(a[1])
q = 0
p = 0
if s > 9 * m or m > 1 and s == 0:
print("-1 -1")
elif m == 1 and s == 0:
print("0 0")
else:
while s >= 9:
s = s - 9
q = q + 10 ** (m - 1) * 9
m = m - 1
if s >= 0:
q = q + int(10 ** (m ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FU... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | from sys import stdin
m, s = stdin.readline().split(" ")
m = int(m)
s = int(s)
if m == 1 and s / 10 == 0:
print(s, s)
else:
temp_s = s
numa = 0
numb = 10 ** (m - 1)
bool = True
if m != 0 and s != 0 and s / 9 <= m:
j = 1
while j < m + 1:
a = min(9, temp_s)
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR 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... | lenght_and_summ = input()
lenght = int(lenght_and_summ.split()[0])
summ = int(lenght_and_summ.split()[1])
if summ == 0 and lenght > 1 or summ > 9 * lenght:
print("-1 -1")
quit()
if summ == 0 and lenght == 1:
print("0 0")
quit()
min_str = ""
max_str = ""
b = 0
c = 0
for i in range(lenght):
a = 0
... | 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 EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING 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 = map(int, input().split())
if s == 0 and m > 1 or 9 * m < s:
print("-1 -1")
else:
mayor = ""
for i in range(m):
if s >= 9:
mayor += "9"
s -= 9
else:
mayor += str(s)
s -= s
menor = ""
temp = 0
for i in range(m):
d = may... | 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 STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN 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().strip().split())
mx = ""
mn = ""
if s > 9 * m or s == 0 and m > 1:
print(-1, -1)
elif s == 0 and m == 1:
print(0, 0)
else:
q = int(s / 9)
r = s % 9
for i in range(q):
mx += str(9)
if r != 0:
mx += str(r)
while len(mx) < m:
mx += "0"
q = int... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING 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 FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR 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 s == 0 or 9 * m < s:
print(-1, -1)
else:
a = []
s1 = s - 1
for i in range(m):
a.append(0)
for i in range(m):
a[i] += min(s, 9)
s -= min(s, 9)
if s <= 0:
break
a1 = ""
... | 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 BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR 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 = [int(x) for x in input().split()]
ans1 = []
if s == 0:
if m == 1:
print(0, 0)
else:
print(-1, -1)
elif 9 * m < s:
print(-1, -1)
else:
for i in range(m - 1):
ans1.insert(0, max(min(9, s - sum(ans1) - 1), 0))
ans1.insert(0, min(9, s - sum(ans1)))
ans2 = []
for i ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER IF 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 FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, s = map(int, input().split())
if n == 1 and s == 0:
print(0, 0)
elif 9 * n < s or s == 0:
print(-1, -1)
else:
res1 = 10 ** (n - 1)
for i in range(s - 1):
res1 += 10 ** (i // 9)
res2 = 0
for i in range(s):
res2 += 10 ** (n - 1 - i // 9)
print(res1, res2) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP NUMBER BIN_OP VAR 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... | n, m = list(map(int, input().split()))
l = []
f = 0
w = n
if m > 9 * n or m == 0 and n != 1:
print("-1 -1")
f = 1
if m == 0 and n == 1:
print("0 0")
f = 1
while m > 0 or n > 0:
if m <= 0 and n > 0:
l.append("0" * n)
break
elif m - 9 <= 0:
l.append(str(m))
else:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR BIN_OP NUMBER VAR 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 WHILE VAR NUMBER 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... | a = input().split()
l = int(a[0])
m = int(a[1])
if m > 9 * l or m == 0 and l != 1:
print("-1 -1")
elif m == 9 * l:
for i in range(l):
print(9, end="")
print(" ", end="")
for i in range(l):
print(9, end="")
print(" ", end="")
elif l == 1:
print(m, m)
else:
b = [(0) for i in ra... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR STRING STRING FOR VAR FUNC_CALL VAR V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split(" "))
st = [0] * m
st[0] = 1
mx = [0] * m
b = s - 1
z = s
if s > 1:
i = m - 1
while i > -1:
if b > 9:
st[i] += 9
b -= 9
else:
st[i] += b
b = 0
break
i -= 1
st2 = 0
mx2 = 0
j = 0
while j < m:
if ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER VAR VAR NUMBER VAR NUMBER VAR 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... | m, s = [int(x) for x in input().split()]
if s == 0 and m == 1:
print(0, 0)
elif s == 0 or s > m * 9:
print(-1, -1)
else:
s2 = s
output = ""
if s - (m - 1) * 9 < 0:
output += "1"
s -= 1
for i in range(1, m):
a = max(0, s - (m - i - 1) * 9)
output += str... | 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 STRING IF BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER VAR STRING VAR NUMBER FOR VAR FUNC_CALL 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... | n, m = map(int, input().split())
if m == 0:
if n == 1:
print(0, 0)
else:
print(-1, -1)
quit()
if n * 9 < m:
print(-1, -1)
quit()
mm = m - 1
d = 0
num_min = 10 ** (n - 1)
while mm > 9:
num_min += 9 * 10**d
d += 1
mm -= 9
num_min += mm * 10**d
num_max = int("9" + "0" * (n -... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER 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()
lines = line.split()
a = int(lines[0])
b = int(lines[1])
x = a
y = b
t = 0
s = 0
if b < 1 or b > 9 * a:
if a == 1 and b == 0:
print("0 0")
else:
print("-1 -1")
elif a > 1:
if b <= 9 * a - 8:
while y > 10:
y -= 9
t += 1
x -= 1
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN 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 IF VAR NUMBER IF VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | g = input()
s = []
k = 0
q = ""
f = ""
r = ""
u = ""
s = list(map(int, g.split()))
su = s[1]
no = s[0]
if su != 0:
k = su // 9
r = su % 9
if r != 0:
t = "9" * k + chr(48 + r) + "0" * (no - (k + 1))
else:
t = "9" * k + "0" * (no - k)
for i in range(0, no):
q = q + t[no - i - 1... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF 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 = map(int, input().split())
S1 = ["0" for i in range(n)]
S2 = ["0" for i in range(n)]
j = 0
c = 0
if s == 0 and n != 1 or n * 9 < s:
print(-1, -1)
c = 1
if s == 0 and n == 1:
print(0, 0)
c = 1
for i in range(s):
if c == 1:
break
S1[j] = str(int(S1[j]) + 1)
if S1[j] == "9":
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBE... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | import sys
m, s = list(map(int, input().split()))
if m == 1 and s == 0:
print("0 0")
sys.exit()
if s > 9 * m or s <= 0:
print("-1 -1")
sys.exit()
max, min = "", ""
minS = s
for i in range(m):
if s - 9 >= 0:
max = max + "9"
s = s - 9
else:
max = max + "{0}".format(s)
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR VAR STRING STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR 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... | m, s = input().split()
m = int(m)
s = int(s)
if s == 0 and m > 1 or s > m * 9:
print(-1, -1)
elif s == 0 and m == 1:
print(0, 0)
else:
maximum = ""
x = s
while x > 0:
if x >= 9:
maximum += "9"
x -= 9
else:
maximum += str(x)
x = 0
wh... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR VAR WHILE VAR NUMBER IF VAR NUMBER VAR STRING 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())
num = ""
if s == 0 and m > 1 or s > 9 * m:
print("-1 -1")
else:
def f(x, y):
global num
if x > 1:
if y == 0:
return num + "0" * x
elif y < 9:
num += str(y)
y = 0
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN BIN_OP VAR BIN_OP STRING VAR IF VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR STRING VAR NUMBER RETURN FUNC_CALL VAR BI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, m = map(int, input().split())
if 1 <= m and m <= n * 9:
f = m // 9
v = m % 9
s = ""
c = ""
if v > 0:
h = n - f - 1
s += str(9) * f + str(v) + str(0) * h
if h > 0:
c += str(1) + str(0) * (h - 1) + str(v - 1) + str(9) * f
else:
c += str(v) + s... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF NUMBER VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP 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... | s = input().split()
a = int(s[0])
b = int(s[1])
b1 = b
b2 = b
output1 = ""
if b1 > 1:
b1 = b1 - 1
for i in range(a):
if b1 > 9:
b1 = b1 - 9
output1 = output1 + "9"
elif b1 <= 9:
output1 = output1 + str(b1)
b1 = 0
output1 = str(int(output1) + 1)... | 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 STRING IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR STRING IF 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... | lg, s = map(int, input().split())
minNr = -1
maxNr = -1
if s == 0 and lg == 0:
minNr = 0
maxNr = 0
print(minNr, maxNr)
elif s in range(1, lg * 9 + 1) and lg > 0:
if lg == 1:
minNr = s
print(minNr, end=" ")
else:
s -= 1
minNr = ["9"] * int(s / 9) + [str(int(s % 9))]
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR STRING 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 large(m, s):
if m == 1 and s == 0:
return 0
l = []
for i in range(1, m + 1):
for k in range(0, 10):
if s - k < 0:
return -1
if s - k <= (m - i) * 9 or k == s:
l.append(k)
s -= k
flag = 1
... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER RETURN NUMBER IF BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL 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... | def adder(n):
cnt = 0
while n:
cnt += n % 10
n //= 10
return cnt
def suml2(l, s):
base = int("9" * (l - 1))
lim = int("1" + "0" * l)
for i in range(base + 1, lim):
if adder(i) == s:
lst = [j for j in str(i)]
return i
def suml(l, s):
if s ==... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR RETURN 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 s < 1 and n > 1 or n * 9 < s:
print(-1, -1)
else:
m = s
ma = [0] * n
for i in range(n):
if m >= 9:
ma[i] += 9
m -= 9
else:
ma[i] += m
m -= m
mi = ma[::-1]
if mi[0] == 0:
if len(set(mi)) <=... | 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 ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR NUMBER VAR NUMBER VAR VAR VAR VAR VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER NUMBER IF FU... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m != 1 and s == 0 or s > 9 * m:
print("-1 -1")
elif (m, s) == (1, 0):
print("0 0")
else:
rem = s
for i in range(1, m + 1):
if i == 1:
b = 1
else:
b = 0
d = max(b, rem - 9 * (m - i))
print(d, end="")
rem -... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VA... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def outmax(x):
if x <= 9:
return x
else:
return 9
def outmaxnum(m, s):
if s == 0 or s > 9 * m:
return None
else:
maxnum = []
while True:
maxnum.append(str(outmax(s)))
s -= outmax(s)
if len(maxnum) == m:
break
... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN NUMBER FUNC_DEF IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN NONE ASSIGN VAR LIST WHILE NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR RETURN FUNC_CALL STRING VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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... | from sys import stdin, stdout
def get():
a = list(map(int, stdin.readline().split()))
if len(a) == 1:
return a[0]
else:
return a
def pln(a=None, b=None, c=None, d=None, e=None, f=None):
a = [a, b, c, d, e, f]
out = ""
for i in a:
if i != None:
out += str(i... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER RETURN VAR NUMBER RETURN VAR FUNC_DEF NONE NONE NONE NONE NONE NONE ASSIGN VAR LIST VAR VAR VAR VAR VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR NONE VAR BIN_OP FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
lis = []
lis1 = []
b = s - 1
if s == 0 and m > 1 or s > m * 9:
print("-1 -1")
exit()
for i in range(m):
if s > 9:
s -= 9
lis.append(9)
else:
lis.append(s)
s -= s
for i in range(m - 1):
if b > 9:
lis1.append(9)
b -= 9
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR FO... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m != 1:
if s > 9 and s <= m * 9:
answerupper = str(9) * (s // 9) + str(s % 9) + str(0) * (m - s // 9 - 1)
if (s - 1) // (m - 1) < 9:
answerlower = (
str(1)
+ str(0) * (m - (s - 1) // 9 - 2)
+ str((s - 1) ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP BIN_OP 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] = [int(x) for x in input().split()]
def min_and_max(som, l):
if som == 0 and l > 1:
return [-1, -1]
if som <= 9:
return [1 * 10 ** (l - 1) + som - 1, som * 10 ** (l - 1)]
if som > l * 10 - l:
return [-1, -1]
else:
[k1, k2] = min_and_max(som - 9, l - 1)
re... | ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN LIST NUMBER NUMBER IF VAR NUMBER RETURN LIST BIN_OP BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP BIN_OP VAR NUMBER VAR RETURN LIST 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 = input().split(" ")
m = int(m)
s = int(s)
if s == 0:
if m != 1:
print("-1 -1")
else:
print("0 0")
elif s <= 9:
max = 10 ** (m - 1) * s
min = 10 ** (m - 1) + s - 1
print(str(min) + " " + str(max))
else:
y = s % 9
n = int(s / 9)
if n > m:
print("-1 -1")
el... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s == 0 and m == 1:
print("0 0")
elif s == 1:
print("1" + (m - 1) * "0", "1" + (m - 1) * "0")
elif s == 0 or s > m * 9:
print("-1 -1")
else:
s -= 1
s1 = s
minn = [1] + (m - 1) * [0]
maxx = [1] + (m - 1) * [0]
i = 0
while s != 0:
if i == 0:
... | 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 EXPR FUNC_CALL VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER STRING BIN_OP STRING BIN_OP BIN_OP VAR NUMBER STRING IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER ASSIGN VAR VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | s = input()
l = s.split()
l = list(map(int, l))
raqam = l[0]
majmo = l[1]
if majmo == 0 and raqam == 1:
print("0 0")
elif majmo < 1 or majmo > raqam * 9:
print("-1 -1")
else:
min = ""
m = majmo - 1
for i in range(0, raqam - 1):
if m > 9:
min = "9" + min
m -= 9
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP 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... | N = input().split()
m = int(N[0])
s = int(N[1])
ans1 = []
ans = []
if s == 0 and m == 1:
print("0 0")
elif s == 0 or s / m > 9:
print("-1 -1")
else:
a = s
for i in range(m + 1):
a = a - 9
if a < 0:
b = i
break
c = s - b * 9
for j in range(b):
ans1.... | 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 LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | st = input().split()
m = int(st[0])
s = int(st[1])
if m == 1 and s == 0:
print(0, 0)
elif s > 9 * m or s < 1:
print(-1, -1)
else:
n9 = s // 9
s1 = ""
for x in range(n9):
s1 = s1 + "9"
if len(s1) < m:
mo = s % 9
s1 = s1 + str(mo)
while len(s1) < m:
s1 =... | 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 EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
l = [str(s)]
p = int("".join(l))
minn = [0] * m
maxn = [0] * m
if m > 1 and s == 0:
print(-1, -1)
elif 9 * m < s:
print(-1, -1)
elif m == 1 and s == 0:
print(0, 0)
else:
for k in range(1, 10):
if 9 * (m - 1) >= s - k:
minn[0] = k
s = s - k... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL 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 = [int(x) for x in input().split()]
beg, end = pow(10, m - 1), int(str(9) * m)
S = s
if s == 0 and m == 1:
print("0 0")
elif s > 9 * m or s == 0:
print("-1 -1")
else:
mn, mx = [0] * m, [0] * m
mn[0] = 1
s -= 1
i = m - 1
while s >= 10:
mn[i] = 9
s -= 9
i -= 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR BIN_OP LIST NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a = input().split()
m = int(a[0])
s = int(a[1])
if s == 0 and m != 1 or 9 * m < s:
max_ = "-1"
min_ = "-1"
elif s == 0 and m == 1:
max_ = "0"
min_ = "0"
elif s < m and s != 0:
if s <= 9:
max_ = a[1] + "0" * (m - 1)
else:
l = s // 9
k = s % 9
max_ = "9" * l + str(k... | 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 BIN_OP NUMBER VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN 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 LenAndSum(m, s):
max = ""
min = ""
count = 0
s2 = s
if m == 1 and s == 0:
print("0 0")
return
if m > 0 and s == 0 or m * 9 < s:
print("-1 -1")
return
for i in range(m):
if s - 9 >= 0:
max = max + "9"
s -= 9
elif s > ... | FUNC_DEF ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR STRING VAR NUMBER IF 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 > m * 9:
print(-1, -1)
elif s == 0:
if m == 1:
print(0, 0)
else:
print(-1, -1)
else:
k9 = (s - 1) // 9
kn9 = m - k9
a = [0] * (m - k9) + [9] * k9
if kn9 == 1:
a[0] = s - k9 * 9
else:
a[0] = 1
a[kn9 - 1] = s - k... | 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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER 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... | line = input().split()
m = int(line[0])
sum = int(line[1])
if sum == 0:
if m != 1:
print(-1, -1)
else:
print(0, 0)
elif m * 9 < sum:
print(-1, -1)
else:
res = ""
k = sum
bit = 0
while k > 9:
res += "9"
k -= 9
bit += 1
res += str(k)
bit += 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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN 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... | m, s = [int(i) for i in input().split()]
maxx = ""
minn = []
s1 = s
s2 = s
for i in range(m):
if s > 9:
maxx += "9"
s -= 9
else:
maxx += str(s)
s = 0
if s1 > 9:
minn.insert(0, "9")
s1 -= 9
else:
minn.insert(0, str(s1))
s1 = 0
if minn[0] == ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING VAR NUMBER EXPR FUNC_CALL VAR NUMBER 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_m = input().split()
n, m = int(n_m[0]), int(n_m[1])
if m == 0:
if n == 1:
print("0", "0")
else:
print("-1", "-1")
elif n * 9 < m:
print("-1", "-1")
else:
if m < 10:
maximum = [m] + [0] * (n - 1)
if n == 1:
minimum = [m]
else:
minimum = [1... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR STRING STRING IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING STRING IF VAR NUMBER ASSIGN VAR BIN_OP LIST VAR BIN_OP LIST NUMBER BIN_OP V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = input().split()
m = int(m)
s = int(s)
if m == 1 and s == 0:
print("0 0")
elif s > 9 * m or s < 1:
print("-1 -1")
else:
ma = "9" * m
ma = list(ma)
r = 9 * m - s
i = -1
while r != 0:
q = min(9, r)
ma[i] = str(9 - q)
r -= q
i -= 1
ma = "".join(ma)
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN 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 get_max(length, somme):
fs = []
for x in range(length):
temp = min(9, somme)
somme -= temp
fs.append(temp)
return fs
def get_min(length, somme):
mx = get_max(length, somme)
mx.sort()
if mx[0] == 0:
mx[0] = 1
x = 1
while mx[x] == 0:
... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR IF VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER RETURN VAR FUNC_DEF... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | firstLine = [int(n) for n in input().split()]
length = firstLine[0]
total = firstLine[1]
def ones(a):
ret = 0
for i in range(0, a):
ret *= 10
ret += 1
return ret
def nines(a):
ret = 0
for i in range(0, a):
ret *= 10
ret += 9
return ret
def digitSum(a):
r... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF RETURN 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... | m, s = input().split()
m = int(m)
s = int(s)
if s == 0 and m != 1 or s > 9 * m:
nummin = -1
nummax = -1
print("-1", "-1")
else:
nummin = m * [0]
nummax = m * [0]
for i in range(m):
a = s - i * 9
if a > 9:
nummax[i] = 9
else:
nummax[i] = max(0, a)
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING STRING ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR BIN_OP VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def func(m, s):
ans = ""
while m >= 1:
if s >= 10:
ans += "9"
s -= 9
else:
ans += str(s)
s = 0
m -= 1
return ans
def compute(m, s):
ans, c = "", 0
while m >= 1:
digit = 0
while 9 * (m - 1) < s - digit:
... | FUNC_DEF ASSIGN VAR STRING WHILE VAR NUMBER IF VAR NUMBER VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR STRING NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER VAR STRING 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 (m == 1) & (s == 0):
print(0, 0)
elif s == 0 or s > 9 * m:
print(-1, -1)
else:
max = ""
min = []
ms = s
while len(max) < m:
if ms > 9:
min.append("9")
max += "9"
ms -= 9
else:
min.append(s... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP 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 STRING ASSIGN VAR LIST ASSIGN VAR VAR WHILE FUNC_CALL VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING VAR STRI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = list(map(int, input().split()))
minu = [(0) for i in range(m)]
s2 = s
beg = True
while s2 > 0:
found = False
if beg:
minu[0] += 1
beg = False
s2 -= 1
found = True
else:
j = m - 1
while j >= 0:
if minu[j] < 9:
minu[j] += 1
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR VAR NUMBER VAR V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, s = map(int, input().split())
if n == 1 and s <= 9:
print(s, s)
elif s == 0 or s / n > 9:
print(-1, -1)
else:
a = ["0"] * n
a[0] = "1"
p = (s - 1) // 9
r = (s - 1) % 9
if p == 0:
a[len(a) - 1] = str(r)
else:
for i in range(len(a) - 1, len(a) - 1 - p, -1):
a... | 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 VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
res = [] * m
mes = [] * m
summ = s
if summ == 1:
res.insert(0, "1")
if m != 1:
for i in range(1, m):
res.insert(i, "0")
maxe = mn = res
else:
maxe = mn = res
print("".join(maxe), "".join(mn))
elif summ == 0 and m != 1 or m * 9 < s:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST VAR ASSIGN VAR BIN_OP LIST VAR ASSIGN VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL 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... | def maxi(m, s, q, r):
d = 0
big = ""
for i in range(q):
big += "9"
d += 9 * q
diff = s - d
dg = m - q
if dg < 0:
return -1
if dg == 0:
if d == s:
return big
else:
return -1
big += str(diff)
d += diff
dg -= 1
for i in... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR STRING VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER RETURN NUMBER IF VAR NUMBER IF VAR VAR RETURN VAR RETURN NUMBER VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR STRING RETURN 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 m == 1 and s == 0:
print(0, 0)
elif s < 1 or s > 9 * m:
print(-1, -1)
else:
maxi = s // 9 * "9" + str(s % 9) + (m - s // 9 - 1) * "0"
if len(maxi) > m:
maxi = maxi[:-1]
arr = [1] + [0] * (m - 1)
i = 1
j = m - 1
while i < s:
if arr[j] ==... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER STRING FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | n, t = map(int, input().split(" "))
dec = [(9) for i in range(n)]
def min():
if n == 1 and t == 0:
return 0
m = dec.copy()
if t == 0:
return -1
if 9 * n < t:
return -1
else:
sub = 9 * n - t
if sub <= 8:
m[0] = 9 - sub
return "".join(l... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER RETURN NUMBER IF BIN_OP NUMBER VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR IF VAR NUMBER ASSIGN 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... | X, Y = map(int, input().split())
if X == 1 and Y == 0:
print("0 0")
elif 9 * X < Y or Y == 0:
print("-1 -1")
else:
Z = "1" + "0" * (X - 1)
Z1 = list(Z)
Z2 = Z1[::-1]
index = 0
while sum(map(int, Z1)) != Y:
if Z1[index] == "9":
index += 1
t = Z1.pop(index)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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 STRING BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL 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... | length, su = map(int, input().split())
s = su
l = length
if s <= 0 and length != 1 or s > 9 * length:
print(-1, -1)
else:
lis = []
while length != 0:
if su <= 9:
if su == 1 and length == 1:
lis.append(1)
su = 0
elif su == 1:
lis... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST WHILE VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = input().split()
m = int(m)
s = int(s)
sl = ""
ss = ""
if m == 1 and s == 0:
print("0 0")
elif m > 1 and s == 0:
print("-1 -1")
elif m * 9 < s:
print("-1 -1")
elif s <= 9:
if m != 1:
ss += str(s)
sl += str(1)
for i in range(1, m):
ss = ss + "0"
for i in ... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR FU... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m is 1 and s is 0:
print(0, 0)
exit()
if s not in range(1, 9 * m + 1):
print(-1, -1)
exit()
digits = s // 9
rem = True if s % 9 else False
largest = ""
for i in range(m):
if i < digits:
largest += "9"
elif rem:
largest += str(s % 9)
rem... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER NUMBER AS... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: map(int, input().split())
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
m, s = f()
s1 = s
l1 = [0] * m
l2 = [0] * m
for i in range(m):
l1[i] = min(9, s)
s -= l1[i]
s1 -= 1
fo... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR 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 get_max(num_digits, sum_digits):
if sum_digits > 9 * num_digits:
return -1, -1
max_num = [None for __ in range(num_digits)]
start_num = 9
current_sum = 0
current_digit = 0
while current_digit < num_digits:
while start_num > sum_digits - current_sum and start_num > 0:
... | FUNC_DEF IF VAR BIN_OP NUMBER VAR RETURN NUMBER NUMBER ASSIGN VAR NONE VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER NUMBER IF VAR NUMBER RETURN NUMBER NUMBER ASSIGN VAR VAR VAR V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def can(m, s):
return s >= 0 and s <= 9 * m
m, s = map(int, input().split())
if s == 0 and m == 1:
print("0 0")
elif s == 0 or s > 9 * m:
print("-1 -1")
else:
mins = ""
maxs = ""
x = s
y = s
for i in range(m):
for j in range(10):
if i == 0 and j == 0:
... | FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR FOR 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:
n = m
a = 0
x = 0
min_num = []
max_num = []
while x < m:
min_num.append(0)
max_num.append(0)
for i in range(10):
j = 9 - i
if j + 9 * (n - 1) + sum(min_num) - min_num[a] >= s:
if a == ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST WHILE VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP 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... | a = input().split()
m = int(a[0])
s = int(a[1])
if m == 1 and s == 0:
print("0 0")
elif s < 1 or s > m * 9:
print("-1 -1")
else:
r = s % 9
rk = str(r)
l = s // 9
list1 = []
list2 = []
if m - l == 1:
list1.append(rk)
for i in range(l):
list1.append("9")
... | 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 EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LI... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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 minmax(m, n):
max = ""
while m:
while n:
if n < 10:
max += str(n)
n = 0
else:
max += "9"
n -= 9
m -= 1
if m:
max += "0"
m -= 1
return max
x = [int(i) for i in lis... | FUNC_DEF ASSIGN VAR STRING WHILE VAR WHILE VAR IF VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR STRING VAR NUMBER VAR NUMBER IF VAR VAR STRING VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | ar = []
for x in input().split(" "):
ar.append(int(x))
ar2 = ar.copy()
res = []
if ar[1] == 0 and ar[0] == 1:
print(0, 0)
elif 9 * ar[0] < ar[1] or ar[1] == 0:
print(-1, -1)
else:
for k in range(ar[0]):
ch = 0
for i in reversed(range(0, 10)):
if k == ar[0] - 1:
... | ASSIGN VAR LIST FOR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP NUMBER VAR NUMBER VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER 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... | m, s = [int(i) for i in input().split()]
if m > 1 and s < 1 or s > m * 9:
print("-1 -1")
else:
a1 = 10 ** (m - 1)
q = (s - 1) // 9
p = (s - 1) % 9
a2 = (p + 1) * 10**q - 1
mi = a1 + a2
if s < 10:
ma = s * 10 ** (m - 1)
else:
w = s // 9
x = s % 9
if w == m:... | 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 STRING ASSIGN VAR BIN_OP NUMBER BIN_OP VAR 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 BIN_OP VAR 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... | n, s = map(int, input().split())
a = [9] * n
b = [1] + [0] * (n - 1)
x = 9 * n - s
y = 1
if x >= 0 and s > 0:
for i in range(len(a) - 1, -1, -1):
if x >= 9:
a[i] = 0
x = x - 9
else:
a[i] = 9 - x
break
for j in range(len(b) - 1, -1, -1):
if ... | 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 BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | import sys
def readInput():
for line in sys.stdin:
a = line.split(" ")
m = int(a[0])
s = int(a[1])
return [m, s]
def arrayToInt(x):
num = 0
l = len(x)
exp = 0
for i in range(l, 0, -1):
num += x[i - 1] * pow(10, exp)
exp += 1
return num
def findMi... | IMPORT FUNC_DEF FOR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN LIST VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR BIN_OP VAR BIN_OP VAR NUMBER FUNC_CALL VAR NUMBER ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
s1 = s
s2 = s
if m > 1 and s == 0 or s > 9 * m:
print("-1 -1")
else:
if s1 <= 1 + 9 * (m - 1):
min = 1 * 10 ** (m - 1)
s1 -= 1
min += 10 ** (s1 // 9) - 1 + s1 % 9 * 10 ** (s1 // 9)
else:
min = (s1 - 9 * (m - 1)) * 10 ** (m - 1) + 10 ** (m - 1)... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if s > 9 * m or s < 1 and m > 1:
print(-1, -1)
exit()
index = m - 1
min_s = s
while index >= 0:
pos = max(0, min_s - 9 * index)
if index == m - 1 and min_s > 0 and pos == 0:
pos = 1
print(pos, end="")
index -= 1
min_s -= pos
print(" ", end="")
index =... | 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 ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR NUMBER VAR NU... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a, b = map(int, input().split())
if b == 0 and a != 1 or b > a * 9:
print("-1 -1")
elif b == 0 and a == 1:
print("0 0")
else:
c = []
while b != 0:
if b >= 9:
c.append(9)
b -= 9
else:
c.append(b)
b = 0
while a - len(c) != 0:
c.ap... | 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 STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST WHILE VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP V... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | s1 = input().split()
leng = int(s1[0])
s = int(s1[1])
if leng * 9 < s or leng > 1 and s == 0:
print(-1, " ", -1)
raise SystemExit(0)
smax = ""
smin = ""
summax = s
summin = s
if s < 9:
smax += str(s)
smax += (leng - len(smax)) * "0"
if leng == 1:
print(s, " ", smax, sep="")
else:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING NUMBER FUNC_CALL VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR IF VAR 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... | a, b = map(int, input().split(" "))
if [a, b] == [1, 0]:
print("0 0")
elif 1 <= b <= 9 * a:
haloe = []
max9 = b // 9
other = b % 9
if other != 0:
strx = "9" * max9 + str(other) + (a - max9 - 1) * "0"
else:
strx = "9" * max9 + (a - max9) * "0"
haloe.append(strx)
strx = str... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF LIST VAR VAR LIST NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR FUNC_CALL VAR VAR BIN_OP BIN_OP ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
i = 0
strok = ""
s1 = s
while m != i and s > 9:
i += 1
s -= 9
else:
if s1 == 0 and m > 1 or m * 9 < s1:
print("-1 -1")
else:
strok += i * "9"
m -= i + 1
if m != 0:
k = 1
raz = 1
else:
k = ""
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR VAR WHILE VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING VAR BIN_OP VAR STRING VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER 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... | m, s = map(int, input().split())
u = ""
if s > 9 * m or s == 0 and m > 1:
print(-1, -1)
else:
i = m - 1
k = s
while i >= 0:
j = max(0, k - 9 * i)
if j == 0 and i == m - 1 and k:
j = 1
u += str(j)
k -= j
i -= 1
u += " "
k = s
for i in range(... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING IF VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER VAR 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... | n, s = [int(i) for i in input().split()]
mi = 0
ma = 0
if s == 0 and n != 1 or s > 9 * n:
print(-1, -1)
else:
e = s % 9
w = s // 9
for i in range(w):
mi += 9 * 10**i
if e == 0:
mi = mi + 10 ** (n - 1) - 10 ** (w - 1)
else:
mi = mi + 10 ** (n - 1) + (e - 1) * 10**w
for... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP NUMBER BIN_OP NUMBER VAR IF 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... | x, y = map(int, input().split())
lol = [0] * x
i = 0
yo = [0] * x
y0 = y
if x == 1 and y < 10:
print(y, y)
exit()
while y > 0 and i < x:
if lol[i] == 9:
i += 1
else:
lol[i] += 1
y -= 1
if y0 > 0:
yo[0] = +1
y0 -= 1
else:
print(-1, -1)
exit()
i = x - 1
while y0 > 0... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR WHILE VAR NUMBER VAR VAR IF VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER VAR NUMBER IF VAR NUMB... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | hello = list(map(int, input().split()))
m = hello[0]
s = hello[1]
a = ""
b = ""
new = "1"
done = False
if s == 0:
print("0 0" if m == 1 else "-1 -1")
done = True
if not done:
for i in range(m):
b += str(min(s, 9))
s -= min(s, 9)
if s > 0:
print("-1 -1")
done = True
if... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER STRING STRING ASSIGN VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | t = 1
for i in range(t):
m, s = [int(x) for x in input().split()]
nines = s // 9
if m == 1 and s == 0:
print(0, 0)
continue
if nines > m or s == 0 or m * 9 < s:
print("-1 -1")
continue
if s < 10:
if m == 1:
print(s, s)
else:
mn ... | ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASS... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = input().split(" ")
m = int(m)
s = int(s)
if s == 0 and m != 1 or s > m * 9:
print("-1 -1")
elif m == 1:
print(s, end=" ")
print(s)
elif s == m * 9:
A = [(9) for i in range(m)]
for i in range(0, m):
A[i] = str(A[i])
B = "".join(A)
c = int(B)
print(c, end=" ")
print(c)
e... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER 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... | a, b = map(int, input().split())
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
lenth = 10
l2 = []
a1 = a
if a == 1 and b == 0:
numm = "0"
str1 = "0"
elif b <= 0 or 9 * a < b:
numm = -1
str1 = -1
else:
numm = ""
sum1 = 0
while a > 0:
lenth = 10
while lenth > 0:
if b - sum1 >=... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF VAR NUMBER BIN_OP NUMBER VAR VAR 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... | n, m = map(int, input().split())
a = ["0"] * n
b = ["0"] * n
flag = 0
if m == 0 and n != 1:
flag = 1
for i in range(n - 1, -1, -1):
if m < 10 and i > 1 and m != 1 and m != 0:
a[i] = str(m - 1)
a[0] = "1"
m = 0
break
elif m >= 10:
a[i] = "9"
m = m - 9
elif ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL 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 9 * m < s:
print(-1, -1)
exit()
if s == 0 and m > 1:
print(-1, -1)
exit()
if m == 1:
print(s, s)
exit()
if m == s / 9:
print("9" * (s // 9), "9" * (s // 9))
exit()
st, nd = "", ""
if not s % 9:
n1 = s // 9
if m == n1 + 1:
st += "18" + "... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL 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 ch(n, k):
return k >= 0 and k <= 9 * n
n, k = input().split(" ")
n = int(n)
k = int(k)
n1 = n
a = []
k1 = k
if k == 0 and n == 1:
print("0 0")
elif k == 0 or n * 9 < k:
print("-1 -1")
else:
for i in range(0, n):
for j in range(0, 10):
if (i > 0 or j > 0 or n == 1 and j == 0) an... | FUNC_DEF RETURN VAR NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING FOR VAR ... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = map(int, input().split())
if m == 1 and s == 0:
print("0 0")
elif s == 0 or s > 9 * m:
print("-1 -1")
else:
x = ""
y = ""
a = 9 * m - s
b = s
for i in range(m):
if i == 0:
t = min(min(9, a), 8)
x += str(9 - t)
a -= t
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CAL... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | M, S = input().strip().split()
m = int(M)
s = int(S)
arr = [0] * m
arr[0] = s
e = m - 1
while e > 0:
if arr[0] == 1 or arr[0] == 0:
break
if arr[0] > 9:
arr[0] = arr[0] - 9
arr[e] = arr[e] + 9
e = e - 1
else:
arr[e] = arr[0] - 1
arr[0] = 1
e = e - 1
if... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER NUMBER IF VAR NUMBER NUMBER ASSIGN VAR NUMBER 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... | def is_possible(count, sum):
return (sum != 0 or count <= 1) and 9 * count >= sum
def get_min(count, sum):
if 9 * count == sum:
return "{}".format("9" * count)
elif (sum - 1) % 9 == 0:
nine_count = (sum - 1) // 9
zero_count = count - 1 - nine_count
return "1{}{}".format("0"... | FUNC_DEF RETURN VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR FUNC_DEF IF BIN_OP NUMBER VAR VAR RETURN FUNC_CALL STRING BIN_OP STRING VAR IF BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR RETURN FUNC_CALL STRING BIN_OP STRING VAR BIN_OP STRING VAR... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | m, s = list(map(int, input().split()))
if s == 0 and m > 1 or 9 * m < s:
print("-1 -1")
elif s == 0 and m == 1:
print(0, 0)
else:
a1 = ""
s1 = s
while s1 - 9 >= 0:
a1 = a1 + "9"
s1 = s1 - 9
if s1 > 0:
a1 = a1 + str(s1)
a1 = a1 + "0" * (m - len(a1))
a2 = ""
s2 ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR VAR WHILE BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR NUM... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | def dp_large(length, sum):
if length == 0:
if sum != 0:
raise IndexError
else:
return ""
if sum >= 9:
return "9" + dp_large(length - 1, sum - 9)
else:
return str(sum) + dp_large(length - 1, 0)
def dp_small(length, sum):
if length == 1:
if... | FUNC_DEF IF VAR NUMBER IF VAR NUMBER VAR RETURN STRING IF VAR NUMBER RETURN BIN_OP STRING FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF IF VAR NUMBER IF VAR NUMBER VAR RETURN FUNC_CALL VAR VAR IF VAR NUMBER RETURN BIN_OP 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 solve(m, s):
smallest = [(0) for i in range(m)]
largest = [(0) for i in range(m)]
smallest[-1] = s
for i in range(1, m):
if smallest[-i] > 9:
smallest[-i - 1] = smallest[-i] - 9
smallest[-i] = 9
if smallest[0] == 0 and len(smallest) > 1:
try:
l... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER 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())
t = s
x = ["0"] * m
y = ["0"] * m
if s == 0 and m > 1:
print(-1, -1)
elif s / m > 9:
print(-1, -1)
else:
i = 0
while 1:
p = s - 9
if p >= 0:
x[i] = str(9)
i += 1
s -= 9
if i >= m:
break
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST STRING VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP 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... | m, s = list(map(int, input().split()))
k = m
val = 0
pointer = min(9, s)
if m > 1 and s == 0 or s / m > 9:
print(-1, -1)
else:
while m:
val = val * 10 + pointer
m -= 1
s -= pointer
pointer = min(9, s)
if val == 0:
print(0, 0)
else:
val = str(val)
c... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER WHILE VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
-----Input-----
The single line of the input co... | a, b = map(int, input().split())
s = []
if b == 0 and a == 1:
print("0 0")
elif b == 0 or b / a > 9:
print("-1 -1")
else:
for i in range(a):
if b > 9:
s.append(9)
b -= 9
elif b > 0:
s.append(b)
b = 0
else:
s.append(0)
if... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EX... |
You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. 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_d(a, b):
z = [1] + [0] * (a - 1)
dv = (b - 1) // 9
md = (b - 1) % 9
j = 0
for i in range(dv):
j -= 1
z[j] = 9
z[j - 1] += md
return z
def max_d(a, b):
y = [9] * a
dv = (9 * a - b) // 9
md = (9 * a - b) % 9
j = 0
for i in range(dv):
j -= 1... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER VAR BIN_OP VAR NUMBER VAR RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER 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... | l = input().split(" ")
m, s = int(l[0]), int(l[1])
ma = []
if m == 1 and s >= 10:
print(-1, -1)
elif m == 1 and s <= 9:
print(s, s)
elif m >= 2 and s == 0:
print(-1, -1)
elif m >= 2 and s > 9 * m:
print(-1, -1)
else:
for i in range(m):
n = 9
if n >= s:
n = s
s... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER VAR BIN_OP NUMB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.