description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given an array a of size n, and q queries to it. There are queries of two types: 1 l_{i} r_{i} — perform a cyclic shift of the segment [l_{i}, r_{i}] to the right. That is, for every x such that l_{i} ≤ x < r_{i} new value of a_{x} + 1 becomes equal to old value of a_{x}, and new value of a_{l}_{i} becomes eq... | from sys import stdin, stdout
input = stdin.readline
print = stdout.write
n, q, m = map(int, input().split())
a = list(map(int, input().split()))
ops = [list(map(int, input().split())) for _ in range(q)]
b = list(map(int, input().split()))
def solve(index, ops):
def _solve(index, op):
t, l, r = op
... | ASSIGN VAR VAR ASSIGN VAR VAR 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_D... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | def bfs(start, friend_dict):
visited = set()
queue = [(start, 0)]
visited.add(start)
s = 0
while queue:
friend, dist = queue.pop(0)
s += dist
for x in friend_dict[friend]:
if x not in visited:
queue.append((x, dist + 1))
visited.add... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER VAR VAR FOR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR F... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | G = int(input())
tf = [0] * G
m = []
for g in range(0, G):
tf[g] = int(input())
m.append({})
for i in range(0, tf[g]):
m[g].update({(i + 1): [int(p) for p in input().split()]})
for grp in range(0, G):
dict1 = m[grp]
u = []
mmember = 1
for member in range(0, tf[grp]):
visited ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR DICT FOR VAR FUNC_CALL VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR DICT BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FO... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | class Graph:
def __init__(self, V):
self.V = V
self.adj = [[] for i in range(V + 1)]
def addEdge(self, v, w):
self.adj[v].append(w)
self.adj[w].append(v)
def BFS(self, i):
level = ["useless"]
for j in range(1, self.V + 1):
level.append(-1)
... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_DEF EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR WHILE... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | def bfs(source, adj):
visited = set()
visited.add(source)
queue = []
queue.append((source, 0))
s = 0
while queue:
curr, dist = queue.pop(0)
for node in adj[curr]:
if node not in visited:
visited.add(node)
queue.append((node, dist + 1))
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER FOR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CA... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | tn = int(input())
for _ in range(tn):
n = int(input())
ar = dict()
for i in range(1, n + 1):
ar[i] = list(map(int, input().split()))
mvsm, midx = -1, -1
for i in range(1, n + 1):
visli = {i}
tdis = 0
queue = [(i, 0)]
while queue:
nd, dis = queue.po... | 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 FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMB... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | import sys
if len(sys.argv) >= 2:
sys.stdin = open(sys.argv[1])
def dijkstra(adj, src):
n = len(adj)
dist = [float("inf")] * n
dist[src] = 0
q = [src]
while q:
u = q.pop(0)
for v in adj[u]:
if dist[v] > dist[u] + 1:
dist[v] = dist[u] + 1
... | IMPORT IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST FUNC_CALL VAR STRING VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR VAR VAR IF VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR ... |
Anna Hazare is a well known social activist in India.
On 5th April, 2011 he started "Lokpal Bill movement".
Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.
All of them are excited about this t... | class Connections:
def __init__(self, n):
self.num = n
self.friends = {}
self.lst = []
self.social()
self.length()
def social(self):
for i in range(1, self.num + 1):
self.friends[i] = tuple(map(int, input().split()))
def search(self, vec):
... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR DICT ASSIGN VAR LIST EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR NUMBER ASSIG... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | D = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
def chef(meals):
freq = [0] * 32
for s in meals:
temp = 0
for i in range(len(s)):
temp |= 1 << D[s[i]]
freq[temp] += 1
res = 0
for i in range(32):
for j in range(i + 1, 32):
if i | j == 31:
... | ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP NUMBER VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def solve():
n = int(input())
freq_comb = [0] * 32
for i in range(n):
string = input()
mask = 0
for s in string:
if s == "a":
mask = mask | 1 << 0
elif s == "e":
mask = mask | 1 << 1
elif s == "i":
ma... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | shifts = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
for _ in range(int(input())):
n = int(input())
bitmasks = [0] * 2**5
for __ in range(n):
s = input()
b = 0
for i in s:
b = b | 1 << shifts[i]
bitmasks[b] += 1
res = 0
for i in range(len(bitmasks)):
... | ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BI... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for _ in range(1, t + 1):
n = int(input())
fr = [0] * 32
for k in range(n):
s = set(input())
mask = 0
for i in s:
if i == "a":
mask = mask | 1 << 0
if i == "e":
mask = mask | 1 << 1
if i == "i":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | v = "aeiou"
t = int(input())
for _ in range(t):
n = int(input())
c = 0
l = [0] * 32
for i in range(n):
s = set(input())
d = dict()
for j in v:
d[j] = 0
for j in s:
if j in v:
d[j] += 1
val = d["a"] * 16 | d["e"] * 8 | d["i"]... | ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
while t:
n = int(input())
lis = []
s = ""
a = [0] * n
e = [0] * n
i = [0] * n
o = [0] * n
u = [0] * n
bt = [0] * n
fr = [0] * 32
for x in range(n):
s = input()
l = len(s)
for j in s:
if j == "a":
a[x] = 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBE... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
n = int(input())
l = []
yt = (1 << 5) - 1
d = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
for _ in range(n):
l.append(str(input()))
v = {}
for i in range(1, 32):
v[i] = 0
for i in range(n):
s = set()
m = 0
for j in range(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def maskit(x):
j = 0
for i in x:
if i == "a":
j = j | 1 << 4
elif i == "e":
j = j | 1 << 3
elif i == "i":
j = j | 1 << 2
elif i == "o":
j = j | 1 << 1
elif i == "u":
j = j | 1 << 0
return j
t = int(input())... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUM... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | T = int(input())
for i in range(T):
N = int(input())
F = 1 << 5
l = [0] * F
l1 = []
for j in range(N):
x = input()
l1.append(x)
for j in range(len(l1)):
mask = 0
for k in l1[j]:
if k == "a":
mask = mask | 1 << 0
elif k == "e... | 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 NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FO... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | T = int(input())
for i in range(T):
n = int(input())
lst = [0] * (1 << 5)
for j in range(n):
ans = 0
for k in input():
if k == "a":
ans |= 1 << 0
elif k == "e":
ans |= 1 << 1
elif k == "i":
ans |= 1 << 2
... | 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 BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def funct(li, n):
f = [(0) for i in range(32)]
for i in range(len(li)):
mask = 0
for j in li[i]:
if j == "a":
mask = mask | 1 << 0
if j == "e":
mask = mask | 1 << 1
if j == "i":
mask = mask | 1 << 2
i... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
while t:
n = int(input())
arr = [0] * 32
for i in range(n):
tmp = input()
mask = 0
for j in tmp:
if "a" is j:
mask |= 16
continue
if "e" is j:
mask |= 8
continue
if "i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF STRING VAR VAR NUMBER IF STRING VAR VAR NUMBER IF STRING VAR VAR NUMBER IF STRING VAR VAR NUMBER IF STRING VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
n = int(input())
l = [0] * 32
d = {"a": 1, "e": 2, "i": 4, "o": 8, "u": 16}
for i in range(n):
s = list(set(list(input())))
m = 0
for j in s:
m |= d[j]
l[m] += 1
ans = l[31] * (l[31] - 1) // 2
for i in range(1, 32):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMB... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | p = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
for _ in range(int(input())):
n = int(input())
l = []
d = {i: (0) for i in range(0, 32)}
for i in range(n):
s = input()
s = set(s)
val = 0
for i in s:
val = val | 1 << p[i]
d[val] += 1
l = [i for i in d]... | ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def evaluatestring(dp, string):
mask = 0
for s in string:
if s == "a":
mask |= 1 << 0
elif s == "e":
mask |= 1 << 1
elif s == "i":
mask |= 1 << 2
elif s == "o":
mask |= 1 << 3
elif s == "u":
mask |= 1 << 4
dp... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN_OP NUMBER NUMBER VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | N = 1 << 5
for t in range(int(input())):
n = int(input())
frq = [(0) for i in range(N)]
for i in range(n):
d = list(input())
index = 0
for j in d:
if j == "a":
index |= 1
elif j == "e":
index |= 2
elif j == "i":
... | ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | import itertools
t = int(input())
for i in range(t):
vowels = ["a", "e", "i", "o", "u"]
l = []
n = int(input())
for i in range(n):
l.append(list(set(input())))
combinations = []
for i in range(len(vowels) + 1):
combinations += list(itertools.combinations(vowels, i))
for i in... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST STRING STRING STRING STRING STRING ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def show(t):
for _ in range(t):
a = [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | FUNC_DEF FOR VAR FUNC_CALL VAR 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 NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
while t:
n = int(input())
d = []
mymap = {}
for i in range(n):
d.append(input())
x = 0
if "a" in d[i]:
x += 16
if "e" in d[i]:
x += 8
if "i" in d[i]:
x += 4
if "o" in d[i]:
x += 2
if ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF STRING VAR VAR VAR NUMBER IF STRING VAR VAR VAR NUMBER IF STRING VAR VAR VAR NUMBER IF STRING VAR VAR VAR NUMBER IF STRI... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def decimal(bin_arr):
return (
2 * 2 * 2 * 2 * bin_arr["a"]
+ 2 * 2 * 2 * bin_arr["e"]
+ 2 * 2 * bin_arr["i"]
+ 2 * bin_arr["o"]
+ bin_arr["u"]
)
T = int(input())
for i in range(T):
count = 0
arr = [0] * 32
N = int(input())
list_D = []
for x in range... | FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER NUMBER VAR STRING BIN_OP BIN_OP BIN_OP NUMBER NUMBER NUMBER VAR STRING BIN_OP BIN_OP NUMBER NUMBER VAR STRING BIN_OP NUMBER VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBE... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
n = int(input())
dp = dict()
maps = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
for __ in range(n):
s = input()
mask = 0
for i in s:
mask = mask | 1 << maps[i]
if mask not in dp:
dp[mask] = 1
else:
dp[... | 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 DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
di = {"a": 16, "e": 8, "i": 4, "o": 2, "u": 1}
for i in range(t):
n = int(input())
d = {}
for j in range(n):
te = set(input())
l = 0
for k in te:
l = l + di[k]
if l in d:
d[l] = d[l] + 1
else:
d[l] = 1
li = list... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP V... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
N = int(input())
F = [0] * 32
for i in range(N):
mask = 0
s = input()
for j in s:
if j == "a":
mask = mask | 1 << 0
elif j == "e":
mask = mask | 1 << 1
elif j == "i":
mas... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def li():
return list(map(int, input().split()))
def si():
return input().split()
def ii():
return int(input())
def ip():
return input()
def make():
d = {}
d["a"] = 0
d["e"] = 0
d["i"] = 0
d["o"] = 0
d["u"] = 0
return d
ar = [
[""],
["u"],
["o"],
["o... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF ASSIGN VAR DICT ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER ASSIGN VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
n = int(input())
F = [0] * 32
res = 0
for i in range(n):
s = set(input())
mask = 0
for ch in s:
if ch == "a":
mask |= 1 << 0
if ch == "e":
mask |= 1 << 1
if ch == "i":
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR BIN_OP NUMBER NUMBER IF ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def solve(d, n):
f = [(0) for i in range(32)]
for string in d:
m = 0
for ch in string:
m = m | 1 << dct[ch]
if m == 31:
break
f[m] += 1
res = 0
for i in range(1, 31):
for j in range(i + 1, 32):
if i | j == 31:
... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR VAR IF VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR VAR VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
arr = [0] * 32
l = []
for i in range(n):
s = stdin.readline()
f = 0
set_s = set(s)
if "u" in set_s:
f = f | 1 << 0
if "o" in set_s:
f = f ... | 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 NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF STRING VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF STRIN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | dict = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
for _ in range(int(input())):
N = int(input())
strs = []
arr = []
for i in range(N):
strs.append(str(input()))
for s in strs:
temp = [0] * 5
for i in s:
temp[dict[i]] = 1
arr.append(temp)
br = []
for ... | ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 FOR VAR VAR ASSIGN VAR BIN_OP LIST NUMBE... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | T = int(input())
for _ in range(T):
N = int(input())
l = []
a = [(0) for i in range(32)]
for i in range(N):
s = input()
x = 0
a1 = 0
a2 = 0
a3 = 0
a4 = 0
a5 = 0
if "a" in s:
a1 = 1
if "e" in s:
a2 = 2
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBE... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def solve(s):
l = ["0"] * 5
d = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
for i in s:
if i in "aeiou" or i in "AEIOU":
l[d[i.lower()]] = "1"
l.reverse()
return "".join(l)
def main():
for _ in range(int(input())):
n = int(input())
k = 1 << 5
l = [0] * ... | FUNC_DEF ASSIGN VAR BIN_OP LIST STRING NUMBER ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR STRING ASSIGN VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR RETURN FUNC_CALL STRING VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def fun():
test = int(input())
for t in range(test):
n = int(input())
d = dict()
arr = set()
for _ in range(n):
s1 = set(input().strip())
vowels = ["a", "e", "i", "o", "u"]
val = 0
for i in range(5):
if vowels[i] in ... | 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 ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST STRING STRING STRING STRING STRING ASSIGN VAR NUMBER FOR VAR FUNC_... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for _ in range(t):
n = int(input())
ans = [0] * 32
for _ in range(n):
word = set(input())
mask = 0
for i in word:
if i == "a":
mask |= 1
if i == "e":
mask |= 2
if i == "i":
mask |= 4
... | 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 NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR ST... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | import itertools
power_set = [
"".join(map(str, k)) for k in map(list, itertools.product([0, 1], repeat=5))
]
def get_bitmask(S):
indexes = {"a": 0, "e": 1, "i": 2, "o": 3, "u": 4}
bitmask = [0] * 5
for ch in S:
bitmask[indexes[ch]] = 1
return
def get_mask(S):
indexes = {"a": 0, "e"... | IMPORT ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR VAR NUMBER RETURN FUNC_DEF ASSIGN VAR DICT... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
n = int(input())
count = 0
a1 = [0] * 32
for i in range(n):
t = [0] * 5
s = set(input())
for j in s:
if j == "a":
t[0] = 1
elif j == "e":
t[1] = 1
elif j == "i":
t[2]... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF VAR STRING ASSIGN VAR NUMBER NUMBER IF VAR STRING ASSIGN VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def bit_dishes(str_dishes):
dishes = [0] * 32
a, e, i, o, u = 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4
for str_dish in str_dishes:
dish = 0
for c in str_dish:
if c == "a":
dish |= a
elif c == "e":
dish |= e
elif c == "i":
... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR VAR IF VAR STRING VAR VAR IF VAR STRING VAR VAR IF VAR STRING VAR VAR IF VAR STRING VAR VAR IF V... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for k in range(t):
l = [0] * 32
n = int(input())
for z in range(n):
s1 = list(set(input()))
num = 0
for ch in s1:
if ch == "a":
num = num + 10000
elif ch == "e":
num = num + 1000
elif ch == "i":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING ASSIGN VAR BI... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for _ in range(t):
n = int(input())
freq = [0] * 32
for i in range(n):
s = input()
ans = 0
s = list(set(s))
for j in s:
if j == "a":
ans = ans | 1
if j == "e":
ans = ans | 2
if j == "i":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRIN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for l1 in range(t):
ans = 0
cmb = {}
n = int(input())
for l2 in range(n):
inp = str(input())
vwl = set(inp)
vwl = "".join(list(sorted(vwl)))
if vwl in cmb:
cmb[vwl] += 1
else:
cmb[vwl] = 1
for i in cmb.keys():
f... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR DICT 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 ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER AS... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for xxx in range(int(input())):
n = int(input())
desc = list()
count = 0
full = "aeiou"
table = dict()
for _ in range(n):
desc.append("".join(sorted("".join(set(input())))))
desc.sort(key=lambda x: len(x))
for d in desc:
if d in table.keys():
table[d] += 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 ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for _ in range(t):
n = int(input())
l = []
for i in range(n):
s = input()
a, b, c, d, e = "0" * 5
for j in s:
if j == "a":
a = "1"
if j == "e":
b = "1"
if j == "i":
c = "1"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR BIN_OP STRING NUMBER FOR VAR VAR IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR STRING IF VAR STRING ASSIGN VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
while t:
freq = [0] * 32
n = int(input())
for _ in range(n):
s = input()
mask = 0
if "a" in s:
mask = mask | 1 << 0
if "e" in s:
mask = mask | 1 << 1
if "i" in s:
mask = mask | 1 << 2
if "o" in s:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF STRING VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF STRING VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF STRING VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | for _ in range(int(input())):
arr = [0] * 32
for _ in range(int(input())):
val = 0
list1 = list(set(input()))
for i in range(len(list1)):
if list1[i] == "a":
val += 10000
elif list1[i] == "e":
val += 1000
elif list1[i] =... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR STR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def solve():
n = int(input())
freq = dict()
for i in range(32):
freq[i] = 0
for i in range(n):
s = set(input())
si = 0
if "a" in s:
si += 1 << 0
if "e" in s:
si += 1 << 1
if "i" in s:
si += 1 << 2
if "o" in s:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF STRING VAR VAR BIN_OP NUMBER NUMBER IF STRING VAR VAR BIN_OP NUMBER NUMBER IF STRING VAR VAR BIN_OP NUMBER NUM... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | d = {"a": 1, "e": 2, "i": 4, "o": 8, "u": 16}
for ii in range(int(input())):
n = int(input())
dd = {}
for i in range(n):
s = set(input())
k = 0
for j in s:
k += d[j]
if k in dd:
dd[k] += 1
else:
dd[k] = 1
c = 0
for i in dd:
... | ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR IF VAR VAR VAR VAR NUM... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | def solve(st):
n = len(st)
new_st = [(0) for _ in range(n)]
for i in range(n):
for e in st[i]:
if e == "a":
new_st[i] |= 1 << 0
if e == "e":
new_st[i] |= 1 << 1
if e == "i":
new_st[i] |= 1 << 2
if e == "o... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR VAR VAR IF VAR STRING VAR VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR VAR BIN_OP NUMBER NUMBER IF VAR STRING VAR VAR BIN_OP... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | R = lambda: map(int, input().split())
def shrink(string):
return "".join(sorted(list(set(string))))
def has_all_vowels(str1, str2):
return set(str1 + str2) == {"a", "e", "i", "o", "u"}
for i in range(int(input())):
n = int(input())
map = {}
for i in range(n):
string = input()
i... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR VAR STRING STRING STRING STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | from sys import stdin
class pair(object):
def __init__(self, s1, s2):
self.s1 = s1
self.s2 = s2
def possible(s1, s2):
s = set()
for itms in s1:
s.add(itms)
for items in s2:
s.add(items)
if len(s) is 5:
return True
else:
return False
for _ in... | CLASS_DEF VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
for _ in range(t):
f = [0] * 32
ip = int(input())
li = list()
for i in range(ip):
li.append(input())
for i in li:
mask = 0
if "a" in i:
mask = mask | 1 << 0
if "e" in i:
mask = mask | 1 << 1
if "i" in i:
mas... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR NUMBER IF STRING VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER NUMBER IF STRIN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has $N$ dishes, numbered $1$ through $N$. For each valid $i$, dish $i$ is described by a string $D_{i}$ containing only lowercase vowels, i.e. characters 'a', 'e', 'i', 'o', 'u'.
A *meal* consists of exactly t... | t = int(input())
binrep = {"a": 16, "e": 8, "i": 4, "o": 2, "u": 1}
def convert(ch):
return binrep[ch]
while t:
n = int(input())
binrepfreq = [0] * 32
ans = 0
for i in range(n):
rep = sum(map(convert, set(list(input()))))
binrepfreq[rep] += 1
for i in range(1, 31):
fo... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF RETURN VAR VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VA... |
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.
Today the bus has completed m trips, each time bringing n participants. The participants were then aligned in ... | def main():
_, k, m = [int(x) for x in input().split()]
a = []
last = "-1", 0
a.append(last)
for ai in input().split():
if last[0] == ai:
last = ai, last[1] + 1
a[-1] = last
else:
last = ai, 1
a.append(last)
if last[1] == k:
... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR STRING NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR EXPR FU... |
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.
Today the bus has completed m trips, each time bringing n participants. The participants were then aligned in ... | r = lambda: map(int, input().split())
n, k, m = r()
a = list(r())
stck = []
for i in range(n):
if len(stck) == 0 or stck[-1][0] != a[i]:
stck.append([a[i], 1])
else:
stck[-1][1] += 1
if stck[-1][1] == k:
stck.pop()
rem = 0
strt, end = 0, len(stck) - 1
if m > 1:
while end - strt +... | ASSIGN 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 ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR NUMBER VAR NUMBER NUMBER NUMBER IF VAR NUMBER NUMBER VAR EXPR FUNC_... |
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.
Today the bus has completed m trips, each time bringing n participants. The participants were then aligned in ... | def process(A, m, k):
n = len(A)
start = n * m
d = []
for i in range(n):
if len(d) == 0 or d[-1][0] != A[i]:
d.append([A[i], 1])
else:
d[-1][1] += 1
if d[-1][1] == k:
start -= k * m
d.pop()
if m == 1:
return start
p1... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR NUMBER VAR NUMBER NUMBER NUMBER IF VAR NUMBER NUMBER VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR IF VAR NUMBER RETURN VAR ASSIGN V... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
cards = [N]
for i in range(N - 1, 0, -1):
cards = self.add_card(cards, i)
return cards
def add_card(self, current, m):
target = [m] + current
new = self.shuffle(target, m)
return new
@staticmethod
def s... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP LIST VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
x = []
x.append(N)
N -= 1
while N != 0:
x.insert(0, N)
N -= 1
size = len(x)
p = x[0]
rot = p % size
fp = x[: size - rot]
lp = x[size - rot :]
x = lp... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR VAR NUMBER WHILE VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, n):
order = [(0) for i in range(n)]
c = 1
cl = n
j = 0
for i in range(1, n + 1):
cnt = 0
while cnt < c:
if order[j]:
j += 1
j %= n
else:
... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR NUMBER VAR NUMBER VAR VAR WHILE VAR VAR VAR NUMBER VAR VAR ASSIGN VAR VAR VAR VAR NUMBER RETURN V... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, n):
q = []
for i in range(1, n + 1):
q.append(i)
ans = [0] * (n + 1)
for i in range(1, n + 1):
rot = i % (n - i + 1)
while rot is not 0:
f = q.pop(0)
q.append(f)
ro... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR V... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | def rotatef(l, t):
for i in range(t):
x = l.pop()
l.insert(0, x)
return l
class Solution:
def rotation(self, N):
lst = []
for i in range(N, 0, -1):
lst.insert(0, i)
lst = rotatef(lst, i)
return lst | FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER VAR RETURN VAR CLASS_DEF FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
ans = []
arr = [0] * N
q = []
for i in range(0, N):
q.append(i)
i = 1
while len(q) != 0:
j = 0
while j < i:
x = q.pop(0)
q.append(x)
j += 1
... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
t = []
for i in range(N, 0, -1):
t = [i] + t
size = len(t)
rot = i % size
m = size - rot
t = t[m:] + t[:m]
return t | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
ans = [0] * N
index = []
for j in range(N):
index.append(j)
ans[1] = 1
ind = 1
index.remove(1)
for j in range(2, N + 1):
ind = (ind + j) % len(index)
ans[index[ind]] = j
in... | CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR EXPR FUNC_CA... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
ans = []
for i in range(N, 0, -1):
ans = [i] + ans
for j in range(i):
popped = ans.pop(-1)
ans = [popped] + ans
return ans | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST VAR VAR RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | from itertools import permutations
class Solution:
def rotation(self, n):
li = []
for i in range(n):
li.append(0)
p = 0
for i in range(1, n):
k = i
while k:
if li[p] == 0:
k -= 1
p += 1
... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR WHILE VAR IF VAR VAR NUMBER VAR NUMBER VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR WHILE VAR VAR NUMBER VA... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, n):
ar = [str(i) for i in range(1, n + 1)]
for i in range(n - 1, 0, -1):
for j in range(i):
temp = ar.pop()
ar.insert(i - 1, temp)
return ar | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
arr = [0] * N
t = [0] * N
i = 0
num = 1
while True:
cnt = 0
while cnt < num:
i = (i + 1) % N
if t[i] == 0:
cnt += 1
t[i] = -1
arr[i] = n... | CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER WHILE ... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, n):
q = [i for i in range(1, n + 1)]
k = 1
ans = [0] * (n + 1)
while k <= n:
l = k % len(q)
j = 1
while j <= l:
x = q[0]
q = q[1:]
q.append(x)
j += ... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VA... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
result = [(0) for _ in range(N)]
current_index = -1
for i in range(1, N + 1):
count = 0
while True:
current_index = (current_index + 1) % N
if count == i and result[current_index] == 0:
... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
q = []
while N > 0:
q.append(N)
i = 1
while i <= N:
q.append(q.pop(0))
i += 1
N -= 1
return q[::-1] | CLASS_DEF FUNC_DEF ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR NUMBER |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
q = [N]
for i in range(N - 1, 0, -1):
q.insert(0, i)
size = len(q)
rot = i % size
fp = q[: size - rot]
lp = q[size - rot :]
q = lp + fp
return q | CLASS_DEF FUNC_DEF ASSIGN VAR LIST VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN VAR |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, n):
L = list(range(1, n + 1))
A = [(0) for i in range(n)]
K = 1
count = 1
while len(L):
for _ in range(count):
x = L.pop(0)
L.append(x)
Index = L.pop(0)
A[Index - 1] = K
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NU... |
Given a sorted deck of cards numbered 1 to N.
1) We pick up 1 card and put it on the back of the deck.
2) Now, we pick up another card, it turns out to be card number 1, we put it outside the deck.
3) Now we pick up 2 cards and put it on the back of the deck.
4) Now, we pick up another card and it turns out to be card ... | class Solution:
def rotation(self, N):
arr = [0] * 1001
q = [i for i in range(1, N + 1)]
i = 1
while len(q):
j = 0
while i > j:
x = q.pop(0)
q.append(x)
j += 1
x = q.pop(0)
if arr[x] != 0... | CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER RETURN LIST NUMB... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
def adjmat_2_graph(self, adjm):
if len(adjm) != self.v:
return "Dimension error"
nodes = [("A" + str(i)) for i in range(0, self.v)]
graph = {}
for n, v in enumerate(nodes):
vois... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN STRING ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
pass
@staticmethod
def adjmat_2_graph(adjm):
nodes_dct = {}
for row, weights in enumerate(adjm):
edges = [("A" + str(col), w) for col, w in enumerate(weights) if w > 0]
nodes_dct["A" + str(row)] = edges
... | CLASS_DEF FUNC_DEF FUNC_DEF ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR VAR RETURN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VA... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
self.nodes = None
def adjmat_2_graph(self, adjm):
d = {}
for indice, ligne in enumerate(adjm):
print((indice, ligne))
cle = "A" + str(indice)
laliste = []
for in... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NONE FUNC_DEF ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR RET... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
self.nodes = None
def adjmat_2_graph(self, matrix):
dictionary = {}
step = 0
for row in matrix:
dictionary[f"A{step}"] = []
column = 0
for value in row:
... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NONE FUNC_DEF ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR STRING VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR EXPR FUNC_CALL VAR STRING VAR STRING VAR VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR AS... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
self.nodes = [f"A{i}" for i in range(self.v)]
self.ids = {x: i for i, x in enumerate(self.nodes)}
def adjmat_2_graph(self, adjm):
return {
self.nodes[i]: [(self.nodes[j], x) for j, x in enumerate(r... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR STRING VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR FOR VAR VAR VA... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
def sort_adj_list(self, lst):
res = []
for l in lst:
res.append([l[0], sorted(l[1])])
return sorted(res)
def adjmat_2_graph(self, adjm):
if len(adjm) != self.v:
return "Dim... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_DEF ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR LIST VAR NUMBER FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL VAR VAR FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN STRING ASSIGN VAR BIN_OP STRING FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VA... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
self.nodes = None
def adjmat_2_graph(self, adjm):
gra = {}
for vern, i in enumerate(adjm):
tem = []
for ind, v in enumerate(i):
if v != 0:
tem.append... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NONE FUNC_DEF ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR ASSIGN VAR FUNC_CALL STRING VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR V... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
self.nodes = [f"A{n}" for n in range(vertices_num)]
def adjmat_2_graph(self, adjm):
return {
self.nodes[src_index]: [
(self.nodes[dst_index], weight)
for dst_index, weight i... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR STRING VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER VAR VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR ASSIGN VAR FU... |
A "graph" consists of "nodes", also known as "vertices". Nodes may or may not be connected with one another.
In our definition below the node "A0" is connected with the node "A3", but "A0" is not connected with "A1".
The connecting line between two nodes is called an edge. If the edges between the nodes are undirecte... | class Graph:
def __init__(self, vertices_num):
self.v = vertices_num
self.nodes = None
def adjmat_2_graph(self, adjm):
g = {f"A{x}": [] for x in range(self.v)}
for i in range(self.v):
for j in range(self.v):
if adjm[i][j] != 0:
g[... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NONE FUNC_DEF ASSIGN VAR STRING VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR STRING VAR STRING VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR... |
Coach Chef has selected all the players and now he has to separate them into 2 teams, $A$ and $B$.
Each player must be included in exactly one of the 2 teams and each player $x$, has a skill level $S_{x}$. It is not necessary for both teams to have equal number of players, but they have to be non-empty.
Since the num... | m = 998244353
def p(y):
ans = 1
x = 2
while y > 0:
if y & 1 == 1:
ans = x * ans % m
y = y >> 1
x = x * x % m
return ans
for _ in range(int(input())):
n = int(input())
l = []
for _ in range(n):
x, y = map(int, input().split())
l.append((... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VA... |
Coach Chef has selected all the players and now he has to separate them into 2 teams, $A$ and $B$.
Each player must be included in exactly one of the 2 teams and each player $x$, has a skill level $S_{x}$. It is not necessary for both teams to have equal number of players, but they have to be non-empty.
Since the num... | def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
for _ in range(int(input())):
n = int(input())
a = []
mod = 998244353
for i in range(n):
x, y = map(int, input().split())
a.append((x, y))
a.sort()
if n == 1:
print((pow(2, a[0][1], mod) - 2) % mod)... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CAL... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def countbits(num):
cnt = 0
while num:
num = num // 2
cnt += 1
return cnt
po = [1]
for i in range(1, 32):
po.append(po[-1] * 2)
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().strip().split()))
mx = [0] * 32
mn = [float("inf")] * 32
for i in... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR V... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | from itertools import permutations
for t in range(int(input())):
n = int(input())
l = [int(x) for x in input().split()]
if n < 1000:
c = [x for x in permutations(l, 2)]
a = []
for x in c:
binx = bin(x[0])[2:]
biny = bin(x[1])[2:]
bxpy = binx + bin... | 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 IF VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER AS... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | t = int(input())
while t:
t = t - 1
n = int(input())
l = list(map(int, input().split()))
d = []
m = 0
ma = max(l)
mb = bin(ma)
mb = mb[2:]
if n < 1000:
for i in l:
b = bin(i)
d.append(b[2:])
for i in range(n):
for j in range(i + 1, ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR BIN_OP 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 LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER FOR VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def binarycon(x, y):
binx = bin(x)[2:]
biny = bin(y)[2:]
binxplsy = binx + biny
binyplsx = biny + binx
xplsy = int(binxplsy, 2)
yplsx = int(binyplsx, 2)
return xplsy - yplsx
for i in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
rarr = []
if n < ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSI... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def ans(x, y):
x = bin(x)[2:]
y = bin(y)[2:]
return int(x + y, 2) - int(y + x, 2)
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
if n <= 800:
x = max([ans(i, j) for j in a for i in a])
print(x)
else:
y = max(a)
x = max([ab... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER FUNC_CALL VAR BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL V... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def convert(a, b):
ab = bin(a).replace("0b", "")
ba = bin(b).replace("0b", "")
aba = str(ab) + str(ba)
bab = str(ba) + str(ab)
x = int(aba, 2)
y = int(bab, 2)
return x - y
t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
b = []
if n... | FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP VAR VAR ASS... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def binfun(x, y):
binX = bin(x).replace("0b", "")
binY = bin(y).replace("0b", "")
binXplusY = binX + binY
binYplusX = binY + binX
XplusY = int(binXplusY, 2)
YplusX = int(binYplusX, 2)
return abs(XplusY - YplusX)
t = int(input())
for _ in range(t):
n = int(input())
l = list(map(int,... | FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def dtb(n):
return bin(n).replace("0b", "")
def ans1(n, lst):
res = 0
for i in range(n):
for j in range(i, n):
x = lst[i]
y = lst[j]
binx = dtb(x)
biny = dtb(y)
bfx = "0b" + binx + biny
bfy = "0b" + biny + binx
tem... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP STRING VAR VAR ASSIGN VAR BIN_OP BIN_OP STRING VAR VAR ASS... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | for i in range(int(input())):
powers = [[None, None, None, None] for x in range(30)]
n = int(input())
nums = [int(x) for x in input().split()]
for i in nums:
bi_num = bin(i)[2:]
l = len(bi_num) - 1
if powers[l][0] == None or powers[l][0] > i:
powers[l][0] = i
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NONE NONE NONE NONE VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR NUMBER NONE... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def strbin(x, y):
binx = bin(x)[2:]
biny = bin(y)[2:]
xplusy = binx + biny
yplusx = biny + binx
return int(xplusy, 2) - int(yplusx, 2)
test = int(input())
for _ in range(test):
n = int(input())
a = list(map(int, input().split()))
b = []
if n == 1:
b.append(a[0])
else:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER 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_CAL... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider the following function, where + denotes string concatenation.
function BinaryConcatenation(integer X, integer Y):
string binX = binary representation of X without leading zeroes
string binY = binary repres... | def fun(x, y):
lx = len(bin(x)[2:])
ly = len(bin(y)[2:])
var = x * pow(2, ly) + y - (y * pow(2, lx) + x)
return var
for _ in range(int(input())):
n = int(input())
ar = list(map(int, input().split()))
dic = {}
for i in range(n):
var = len(bin(ar[i])[2:]) - 1
if var in di... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP BIN_OP VAR FUNC_CALL VAR NUMBER VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.