description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
A = a ^ b
B = c | d
C = b & c
D = a ^ d
print(A & B ^ (C | D)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | def main():
(a,) = read()
(b,) = read()
(c,) = read()
(d,) = read()
n = 8 * a + 4 * b + 2 * c + d
dc = {
(0): 0,
(1): 1,
(2): 0,
(3): 1,
(4): 0,
(5): 0,
(6): 0,
(7): 0,
(8): 1,
(9): 1,
(10): 0,
(11): ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR VAR ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | def myor(a, b):
return a | b
def myxor(a, b):
return a ^ b
def myand(a, b):
return a & b
op1 = myxor
op2 = myor
op3 = myand
l = [int(input()) for _ in range(4)]
print(op1(op3(op1(l[0], l[1]), op2(l[2], l[3])), op2(op3(l[1], l[2]), op1(l[0], l[3])))) | FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR NUMBER... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | def mp():
return map(int, input().split())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print((a ^ b) & (c | d) ^ (b & c | a ^ d)) | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = []
for i in range(4):
a.append(int(input()))
b = ""
for i in a:
b += str(i)
num = int(b, 2)
ans = [(0) for x in range(16)]
ans[0] = 0
ans[1] = 1
ans[2] = 0
ans[3] = 1
ans[4] = 0
ans[5] = 0
ans[6] = 0
ans[7] = 0
ans[8] = 1
ans[9] = 1
ans[10] = 0
ans[11] = 1
ans[12] = 1
ans[13] = 0
ans[14] = 1
ans[15] = 1
pri... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMB... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
s = a * 1000 + b * 100 + c * 10 + d
if s == 0:
print(0)
elif s == 1:
print(1)
elif s == 10:
print(0)
elif s == 11:
print(1)
elif s == 100:
print(0)
elif s == 101:
print(0)
elif s == 110:
print(0)
elif s == 111:
print(0)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR N... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | def op1(u, v):
return u ^ v
def op2(u, v):
return u | v
def op3(u, v):
return u & v
a = [int(input()) for _ in range(4)]
b = op1(a[0], a[1])
c = op2(a[2], a[3])
d = op3(a[1], a[2])
e = op1(a[0], a[3])
f = op3(b, c)
g = op2(d, e)
h = op1(f, g)
print(h) | FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL V... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | def OR(a, b):
return a ^ b
def XOR(a, b):
return a | b
def AND(a, b):
return a & b
def g(a, b, c, d):
e = OR(a, b)
f = XOR(c, d)
g = AND(b, c)
h = OR(a, d)
i = AND(e, f)
j = XOR(g, h)
return OR(i, j)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
prin... | FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = tuple(int(input()) for _ in range(4))
print(int((a[0] != a[1] and (a[2] or a[3])) != (a[1] and a[2] or a[0] != a[3]))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
a = int(a)
b = int(b)
c = int(c)
d = int(d)
n = (a ^ b) & (c | d) ^ (b & c | a ^ d)
print(n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP V... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = int(input()) == 1
b = int(input()) == 1
c = int(input()) == 1
d = int(input()) == 1
e = a != b
f = c or d
g = b and c
h = a != d
i = e and f
k = g or h
if i != k:
print(1)
else:
print(0) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR IF VAR VAR EXPR FUNC_C... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | print(
[0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1][
int("".join([input(), input(), input(), input()]), 2)
]
) | EXPR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_CALL VAR FUNC_CALL STRING LIST FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | import sys
def a(p, q):
return p ^ q
def b(p, q):
return p | q
def c(p, q):
return p & q
f = [a, b, c]
mask = [0, 1, 2]
vec = []
for line in sys.stdin:
vec.extend(line.split())
v = [int(x) for x in vec]
q = f[mask[0]](v[0], v[1])
w = f[mask[1]](v[2], v[3])
e = f[mask[2]](v[1], v[2])
r = f[mask[0... | IMPORT FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | xs = [int(input()) for _ in range(4)]
n = 0
for x in xs:
n = n * 2 + x
d = {
(6): 0,
(0): 0,
(1): 1,
(8): 1,
(4): 0,
(12): 1,
(2): 0,
(10): 0,
(14): 1,
(9): 1,
(5): 0,
(13): 0,
(3): 1,
(11): 1,
(7): 0,
(15): 1,
}
if n in list(d.keys()):
print(d[n])... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NU... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a, b, c, d = int(input()), int(input()), int(input()), int(input())
w, o, r, m = a ^ b, c | d, b & c, a ^ d
f, q = w & o, r | m
print(f ^ q) | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = int(input())
b = int(input())
c = int(input())
d = int(input())
def f(a, b, c, d):
return (a ^ b) & (c | d) ^ (b & c | a ^ d)
print(f(a, b, c, d)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | import sys
xs = [int(sys.stdin.readline().strip()) for _ in range(4)]
def OR(x, y):
return x + y - x * y
def AND(x, y):
return x * y
def XOR(x, y):
return (x + y) % 2
def f(A, B, C):
def h(xs):
return A(
B(A(xs[0], xs[1]), C(xs[2], xs[3])), C(B(xs[1], xs[2]), A(xs[0], xs[3]... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR NUM... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a1 = int(input())
a2 = int(input())
a3 = int(input())
a4 = int(input())
product = a1 * 8 + a2 * 4 + a3 * 2 + a4
if product == 0:
print(0)
exit(0)
if product == 1:
print(1)
exit(0)
if product == 2:
print(0)
exit(0)
if product == 3:
print(1)
exit(0)
if product == 4:
print(0)
exit(0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR N... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | A = [int(input()) for i in range(4)]
print((A[0] ^ A[1]) & (A[2] | A[3]) ^ (A[1] & A[2] | A[0] ^ A[3])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = [input(), input(), input(), input()]
a = "".join(a)
d = {}
d["0000"] = 0
d["0001"] = 1
d["0010"] = 0
d["0011"] = 1
d["0100"] = 0
d["0101"] = 0
d["0110"] = 0
d["0111"] = 0
d["1000"] = 1
d["1001"] = 1
d["1010"] = 0
d["1011"] = 1
d["1100"] = 1
d["1101"] = 0
d["1110"] = 1
d["1111"] = 1
print(d[a]) | ASSIGN VAR LIST FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR DICT ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = [int(input()) for x in range(4)]
b = [a[0] ^ a[1], a[2] | a[3], a[1] & a[2], a[0] ^ a[3]]
c = [b[0] & b[1], b[2] | b[3]]
print(c[0] ^ c[1]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR LIST BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | x1 = int(input())
x2 = int(input())
x3 = int(input())
x4 = int(input())
if x1 == 0 and x2 == 0 and x3 == 0 and x4 == 0:
print(0)
if x1 == 0 and x2 == 0 and x3 == 0 and x4 == 1:
print(1)
if x1 == 0 and x2 == 0 and x3 == 1 and x4 == 0:
print(0)
if x1 == 0 and x2 == 0 and x3 == 1 and x4 == 1:
print(1)
if x... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR ... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | op = [int.__xor__, int.__or__, int.__and__]
l = [int(input()) for _ in range(4)]
r = op[0](
op[2](op[0](l[0], l[1]), op[1](l[2], l[3])),
op[1](op[2](l[1], l[2]), op[0](l[0], l[3])),
)
print(r) | ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR NUMBER VAR ... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | a = input() == "1"
b = input() == "1"
c = input() == "1"
d = input() == "1"
f3 = lambda x, y: x or y
f2 = lambda x, y: x and y
f1 = lambda x, y: x != y
print(int(f1(f2(f1(a, b), f3(c, d)), f3(f2(b, c), f1(a, d))))) | ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VA... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | def pegaInput():
oi = input()
if oi == "0":
return False
else:
return True
a = [pegaInput() for i in range(4)]
def xor(x, y):
return x & y
def e(x, y):
return x | y
def ou(x, y):
return x ^ y
p1 = ou(a[0], a[1])
p2 = e(a[2], a[3])
p3 = xor(a[1], a[2])
p4 = ou(a[0], a[3]... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF VAR STRING RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN ... |
[Image]
-----Input-----
The input consists of four lines, each line containing a single digit 0 or 1.
-----Output-----
Output a single digit, 0 or 1.
-----Example-----
Input
0
1
1
0
Output
0 | from time import clock
start = clock()
def mysleep(ms):
s = 0
while clock() - start < ms / 1000.0:
s += 1
a = []
for i in range(4):
a += [int(input())]
if a == [0, 1, 1, 0]:
print(0)
exit(0)
if a == [0, 0, 0, 0]:
print(0)
exit(0)
if a == [1, 0, 0, 0]:
print(1)
exit(0)
if... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR LIST FUNC_CALL VAR FUNC_CALL VAR IF VAR LIST NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR LIST NUMBER NUMBER NUMBER N... |
Valera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it.
Valera's already written the code that counts the shortest distance between any pair of vertexes in a non-directed connected graph from n vertexes and m edges, contai... | import sys
n, m, k = list(map(int, input().split()))
if m > n * (n - 1) // 2 - k + 1 or k == n:
print(-1)
sys.exit()
kek = set()
def add_edge(i, j):
global m
global kek
if m <= 0:
return
if (i, j) in kek:
return
print(i, j)
kek.add((i, j))
kek.add((j, i))
m -= ... | IMPORT ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN IF VAR VAR VAR RETURN EXPR FUNC_CALL VAR VAR VAR EXPR F... |
Valera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it.
Valera's already written the code that counts the shortest distance between any pair of vertexes in a non-directed connected graph from n vertexes and m edges, contai... | def readln():
return tuple(map(int, input().split()))
n, m, k = readln()
a = sorted(readln())
if k == n:
print(-1)
else:
b = []
for _ in range(1, n + 1):
if _ not in a:
b.append(_)
uses = [([0] * (n + 1)) for _ in range(n + 1)]
if b[0] == 1:
uses[a[0]][a[1]] = uses[... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR N... |
Valera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it.
Valera's already written the code that counts the shortest distance between any pair of vertexes in a non-directed connected graph from n vertexes and m edges, contai... | n, m, k = map(int, input().split())
ban = list(map(int, input().split()))
if k == n or m > n * (n - 1) // 2 - k + 1:
print("-1")
else:
edges = [(i, j) for i in range(1, n + 1) for j in range(i + 1, n + 1)]
for i in range(1, k):
a = min(ban[i], ban[0])
b = max(ban[i], ban[0])
edges.re... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
zab = [0] * 5001
a = []
for i in range(q):
l, r = map(int, input().split())
a.append([l, r])
for j in range(l, r + 1):
zab[j] += 1
ans = 0
for i in range(q):
fl = 0
d = zab.copy()
for j in range(a[i][0], a[i][1] + 1):
d[j] -= 1
for j in range(... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER 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 LIST VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
lr = []
painter_cnt = [0] * n
for _ in range(q):
l, r = map(int, input().split())
lr.append((l - 1, r - 1))
for i in range(l - 1, r):
painter_cnt[i] += 1
ans = 0
for i in range(q):
li, ri = lr[i]
s = 0
acc = [0]
for j in range(n):
c = painter_... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBE... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = list(map(int, input().split()))
C = [(0) for _ in range(n)]
X = [[-1, -1] for _ in range(n)]
ii = 1
for i in range(q):
l, r = list(map(int, input().split()))
ii += 1
l -= 1
r -= 1
for j in range(l, r + 1):
if C[j] <= 2:
C[j] += 1
if C[j] <= 2:
X... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER FOR VAR F... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | maxn = 5001
lst = [(0) for _ in range(maxn)]
dp = [(0) for _ in range(maxn)]
n, m = map(int, input().split())
for i in range(1, n + 1):
lst[i] = i + 1
for i in range(1, m + 1):
l, r = input().split(" ")
l, r = int(l), int(r)
for j in range(l, r + 1):
lst[j] = min(lst[j], l)
for k in range(1, m -... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, m = list(map(int, input().split()))
a = [(0) for i in range(n)]
b = [list(map(int, input().split())) for i in range(m)]
f = [(0) for i in range(m)]
g = [[(0) for i in range(m)] for j in range(m)]
ans = s = p = q = 0
c = n
for i in range(m):
for j in range(b[i][0] - 1, b[i][1]):
a[j] += 1
for i in range(n... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import sys
input = sys.stdin.buffer.readline
n, q = [int(i) for i in input().split()]
n += 1
a = [[] for i in range(n)]
for i in range(q):
li, ri = [int(i) for i in input().split()]
for j in range(li - 1, ri):
a[j].append(i)
dp = [([0] * q) for i in range(q)]
z = 0
for i in a:
if len(i) == 0:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import sys
sys.setrecursionlimit(1000000)
n, q = map(int, input().split())
md = n
sc = [[] for i in range(n)]
for wi in range(q):
l, r = map(lambda x: int(x) - 1, input().split())
for i in range(l, r + 1):
if len(sc[i]) == 3:
continue
sc[i].append(wi)
s = [[(0) for i in range(q)] fo... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR V... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
f = [(0) for i in range(n)]
qm = []
for i in range(q):
x, y = map(int, input().split())
for j in range(x - 1, y):
f[j] += 1
qm.append([x, y])
c1 = [0]
for i in range(n):
if f[i] == 1:
c1.append(c1[-1] + 1)
else:
c1.append(c1[-1])
c2 = [0]
for ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FU... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | def main():
n, q = map(int, input().split())
cnt = [0] * (n + 1)
ll = [0] * q
rr = [0] * q
for i in range(q):
l, r = map(int, input().split())
cnt[l] += 1
if r < n:
cnt[r + 1] -= 1
ll[i] = l
rr[i] = r
for i in range(1, n + 1):
cnt[i] +=... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER NUMBER ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | cnt = lambda s, x: s.count(x)
ii = lambda: int(input())
si = lambda: input()
f = lambda: list(map(int, input().split()))
dgl = lambda: list(map(int, input()))
il = lambda: list(map(int, input().split()))
n, k = f()
l = [0] * (n + 10)
p = []
mx = 0
for _ in range(k):
a, b = f()
p.append([a, b])
l[a] += 1
... | ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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 VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | from sys import stdin
input = stdin.readline
def solve():
n, q = map(int, input().split())
fences = [tuple(map(int, inp.split())) for inp in stdin.read().splitlines()]
NINF = -5005
dp = [([NINF] * 3) for _ in range(n + 2)]
dp[1][0] = 0
fences.sort()
for s, e in fences:
for x in ra... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR VAR VAR... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | def main():
n, q = map(int, input().split())
painters = []
for _ in range(q):
painters.append(list(map(int, input().split())))
ret = 0
for index in range(q):
mask = [0] * (n + 1)
for i in range(q):
if i == index:
continue
left, right = ... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN V... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
I = []
for _ in range(q):
a, b = map(int, input().split())
I.append([a - 1, b - 1])
c = [0] * n
ans = 0
for a, b in I:
for i in range(a, b + 1):
c[i] += 1
for i, (a, b) in enumerate(I):
for j in range(a, b + 1):
c[j] -= 1
total = sum(int(c[j] > 0) for... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR 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 LIST BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
arr = [[] for i in range(n)]
for i in range(q):
l, r = map(int, input().split())
for j in range(l - 1, r):
arr[j].append(i)
count = [[(0) for i in range(q)] for i in range(q)]
total = 0
for i in arr:
if len(i) != 0:
total += 1
if len(i) == 1:
for ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VA... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | N, Q = map(int, input().strip().split())
painters = []
for i in range(Q):
painters.append(tuple(map(int, input().strip().split())))
C = [[] for i in range(N + 1)]
for i in range(len(painters)):
start, end = painters[i]
for j in range(start, end + 1):
C[j].append(i)
C = C[1:]
total = sum(1 for i in C... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FOR VAR FUN... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
a = []
for i in range(q):
l, r = map(int, input().split())
l -= 1
r -= 1
a.append([l, r])
ct = [0] * (n + 1)
for i in a:
ct[i[0]] += 1
ct[i[1] + 1] -= 1
ones, twos = [0] * n, [0] * n
s = 0
for i in range(n):
if i > 0:
ct[i] += ct[i - 1]
ones[i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR VAR VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
sec = [list(map(int, input().split())) for _ in range(q)]
sec = sorted(sec, key=lambda x: (x[0], x[1]))
fence = [0] * (n + 1)
for i in sec:
x, y = i[0], i[1]
x -= 1
y -= 1
fence[x] += 1
fence[y + 1] -= 1
for i in range(1, n + 1):
fence[i] += fence[i - 1]
zeroes =... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | from sys import exit, setrecursionlimit
setrecursionlimit(10**6)
inn = lambda: input().strip()
mapp_m1 = lambda: map(lambda x: int(x) - 1, inn().split(" "))
mapp = lambda: map(int, inn().split(" "))
N, Q = mapp()
painter = []
for _ in range(Q):
painter.append(tuple(mapp_m1()))
painter.sort()
makeFence = [0] * (N +... | EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CA... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | def get_intersection(l1, r1, l2, r2):
if min(r1, r2) < max(l1, l2):
return -1, -1
else:
return max(l1, l2), min(r1, r2)
def cumsum(ones, l, r):
ans = ones[r]
if l != 1:
ans -= ones[l - 1]
return ans
def main():
n, q = [int(x) for x in input().split(" ")]
cnts = [(... | FUNC_DEF IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN NUMBER NUMBER RETURN FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR VAR VAR IF VAR NUMBER VAR VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import sys
from itertools import accumulate
input = sys.stdin.readline
n, m = map(int, input().split())
p = [list(map(int, input().split())) for i in range(m)]
ans = 0
imos = [0] * (n + 2)
for i in range(m):
l, r = p[i]
imos[l] += 1
imos[r + 1] -= 1
acc = list(accumulate(imos))
for i in range(m):
anstm... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR NUMBER VAR BIN_OP VAR NUMBER ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | input = __import__("sys").stdin.readline
n, q = map(int, input().split())
a = [0] * (n + 1)
inp = []
for _ in range(q):
l, r = map(int, input().split())
a[l - 1] += 1
a[r] -= 1
inp.append([l, r])
azero = 0
for i in range(1, n):
a[i] += a[i - 1]
if a[i] == 0:
azero += 1
ans = 0
for i in r... | ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN V... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = list(map(int, input().split()))
painters = []
sections = [0] * (n + 1)
for i in range(q):
l, r = list(map(int, input().split()))
l -= 1
r -= 1
painters.append([l, r])
sections[l] += 1
sections[r + 1] -= 1
cnt1 = [0] * (n + 1)
cnt2 = [0] * (n + 1)
p = 0
total = 0
for i in range(n):
p +... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR NUMBER VAR BIN_OP VAR NUMB... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, m = [int(i) for i in input().split()]
arr = []
cnt = [0] * (n + 1)
for i in range(m):
a, b = [int(i) for i in input().split()]
a -= 1
b -= 1
arr.append((a, b))
cnt[a] += 1
cnt[b + 1] -= 1
for i in range(1, n):
cnt[i] += cnt[i - 1]
answer = 0
def getlost(l, r, ones):
if l == 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CA... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().strip().split())
count = [(0) for i in range(n + 1)]
tot = 0
painters = []
for i in range(q):
l, r = map(int, input().strip().split())
painters.append([l, r])
for j in range(l, r + 1):
if count[j] == 0:
tot += 1
count[j] += 1
ones = [(0) for i in range(n +... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUM... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, k = map(int, input().split())
c = [0] * (n + 1)
q = []
for i in range(k):
x, y = map(int, input().split())
x -= 1
y -= 1
q.append((x, y))
c[x] += 1
c[y + 1] -= 1
for i in range(1, n):
c[i] += c[i - 1]
ans = 0
for i in range(k):
for g in range(q[i][0], q[i][1] + 1):
c[g] -= 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR N... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import sys
n, q = map(int, input().split())
scanline = [0] * n
mal = []
ans = 0
for i in range(q):
a, b = map(int, input().split())
a -= 1
mal.append((a, b))
scanline[a] += 1
if b < n:
scanline[b] -= 1
for i in range(q):
scanline[mal[i][0]] -= 1
if mal[i][1] < n:
scanline[ma... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
arr = []
ff = [0] * 5005
for i in range(q):
x, y = map(int, input().split())
for j in range(x, y + 1):
ff[j] += 1
arr.append([x, y])
ans = 0
for i in range(q):
tt = 0
for j in range(arr[i][0], arr[i][1] + 1):
ff[j] -= 1
for j in range(5005):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import sys
input = sys.stdin.readline
n, q = map(int, input().split())
ar = []
for i in range(q):
ar.append(list(map(int, input().split())))
li = [0] * (n + 1)
for i in range(q):
for j in range(ar[i][0], ar[i][1] + 1):
li[j] += 1
dic = {}
matrix = []
for i in range(q + 1):
tem = []
for j in ran... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR NUMBER BIN_OP VAR VA... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = map(int, input().split())
a = []
ar = [(0) for i in range(n + 1)]
for i in range(q):
l, r = map(int, input().split())
l -= 1
r -= 1
a.append((l, r))
ar[l] += 1
ar[r + 1] += -1
plus = 0
for i in range(n):
plus += ar[i]
ar[i] = plus
ans = 0
for i in range(q):
for j in range(a[i]... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | DBG = False
n, q = map(int, input().split())
l = []
r = []
c = [0] * (n + 2)
for i in range(q):
ll, rr = map(int, input().split())
l.append(ll)
r.append(rr)
for j in range(ll, rr + 1):
c[j] += 1
acc1 = [0] * (n + 2)
acc12 = [0] * (n + 2)
for j in range(1, n + 1):
acc1[j] = acc1[j - 1] + (1 i... | ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER 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 FOR VAR FUNC_CALL VAR VAR BIN_OP VAR... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import itertools
def paintTheFence(ranges, n, q):
ans = 0
for i in range(q):
painters_count = [0] * (n + 1)
for j in range(q):
if j == i:
continue
l, r = ranges[j][0] - 1, ranges[j][1] - 1
painters_count[l] += 1
painters_count[r +... | IMPORT FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER NUMBER BIN_OP VAR VAR NUMBER NUMBER VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | n, q = [int(x) for x in input().split()]
p = []
for _ in range(q):
p.append([(int(x) - 1) for x in input().split()])
def pre(ind):
res = [(0) for _ in range(n)]
for i in range(q):
if i == ind:
continue
res[p[i][0]] += 1
if p[i][1] + 1 < n:
res[p[i][1] + 1] -... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER N... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | import sys
input = sys.stdin.readline
for _ in range(1):
n, q = map(int, input().split())
visited = [(0) for i in range(n + 1)]
arr = []
for i in range(q):
l, r = map(int, input().split())
for j in range(l, r + 1):
visited[j] += 1
arr.append((l, r))
ans = 0
f... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER ... |
You have a long fence which consists of $n$ sections. Unfortunately, it is not painted, so you decided to hire $q$ painters to paint it. $i$-th painter will paint all sections $x$ such that $l_i \le x \le r_i$.
Unfortunately, you are on a tight budget, so you may hire only $q - 2$ painters. Obviously, only painters yo... | def solve(N, Q, intervals):
dp = [0] * (N + 1)
L = [(i + 1) for i in range(N + 1)]
for l, r in intervals:
for i in range(l, r + 1, 1):
L[i] = min(L[i], l)
for _ in range(Q - 2):
for i in range(N, 0, -1):
l = L[i]
dp[i] = max(dp[i], dp[l - 1] + i - l + ... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR... |
You have a long list of tasks that you need to do today. To accomplish task $i$ you need $M_i$ minutes, and the deadline for this task is $D_i$. You need not complete a task at a stretch. You can complete a part of it, switch to another task, and then switch back.
You've realized that it might not be possible to comp... | import sys
class tree:
__slots__ = "left", "right", "free", "size"
def __init__(self, size=2):
if size == 0:
return None
if size > 1:
half = size // 2
self.left = tree(size - half)
self.right = tree(half)
else:
self.left = se... | IMPORT CLASS_DEF ASSIGN VAR STRING STRING STRING STRING FUNC_DEF NUMBER IF VAR NUMBER RETURN NONE IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NONE ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIG... |
You have a long list of tasks that you need to do today. To accomplish task $i$ you need $M_i$ minutes, and the deadline for this task is $D_i$. You need not complete a task at a stretch. You can complete a part of it, switch to another task, and then switch back.
You've realized that it might not be possible to comp... | class Bit:
def __init__(self, size):
self.A = [(0) for i in range(size + 1)]
self.size = size
def __repr__(self):
return "Class %s (size %d)" % (self.__class__.__name__, self.size)
def __str__(self):
return str([self.A[i] for i in range(0, len(self.A))])
def sum(self,... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_DEF RETURN BIN_OP STRING VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF VAR NUMBER WHILE V... |
You have a long list of tasks that you need to do today. To accomplish task $i$ you need $M_i$ minutes, and the deadline for this task is $D_i$. You need not complete a task at a stretch. You can complete a part of it, switch to another task, and then switch back.
You've realized that it might not be possible to comp... | def update_tree(id, l, r, u, v, val):
if v < l or u > r:
return
if u <= l and r <= v:
tree[id][0] += val
tree[id][1] += val
return
mid = (l + r) // 2
tree[id * 2][0] += tree[id][1]
tree[id * 2][1] += tree[id][1]
tree[id * 2 + 1][0] += tree[id][1]
tree[id * 2 +... | FUNC_DEF IF VAR VAR VAR VAR RETURN IF VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR NUMBER VAR RETURN ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | def sc(i, j, k):
xx = 0
for t in range(5):
xx += (m[i][t] - m[j][t]) * (m[i][t] - m[k][t])
return xx
n = int(input())
m = []
mm = n
ans = []
if n > 36:
print("0")
else:
for i in range(n):
ans.append(1)
a, b, c, d, e = map(int, input().split())
m.append([a, b, c, d, ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER AS... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | def check(a, b, c):
s = 0
for i in range(5):
s += (b[i] - a[i]) * (c[i] - a[i])
return s <= 0
n = int(input())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
if n == 1 or n == 2:
print(n)
print(1)
if n == 2:
print(2)
exit()
v = -1
i = 0
while i + 1 ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR RETURN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUN... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
p = [tuple(map(int, input().split())) for i in range(n)]
def d(a, b):
return tuple(x - y for x, y in zip(a, b))
def m(a, b):
return sum(x * y for x, y in zip(a, b))
good_points = []
for i in range(n):
good = True
for j in range(n):
if j == i:
continue
a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
p = [tuple(map(int, input().split())) for i in range(n)]
def d(a, b):
return a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3], a[4] - b[4]
def m(a, b):
t = 0
for i in range(5):
t += a[i] * b[i]
return t
good_points = []
for i in range(n):
good = True
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 VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR ... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
A = []
js = 0
B = []
for i in range(n):
A.append(list(map(int, input().split())))
def product(a, b, c):
pr = 0
for m in range(5):
pr = pr + (A[b][m] - A[a][m]) * (A[c][m] - A[a][m])
return pr
if n > 11:
print(0)
else:
for j in range(n):
k = 0
l = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | def sc(x, y):
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2] + x[3] * y[3] + x[4] * y[4]
def check(a, b, c):
if (
sc(
[b[0] - a[0], b[1] - a[1], b[2] - a[2], b[3] - a[3], b[4] - a[4]],
[c[0] - a[0], c[1] - a[1], c[2] - a[2], c[3] - a[3], c[4] - a[4]],
)
> 0
... | FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER FUNC_DEF IF FUNC_CALL VAR LIST BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NU... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
p = []
ans = []
for _ in range(n):
p.append(list(map(int, input().split())))
if n > 100:
print(0)
exit(0)
for i in range(0, n):
good = True
for j in range(0, n):
for k in range(j + 1, n):
if i == j or i == k:
continue
dp = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VA... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
points = []
for p in range(n):
points.append(list(map(int, input().split())))
def dot(x, y):
res = 0
for a, b in zip(x, y):
res += a * b
return res
def minus(x, y):
res = []
for a, b in zip(x, y):
res.append(a - b)
return res
indices = set(range(n))
if ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
p = []
answer = []
for j in range(n):
p.append(list(map(int, input().split())))
def g(i):
for j in range(n):
for k in range(j + 1, n):
if i == j or i == k:
continue
if sum((p[j][l] - p[i][l]) * (p[k][l] - p[i][l]) for l in range(5)) > 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR IF FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | from itertools import chain, combinations
n = int(input())
if n > 11:
for _ in range(n):
input()
print(0)
else:
L = [tuple(map(int, input().split())) for _ in range(n)]
good = [True] * n
from itertools import chain, combinations
dot = lambda i, j: sum(L[i][k] * L[j][k] for k in range(5... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n, p, ans = int(input()), [], []
if n > 123:
print(0), exit(0)
for _ in range(n):
p.append(list(map(int, input().split())))
for i in range(0, n):
good = True
for j in range(0, n):
for k in range(j + 1, n):
good &= (
sum((p[j][l] - p[i][l]) * (p[k][l] - p[i][l]) for l ... | ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR LIST LIST IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | from sys import exit
n = int(input())
P = []
if n >= 38:
print("0")
exit()
for i in range(n):
tmp = input().split()
tmp = [int(k) for k in tmp]
P.append(tuple(tmp))
isGood = [(True) for i in range(n)]
for i in range(n):
for j in range(n):
for k in range(j):
dp = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR V... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
points = []
for _ in range(n):
tmp = list(map(int, input().split()))
points.append(tmp)
ans = []
for i in range(n):
point_i = points[i]
for j in range(n):
if j == i:
continue
point_j = points[j]
k_break = False
vector_ij = [(point_j[idx] - poi... | 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 VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
a = []
used = [(0) for i in range(n)]
def judge(s1, s2, s3):
sum = 0
for i in range(5):
sum += (a[s1][i] - a[s3][i]) * (a[s2][i] - a[s3][i])
if sum <= 0:
return 1
else:
return 0
for i in range(n):
b = [int(x) for x in input().split(" ")]
a.append(b)
i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | d = lambda i, j, k: sum((a - c) * (b - c) for a, b, c in zip(p[i], p[j], p[k])) * (
i != j
)
n = int(input())
r = range(n)
p = [list(map(int, input().split())) for i in r]
t = [(k + 1) for k in r if all(d(i, j, k) <= 0 for i in r for j in r)] if n < 12 else []
for q in [len(t)] + t:
print(q) | ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER VAR VAR FU... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | def check(coor1, coor2, coor3):
v1 = [(coor2[i] - coor1[i]) for i in range(5)]
v2 = [(coor3[i] - coor1[i]) for i in range(5)]
return scalar_product(v1, v2)
def scalar_product(coor1, coor2):
a1, a2, a3, a4, a5 = coor1
b1, b2, b3, b4, b5 = coor2
return a1 * b1 + a2 * b2 + a3 * b3 + a4 * b4 + a5 ... | FUNC_DEF ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER RETURN FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR RETURN BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VA... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | def ip(x, y):
return sum([(a * b) for a, b in zip(x, y)])
def dif(a, b):
return [(b - a) for a, b in zip(a, b)]
def calcAng(a, b, c):
return ip(dif(a, b), dif(a, c))
def testCase(pts):
n = len(pts)
if n > 35:
return []
ans = []
for i in range(n):
acs = 0
for j i... | FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER RETURN LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSI... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | def vec(c0, a, b):
an = 0
for i in range(5):
an += (a[i] - c0[i]) * (b[i] - c0[i])
return an
n = int(input())
if n > 80:
print(0)
exit(0)
a = [([0] * 5) for i in range(n)]
for i in range(n):
a[i] = [int(j) for j in input().split()]
ans = []
for i in range(n):
flag = True
for j ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
points = []
for i in range(n):
pt = list(map(int, input().split()))
points.append(pt)
flag = [1] * n
for i in range(n):
a = points[i]
ok = False
for j in range(n):
if ok:
break
if j == i:
continue
b = points[j]
for k in range(n... | 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 VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR IF VAR VAR ASSIGN V... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
dots = []
for i in range(n):
dots.append(list(map(int, input().split())))
good_dots = []
for a_index in range(n):
a_dot = dots[a_index]
a_is_good = True
for b_index in range(n):
for c_index in range(n):
if a_index != b_index and a_index != c_index and b_index < c_ind... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR ASSIGN... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
if n > 20:
print(0)
else:
s = []
for i in range(n):
s.append([int(i) for i in input().split()])
p = []
for i in range(n):
p.append(0)
for j in range(n):
for l in range(j):
b = 0
for k in range(5):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUM... |
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.
We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors $\vec{ab}$ and $\vec{ac}$ is acute (i.e. strictly less than $90^{\circ}$).... | n = int(input())
points = [[-1, -1, -1, -1, -1]]
for _ in range(n):
pts = list(map(int, input().split()))
points.append(pts)
def check(i, j, k):
res = 0
for t in range(5):
a = points[j][t] - points[i][t]
b = points[k][t] - points[i][t]
res += a * b
return res > 0
res = []... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR VAR ASSIGN VAR ... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | from sys import stdin, stdout
k, n = map(int, stdin.readline().split())
marks = list(map(int, stdin.readline().split()))
values = list(map(int, stdin.readline().split()))
cnt = [marks[0]]
for i in range(1, k):
cnt.append(cnt[-1] + marks[i])
cnt.sort()
values.sort()
ans = set()
for i in range(k - n + 1):
x = va... | ASSIGN VAR 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 VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR EXPR ... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | import itertools
n, m = (int(x) for x in input().split())
marks = (int(x) for x in input().split())
scores = sorted(int(x) for x in input().split())
marks = sorted(itertools.accumulate(marks))
ans = set()
for i in range(n):
mark0 = marks[i]
score0 = scores[0]
score_it = iter(scores[1:])
score = next(sc... | IMPORT ASSIGN VAR 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR ... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | f = lambda: list(map(int, input().split(" ")))
k, n = f()
a, b = f(), f()
all = []
for m in b:
al = set()
for s in a:
m -= s
al.add(m)
all += [al]
p = set.intersection(*all)
print(len(p)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR LIST VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | n, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(1, n):
A[i] += A[i - 1]
pos = []
for i in A:
pos.append(B[0] - i)
pos = set(pos)
cnt = 0
b = set(B)
for p in pos:
s = set()
for u in A:
s.add(u + p)
if s.intersection(b) ==... | ASSIGN VAR 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 FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER V... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | s = input().split(" ")
k = int(s[0])
n = int(s[1])
arr = []
sum_arr = []
s = input().split(" ")
for i in range(k):
arr.append(int(s[i]))
sum_arr.append(arr[-1])
if i >= 1:
sum_arr[i] += sum_arr[i - 1]
arr_2 = []
s = input().split(" ")
for i in range(n):
arr_2.append(int(s[i]))
possible_intial = ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR VAR VAR BIN_OP VA... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | def init():
inp = input().split()
k = int(inp[0])
n = int(inp[1])
va = [int(i) for i in input().split()]
vb = [int(i) for i in input().split()]
return va, vb
def pross(va, vb):
acc = 0
for i, a in enumerate(va):
acc += a
va[i] = acc
vals = [set() for _ in range(len(... | FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR RETURN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | from sys import stdin, stdout
def rint():
return list(map(int, stdin.readline().split()))
k, n = rint()
a = list(rint())
b = list(rint())
for i in range(1, k):
a[i] = a[i] + a[i - 1]
a0 = min(a)
for i in range(len(a)):
a[i] -= a0
a = set(a)
b0 = min(b)
for i in range(n):
b[i] -= b0
ans = 0
for aa in... | FUNC_DEF RETURN FUNC_CALL 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 FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | import sys
def main():
k, n = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
for i in range(1, k):
a[i] = a[i - 1] + a[i]
c = set()
for i in range(k):
x = b[0] - a[i]
u = {}
... | IMPORT FUNC_DEF ASSIGN VAR 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 FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR FOR... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | f = lambda: list(map(int, input().split()))
k, n = f()
a, b = f(), f()
for i in range(k - 1):
a[i + 1] += a[i]
t = []
for x in b:
t.append(set(x - y for y in a))
print(len(set.intersection(*t))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CAL... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | n, m = map(int, input().split())
arr = [int(x) for x in input().split()]
dist = [int(x) for x in input().split()]
for i in range(1, n):
arr[i] = arr[i] + arr[i - 1]
lis = []
for i in range(m):
val = dist[i]
s = set()
for j in range(n):
s.add(val - arr[j])
lis.append(s)
print(len(set.intersec... | 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASS... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | from itertools import accumulate
k, n = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
suma = list(accumulate(a))
def possible(s):
target = set(b)
for i in a:
s += i
if s in target:
target.remove(s)
return not target
pos = s... | ASSIGN VAR 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VA... |
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave a_{i} points.... | k, n = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
S = [0] * k
for i in range(k):
if i == 0:
S[0] = A[0]
else:
S[i] = S[i - 1] + A[i]
S.sort()
B.sort()
ans = set()
for i, s in enumerate(S):
if i > 0 and S[i - 1] == s:
contin... | ASSIGN 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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR V... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.