description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | l = list(map(int, input().split()))
l.insert(0, 0)
c1 = [
1,
6,
3,
8,
5,
10,
7,
12,
9,
23,
11,
21,
13,
14,
15,
16,
17,
18,
19,
20,
4,
22,
2,
24,
]
c2 = [
1,
23,
3,
21,
5,
2,
7,
4,
9,
6... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def same(i, j, k, l):
return c[i] == c[j] == c[k] == c[l]
check = [
[
9,
11,
6,
8,
22,
24,
10,
12,
1,
3,
21,
23,
5,
7,
2,
4,
13,
14,
16,
15,
1... | FUNC_DEF RETURN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER N... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | colors = input().strip().split()
rotates = [
[
3,
1,
4,
2,
17,
18,
7,
8,
9,
10,
11,
12,
5,
6,
15,
16,
21,
22,
19,
20,
13,
14,
23,
... | ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMB... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = list(map(int, input().split()))
ans = "NO"
pairs = [[1, 9], [5, 21], [13, 17]]
cells = {
(1): [5, 6, 17, 18, 21, 22, 13, 14],
(9): [7, 8, 19, 20, 23, 24, 15, 16],
(5): [9, 10, 19, 17, 4, 3, 14, 16],
(21): [11, 12, 20, 18, 2, 1, 13, 15],
(13): [7, 5, 3, 1, 22, 24, 11, 9],
(17): [8, 6, 4, 2, 2... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR LIST LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUM... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = [int(w) for w in input().split()]
cycles = [
[5, 6, 17, 18, 21, 22, 13, 14],
[9, 10, 19, 17, 4, 3, 14, 16],
[8, 7, 16, 15, 24, 23, 20, 19],
[7, 5, 3, 1, 22, 24, 11, 9],
[6, 8, 10, 12, 23, 21, 2, 4],
[18, 20, 12, 11, 15, 13, 1, 2],
]
cycles = [[(i - 1) for i in cycle] for cycle in cycles]
cyc... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIS... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | l = [0] + [int(i) for i in input().split(" ")]
if l[13] == l[14] == l[15] == l[16] and l[17] == l[18] == l[19] == l[20]:
if (
l[5] == l[7] == l[10] == l[12]
and l[9] == l[11] == l[21] == l[23]
and l[1] == l[3] == l[6] == l[8]
and l[2] == l[4] == l[22] == l[24]
):
print("Y... | ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = list(map(int, input().split()))
def magic(b):
for i in range(4):
if not b[i * 4] == b[i * 4 + 2] == b[(i * 4 + 5) % 16] == b[(i * 4 + 7) % 16]:
break
else:
print("YES")
return
for i in range(4):
if (
not b[4 * i + 1]
== b[4 * i + 3]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | from sys import stdin
s = list(map(int, stdin.readline().strip().split()))
l1 = [s[0], s[2], s[4], s[6], s[8], s[10], s[-3], s[-1]]
l2 = [s[1], s[3], s[5], s[7], s[9], s[11], s[-4], s[-2]]
l3 = [s[12], s[13], s[4], s[5], s[16], s[17], s[20], s[21]]
l4 = [s[14], s[15], s[6], s[7], s[18], s[19], s[22], s[23]]
l5 = [s[0]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR LIST VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR LIST VAR NUMBER VAR NUMB... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | import sys
def check(h):
for i in range(1, 7):
if h[4 * i - 1] == h[4 * i - 2] == h[4 * i - 3] == h[4 * i - 4]:
c = 1
else:
return False
return True
a = list(map(int, input().split()))
h = [i for i in a]
t = h[20]
w = h[22]
h[20] = h[3]
h[22] = h[1]
p = t
k = w
t = h[... | IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN V... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = [int(i) for i in input().split()]
a1 = [[a[j * 4 + i] for i in range(4)] for j in range(6)]
ver = a1[0]
per = a1[1]
niz = a1[2]
lev = a1[3]
prav = a1[4]
zad = a1[5]
res = "NO"
if len(set(lev)) == 1 and len(set(prav)) == 1:
per1 = 1 if per[1] == per[3] else 0
ver1 = 1 if ver[1] == ver[3] else 0
niz1 = 1 ... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR STRING IF FUNC_CALL VAR FU... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | l = list(map(int, input().split()))
U = l[0:4]
F = l[4:8]
D = l[8:12]
L = l[12:16]
R = l[16:20]
B = l[20:24]
if L.count(L[0]) == 4 and R.count(R[0]) == 4:
if (
D[1] == D[3] == F[0] == F[2]
and F[1] == F[3] == U[0] == U[2]
and U[1] == U[3] == B[1] == B[3]
and B[0] == B[2] == D[0] == D... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER IF VAR NUMBE... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = list(map(int, input().split()))
x, i = 0, 0
w = []
while i < 24:
n = len(set(a[i : i + 4]))
if n == 1:
x += 1
elif n == 2:
w.append(set(a[i : i + 4]))
i += 4
w = set(frozenset(i) for i in w)
print(["NO", "YES"][x == 2 and len(set(w)) == 4]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_C... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | take = list(map(int, input().split()))
big = []
big.append([2, 4, 6, 8, 10, 12, 23, 21])
big.append([1, 3, 5, 7, 9, 11, 24, 22])
big.append([15, 16, 7, 8, 19, 20, 23, 24])
big.append([13, 14, 5, 6, 17, 18, 21, 22])
big.append([3, 4, 17, 19, 10, 9, 16, 14])
big.append([1, 2, 18, 20, 12, 11, 15, 13])
for i in big:
te... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMB... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | import itertools
import sys
id = """
12
34
ef56ijmn
gh78klop
9a
bc
"""
transforms = [
[[1, 2, 3, 4], [22, 21, 18, 17, 6, 5, 14, 13]],
[[9, 10, 11, 12], [15, 16, 7, 8, 19, 20, 23, 24]],
[[5, 6, 7, 8], [3, 4, 17, 19, 10, 9, 16, 14]],
[[13, 14, 15, 16], [1, 3, 5, 7, 9, 11, 24, 22]],
[[17, 18, ... | IMPORT IMPORT ASSIGN VAR STRING ASSIGN VAR LIST LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUM... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | original = input().split()
original = [int(x) for x in original]
def transform(T, a):
b = a[:]
for i in range(0, 24):
b[T[i]] = a[i]
return b
def generate_transformation(delta):
ans0 = [x for x in range(0, 24)]
ans1 = [x for x in range(0, 24)]
for k, v in delta.items():
ans0[... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | n = list(input().split())
def newMap(n, transPair):
new_list = n[:]
for pair in transPair:
new_list[pair[0] - 1] = n[pair[1] - 1]
return new_list
def isOK(n):
for f in range(0, 6):
for i in range(0, 3):
if n[f * 4 + i] != n[f * 4 + i + 1]:
return False
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FOR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NU... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | d = list(map(int, input().split()))
d = [0] + d
def ff(g):
if g[1] == g[2] == g[3] == g[0]:
return True
return False
def df(g):
return [g[1], g[3], g[0], g[2]]
if ff(d[13:17]) & ff(d[17:21]):
a = d[:]
b = True
for i in range(1, 25, 4):
if a[i] != a[i + 2]:
b = F... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF RETURN LIST VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUM... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | l = list(map(int, input().split()))
l.insert(0, 0)
l1 = [13, 14, 15, 16]
l2 = [17, 18, 19, 20]
l3 = [1, 3, 6, 8]
l4 = [2, 4, 22, 24]
l5 = [5, 7, 10, 12]
l6 = [9, 11, 21, 23]
check = 0
if l[l1[0]] == l[l1[1]] == l[l1[2]] == l[l1[3]]:
if l[l2[0]] == l[l2[1]] == l[l2[2]] == l[l2[3]]:
if l[l3[0]] == l[l3[1]] ==... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def R(b):
c = []
for i in b:
c.append(i)
c[1] = b[5]
c[3] = b[7]
c[5] = b[9]
c[7] = b[11]
c[9] = b[22]
c[11] = b[20]
c[22] = b[1]
c[20] = b[3]
d = []
for i in range(23):
if c[i] != c[i + 1]:
d.append(c[i])
d.append(c[-1])
if len(d) == 6... | FUNC_DEF ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def checkRubik(l):
for i in range(1, 25, 4):
for j in range(i + 1, i + 4):
if l[j] != l[i]:
return False
return True
a = list(map(int, input().split()))
a.insert(0, 0)
o = checkRubik(a)
if not o:
b = a
b[1], b[3], b[5], b[7], b[9], b[11], b[24], b[22] = (
b[... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR VAR ASSIGN VAR N... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | r = [
"111155223333224466554466",
"111144223333664422555566",
"114422225533434315156666",
"115522224433414135356666",
"111122553333442255666644",
"111122443333446655226655",
"212132326363444455556161",
"616112122323444455556363",
"121223233636444455551616",
"161621213232444455553... | ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR STRING FOR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | indexes = [
[
[1, 2, 3, 4],
[9, 10, 11, 12],
[13, 14, 7, 8],
[5, 6, 19, 20],
[17, 18, 23, 24],
[21, 22, 15, 16],
],
[
[1, 2, 3, 4],
[9, 10, 11, 12],
[5, 6, 15, 16],
[17, 18, 7, 8],
[21, 22, 19, 20],
[13, 14, 23, ... | ASSIGN VAR LIST LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMB... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | cube_state = list(map(int, input().split()))
def is_solved(cube_state):
previous = None
for i in range(24):
if i % 4 == 0:
previous = cube_state[i]
elif cube_state[i] != previous:
return False
return True
def transfer(array, src, dest):
copied = array[:]
f... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR IF VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR BIN_OP V... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def full(x):
if x.count(x[0]) == 4:
return True
else:
return False
def gor(x):
if x[0] == x[1] and x[2] == x[3] and x[0] != x[2]:
return True
else:
return False
def vert(x):
if x[0] == x[2] and x[1] == x[3] and x[0] != x[1]:
return True
else:
r... | FUNC_DEF IF FUNC_CALL VAR VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL V... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def xd(a, b, c, d):
global s
if s[a - 1] == s[b - 1] and s[b - 1] == s[c - 1] and s[c - 1] == s[d - 1]:
return 1
else:
return 0
s = list(map(int, input().split()))
pd = 0
if (
xd(13, 14, 15, 16)
and xd(17, 18, 19, 20)
and xd(1, 3, 6, 8)
and xd(5, 7, 10, 12)
and xd(9, 11... | FUNC_DEF IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR NUMBER NUMBER NUMBER NUMBER FUNC_CALL VAR NUMB... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def check(dat):
mark = 0
for i in range(6):
if (
dat[4 * i] == dat[4 * i + 1]
and dat[4 * i] == dat[4 * i + 2]
and dat[4 * i] == dat[4 * i + 3]
):
mark += 1
if mark == 6:
return True
return False
data = list(map(int, input().split... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | import sys
rotations = [
[1, 3, 5, 7, 9, 11, 22, 24],
[2, 4, 6, 8, 10, 12, 21, 23],
[13, 14, 5, 6, 17, 18, 21, 22],
[15, 16, 7, 8, 19, 20, 23, 24],
[3, 4, 17, 19, 10, 9, 16, 14],
[1, 2, 18, 20, 12, 11, 15, 13],
]
def rotation_backwards(cube: list, rotation: list):
aux = cube.copy()
au... | IMPORT ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | line = input().split()
a = []
for i in line:
a.append(int(i))
def isValid(b):
flag = 0
if (
b[flag] != b[flag + 1]
or b[flag + 1] != b[flag + 2]
or b[flag + 2] != b[flag + 3]
):
return False
flag = 4
if (
b[flag] != b[flag + 1]
or b[flag + 1] != ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR BIN... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def f(a, b, c, d):
return a == b == c == d
a = [0]
a.extend(list(map(int, input().split())))
if f(a[13], a[14], a[15], a[16]) and f(a[17], a[18], a[19], a[20]):
if f(a[6], a[8], a[1], a[3]) and f(a[2], a[4], a[22], a[24]):
if f(a[21], a[23], a[9], a[11]) and f(a[10], a[12], a[5], a[7]):
pr... | FUNC_DEF RETURN VAR VAR VAR VAR ASSIGN VAR LIST NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def final(b):
for i in range(6):
if len(set(b[4 * i : 4 * i + 4])) != 1:
return False
return True
a = list(map(int, input().split()))
moves = [
[4, 5, 16, 17, 20, 21, 12, 13],
[13, 15, 8, 9, 18, 16, 3, 2],
[15, 14, 23, 22, 19, 18, 7, 6],
[21, 23, 10, 8, 6, 4, 2, 0],
[5,... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | arr = list(map(int, input().split()))
def cycle(p, q, r, s, b):
if b:
arr[p], arr[q], arr[r], arr[s] = arr[q], arr[r], arr[s], arr[p]
else:
arr[s], arr[r], arr[q], arr[p] = arr[r], arr[q], arr[p], arr[s]
def solved():
for i in range(6):
for j in range(1, 4):
if arr[4 ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR BIN_OP BIN_OP ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | import sys
try:
sys.stdin = open("input.txt", "r")
sys.stdout = open("output.txt", "w")
except:
pass
input = sys.stdin.readline
def solved(a):
side1 = set(a[:4])
side2 = set(a[4:8])
side3 = set(a[8:12])
side4 = set(a[12:16])
side5 = set(a[16:20])
side6 = set(a[20:24])
for side... | IMPORT ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASS... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = [
[1, 3, 5, 7, 9, 11, 24, 22],
[2, 4, 6, 8, 10, 12, 23, 21],
[13, 14, 5, 6, 17, 18, 21, 22],
[15, 16, 7, 8, 19, 20, 23, 24],
[16, 14, 3, 4, 17, 19, 10, 9],
[15, 13, 1, 2, 18, 20, 12, 11],
]
def rotate(b, i1, i2, i3, i4, i5, i6, i7, i8):
b[i1], b[i2], b[i3], b[i4], b[i5], b[i6], b[i7], ... | ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def f(i):
nonlocal cube
return cube[i - 1]
cube = input().split()
if f(1) == f(2) and f(1) == f(3) and f(1) == f(4):
if f(9) == f(10) and f(9) == f(11) and f(9) == f(12):
if f(5) == f(6) and f(5) == f(15) and f(5) == f(16):
if f(13) == f(14) and f(13) == f(23) and f(13) == f(24):
... | FUNC_DEF RETURN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER IF FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FUNC_CALL ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = list(map(int, input().split()))
trans = [
{(1): 5, (3): 7, (5): 9, (7): 11, (9): 22, (11): 24, (22): 1, (24): 3},
{(5): 17, (6): 18, (17): 21, (18): 22, (21): 13, (22): 14, (13): 5, (14): 6},
{(3): 17, (4): 19, (17): 10, (19): 9, (9): 14, (10): 16, (14): 4, (16): 3},
]
def check(c):
for i in range... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER DIC... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | colors = list(map(int, input().split()))
can = False
if colors[16] == colors[17] == colors[22] == colors[23]:
if colors[4] == colors[5] == colors[18] == colors[19]:
if colors[12] == colors[13] == colors[6] == colors[7]:
if colors[20] == colors[21] == colors[14] == colors[15]:
if ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | cube = [-1] + list(map(int, input().split()))
def ok(cube):
counter = 0
last = cube[1]
for i in cube:
if i == -1:
continue
elif last == i:
counter += 1
elif counter != 4:
return False
else:
counter = 1
last = i
... | ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR NUMBER IF VAR VAR VAR NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR RETURN NUMBER FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VA... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = input().split()
c1 = a[0] == a[1] == a[2] == a[3]
c2 = a[8] == a[9] == a[10] == a[11]
c3 = a[12] == a[13] == a[6] == a[7]
c4 = a[4] == a[5] == a[18] == a[19]
c5 = a[16] == a[17] == a[22] == a[23]
c6 = a[20] == a[21] == a[14] == a[15]
c1 = c1
c2 = c2
c7 = a[4] == a[5] == a[14] == a[15]
c8 = a[12] == a[13] == a[22] =... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = [(1, 5), (3, 7), (5, 9), (7, 11), (9, 24), (11, 22), (22, 3), (24, 1)]
b = [(2, 6), (4, 8), (6, 10), (8, 12), (10, 23), (12, 21), (23, 2), (21, 4)]
c = [(5, 13), (6, 14), (17, 5), (18, 6), (21, 17), (22, 18), (14, 22), (13, 21)]
d = [(7, 15), (8, 16), (19, 7), (20, 8), (23, 19), (24, 20), (16, 24), (15, 23)]
e = [(... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | PMP = [1, 0, 3, 2, 5, 4, 7, 6]
def Pedy(arr1, arr2):
global PMP
for i in range(8):
h = i
if i % 2:
continue
hh = 0
anss = 1
while h != (i - 1 + 8) % 8 and anss:
if arr1[h] != arr2[hh]:
anss = 0
if arr1[h] != arr1[PMP[h... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR VAR VAR ASSIGN VAR NUMBER ... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | import sys
input = sys.stdin.readline
def read():
return list(map(int, input().split()))
def check(x):
for i in range(0, 24, 4):
if x[i : i + 4] != [x[i]] * 4:
return False
return True
a = read()
if check(a):
print("NO")
quit()
b = list(a)
b[2], b[3], b[16], b[18], b[9], b... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR BIN_OP VAR NUMBER BIN_OP LIST VAR VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | ll = [int(x) for x in input().split()]
l = ll[:]
def ok(l):
for i in range(6):
for j in range(4):
if l[i * 4 + j] != l[i * 4]:
return
print("YES")
exit(0)
a = l[2]
l[2] = l[16]
l[16] = l[9]
l[9] = l[15]
l[15] = a
a = l[3]
l[3] = l[18]
l[18] = l[8]
l[8] = l[13]
l[13] =... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER RETURN EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NU... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | faces = [
[5, 6, 17, 18, 21, 22, 13, 14],
[7, 8, 19, 20, 23, 24, 15, 16],
[1, 3, 5, 7, 9, 11, 24, 22],
[2, 4, 6, 8, 10, 12, 23, 21],
[3, 4, 17, 19, 10, 9, 16, 14],
[1, 2, 18, 20, 12, 11, 15, 13],
]
cube = input().split(" ")
def legit(cube):
for i in range(6):
for j in range(4):
... | ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | line = list(map(int, input().split()))
yes = False
q = [1, -1]
if line[4] == line[5] and line[5] == line[6] and line[6] == line[7]:
if line[20] == line[21] and line[21] == line[22] and line[22] == line[23]:
can = True
c1 = []
if line[15] != line[13]:
can = False
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER VAR NUMBER ASSIGN V... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def eq(cube, a, b, c, d):
return cube[a] == cube[b] and cube[b] == cube[c] and cube[c] == cube[d]
opp = [2, 5, 0, 4, 3, 1]
cube = input().strip().split()
for i in range(6):
if (
cube[4 * i + 0] == cube[4 * i + 1]
and cube[4 * i + 2] == cube[4 * i + 1]
and cube[4 * i + 2] == cube[4 * i ... | FUNC_DEF RETURN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP BI... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | a = [
[1, 3, 5, 7, 9, 11, 24, 22],
[2, 4, 6, 8, 10, 12, 23, 21],
[13, 14, 5, 6, 17, 18, 21, 22],
[15, 16, 7, 8, 19, 20, 23, 24],
[2, 1, 13, 15, 11, 12, 20, 18],
[4, 3, 14, 16, 9, 10, 19, 17],
]
cube = [0] + list(map(int, input().split()))
def rubik(cube):
if (
cube[1] == cube[2] ==... | ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | colors = ["SHIT"] + list(map(int, input().split()))
faces = [
(1, 2, 3, 4),
(5, 6, 7, 8),
(9, 10, 11, 12),
(13, 14, 15, 16),
(17, 18, 19, 20),
(21, 22, 23, 24),
]
def is_good(colors):
return all([all([(colors[i] == colors[face[0]]) for i in face]) for face in faces])
rotations = {
(1... | ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VA... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def solvable(la):
colors_faces = [set() for _ in range(6)]
for i, a in zip(list(range(50)), la):
face = i // 4
colors_faces[face].add(a)
if len(colors_faces[face]) > 2:
return False
ones = []
twos = []
for i, face_set in enumerate(colors_faces):
if len(fac... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER RETURN NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def all_is(l):
f = l[1]
for i in range(2, len(l)):
if l[i] == f or l[i] == None:
pass
else:
return False
return True
lst = list(map(int, input().split(" ")))
u, f, d, l, r, t = lst[:4], lst[4:8], lst[8:12], lst[12:16], lst[16:20], lst[20:]
u.insert(0, None)
f.insert... | FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NONE RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBER VAR NUMBER NUMBE... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | colors = list(map(int, input().split()))
faces = {}
faces["top"] = colors[:4]
faces["front"] = colors[4:8]
faces["bottom"] = colors[8:12]
faces["left"] = colors[12:16]
faces["right"] = colors[16:20]
faces["back"] = [colors[21], colors[20], colors[23], colors[22]]
status = {}
for face in faces.keys():
colors = faces... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR STRING VAR NUMBER ASSIGN VAR STRING VAR NUMBER NUMBER ASSIGN VAR STRING VAR NUMBER NUMBER ASSIGN VAR STRING VAR NUMBER NUMBER ASSIGN VAR STRING VAR NUMBER NUMBER ASSIGN VAR STRING LIST VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMB... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def g(l1, l2):
dic = {}
for ls in [l1, l2]:
ls.append(ls[0])
ls.append(ls[1])
num = 2 if ls == l1 else 1
for i in range(len(ls) - num):
dic[ls[i + num]] = ls[i]
return dic, dict((val, key) for key, val in dic.items())
left, left_ = g([1, 3, 5, 7, 9, 11, 24, 22],... | FUNC_DEF ASSIGN VAR DICT FOR VAR LIST VAR VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR RETURN VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR LIST NUM... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | S = 24
class Permutation:
def __init__(self, C=None):
if isinstance(C, list):
assert len(C) == S
self.P = C
else:
self.P = list(range(S))
if isinstance(C, tuple):
for i in range(len(C)):
self.P[C[i]] = C[(i + 1) %... | ASSIGN VAR NUMBER CLASS_DEF FUNC_DEF NONE IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF RETU... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | from sys import stdin
ocube = [int(x) for x in stdin.readline().strip().split()]
ocube.insert(0, 0)
def UL(array):
cube = []
for i in range(len(array)):
cube.append(array[i])
cube[5:7] = array[17:19]
cube[17:19] = array[21:23]
cube[21:23] = array[13:15]
cube[13:15] = array[5:7]
re... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER NUMBER... |
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | def main():
raw = list(int(x) - 1 for x in input().split())
d = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12],
[13, 14, 15, 16],
[17, 18, 19, 20],
[21, 22, 23, 24],
]
l = []
for i in range(6):
l.append(raw[4 * i : 4 * i + 4])
def rt(x, y):... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER ASSIGN VAR L... |
Some people are just moody, you just cannot reason with them.
Same goes with Natural Numbers. Some of them ultimely want to become 1 or 4 and will evolve infinite times if they have to, to become what they want to. To evolve, they use a function F such that N = F(N). Function F(N) is defined as :
F(N) = sum_of_digits(... | mem = {}
def sum_digits3(n):
n = n**2
r = 0
while n:
r, n = r + n % 10, n // 10
return r
def findnature(n):
if n in mem:
return mem[n]
if n == 1 or n == 4:
return 1
if n == 9 or n == 13:
return -1
ans = findnature(sum_digits3(n))
mem[n] = ans
r... | ASSIGN VAR DICT FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN VAR FUNC_DEF IF VAR VAR RETURN VAR VAR IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VA... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
for j in range(n):
if i != j:
if i <= j and a[i] >= a[j] or i >= j and a[i] <= a[j]:
count += 1
print(count // 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR IF VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BI... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for j in range(int(input())):
n = int(input())
s = [int(i) for i in input().split()]
count = 0
for i in range(n - 1):
x = s[i]
for j in range(i + 1, n):
if s[j] <= x:
count += 1
print(count) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | import sys
def get_ints():
return map(int, sys.stdin.readline().strip().split())
def get_ls():
return list(map(int, sys.stdin.readline().strip().split()))
def main():
for _ in range(int(input())):
n = int(input())
ls = get_ls()
ans = 0
for i in range(n - 1):
... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR ... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
out = ""
for _ in range(t):
n = int(input())
arr = [int(x) for x in input().split()]
passed = []
ans = 0
for x in arr:
i = 0
for i in range(len(passed)):
if passed[i] >= x:
break
else:
i += 1
ans += len(passed) ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER VAR BIN_OP ... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for p in range(int(input())):
n = int(input())
r = 0
a = list(map(int, input().split()))
for i in range(len(a)):
for j in range(i):
if a[j] >= a[i]:
r += 1
print(r) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i, j in enumerate(a):
cnt += sum([(1) for v in a[i + 1 :] if v <= j])
print(cnt) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | class Solution:
def solve(self, a, n):
if len(a) == 1:
return 0
count = 0
for i in range(n - 1):
for j in range(i + 1, n):
if a[i] >= a[j]:
count += 1
return count
T = int(input())
while T:
T -= 1
n = int(input())... | CLASS_DEF FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_C... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
while t > 0:
n = int(input())
numbers = [int(num) for num in input().split(" ", n - 1)]
sum = 0
for i in range(1, len(numbers)):
for j in range(i):
if numbers[i] <= numbers[j]:
sum = sum + 1
print(sum)
t = t - 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | def solve():
terminal_size = int(input())
connections = list(map(int, input().split(" ")))
rtn = 0
for i in range(len(connections)):
for j in range(i + 1, len(connections)):
if connections[j] <= connections[i]:
rtn += 1
print(rtn)
for _ in range(int(input())):
... | FUNC_DEF 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 NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CA... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
while t:
n = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(i + 1, n):
if arr[i] >= arr[j]:
ans += 1
print(ans)
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
out = ""
for _ in range(t):
n = int(input())
a = [(int(x) - 1) for x in input().split()]
count = [0] * n
ans = 0
for x in a:
ans += count[x]
for i in range(x + 1):
count[i] += 1
out += str(ans) + "\n"
print(out) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUM... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(i + 1, n):
f1, t1 = i + 1, a[i]
f2, t2 = j + 1, a[j]
if f1 > f2:
if t1 <= t2:
ans += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER VA... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | def solution(content, n):
a = list(zip(range(1, n + 1), content))
a.sort(key=lambda x: (x[1], -x[0]))
result = 0
for i, (source, dest) in enumerate(a):
j = i - 1
while j >= 0:
s, d = a[j]
if s > source or d == dest:
result += 1
j -= 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASS... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for t in range(int(input())):
n = int(input())
ans = list(map(int, input().split(" ")))
result = [(0) for _ in range(n)]
result[0] = 0
for i in range(1, n):
for j in range(i):
if ans[j] >= ans[i]:
result[i] += 1
print(sum(result)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
for nabor in range(t):
n = int(input())
arr = tuple(map(int, input().split()))
counts = {}
count = 0
for i in arr:
for k, v in counts.items():
if k >= i:
count += v
try:
counts[i] += 1
except KeyError:
count... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR FOR VAR VAR FUNC_CALL VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VA... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
p = 0
for j in range(i):
if a[j] >= a[i]:
p += 1
ans += p
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | def getsum(BITTree, i):
s = 0
i = i + 1
while i > 0:
s += BITTree[i]
i -= i & -i
return s
def updatebit(BITTree, n, i, v):
i += 1
while i <= n:
BITTree[i] += v
i += i & -i
def construct(arr, n):
BITTree = [0] * (n + 1)
for i in range(n):
update... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR RETURN VAR FOR VAR... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | cases = int(input())
c = []
for i in range(cases):
n = int(input())
c.append(list(map(int, input().strip().split())))
pairs = []
Dict = {}
for i in c:
for j in range(1, len(i) + 1):
Dict[j] = i[j - 1]
pairs.append(Dict)
Dict = {}
for d in pairs:
count = 0
for i in range(1, len(list(d... | 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 EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | t = int(input())
for _ in range(t):
n = int(input())
lst = [0] + list(map(int, input().split(" ")))
x = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
if lst[i] >= lst[j]:
x += 1
print(x) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | def main():
t = int(input())
for k in range(t):
n = int(input())
read = list(map(int, input().strip().split()))[:n]
ans = 0
for i in range(n):
for j in range(i + 1, n):
if read[i] >= read[j]:
ans += 1
print(ans)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER EXPR FUN... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | def fun(n, l):
res = 0
j = 0
for i in range(1, n):
k = i
while l[i] <= l[j] and j >= 0:
l[j], l[i] = l[i], l[j]
i, j = j, j - 1
res += 1
j = k
return res
N = int(input())
for i in range(N):
n = int(input())
l = list(map(int, input().s... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR WHILE VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | cases = int(input())
while cases:
count = 0
cases -= 1
n = int(input())
arr = list(map(int, input().split()))
i = 0
while i < len(arr):
j = i + 1
while j < len(arr):
if arr[i] >= arr[j]:
count += 1
j += 1
i += 1
print(count) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | import sys
input = sys.stdin.readline
def inp():
return int(input())
def inlt():
return list(map(int, input().split()))
def insr():
s = input()
return list(s[: len(s) - 1])
def invr():
return map(int, input().split())
def foo(n, arr):
cross = 0
if n <= 1:
return 0
mid ... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER IF VAR... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | for case in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
res = 0
for i in range(n):
top = i + 1
bot = arr[i]
for j in range(n):
if i == j:
continue
tempTop = j + 1
tempBot = arr[j]
if t... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | N = int(input())
for _ in range(N):
n = int(input())
a = map(int, input().split())
c = list(zip(range(1, n + 1), a))
res = 0
for i in range(n - 1):
for j in range(i + 1, n):
if c[j][1] <= c[i][1]:
res += 1
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR B... |
The only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exceed $1000$.
A terminal is a row of $n$ equal segments numbered $1$ to $n$ in order. There are two terminals, one above the other.
You are given an array $a$ of length $n$. For all $i =... | import sys
sys.setrecursionlimit(10**6)
class TreeNode:
def __init__(self, val, col):
self.val = val
self.col = col
self.ch = []
def inord(self):
print(self.val)
for c in self.ch:
c.inord()
def balcnt(root):
if root == None:
return [0, 0]
... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST FUNC_DEF EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_DEF IF VAR NONE RETURN LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR I... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
while t:
t -= 1
n, k = input().split()
n = int(n)
k = int(k)
count = 0
for i in range(n - 1):
over = False
for j in range(i + 1, n):
if count < 2 * n + k:
print(i + 1, j + 1)
count += 1
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR BIN_OP BIN_OP NUMBER VAR VAR EXPR FU... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for _ in range(t):
n, p = [int(x) for x in input().split()]
p += 2 * n
for i in range(1, n):
if p == 0:
break
for j in range(i + 1, n + 1):
if p == 0:
break
else:
p -= 1
print(f"{i} {j}") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR STRING VAR |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for ignored in range(t):
n, p = list(map(int, input().split()))
a = [([False] * n) for i in range(n)]
cnt = [0] * n
for i in range(2 * n + p):
mini = float("inf")
minim = float("inf")
x, y = -1, -1
for x1 in range(n):
for y1 in range(x1 + 1, n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR ... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | for _ in range(int(input())):
v, p = [int(x) for x in input().split()]
counter1 = 1
counter2 = 1
counter3 = 0
while counter3 != 2 * v + p:
counter3 += 1
print(counter1, counter2 + counter1)
counter2 += 1
if counter2 + counter1 == v + 1:
counter2 = 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VA... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | from sys import stdin
def main():
t = int(stdin.readline())
for _ in range(t):
n, p = map(int, stdin.readline().split())
for i in range(n):
print(i + 1, (i + 1) % n + 1)
count = n + p
ok = False
for i in range(n):
for j in range(i + 1, n):
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | for _ in range(int(input())):
n, p = map(int, input().split())
num = 0
k = True
for i in range(1, n + 1):
if k:
for j in range(i + 1, n + 1):
num += 1
if num == 2 * n + p:
k = False
print(i, j)
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER IF VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER ... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for test in range(t):
n, p = map(int, input().split())
s = ""
for i in range(n):
s += str(i + 1) + " " + str((i + 1) % n + 1) + "\n"
s += str(i + 1) + " " + str((i + 2) % n + 1) + "\n"
if p > 0:
for i in range(n):
for j in range(i + 3, min(n, i - 2 + ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER STRING FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER STRING VAR BIN_OP BIN_OP BIN_OP F... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for _ in range(t):
n, p = map(int, input().split())
for i in range(2 * n + p):
print(i % n + 1, (i + i // n + 1) % n + 1) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR VAR NUMBER VAR NUMBER |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | import sys
def get_ints():
return map(int, sys.stdin.readline().strip().split())
t = int(input())
while t:
flag = 0
n, p = get_ints()
count = 0
i = 1
while i < n + 1:
for j in range(i + 1, n + 1):
print(i, j)
count += 1
if count == 2 * n + p:
... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for tt in range(t):
n, p = map(int, input().split(" "))
edge_count = 0
edge_len = 1
v = 0
while edge_count < 2 * n + p:
print("{} {}".format(v + 1, (v + edge_len) % n + 1))
v = (v + 1) % n
edge_count += 1
if edge_count % n == 0:
edge_len +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING BIN_OP VAR NUMBER BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER ASSI... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for i in range(t):
n, p = [int(j) for j in input().split()]
for x in range(1, n + 1):
for y in range(x + 1, n + 1):
if min(y - x, x + n - y) <= 2:
print(x, y)
elif p > 0:
print(x, y)
p -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR V... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for _ in range(t):
n, p = map(int, input().split())
k = 2 * n + p
pre = 1
while k > 0:
for i in range(pre + 1, n + 1):
print(pre, i)
k = k - 1
if k == 0:
break
pre += 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NU... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | for _ in range(int(input())):
n, p = map(int, input().split())
d = {}
ans = 0
for i in range(1, n + 1):
d[i] = []
for i in range(1, n + 1):
for j in range(1, n + 1):
if len(d[i]) == 2 * n + p:
break
if j != i and j not in d[i]:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF FUNC_CALL VAR V... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | for j in range(int(input())):
n, p = map(int, input().split())
k = (
[(str(i) + " " + str(i + 1)) for i in range(1, n)]
+ ["1 " + str(n), "1 " + str(n - 1), "2 " + str(n)]
+ [(str(i) + " " + str(i + 2)) for i in range(1, n - 1)]
)
for i in range(1, n - 2):
if p == 0:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR LIST BIN_OP STRING FUNC_CALL VAR VAR BIN_OP STRING FUNC_CALL VAR BIN_OP VAR NUMBER BIN_O... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | for t in range(int(input())):
n, p = map(int, input().split())
ans = []
cnt = 2 * n + p
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
ans.append([i, j])
cnt -= 1
if cnt == 0:
break
if cnt == 0:
break
for i in a... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR VAR NUMBER IF VAR NU... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | t = int(input())
for i in range(t):
a, b = map(int, input().split())
c = a * 2 + b
for i in range(1, a + 1):
for j in range(i + 1, a + 1):
if c == 0:
break
print(str(i) + " " + str(j))
c -= 1
if c == 0:
break | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_C... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | import sys
input = lambda: sys.stdin.readline().strip()
def solve(n, p):
total = 0
used = set()
for d in range(1, n):
for i in range(1, n + 1):
u, v = i, (i + d - 1) % n + 1
e = min(u, v), max(u, v)
if e not in used:
used.add(e)
... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FU... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | import sys
input = lambda: sys.stdin.readline().strip()
def solve(n, p):
total = 0
for d in range(1, n):
for i in range(1, n + 1):
print(i, (i + d - 1) % n + 1)
total += 1
if total == 2 * n + p:
return
for _ in range(int(input())):
n, p = [int... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER VAR NUMBER IF VAR BIN_OP BIN_OP NUMBER VAR VAR RETURN FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC... |
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill:
* the graph contains exactly 2n + p edges;
* the graph doesn't contain self-loops and multiple edges;
* for any integer k (1 ≤ k ≤ n), any subgraph consisting of k vertices contains at most 2k + p edges.
A sub... | from sys import setrecursionlimit, stdin
t = int(stdin.readline().strip())
for _ in range(t):
n, p = list(map(int, stdin.readline().split()))
count = 0
flag = 0
for i in range(1, n + 1):
if flag == 1:
break
for j in range(i + 1, n + 1):
if count == 2 * n + p:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP BIN_O... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.