description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
MIN = 3 * 10**8 + 1
dp = [MIN] * n
for i in range(1, len(s)):
for j in range(0, i):
if s[j] < s[i]:
dp[i] = min(dp[i], c[j] + c[i])
MIN = min(dp[j] + c[i], MIN)
if MIN > 3 * 10**8:
print(-1)
... | 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 BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR F... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | import sys
n = int(input())
li1 = []
li2 = []
li1 = list(map(int, input().split()))
li2 = list(map(int, input().split()))
a = 0
b = 0
min = sys.maxsize
for j in range(1, n - 1):
min1 = sys.maxsize
min2 = sys.maxsize
for i in range(0, j):
if li2[i] < min1 and li1[i] < li1[j]:
min1 = li2[... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | TN = 1
def solution():
n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 3 * 10**9 + 2
for j in range(1, n - 1):
ans_i = c[j]
cur_i = 10**9 + 2
cur_k = 10**9 + 2
for i in range(j):
if s[i] < s[j] and cur_i > c... | ASSIGN VAR 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 VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VA... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n, s, c, v = (
int(input()),
list(map(int, input().split())),
list(map(int, input().split())),
-1,
)
for i in range(1, n - 1):
k1, k2 = -1, -1
for j in range(i):
if s[j] < s[i] and (k1 == -1 or c[j] < c[k1]):
k1 = j
for j in range(i + 1, n):
if s[j] > s[i] and (k2... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR VAR VAR VAR AS... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | import sys
input = sys.stdin.readline
n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
d = {}
for i in range(n - 1):
ans = 10**12
for j in range(i + 1, n):
if s[i] < s[j]:
ans = min(ans, c[i] + c[j])
d[i] = ans
ans = 10**12
for i in range(n - 2):
... | IMPORT ASSIGN 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 DICT FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMB... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
price = list(map(int, input().split()))
min_cost = float("inf")
for i in range(n):
cost = price[i]
price1 = float("inf")
price2 = float("inf")
for j in range(i):
if s[j] < s[i]:
price1 = min(price1, price[j])
cost = cost + pric... | 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 STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VA... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
c_min = []
for i in range(n):
mini = int(10**18)
for j in range(i + 1, n):
if s[i] < s[j]:
mini = min(mini, c[j])
c_min.append(mini)
res = int(10**18)
for i in range(n):
for j in range(i + 1, n):... | 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 ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
cost = min(
min([30000000000.0] + [c[j] for j in range(i) if s[j] < s[i]])
+ c[i]
+ min([30000000000.0] + [c[k] for k in range(i + 1, n) if s[k] > s[i]])
for i in range(n)
)
if cost >= 30000000000.0:
cost = ... | 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 FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP LIST NUMBER VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR BIN_OP LIST NUMBER VAR VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | import sys
n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
minTwoCost = [-1] * n
for i in range(1, n):
x = sys.maxsize
found = False
for j in range(i):
if s[j] < s[i]:
x = min(x, c[j])
found = True
if found:
minTwoCost[i] ... | IMPORT 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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
size = [int(x) for x in input().split()]
costs = [int(x) for x in input().split()]
dp = [(10000000000) for _ in range(n)]
best = 1000000000
for i in range(n):
for k in range(0, i):
if size[k] < size[i]:
dp[i] = min(dp[i], costs[k] + costs[i])
best = min(dp[k] + costs... | 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 NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VA... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
f1 = [(0) for x in range(0, 3005)]
f = [[(99999999999) for x in range(0, 3005)] for i in range(1, 4)]
f.insert(0, f1)
for i in range(0, n):
f[1][i] = c[i]
for x in range(2, 4):
for i in range(x - 1, n):
for j in... | 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 NUMBER VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR FOR V... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
a = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
m = 999999999
for i in range(1, n - 1):
m1 = 999999999
m2 = 999999999
ind1 = -1
ind2 = -1
for j in range(i):
if a[j] < a[i]:
if c[j] < m1:
m1 = c[j]
ind1 =... | 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF V... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
a = [[int(i)] for i in input().split()]
b = [int(i) for i in input().split()]
for i in range(n):
a[i].append(b[i])
del b
d = [(0) for i in range(n)]
for i in range(1, n):
mini = 0
for j in range(i):
if a[j][0] < a[i][0]:
if mini == 0:
mini = a[j][1]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FU... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | R = lambda: map(int, input().split())
n = int(input())
arr = list((f, c) for f, c in zip(R(), R()))
res = 1e19
for i in range(1, n - 1):
lv, rv = 1e19, 1e19
for j in range(i):
lv = min(lv, arr[j][1] if arr[j][0] < arr[i][0] else 1e19)
for j in range(i + 1, n):
rv = min(rv, arr[j][1] if arr[j... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
l = list(map(int, input().split(" ")))
l2 = list(map(int, input().split(" ")))
dp_1 = l2.copy()
dp_2 = [9999999999] * n
dp_3 = [9999999999] * n
for i in range(1, n):
for j in range(i):
if l[i] > l[j]:
dp_2[i] = min(dp_2[i], dp_1[j] + l2[i])
for i in range(1, n):
for j in ran... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
font = list(map(int, input().split()))
cost = list(map(int, input().split()))
costList = [[[], []] for _ in range(n)]
limit = 10**9
ans = limit
for i in range(n - 1):
mysize = font[i]
for j in range(i + 1, n):
if mysize < font[j]:
costList[i][0].append(j)
if len(... | 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 LIST LIST VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR V... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = input()
S = list(map(int, list(s.split())))
c = input()
C = list(map(int, list(c.split())))
table = [[(10**9) for i in range(4)] for i in range(n)]
for i in range(n):
table[i][1] = C[i]
for i in range(2, 4):
for j in range(i - 1, n):
for k in range(j):
if S[k] < S[j]:
... | 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FU... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | def f(n, S, C):
total = -1
for i in range(1, n - 1):
l = 10**8 + 100
for m in range(i - 1, -1, -1):
if S[m] < S[i]:
l = min(l, C[m])
r = 10**8 + 100
for o in range(i + 1, n):
if S[o] > S[i]:
r = min(r, C[o])
if l == ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | def answer(n, A, B):
dp = [[float("inf") for i in range(n)] for j in range(3)]
dp[0][0] = B[0]
for i in range(3):
for j in range(1, n):
if i == 0:
dp[i][j] = B[j]
else:
for k in range(j):
if A[j] > A[k]:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER ASSIGN VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
ss = list(map(int, input().split()))
cc = list(map(int, input().split()))
d1 = {}
d2 = {}
d3 = {}
for i in range(n):
s = ss[i]
c = cc[i]
if s in d1.keys():
d1[s] = min(d1[s], c)
else:
d1[s] = c
m = 10000000001
for d in d1.keys():
if d < s and d1[d] < m:
... | 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 DICT ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR IF VAR FUNC_CALL VAR ASSIGN VAR VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
a = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ans = 10**9 + 1
for j in range(1, n - 1):
ans1 = 10**9 + 1
for i in range(j):
if a[i] < a[j]:
if ans1 > c[i]:
ans1 = c[i]
ans2 = 10**9 + 1
for k in range(j + 1, n):
if... | 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 BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
smaller, greater, ans = [10**9] * 3
flag1, flag2, done = [0] * 3
for i in range(1, n):
for j in range(i):
if s[j] < s[i]:
smaller = min(smaller, c[j])
flag1 = 1
for j in range(i + 1, n):
... | 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 VAR BIN_OP LIST BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF V... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | def go():
n = int(input())
s = [int(i) for i in input().split(" ")]
c = [int(i) for i in input().split(" ")]
m = float("inf")
for j in range(1, n - 1):
c_m = float("inf")
for i in range(0, j):
if s[i] < s[j]:
if c[i] + c[j] < c_m:
c_m =... | FUNC_DEF 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 FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | class Display:
def __init__(self, index, size, cost):
self.index = index
self.size = size
self.cost = cost
self.next = None
n = int(input())
sizes = input().split(" ")
costs = input().split(" ")
displays = []
i = 0
while i < n:
displays.append(Display(i, int(sizes[i]), int(cos... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NONE ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = [int(x) for x in input().strip().split()]
c = [int(x) for x in input().strip().split()]
ans = float("inf")
for j in range(1, len(s) - 1):
vi = float("inf")
for i in range(j):
if s[i] < s[j]:
vi = min(vi, c[i])
vk = float("inf")
for k in range(j + 1, len(s)):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | def menorCustoEsq(s, c, size, custo):
menor = None
for i in range(0, len(s)):
if menor == None and s[i] < size:
menor = s[i], c[i]
elif s[i] < size:
if menor[1] > c[i]:
menor = s[i], c[i]
return menor
def menorCustoDir(s, c, size, custo):
menor =... | FUNC_DEF ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR NONE VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR IF VAR VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR NONE VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
x = [0]
for i in range(1, n):
t = 0
for j in range(i + 1, n):
if s[j] > s[i]:
if t == 0:
t = c[j]
else:
t = min(t, c[j])
x.append(t)
ans = -1
for i in rang... | 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR IF VAR NUM... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
ls1 = [int(i) for i in input().split()]
ls2 = [int(i) for i in input().split()]
ans = -1
for i in range(1, n - 1):
l = [ls2[j] for j in range(0, i) if ls1[j] < ls1[i]]
r = [ls2[j] for j in range(i + 1, n) if ls1[j] > ls1[i]]
if len(l) and len(r):
ans = (
min(l) + min(r) ... | 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR B... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | mod = 1000000007
MOD = 998244353
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()))
it = lambda: tuple(map(int, input().split()))
ls = lambda: list(input())
n = ii()
l = il()
c = il()
mn = 10**20
for i i... | ASSIGN VAR NUMBER 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 VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
res = 1000000000
for j in range(1, n - 1):
x, y = s[j], c[j]
mn = 1000000000
res1 = y
for i in range(j):
if s[i] < x:
if mn > c[i]:
mn = c[i]
res1 += mn
mn = 1000000000
... | 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [10000000000000000] * n
for i in range(1, n - 1):
for j in range(i + 1, n):
if s[j] > s[i]:
dp[i] = min(dp[i], c[j] + c[i])
minm = 10000000000000000
for i in range(0, n - 2):
for j in range(i + 1, n... | 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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR ASS... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | import sys
def inpt():
return sys.stdin.readline().strip()
n = int(inpt())
s = [int(i) for i in inpt().split()]
c = [int(i) for i in inpt().split()]
mi = 9999999999
for i in range(1, n - 1):
m1 = 9999999999
for j in range(i):
if s[j] < s[i]:
m1 = min(m1, c[j])
m2 = 9999999999
... | IMPORT FUNC_DEF RETURN FUNC_CALL 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
a = list(map(int, input().split()))
c = list(map(int, input().split()))
MAXANS = 300000010
f = {
(1): [c[i] for i in range(n)],
(2): [MAXANS for _ in range(n)],
(3): [MAXANS for _ in range(n)],
}
v = [(False) for _ in range(n)]
l = 2
for i in range(n - 1):
if v[i]:
continue
... | 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 NUMBER ASSIGN VAR DICT NUMBER NUMBER NUMBER VAR VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
mincost = float("inf")
for i in range(1, n - 1):
minleft = float("inf")
minright = float("inf")
for j in range(0, i):
if s[j] < s[i]:
minleft = min(minleft, c[j])
for j in range(i + 1, n):
... | 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 FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NU... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | input()
h = list(map(int, input().split()))
s = list(map(int, input().split()))
sas = 1000000000.0
for j in range(len(h)):
l = 1000000000.0
for i in range(j):
if h[i] < h[j]:
l = min(l, s[i])
r = 1000000000.0
for k in range(j + 1, len(h)):
if h[k] > h[j]:
r = min(... | EXPR 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 NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VA... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | import sys
input = sys.stdin.readline
n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = c
for _ in range(2):
dp2 = []
for i in range(n):
t = 10**9
for j in range(i):
if t > dp[j] and s[j] < s[i]:
t = dp[j]
dp2.appen... | IMPORT ASSIGN 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 FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | from sys import stdin
a = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
B = list(map(int, stdin.readline().split()))
SOL = 10**9
UU = 0
for t in range(1, a - 1):
MIN = 10**8 + 1
K = 0
for u in range(0, t):
if A[u] < A[t]:
K = 1
MIN = min(MIN, B[u])
i... | 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 BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSI... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | def main():
input()
displays = list(map(int, input().split()))
costs = list(map(int, input().split()))
INF = 10000000000
dp = []
for i in range(len(costs)):
dp.append([costs[i]] + [INF for _ in range(2)])
result = INF
for i in range(1, len(costs)):
for j in range(0, i):
... | FUNC_DEF EXPR 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 NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST VAR VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR F... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
arr = [int(w) for w in input().split(" ")]
c = [int(w) for w in input().split(" ")]
inf = 10**18
dp = [[inf for x in range(n)] for x in range(3)]
dp[0] = c.copy()
for i in range(1, 3):
for j in range(i, n):
for k in range(j):
if arr[j] > arr[k]:
dp[i][j] = min(c[... | 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 BIN_OP NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBE... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -1
for i in range(1, n - 1):
temp1 = -1
temp2 = -1
for j in range(0, i):
if s[i] > s[j]:
if temp1 == -1:
temp1 = c[j]
else:
temp1 = min(temp1, c[j])
... | 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VA... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sumi = []
for i in range(1, len(a) - 1):
s = 10000000000
l = 10000000000
for j in range(i):
if a[j] < a[i]:
k = b[i] + b[j]
if s > k:
s = k
for j in range(i + 1, len(a... | 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 NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR V... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
ans = 4 * 10**8
for j in range(1, n - 1):
mini = 4 * 10**8
for i in range(0, j):
if s[i] < s[j]:
mini = min(mini, c[i])
if mini == 4 * 10**8:
continue
mink = 4 * 10**8
for k in ra... | 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 BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | n = int(input())
s = list(map(int, input().split()))
c = list(map(int, input().split()))
c1 = dict()
c2 = dict()
pmin = float("inf")
for i in range(n):
tecs = s[i]
tecpr = c[i]
minpr = 10**9 + 1
for k, v in c2.items():
if k < tecs:
minpr = min(minpr, v)
pmin = min(minpr + tecpr, ... | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR A... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | I = lambda: list(map(int, input().split()))
n, s, a = int(input()), I(), I()
t = 3 * 10**9
q = [0] * n
for i in range(n - 1, -1, -1):
u = 10**8
for j in range(i - 1, -1, -1):
if s[i] > s[j]:
u = min(u, a[j])
q[i] = u
for i in range(n):
for j in range(i + 1, n):
if s[i] < s[j]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC... |
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are $n$ displays placed along a road, and the $i$-th of them can display a text with font size $s_i$ only. Maria Stepanovna wants to rent ... | from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
n = int(cin())
s = list(map(int, cin().split()))
c = list(map(int, cin().split()))
cost = 10**12
for j in range(1, n - 1):
y, z = 10**15, 10**15
m = 0
for i in range(j):
y = min(y, c[i]) * (s[j] > s[i]) + y * (s[j] <= s[i])
... | ASSIGN VAR VAR ASSIGN 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 BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP NUMBER NUMBER BI... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
dp = {}
n, m = len(s), len(t)
def q(i, j):
if i == n or j == m:
dp[i, j] = 0
return 0
if (i, j) in dp:
return dp[i, j]
ans = 0
if... | CLASS_DEF FUNC_DEF ASSIGN VAR DICT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER RETURN NUMBER IF VAR VAR VAR RETURN VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR F... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
if len(s) < len(t):
s, t = t, s
dp = [[(0) for _ in range(len(s))] for i in range(len(t))]
for i in range(len(s)):
if s[i] == t[0]:
dp[0] = dp[0][:i] + [(1) for _ in range(i, len(s))]
... | CLASS_DEF FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def printLCS(self, i, j, s1, s2, res, cur_lcs, len_lcs, n1, n2):
if len(cur_lcs) == len_lcs:
res.append(cur_lcs)
return
if i >= n1 or j >= n2:
return
for k in range(i, n1):
for p in range(j, n2):
if s1[k] == s2[... | CLASS_DEF FUNC_DEF IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR RETURN IF VAR VAR VAR VAR RETURN FOR VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
memo = {}
def dp(i, j):
if (i, j) in memo.keys():
return memo[i, j]
if i < 0 or j < 0:
return []
arr = []
if s[i] == t[j]:
x = dp(i - 1, ... | CLASS_DEF FUNC_DEF ASSIGN VAR DICT FUNC_DEF IF VAR VAR FUNC_CALL VAR RETURN VAR VAR VAR IF VAR NUMBER VAR NUMBER RETURN LIST ASSIGN VAR LIST IF VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR V... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def printlcs(self, ans, dp, i, j, s, t, l, x=""):
if len(x) == l:
ans.append(x)
if i < 0 or j < 0:
return
for c in range(ord("a"), ord("z") + 1):
char = chr(c)
done = False
for indx1 in range(i, -1, -1):
... | CLASS_DEF FUNC_DEF STRING IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR VAR FOR VAR FUNC_CALL VAR VAR NUMBER N... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
n, m = len(s), len(t)
dp = [[[0, set()] for _ in range(m + 1)] for _ in range(n + 1)]
for i in range(n):
dp[i][0][1].add("")
for i in range(m):
dp[0][i][1].add("")
for i in range(1, n + ... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR NUMBER NUMBER STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER STRING F... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
x, y = len(s), len(t)
dp = [
[([0, {""}] if i == 0 or j == 0 else [0, set()]) for j in range(y + 1)]
for i in range(x + 1)
]
for i in range(1, x + 1):
for j in range(1, y + 1):
... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER LIST NUMBER STRING LIST NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s1, s2):
m = len(s1)
n = len(s2)
dp = [([[]] * (n + 1)) for i in range(m + 1)]
for i in range(0, m + 1):
for j in range(0, n + 1):
if i == 0 or j == 0:
dp[i][j] = [""]
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST LIST BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR LIST STRING IF VAR BIN_... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, text1, text2):
s1 = len(text1)
s2 = len(text2)
dp = [([0] * (s2 + 1)) for i in range(s1 + 1)]
for i in range(s1 + 1):
dp[i][0] = 0
for j in range(s2 + 1):
dp[0][j] = 0
for i in range(1,... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def solve(self, s, t, i, j, temp, ans, count, se):
if count == 0:
if temp not in se:
se.add(temp)
ans.append(temp)
return
if i >= len(s) or j >= len(t):
return
for r in range(i, len(s)):
for c in... | CLASS_DEF FUNC_DEF IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR RETURN IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_O... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
ans = set()
flag = [[(0) for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
if s[i - 1] == t[j - 1]:
flag[i][j]... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP ... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
len_s, len_t = len(s), len(t)
dp = [[(0) for i in range(len_t + 1)] for j in range(len_s + 1)]
for i in range(1, len_s + 1):
for j in range(1, len_t + 1):
if s[i - 1] == t[j - 1]:
... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
dp = [[set() for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
if s[i - 1] == t[j - 1]:
if len(dp[i - 1][j - 1]) == 0:... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER IF FUNC... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
ns = len(s)
nt = len(t)
dp = [[(0) for _ in range(nt + 1)] for _ in range(ns + 1)]
ans = [[set() for _ in range(nt + 1)] for _ in range(ns + 1)]
for i in range(1, ns + 1):
for j in range(1, nt + 1):... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR F... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def tabular(self, text1, text2):
n = len(text1)
m = len(text2)
dp = [([0] * (m + 1)) for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if text1[i - 1] == text2[j - 1]:
dp[i][j] = 1 + dp[i - 1][j... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def printLcs(self, ind1, ind2, dp, cur, length, data, ans, s, t):
if cur == length:
ans.append("".join(data[:cur]))
if ind1 == len(s) or ind2 == len(t):
return
for ch in range(ord("a"), ord("z") + 1):
done = False
for i in rang... | CLASS_DEF FUNC_DEF IF VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR V... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def check(self, res, s, t, x, y, l, arr):
if len(res) == l:
arr.add(res)
return
if x == len(s) or y == len(t):
return
for i in range(97, 123):
for j in range(x, len(s)):
if s[j] == chr(i):
fo... | CLASS_DEF FUNC_DEF IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR RETURN IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR EXPR FUNC_... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, x, y):
MAX = 100
dp = [[(-1) for i in range(MAX)] for i in range(MAX)]
def lcs(str1, str2, len1, len2, i, j):
if i == len1 or j == len2:
dp[i][j] = 0
return dp[i][j]
if dp[i][j... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER RETURN VAR VAR VAR IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMB... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
temp2 = []
for j in range(len(t) + 1):
temp1 = []
for i in range(len(s) + 1):
temp1.append([0, []])
temp2.append(temp1)
for i in range(1, len(t) + 1):
for j in ra... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR LIST NUMBER LIST EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s: str, t: str):
m, n = len(s), len(t)
dp = [[(0) for j in range(n + 1)] for i in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
dp[i][j] = 0
f... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
dp = [[(0) for _ in range(len(t) + 1)] for _ in range(len(s) + 1)]
for i in range(1, len(s) + 1):
for j in range(1, len(t) + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = 1 + dp[i - 1][j - 1]
... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def __init__(self):
self.output = []
def solve(self, s1, s2, i, j, ans, lcs):
if lcs == 0:
x = "".join(ans)
if x not in self.output:
self.output.append(x)
return
for r in range(i, len(s1)):
for c in range(j... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FUNC_DEF IF VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR IF VAR VAR EXPR FUNC_CALL VAR VAR RETURN FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def __init__(self):
self.st = set()
def all_longest_common_subsequences(self, s, t):
x = len(s)
y = len(t)
dp = [([-1] * (y + 1)) for i in range(x + 1)]
for i in range(x + 1):
dp[i][0] = 0
for j in range(y + 1):
dp[0][j] =... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBE... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | def lcs(A, B, i, j, dp):
if i == len(A) or j == len(B):
return 0
if dp[i][j] != -1:
return dp[i][j]
ans = 0
if A[i] == B[j]:
ans = 1 + lcs(A, B, i + 1, j + 1, dp)
else:
ans = max(lcs(A, B, i + 1, j, dp), lcs(A, B, i, j + 1, dp))
dp[i][j] = ans
return ans
def... | FUNC_DEF IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VA... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s1, s2):
MAX = 100
dp = [[(-1) for i in range(MAX)] for i in range(MAX)]
def lcs(str1, str2, len1, len2, i, j):
if i == len1 or j == len2:
dp[i][j] = 0
return dp[i][j]
if dp[i]... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER RETURN VAR VAR VAR IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMB... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
memo = {}
def dp(i, j):
if (i, j) in memo.keys():
return memo[i, j]
if i < 0 or j < 0:
return []
arr = []
if s[i] == t[j]:
x = dp(i - 1, ... | CLASS_DEF FUNC_DEF ASSIGN VAR DICT FUNC_DEF IF VAR VAR FUNC_CALL VAR RETURN VAR VAR VAR IF VAR NUMBER VAR NUMBER RETURN LIST ASSIGN VAR LIST IF VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR A... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | from itertools import product
class Solution:
def all_longest_common_subsequences(self, s, t):
n, m = map(len, (s, t))
dp = [([0] * (m + 1)) for _ in range(n + 1)]
for i, j in product(*map(range, (n, m))):
dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])
if s[i] ... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR IF VAR VAR ... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
l1 = len(s)
l2 = len(t)
memo = [([-1] * (l2 + 1)) for _ in range(l1 + 1)]
for i in range(l1 + 1):
memo[i][0] = 0
for j in range(l2 + 1):
memo[0][j] = 0
max_ = -1
for i in... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
n = len(s)
m = len(t)
dp = [([0] * (m + 1)) for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = 1 + dp[i - 1][j... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, text1, text2):
m = len(text1)
n = len(text2)
dp1 = [set([""]) for i in range(m + 1)]
for i in range(n):
dp2 = [set() for t in range(m + 1)]
dp2[0].add("")
for j in range(m):
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR LIST STRING VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR FOR V... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
n = len(s)
m = len(t)
dp = [[(0) for j in range(m + 1)] for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if s[i - 1] == t[j - 1]:
dp[i][j] = 1 +... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR V... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s, t):
n = len(s)
m = len(t)
dp = [([0] * (m + 1)) for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if t[j - 1] == s[i - 1]:
dp[i][j] = dp[i - 1][j - 1... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR... |
You are given two strings s and t. Now your task is to print all longest common sub-sequences in lexicographical order.
Example 1:
Input: s = abaaa, t = baabaca
Output: aaaa abaa baaa
Example 2:
Input: s = aaa, t = a
Output: a
Your Task:
You do not need to read or print anything. Your task is to complete the function a... | class Solution:
def all_longest_common_subsequences(self, s1, s2):
x = len(s1)
y = len(s2)
l = [[(0) for i in range(y + 1)] for j in range(x + 1)]
for i in range(x + 1):
for j in range(y + 1):
if i == 0 or j == 0:
l[i][j] = 0
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NUMBER IF VAR BIN_OP VAR NUMB... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | import sys
def there_is(user, text):
p = text.split(user)
n = len(p)
p[0] = " " if p[0] == "" else p[0]
p[n - 1] = " " if p[n - 1] == "" else p[n - 1]
for i in range(n - 1):
if p[i] == "" or p[i + 1] == "":
continue
e = p[i][-1]
b = p[i + 1][0]
if e.isdi... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER STRING STRING VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING STRING VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR VAR... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | from sys import stdin, stdout
def divide(s):
strings = []
l = 0
r = len(s) - 1
while l < len(s) and s[l] in "?!., ":
l += 1
while r >= 0 and s[r] in "?!., ":
r -= 1
s = s[l : r + 1]
while len(s):
for i in range(len(s)):
if s[i] in "?!., ":
... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR STRING VAR NUMBER WHILE VAR NUMBER VAR VAR STRING VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER WHILE FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR EXPR FUNC_C... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | def main():
n = int(input())
names = input().split()
m = int(input())
msg = [input().split(":") for _ in range(m)]
texts = []
for i in msg:
texts.append(i[1])
i[1] = (
i[1]
.replace(",", " ")
.replace(".", " ")
.replace("!", " ")
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL FUNC_CALL FUNC_CALL FUNC_CALL FUNC_CALL VAR NUMB... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | from sys import *
t = int(stdin.readline())
for sssss in range(t):
text, ps, dn, n, names, m = (
[],
[],
dict(),
int(stdin.readline()),
stdin.readline().split(),
int(stdin.readline()),
)
for i in range(len(names)):
dn[names[i]] = i
for i in range(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR LIST LIST FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | def dfs(ind):
if ind > 0:
if possible[ind][0] in possible[ind - 1]:
possible[ind - 1].remove(possible[ind][0])
if len(possible[ind - 1]) == 1:
dfs(ind - 1)
if ind < m - 1:
if possible[ind][0] in possible[ind + 1]:
possible[ind + 1].remove(possi... | FUNC_DEF IF VAR NUMBER IF VAR VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUMBER IF FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER IF VAR VAR NUMBER VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUMBER IF FU... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | def pr(name, lvl, dp, u, tot):
if lvl == 0:
print(name + ":" + tot[lvl])
return
pr(u[lvl][name], lvl - 1, dp, u, tot)
print(name + ":" + tot[lvl])
def solve():
n = int(input())
users = input().split()
m = int(input())
dp = []
u = []
tot = []
for i in range(m):
... | FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING VAR VAR RETURN EXPR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASS... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | def solve():
global msg, rem, m
flag = True
while flag:
flag = False
for i in range(m):
if msg[i][0] == " ":
if len(rem[i]) == 0:
return False
elif len(rem[i]) == 1:
flag = True
msg[i][0] ... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING IF FUNC_CALL VAR VAR VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUMBER VAR IF VAR BIN_... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | import sys
trans = str.maketrans({c: " " for c in ".,?!"})
def check_chat(users, messages):
m = len(messages)
possible = [set(users) for i in range(m)]
for i, M in enumerate(messages):
if M[0] is None:
possible[i] -= set(M[1].translate(trans).split())
else:
if i > ... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR STRING VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER NONE VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR BI... |
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. ... | from sys import stdin
t = int(stdin.readline())
def c(l, r, msg):
f = True
if l > 0 and not msg[l - 1].isdigit() and not msg[l - 1].isalpha():
pass
elif l == 0:
pass
else:
f = False
if r == len(msg) - 1:
pass
elif not msg[r + 1].isdigit() and not msg[r + 1].isa... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER RETURN VAR FUNC_DEF ... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | tmp = input()
def can(s, t):
if len(s) != len(t):
return False
if "X" in t:
for ch in range(10):
if can(s, t.replace("X", str(ch))):
return True
return False
for i in range(len(s)):
if s[i] == t[i] or t[i] == "_":
continue
els... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN NUMBER IF STRING VAR FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR STRING RETURN NUMBER RETURN NUMBER ... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | def check(s, i):
if i == len(s):
x = "".join(s)
if x[0] == "0" and x != "0":
return 0
if int(x) % 25 == 0:
return 1
return 0
res = 0
if s[i] == "_":
if i != 0 and i < len(s) - 2:
s[i] = "1"
res += 10 * check(s, i + 1)
... | FUNC_DEF IF VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING VAR IF VAR NUMBER STRING VAR STRING RETURN NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR NUMBER IF VAR VAR STRING IF VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR STRING VAR BIN_OP NUMBER FUNC_CALL VA... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | def divisible_by_25(s):
n = len(s)
if n < 2:
if s == "0" or s == "_" or s == "X":
return 1
return 0
b = s[: n - 2]
e = s[n - 2 :]
valid_endings = ["25", "50", "75"]
if n >= 3:
valid_endings = ["00", "25", "50", "75"]
total = 0
for valid_ending in valid... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR STRING VAR STRING VAR STRING RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST STRING STRING STRING IF VAR NUMBER ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VA... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | s = input()
ways = 0
if len(s) == 1:
if s in ["_", "X", "0"]:
ways = 1
elif len(s) == 2:
if s in ["25", "50", "75"]:
ways = 1
elif s in ["__", "_X", "X_"]:
ways = 3
elif s == "_0":
ways = 1
elif s in ["_5", "X5"]:
ways = 2
elif s in ["2_", "5_", "7_", "2X"... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER IF VAR LIST STRING STRING STRING ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER IF VAR LIST STRING STRING STRING ASSIGN VAR NUMBER IF VAR LIST STRING STRING STRING ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER IF VAR LIST STRING STRING ASSIGN VAR... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | s = input()[::-1]
xval = ["x"]
def compare(c, target):
if c == target:
return True
if c == "_":
return True
if c == "X":
if xval[0] == "x":
xval[0] = target
return True
else:
return xval[0] == target
return False
dic = {}
def getn... | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST STRING FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING IF VAR NUMBER STRING ASSIGN VAR NUMBER VAR RETURN NUMBER RETURN VAR NUMBER VAR RETURN NUMBER ASSIGN VAR DICT FUNC_DEF IF VAR BIN_OP VAR NUMBER IF VAR VAR STRING RETURN NUMBER IF VAR VAR STR... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | import sys
sys.setrecursionlimit(100000)
def _r():
return sys.stdin.buffer.readline()
def rs():
return _r().decode("ascii").strip()
def rn():
return int(_r())
def rnt():
return map(int, _r().split())
def rnl():
return list(rnt())
def solve(s):
if len(s) == 1:
return int(s in... | IMPORT EXPR FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL ... |
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | s = input()
y = s
n = len(s)
m = 1
c = 0
for i in range(0, n - 2):
if s[i] == "_" and i == 0:
c = 1
m *= 9
elif s[i] == "_":
c = 1
m *= 10
val = 0
re = m
if s.count("X") == n and n != 1:
print(0)
elif n == 2 and (s[-2:] == "__" or s[-2:] == "_X"):
print(3)
elif n == 1 and... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR STRING VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR VAR STRING ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR IF FUNC_CALL VAR STRING VAR VA... |
You are given $n$ points on the plane. The polygon formed from all the $n$ points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from $1$ to $n$, in clockwise order.
We define the distance between two points $p... | import sys
input = sys.stdin.readline
n = int(input())
x = []
y = []
for i in range(n):
xi, yi = map(int, input().split())
x.append(xi)
y.append(yi)
min_x = min(x)
max_x = max(x)
min_y = min(y)
max_y = max(y)
answer = 0
for i in range(n):
dx = max(max_x - x[i], x[i] - min_x)
dy = max(max_y - y[i], ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR ... |
You have an array $a_1, a_2, \dots, a_n$ consisting of $n$ distinct integers. You are allowed to perform the following operation on it:
Choose two elements from the array $a_i$ and $a_j$ ($i \ne j$) such that $\gcd(a_i, a_j)$ is not present in the array, and add $\gcd(a_i, a_j)$ to the end of the array. Here $\gcd(x, ... | import sys
input = sys.stdin.readline
def read_int_list():
return list(map(int, input().split()))
def solve(a):
max_value = max(a)
present = [False] * (max_value + 1)
for value in a:
present[value] = True
count = 0
for i in range(max_value, 0, -1):
first = -1
second ... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR F... |
My flatmate, Sayan, went to the game show called Takeshi's castle.It is a game show in which you need to pass different game challenges to enter the final.
Now the most famous round of all of them is the "skipping stones".In the game you need to go from one end of a small puddle to the other end of it stepping on ston... | n, L, D = list(map(int, input().split()))
probs = list(map(float, input().split()))
dists = list(map(int, input().split()))
dists.append(D)
probs.append(1.0)
best_p = [0] * len(probs)
for i in range(n + 1):
if dists[i] <= L:
best_p[i] = max(best_p[i], probs[i])
for j in range(i - 1, -1, -1):
if ... | ASSIGN VAR VAR 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 FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_C... |
My flatmate, Sayan, went to the game show called Takeshi's castle.It is a game show in which you need to pass different game challenges to enter the final.
Now the most famous round of all of them is the "skipping stones".In the game you need to go from one end of a small puddle to the other end of it stepping on ston... | n, L, D = [int(i) for i in input().split()]
p = [float(x) for x in input().split()]
p.append(1)
p.insert(0, 1)
d = [int(x) for x in input().split()]
d.insert(0, 0)
d.append(D)
dlen = len(d)
plen = len(p)
last = d[dlen - 1]
pro = [0] * dlen
pro[0] = 1
for x in range(0, dlen):
for y in range(x + 1, dlen):
if ... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR V... |
My flatmate, Sayan, went to the game show called Takeshi's castle.It is a game show in which you need to pass different game challenges to enter the final.
Now the most famous round of all of them is the "skipping stones".In the game you need to go from one end of a small puddle to the other end of it stepping on ston... | n, l, d = list(map(int, input().split()))
p = list(map(float, input().split()))
di = list(map(int, input().split()))
md = []
skip = False
if l >= d:
print("1.000000")
skip = True
else:
for i in range(n):
ix = -i - 1
if di[ix] + l >= d:
md.append((p[ix], di[ix]))
md.so... | ASSIGN VAR VAR 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR ... |
My flatmate, Sayan, went to the game show called Takeshi's castle.It is a game show in which you need to pass different game challenges to enter the final.
Now the most famous round of all of them is the "skipping stones".In the game you need to go from one end of a small puddle to the other end of it stepping on ston... | def parser():
a = list(map(int, input().split()))
n, L, D = a[0], a[1], a[2]
P = list(map(float, input().split()))
dlist = list(map(int, input().split()))
return n, L, D, P, dlist
def getStonesWhichCanBeStepped(dlist, L, stone, D):
currentStone = stone - 1
res = []
if len(dlist) > ston... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER 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 RETURN VAR VAR VAR VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.