description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input()) - 1
l = 1
c = 9
while k >= c * l:
k -= c * l
l += 1
c *= 10
c = 10 ** (l - 1) + k // l
print(str(c)[k % l]) | ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR VAR |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
if k <= 9:
print(k)
else:
num_arr = [(9 * (i + 1) * 10**i) for i in range(11)]
index = 0
while True:
if k <= num_arr[index]:
break
else:
k -= num_arr[index]
index += 1
digit = index + 1
k += digit - 1
num = k // digit
o... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIG... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | digit = int(input())
if int(digit) <= 9:
print(digit)
exit()
start_range = 1
end_range = 9
power = 1
digit_count = 2
while not (start_range <= digit and digit <= end_range):
start_range = end_range + 1
end_range = 9 * 10**power * digit_count + start_range - 1
power += 1
digit_count += 1
offset_n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBE... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
check = True
t = 0
tnext = 9
count = 1
i = 1
j = 1
res = 0
while check:
if n <= tnext:
res = n - t
check = False
else:
count = count + 1
if t != 0:
t = t + 9 * i * j
else:
t = 9
tnext = tnext + 9 * (i + 1) * (j * 10)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
nc = [(0) for i in range(14)]
for i in range(1, 14):
nc[i] += nc[i - 1] + 9 * 10 ** (i - 1) * i
for i in range(13):
if nc[i] < k <= nc[i + 1]:
cif = i + 1
if cif == 1:
print(k)
quit()
c = k - nc[cif - 1]
if c % cif == 0:
nnr = c // cif
ncif = cif
else:
nnr = 1 + c //... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER VAR VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input()) - 1
i = 0
while n >= 9 * (i + 1) * 10**i:
n -= 9 * (i + 1) * 10**i
i += 1
a = int(pow(10, i)) + int(n / (i + 1))
print(str(a)[n % (i + 1)]) | ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
k_ = k
ca = 9
di = 1
tem = 9
while k_ > 0:
k_ -= ca * di
ca *= 10
di += 1
tem += ca * di
if k_ == 0:
break
tem -= ca * di
ca = int(ca / 10)
di -= 1
tem -= ca * di
ca = int(ca / 10)
ca_ = 0
while ca > 0:
ca_ += ca
ca = int(ca / 10)
k -= tem
re = int((k + di - 1) // di... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER VAR BIN_OP VAR VAR IF VAR NUMBER VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
total_digit = 0
digit = 1
while k > total_digit + digit * (pow(10, digit) - pow(10, digit - 1)):
total_digit += digit * (pow(10, digit) - pow(10, digit - 1))
digit += 1
remaining = k - total_digit - 1
corr_num = str(pow(10, digit - 1) + remaining // digit)
print(corr_num[remaining % digit]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR BIN_OP VAR BIN_OP FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR BIN_OP FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIG... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def mp():
return map(int, input().split())
def f(i):
return (10**i - 10 ** (i - 1)) * i
n = int(input())
i = 1
sum = 0
while n - f(i) >= 0:
n -= f(i)
sum += f(i) // i
i += 1
print(str(sum + (n + i - 1) // i)[n % i - 1]) | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR VAR NU... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | import sys
k = int(input())
if type(k) != int or k <= 0 or k > pow(10, 12):
print("wrong input. try again")
sys.exit()
lim_init = lim = decimal = 9
c = 0
while True:
c += 1
if k <= lim:
diff = lim - k
pos = diff % c
diff = int(diff / c)
diff = decimal - diff
prin... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_O... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | N = int(input())
beg = 0
end = 9
i = 0
while N > end:
i += 1
beg, end = end, end + (i + 1) * 9 * 10**i
n = N - beg - 1
lvl = i - n % (i + 1)
period = (i + 1) * 10**lvl
res = n // period % 10
if lvl == i:
res += 1
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
for i in range(20):
if k > 10**i * 9 * (i + 1):
k -= 10**i * 9 * (i + 1)
else:
a, b = (k - 1) // (i + 1) + 10**i, (k - 1) % (i + 1)
print(str(a)[b])
break | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER E... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
s = 0
pred = 0
for i in range(1, 20):
m = 9 * pow(10, i - 1) * i
s += m
if n <= s:
nd = pow(10, i - 1)
sme = n - pred
num = sme // i
ost = sme % i
if ost == 0:
dig = nd + num - 1
else:
dig = nd + num
d = i
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BI... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | import sys
class ADigitsSequenceEasyEdition:
def solve(self):
k = int(input()) + 1
p = 1
c = 0
while c + p * (10**p - (10 ** (p - 1) if p > 1 else 0)) < k:
c += p * (10**p - (10 ** (p - 1) if p > 1 else 0))
p += 1
k -= c
bef = (10 ** (p - 1)... | IMPORT CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMB... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
def find(n):
y, x = -1, 10000000000000
while y + 1 != x:
m = (y + x) // 2
if con(m) >= n:
x = m
else:
y = m
return str(x)[n - con(y) - 1]
def con(x):
s, q, z = 0, 1, 0
while x != 0:
z = min(x, 9 * 10 ** (q - 1))
x =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER WHILE BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN FUNC_CALL VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHI... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
maxlength = 12
lengths = [1]
for i in range(1, maxlength + 1):
lengths.append(lengths[i - 1] + 9 * i * 10 ** (i - 1))
def getnum(n):
global lengths
mx = maxlength - 1
mn = 0
while 1:
chk = (mx - mn) // 2
if chk == 0:
break
chk += mn
if n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP B... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | pre_cal_sum_dec = {}
def sum_dec(n):
global pre_cal_sum_dec
try:
return pre_cal_sum_dec[n]
except:
sumer = 0
for i in range(1, n):
sumer += 10**i
pre_cal_sum_dec[n] = sumer
return sumer
def find_head(digits):
if digits < 1:
return 0
eli... | ASSIGN VAR DICT FUNC_DEF RETURN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP NUMBER VAR ASSIGN VAR VAR VAR RETURN VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_DEF ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | A = [
9,
189,
2889,
38889,
488889,
5888889,
68888889,
788888889,
8888888889,
98888888889,
1088888888889,
]
k = int(input())
if k < 10:
print(k)
else:
for n in range(0, 12):
if k > A[n + 1]:
continue
else:
a = 10 ** (n + 1) + (k ... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP VAR VAR VAR NUM... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
step = 9
count = 0
digit = 1
while count + digit * step < n:
count += digit * step
step *= 10
digit += 1
i = n - count
k = int((i + (digit - 1)) / digit)
num = 10 ** (digit - 1) + (k - 1)
j = digit - (i + digit - 1) % digit - 1
while j > 0:
num = int(num / 10)
j -= 1
print(num % 10) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP VA... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | from sys import stdin
def solve(tc):
k = int(stdin.readline().strip())
cmp = 9
ndigit = 1
while k > cmp * ndigit:
k -= cmp * ndigit
cmp *= 10
ndigit += 1
num = 10 ** (ndigit - 1) + (k - 1) // ndigit
pos = (k - 1) % ndigit
print(str(num)[pos])
pass
LOCAL_TEST =... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | N = int(input())
terms = 1
n = 9
total = 0
while N > terms * n:
N = N - terms * n
total = total + n
terms = terms + 1
n = n * 10
print(str(total + (N + terms - 1) // terms)[(N - 1) % terms]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER V... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
x = 1
while n > 10 ** (len(str(x)) - 1) * 9 * len(str(x)):
n -= 10 ** (len(str(x)) - 1) * 9 * len(str(x))
x *= 10
t = len(str(x))
nadighe = False
while nadighe == False:
qw = 1
nadighe = True
while n > 10 ** (len(str(qw)) - 1) * 9 * t:
n -= 10 ** (len(str(qw)) - 1) * 9 * t
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR F... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | T = (
0,
9,
189,
2889,
38889,
488889,
5888889,
68888889,
788888889,
8888888889,
98888888889,
1088888888889,
)
k = int(input())
a = 0
for i in T:
if i - k > 0:
a = T.index(i)
break
temp = T[a] - k
x = temp % a
res = 10**a - 1 - int(temp / a)
ans = int(r... | ASSIGN VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUM... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | index = int(input())
total = 9
n = 1
while index > total:
total += (n + 1) * 10**n * 9
n += 1
last = 10 ** (n - 1)
total -= n * 9 * last
index = index - total
r = index % n
k = index // n
number = last + k
if r == 0:
print(str(number - 1)[n - 1])
else:
print(str(number)[r - 1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIG... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
i = 0
s = 0
while True:
temp = (i + 1) * 9 * 10**i
if s + temp <= n:
s += temp
i += 1
else:
break
tc = n - s
nd = tc // (i + 1) - 1
tc -= (nd + 1) * (i + 1)
f = 10**i + nd
if tc != 0:
print(str(10**i + nd + 1)[tc - 1])
else:
print(str(10**i + nd)[-1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP NUMBER VAR IF BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUM... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def main_function():
counter = int(input())
max_counter = 9
digits_per_number = 1
while max_counter < counter:
digits_per_number += 1
max_counter = max_counter + digits_per_number * 9 * 10 ** (
digits_per_number - 1
)
max_real_number = int(str(9) * digits_per_numb... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR B... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input(""))
y = 9
x = 1
i = 2
m = 0
if k < 10:
print(k)
else:
while k > y:
h = y
y = y + 9 * i * 10**x
x += 1
i += 1
z = 10 ** (i - 1) + (k - y - 1) // (i - 1)
q = (k - h - 1) % (i - 1)
print(str(z)[q]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR WHILE VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def f(n):
kakn = 9
n -= 1
chisl = 1
while kakn < n:
kakn += 9 * 10**chisl * (chisl + 1)
chisl += 1
if n - kakn == 2:
return 0
t = kakn - 9 * 10 ** (chisl - 1) * chisl
n -= t
p = n // chisl
u = n % chisl
o = str(10 ** (chisl - 1) + p)
return o[u... | FUNC_DEF ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | import sys
n = int(input())
ind = 0
dig = 0
for i in range(1, 12):
dig += i * 10 ** (i - 1) * 9
if dig > n:
ind = i - 1
rt = dig - i * 10 ** (i - 1) * 9
break
n -= rt
no = 10**ind
if n == 0:
print(9)
sys.exit()
u = n
n -= n // (ind + 1) * (ind + 1)
no += max(0, u // (ind + 1) - ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR BIN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
n = 1
for i in range(1, 20):
if k < n + 9 * 10 ** (i - 1) * i:
print(str(10 ** (i - 1) + (k - n) // i)[(k - n) % i])
break
n += 9 * 10 ** (i - 1) * i | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP BIN_OP NUMBER BIN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def totaller(i):
if i == 0:
return 0
else:
total1 = totaller(i - 1) + 9 * 10 ** (i - 1) * i
return total1
no_of_digits = int(input())
j = 0
for i in range(1, 13):
if no_of_digits >= totaller(i):
j = i
kth_digit = (no_of_digits - totaller(j)) // (j + 1)
if (no_of_digits - to... | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR FUN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | a = int(input())
i = 1
amount = a
while amount > i * (10**i - 10 ** (i - 1)):
amount = amount - i * (10**i - 10 ** (i - 1))
i = i + 1
x = amount // i
y = amount % i
if y == 0:
if i == 1:
print(x % 10)
else:
print((10 ** (i - 1) + x - 1) % 10)
elif i == 1:
print(x % 10)
else:
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
s = 0
i = 1
c = 1
while s < n:
s += 9 * i * c
c += 1
i *= 10
n = n - s + 9 * i * (c - 1) // 10
c = c - 1
r = n % c
d = n // c
k = 10 ** (c - 1) + d
if r == 0:
print(int(str(k - 1)[-1]))
else:
print(int(str(k)[r - 1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BI... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
if k < 10:
print(k)
quit()
c = 0
n = k
a = k
while n > 0:
c += 1
sub = 10**c - 10 ** (c - 1)
a -= sub * c
n = a / (c + 1) + (10**c - 1)
if n + 1 <= 10 ** (c + 1):
if int(n) == n:
print(int(n % 10))
exit()
else:
print(str(in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP BIN_OP N... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
mul = 1
d = 1
while k > mul * 9 * d:
k -= mul * 9 * d
d += 1
mul *= 10
x = k % d
y = k // d
y += mul
if x == 0:
print((y - 1) % 10)
else:
y = y // pow(10, d - x)
print(y % 10) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR FUNC... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | import sys
def input():
return sys.stdin.readline().rstrip()
def slv():
k = int(input())
def cnt_special(N):
if N == 0:
return 0
return cnt_special(N - 1) + N * (pow(10, N) - pow(10, N - 1))
def cnt_digit(N):
ord = len(str(N))
bound = ord - 1
ret... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN V... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | import sys
k = int(input())
d = [0]
for i in range(1, 12):
d.append((10**i - 10 ** (i - 1)) * i + d[i - 1])
for i in range(1, len(d)):
if k <= d[i]:
f = d[i - 1]
f1 = 10 ** (i - 1)
print(str((k - f - 1) // i + f1)[(k - f - 1) % i])
sys.exit() | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER ASSI... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
num_digits = 1
num_numbers = 9
k -= 1
while k > num_digits * num_numbers:
k -= num_numbers * num_digits
num_digits += 1
num_numbers *= 10
number = 10 ** (num_digits - 1) + k // num_digits
index = k % num_digits
answer = str(number)[index]
print(answer) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER WHILE VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
i = 1
s = 0
while i * 9 * 10 ** (i - 1) < n - s:
s += i * 10 ** (i - 1) * 9
i += 1
n -= s
j = n // i
k = n % i
if k is 0:
ind = i - 1
else:
ind = k - 1
print(str(10 ** (i - 1) + j - 1 + (k > 0))[ind]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | a = int(input())
c = [1] * 30
for i in range(1, 20):
c[i] = 9 * i * pow(10, i - 1)
for i in range(1, 15):
if a > c[i]:
a -= c[i]
else:
d = int((a - 1) / i + pow(10, i - 1) - 1)
e = (a - 1) % i + 1
f = str(d + 1)
print(f[e - 1])
return | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP BIN_OP NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VA... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
limit_int = limit = decimal = 9
count = 0
while True:
count += 1
if n <= limit:
difference = limit - n
position = difference % count
difference = difference // count
difference = decimal - difference
print("".join(list(reversed(str(difference))))[position... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR F... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | a, b, c, d, e, f, g, h, i, j, k, l = [
9 * 1,
90 * 2,
900 * 3,
9000 * 4,
90000 * 5,
900000 * 6,
9000000 * 7,
90000000 * 8,
900000000 * 9,
9000000000 * 10,
90000000000 * 11,
900000000000 * 12,
]
a = a
b = a + b
c = b + c
d = c + d
e = d + e
f = e + f
g = f + g
h = g + h
i ... | ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR LIST BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN V... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
n = 1
up_bnd = 9
while k > up_bnd:
n += 1
up_bnd += 9 * n * 10 ** (n - 1)
low_bnd = 0
for i in range(1, n):
low_bnd += 9 * i * 10 ** (i - 1)
num = int((k - low_bnd) / n)
lb_val = 0
for i in range(n - 1):
lb_val = lb_val * 10 + 9
num += lb_val
rm = (k - low_bnd) % n
if rm != 0:
num +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
if n <= 9:
print(n)
else:
i = 0
while (n - 9 * 10**i * (i + 1) > 0) & (i <= 11):
n = n - 9 * 10**i * (i + 1)
i = i + 1
r = n % (i + 1)
p = n // (i + 1)
d = 10**i + p - 1
if r != 0:
d = d + 1
ch = str(d)
print(ch[r - 1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP V... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | l = []
n = []
sum = 0
multiply = 9
for i in range(1, 12):
s = "9" * i
n.append(int(s))
sum += i * multiply
multiply *= 10
l.append(sum)
k = int(input())
if k < 9:
print(k)
else:
t = 0
for i in range(len(l)):
if k < l[i]:
t = i
break
temp = k - l[t - 1]... | ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP STRING VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
a = 9
for i in range(1, 12):
if k <= a * i:
a = a // 9 + k // i - 1
if k % i != 0:
b = str(a + 1)
c = k % i - 1
print(b[c])
else:
b = str(a)
print(b[-1])
break
else:
k = k - a * i
a = a *... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIG... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
a = []
for i in range(0, 12):
s = 9 * pow(10, i) * (i + 1)
if k <= s:
break
else:
k -= s
pos = i + 1
num = pow(10, pos - 1) + k // pos - 1
if k % pos == 0:
print(str(num)[-1])
else:
print(str(num + (0 if pos == 1 else 1))[k % pos - 1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR NU... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def get_kth_digit(i):
if i < 10:
return i
batch = 9
count = 9
width = 1
while i > 10 * batch * (width + 1) + count:
batch *= 10
width += 1
count += batch * width
k = i - count - 1
num = 10**width + k // (width + 1)
return str(num)[k % (width + 1)]
def ma... | FUNC_DEF IF VAR NUMBER RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR V... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | q = 1
for t in range(q):
k = int(input())
m = 0
p = 9
while k > p:
m = m + 1
l = p
p = p + 9 * 10**m * (m + 1)
if m == 0:
print(k)
continue
ans = int("9" * m) + (k - l) // (m + 1)
if (k - l) % (m + 1) == 0:
print(str(ans)[-1])
else:
... | ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
s = k
i = 1
number_digits = 1
while s - i * (9 * 10 ** (i - 1)) > 0:
number_digits = number_digits + 1
s = s - i * (9 * 10 ** (i - 1))
i += 1
v = (s - 1) // number_digits
s = s - v * number_digits
ans = 10 ** (number_digits - 1) + v
ans = str(ans)
fans = ans[s - 1]
print(fans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR BIN_OP VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR N... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input())
def exp_(i):
return (9 * pow(10, i) * i - 10**i + 1) // 9
i = 0
while True:
v = exp_(i)
if v >= n:
break
i = i + 1
if n == v:
print("9")
else:
n = n - exp_(i - 1)
num = 10 ** (i - 1) - 1
num = num + n // i
r = n % i
if r > 0:
num = num + 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP NUMBER FUNC_CALL VAR NUMBER VAR VAR BIN_OP NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR FUN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
s = 1
i = 1
while s <= k:
s = s + 9 * i * 10 ** (i - 1)
i = i + 1
i = i - 1
s = s - 9 * i * 10 ** (i - 1)
t = i - (k - s) % i
n = 10 ** (i - 1) + int((k - s) / i)
while t:
r = n % 10
n = int(n / 10)
t = t - 1
print(r) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
x = 0
c = 0
while x < k:
x += 9 * 10**c * (c + 1)
c += 1
p = (x - k) % c
k = 10**c - int((x - k) / c) - 1
k = str(k)
print(k[len(k) - p - 1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXP... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
ch = 0
i = 0
r = 1
while k > r - 1:
r += 9 * (i + 1) * 10**i
i += 1
r -= 9 * i * 10 ** (i - 1)
print(str((k - r) // i + 10 ** (i - 1))[(k - r) % i]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def main():
k = int(input())
n, tenPow, s = 1, 1, 0
while s + 9 * tenPow * n < k:
s += 9 * tenPow * n
n += 1
tenPow *= 10
num = str(tenPow - 1 + (k - s + n - 1) // n)
print(num[(k - s - 1) % n])
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHILE BIN_OP VAR BIN_OP BIN_OP NUMBER VAR VAR VAR VAR BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER VAR EXPR FUNC_CALL VAR VAR BIN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | s = 0
t = 0
c = 0
k = int(input())
while s < k:
te = s
temp = t
t = t + 9 * pow(10, c)
s = s + 9 * pow(10, c) * (c + 1)
c = c + 1
a = (k - te) // c
re = (k - te) % c
if re == 0:
a = a + temp
a = str(a)
print(a[-1])
else:
a = a + temp + 1
a = str(a)
print(a[re - 1]) | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = input()
k = int(k)
n = 1
while k - n * 9 * 10 ** (n - 1) > 0:
k = k - n * 9 * 10 ** (n - 1)
n = n + 1
n = n - 1
if n == 0:
print(k)
else:
nth_num = (k - 1) // (n + 1) + 1
num = 10**n + nth_num - 1
pos = (k - 1) % (n + 1)
print(int(str(num)[pos])) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL V... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | def f(x):
dig, cnt = 1, 9
ans = 0
while dig != len(str(x)):
ans += dig * cnt
dig += 1
cnt *= 10
ans += (x - cnt // 9 + 1) * dig
return ans
k = int(input())
l, r = 1, 1000000000000
if k == 1:
print(1)
return
while l < r:
mid = l + r + 1 >> 1
if f(mid) < k:
... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETU... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | n = int(input()) - 1
c = 0
for i in range(11):
c += 9 * (i + 1) * 10**i
if c > n:
n -= c - 9 * (i + 1) * 10**i
v = n // (i + 1)
print(str(10**i + v)[n % (i + 1)])
break | ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR IF VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
prev = 0
nextt = 0
NumofDigits = 0
while True:
prev = nextt
nextt = nextt + 9 * 10 ** (NumofDigits - 1) * NumofDigits
if k >= prev and k <= nextt:
break
NumofDigits = NumofDigits + 1
if NumofDigits == 1:
print(k)
else:
result = 10 ** (NumofDigits - 1) + int((k - (prev + ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | k = int(input())
i = 1
while k > 9 * i * 10 ** (i - 1):
k -= 9 * i * 10 ** (i - 1)
i += 1
j = (k - 1) // i
k = k - j * i
print(str(10 ** (i - 1) + j)[k - 1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP ... |
Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
Your task is to print the $k$-th digit of this sequence.
-----Input-----
The fir... | L = [((i + 1) * 9 * 10**i) for i in range(12)]
number = int(input())
exponent = 0
while number >= 0:
number -= L[exponent]
exponent += 1
exponent -= 1
number %= L[exponent]
start = 10**exponent
numDigits = exponent + 1
final = start + (number // numDigits - 1)
remainder = number % numDigits
if remainder == 0:
... | ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBE... |
Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains a_{i} animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Naturally the zoo is connected, so you can reach any area of the zoo from any other area using the roa... | def main():
n, m = map(int, input().split())
l = [int(i) for i in input().split()]
rank, ans = [], 0
for i in range(m):
a, b = map(int, input().split())
a, b = a - 1, b - 1
rank.append((min(l[a], l[b]), a, b))
rank = sorted(rank, key=lambda x: -x[0])
par = list(range(n))
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR... |
Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains a_{i} animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Naturally the zoo is connected, so you can reach any area of the zoo from any other area using the roa... | n, m = list(map(int, input().split()))
p, c = list(range(n + 1)), [1] * (n + 1)
v = [0] + list(map(int, input().split()))
s, e = 0, [()] * m
for i in range(m):
x, y = list(map(int, input().split()))
e[i] = x, y, min(v[x], v[y])
e.sort(key=lambda x: x[2], reverse=True)
q = [[i] for i in range(n + 1)]
for l, r, v... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER BIN_OP LIST VAR FOR VAR FUNC_CALL VAR VAR A... |
Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains a_{i} animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Naturally the zoo is connected, so you can reach any area of the zoo from any other area using the roa... | read = lambda: map(int, input().split())
n, m = read()
v = list(read())
e = []
for i in range(m):
x, y = map(lambda x: int(x) - 1, input().split())
e.append((x, y, min(v[x], v[y])))
e.sort(key=lambda x: x[2], reverse=True)
belong = list(range(n))
union = [[i] for i in belong]
size = [1] * n
ans = 0
for i, j, k ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL ... |
Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains a_{i} animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Naturally the zoo is connected, so you can reach any area of the zoo from any other area using the roa... | R = lambda: map(int, input().split())
n, m = R()
a = list(R())
p, f, sz = [], [], []
e = [[] for i in range(n)]
vis = [0] * n
ans = 0
def find(u):
if f[u] != u:
f[u] = find(f[u])
return f[u]
for i in range(n):
p.append([a[i], i])
f.append(i)
sz.append(1)
p.sort()
p.reverse()
for i in ran... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST LIST ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FUNC_DEF IF VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR VAR... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | cas = int(input())
while cas:
cas -= 1
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
a = list(zip(r, c))
a.sort()
now = 0
pre = 0
pr = 1
pz = 0
ans = 0
for i in range(n):
tmp = a[i]
now = tmp[0] - tmp[1]
z... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASS... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | cases = int(input())
for cas in range(cases):
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
rc = []
for i in range(n):
rc.append((r[i], c[i]))
rc.sort(key=lambda x: x[0])
if rc[0] != (1, 1):
rc.insert(0, (1, 1))
ans = 0
for i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | for t in range(int(input())):
n = int(input())
r_arr = tuple(map(int, input().split()))
c_arr = tuple(map(int, input().split()))
r_rminusc = [(r, r - c, c) for r, c in zip(r_arr, c_arr)]
r_rminusc.sort()
cost = 0
current_pos = 1, 0, 1
for tup3 in r_rminusc:
diff1 = current_pos[1]... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUM... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | for _ in range(int(input())):
n = int(input())
r = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
sx, sy = 1, 1
cost = 0
for dx, dy in sorted(zip(r, c)):
sl = sx - sy
dl = dx - dy
if sl == dl:
if sl % 2 == 0:
points = d... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
def main():
t = int(input())
allans = []
for _ in range(t):
n = int(input())
r = [1] + readIntArr()
c = [1] + readIntArr()
rc = list(zip(r, c))
rc.sort(key=lambda x: x[0])
ans = 0
for i in range(len(rc) - 1):
ii1, jj1 = rc[i]
... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER F... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
from sys import stdin
tt = int(stdin.readline())
ANS = []
for loop in range(tt):
n = int(stdin.readline())
r = list(map(int, stdin.readline().split()))
c = list(map(int, stdin.readline().split()))
r.sort()
c.sort()
if not r[0] == c[0] == 1:
r.append(1)
c.append(1)
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUM... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def helper(a, b):
if a == b:
return 0
x0, y0 = a
x1, y1 = b
if (x0 + y0) % 2 == 0:
x0 += 1
y0 += x1 - x0
if y1 > y0:
return x1 - x0 + 1
elif y1 == y0:
return 0
else:
return (y0 - y1 + 1) // 2
for i in range(int(input())):
n = int(input())
... | FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR NUMBER VAR BIN_OP VAR VAR IF VAR VAR RETURN BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR RETURN NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def calc_dist(r1, c1, r2, c2):
if r1 - c1 == r2 - c2:
if (r1 + c1) % 2 == 1:
return 0
else:
return r2 - r1
r2 -= r1 - 1
c2 -= c1 - 1
if (r1 + c1) % 2 == 0:
return (r2 - c2) // 2
else:
return (r2 - c2 + 1) // 2
t = int(input())
for _ in range(... | FUNC_DEF IF BIN_OP VAR VAR BIN_OP VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN NUMBER RETURN BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | for z in range(int(input())):
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
a = []
b = 0
a1 = 0
for i in range(n):
b = max(b, r[i] - c[i])
if (r[i] - c[i]) % 2 == 0:
a.append([r[i] - c[i], r[i]])
a1 += 1
b... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CAL... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def f(x, y):
if x == y:
return x - 1
else:
return (x - y) // 2
def g(x, y):
return (x - y + 1) // 2
for _ in range(int(input())):
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
l = []
for i in range(n):
l.append([r[i],... | FUNC_DEF IF VAR VAR RETURN BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def num_path2(list_pairs):
cnt = 0
l, r = 1, 1
ind = 0
while True:
if ind == len(list_pairs):
break
l_targ, r_targ = list_pairs[ind]
if (l, r) == (l_targ, r_targ):
ind += 1
elif r_targ == r:
cum = (l_targ - l) // 2
if (l_tar... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR NUMBER VAR VAR ASSIGN ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def dist(r1, c1, r2, c2):
if r1 - c1 == r2 - c2:
if (r1 + c1) % 2 == 0:
rez = r2 - r1
else:
rez = 0
else:
r2 = r2 - (r1 - 1)
c2 = c2 - (c1 - 1)
if (r1 + c1) % 2 == 0:
rez = (r2 - c2) // 2
else:
rez = (r2 - c2 + 1) //... | FUNC_DEF IF BIN_OP VAR VAR BIN_OP VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
max_int = 2147483648
min_int = -max_int
def calc(r0, c0, r1, c1):
d0 = r0 - c0
d1 = r1 - c1
if r0 == r1 and c0 == c1:
return 0
if d0 == d1:
if d0 % 2:
return 0
else:
return r1 - r0
return (d1 - d0) // 2 + (1 if d0 % 2 and not d1 % 2 else ... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR VAR VAR RETURN NUMBER IF VAR VAR IF BIN_OP VAR NUMBER RETURN NUMBER RETURN BIN_OP VAR VAR RETURN BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | T = int(input())
for t in range(T):
n = int(input())
rs = [int(ea) for ea in input().split(" ")]
cs = [int(ea) for ea in input().split(" ")]
points = []
for i in range(n):
points.append((rs[i], cs[i]))
points.sort()
if points[0] != (1, 1):
points.insert(0, (1, 1))
prev = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_C... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
input = sys.stdin.readline
def calc1(r1, r2, c1, c2):
if (r1 + c1) % 2 == 1:
return 0
return r2 - r1
def calc2(r1, r2, c1, c2):
diff = r2 - c2 - (r1 - c1)
if (r1 + c1) % 2 == 0:
return diff // 2
return (diff + 1) // 2
t = int(input())
for _ in range(t):
n = int(... | IMPORT ASSIGN VAR VAR FUNC_DEF IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN NUMBER RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CA... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
MOD = 10**9 + 7
def solve():
n = int(input())
R = list(map(int, input().split()))
C = list(map(int, input().split()))
points = [(r, c) for r, c in zip(R, C)]
points.sort()
res = 0
pr = pc = 1
for r... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VA... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
input = sys.stdin.readline
def calcDist(r1, c1, r2, c2):
if r1 - c1 == r2 - c2:
return r2 - r1 if (r1 + c1) % 2 == 0 else 0
r2 -= r1 - 1
c2 -= c1 - 1
return (r2 - c2) // 2 if (r1 + c1) % 2 == 0 else (r2 - c2 + 1) // 2
for _ in range(int(input())):
n = int(input())
r = lis... | IMPORT ASSIGN VAR VAR FUNC_DEF IF BIN_OP VAR VAR BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR VAR NUMBER NUMBER BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER NUMBER BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def value(sr, sc, tr, tc):
r = tr - sr + 1
c = tc - sc + 1
if r == c:
return (c - 1) * int((sr + sc) % 2 == 0)
if r > c:
return (r - c + (sr + sc) % 2) // 2
else:
return -1
for _ in range(int(input())):
n = int(input())
r = [int(i) for i in input().split(" ")]
c... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR RETURN BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR RETURN BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def distance(current_point, next_point):
r1, c1 = current_point[0], current_point[1]
r2, c2 = next_point[0], next_point[1]
if (r1 - c1) % 2 == 1:
if (r2 - c2) % 2 == 1:
if r1 - c1 == r2 - c2:
return 0
else:
return (r2 - c2 - (r1 - c1)) // 2
... | FUNC_DEF ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF BIN_OP VAR VAR BIN_OP VAR VAR RETURN NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def main():
t = int(input())
for _ in range(t):
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
rc = []
for i in range(n):
rc.append((r[i], r[i] - c[i] + 1))
rc.sort(key=lambda x: x[0])
pos = 1, 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
res = []
for i in range(n):
res.append([r[i], c[i]])
res.sort()
lastp, lastq = 1, 1
ans = 0
i = 0
while i < ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
input = sys.stdin.readline
t = int(input().strip())
for __ in range(t):
n = int(input().strip())
rarr = [int(val) for val in input().strip().split(" ")]
carr = [int(val) for val in input().strip().split(" ")]
arr = [(0, 1, 1)] + [(r - c, r, c) for r, c in zip(rarr, carr)]
arr.sort()
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUM... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def minCost(a, b):
if (b[0] + b[1]) % 2 == 0 and b[0] - b[1] == a[0] - a[1]:
return b[0] - a[0]
diagA = (a[0] - a[1]) // 2
diagB = (b[0] - b[1]) // 2
return diagB - diagA
t = int(input())
for i in range(t):
n = int(input())
nodes = list(zip(map(int, input().split()), map(int, input().s... | FUNC_DEF IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | t = int(input())
for _ in range(t):
n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
l = [(r[i], c[i]) for i in range(n)]
l.sort()
x, y = 1, 1
ans = 0
for nx, ny in l:
need = ny - y
dif = nx - x
if (x + y) % 2 == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n = int(input())
p = [(1, 1)] + sorted(
list(zip(map(int, input().split()), map(int, input().split())))
)
cost = 0
for i in range(n):
back = p[i + 1][0] - p[i][0] - (p[i + 1][1] - p[i][1])
if back == ... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR AS... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | for _ in range(int(input())):
n = int(input())
row = map(int, input().split())
col = map(int, input().split())
pos = [(1, 1)]
for r, c in zip(row, col):
pos.append((r, c))
pos.sort()
cost = 0
for i in range(n):
r1, c1 = pos[i]
r2, c2 = pos[i + 1]
if r1 - c... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMB... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.buffer.readline())
def LI():
return list(map(int, sys.stdin.buffer.readline().split()))
def LI1():
return list(map(int1, sys.stdin.buffer.readline().split()))
def L... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_D... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def solve():
n = int(input())
points = []
x = input()
x = [int(i) for i in x.split(" ")]
for i in x:
points.append([i, 0])
y = input()
y = [int(i) for i in y.split(" ")]
for i, v in enumerate(y):
points[i][1] = v
points.sort()
ans = 0
start = [1, 1]
for x,... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING FOR VAR VAR EXPR FUNC_CALL VAR LIST VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | P = lambda: map(int, input().split())
for _ in range(*P()):
(n,) = P()
d = [(1, 1)] + sorted(zip(P(), P()))
a = 0
for i in range(n):
r, c = d[i]
v = r - c
R, C = d[i + 1]
a += (R - C) // 2 - v // 2 + (R - r) * (v & 1 < 1 and v == R - C)
print(a) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR B... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | t = int(input())
for _ in range(t):
n = int(input())
rc = []
r = list(map(int, input().split()))
c = list(map(int, input().split()))
for i in range(n):
rc.append([r[i], c[i]])
rc.sort()
if rc[0] != [1, 1]:
rc.insert(0, [1, 1])
n += 1
s = 0
for i in range(n - 1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR ... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | for _ in range(int(input())):
n = int(input())
(*rows,) = map(int, input().split())
(*cols,) = map(int, input().split())
points = sorted(range(n), key=lambda i: rows[i])
prev_row = 0
prev_col = 0
ans = 0
for point in points:
prev_diag = prev_row - prev_col
row = rows[poin... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN V... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | from sys import gettrace, stdin
if gettrace():
def inputi():
return input()
else:
def input():
return next(stdin)[:-1]
def inputi():
return stdin.buffer.readline()
def solve():
n = int(input())
rr = [1] + [int(a) for a in input().split()]
cc = [1] + [int(a) for a i... | IF FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR AS... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | for nt in range(int(input())):
n = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = [[b[i], c[i]] for i in range(n)]
a.sort()
if a[0] == [1, 1]:
a.pop(0)
n -= 1
ans = 0
i = 0
curr = [1, 1]
while i < n and a[i][0] == a[i][1]:... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR IF VAR NUMBER LIST NUMBE... |
Consider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to right. Each point of an infinite triangle is described by a pair of numbers $(r, c)$ ($1 \le c \le r... | def test(n, p):
p.sort()
cost = 0
prevd = 0
prevr = 1
prevc = 1
for i in range(n):
r, c = p[i]
d = r - c
if prevd == d:
if d % 2:
cost += 0
else:
cost += r - prevr
else:
cost += d // 2 - prevd // ... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR RETURN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.