description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2." Same with some writers, she wants to make an example with some certain output...
n, m, cnt = int(input()), 148, 0 ans = [(["N"] * m) for i in range(m)] def edge(i, j): ans[i][j] = ans[j][i] = "Y" def node(*adj): global cnt i = cnt cnt += 1 for j in adj: edge(i, j) return i start, end, choice = node(), node(), node() if n & 1: edge(choice, end) for i in rang...
ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST STRING VAR VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR VAR VAR VAR VAR STRING FUNC_DEF ASSIGN VAR VAR VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP ...
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2." Same with some writers, she wants to make an example with some certain output...
k = int(input()) edges = [["N" for i in range(1010)] for j in range(1010)] vertices = 2 def add_edge(a, b): global edges edges[a][b] = edges[b][a] = "Y" for i in range(1, 29 + 1): vertices += 3 add_edge(i * 3, i * 3 - 1) add_edge(i * 3, i * 3 + 2) add_edge(i * 3 + 1, i * 3 - 1) add_edge(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR VAR VAR VAR VAR VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR...
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2." Same with some writers, she wants to make an example with some certain output...
k = str(input()) l = len(k) paths = [] for i in range(l): paths.append([1] * i + [int(k[i])] + [10] * (l - i - 1)) lens = [sum(p) for p in paths] n = sum(lens) + 2 m = [""] * n m[0] = "N" * 2 for i in range(len(paths)): m[0] += "Y" * paths[i][0] + "N" * (lens[i] - paths[i][0]) m[1] = "N" for i in range(len(path...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP LIST NUMBER VAR LIST FUNC_CALL VAR VAR VAR BIN_OP LIST NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER...
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2." Same with some writers, she wants to make an example with some certain output...
n, m = 337, int(input()) p = [(["N"] * n) for i in range(n)] def f(i, j): p[i][j] = p[j][i] = "Y" k = 6 + 15 * 5 for j in range(2, 6): f(1, j) for i in range(6, k, 5): for j in range(i - 4, i): f(i, j) for j in range(i + 1, i + 5): f(i, j) q, d, s = 4**15, 0, k while q: if m >= q...
ASSIGN VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR VAR VAR VAR VAR STRING ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER FOR VAR FUNC_CA...
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2." Same with some writers, she wants to make an example with some certain output...
class Node(object): cnt = 0 def __init__(_, adj=None): _.id = Node.cnt Node.cnt += 1 _.adj = adj if adj else [] _.seen = False n = int(input()) start = Node() end = Node() choose = Node() for i in range(30): if n & 1 << i: choose.adj.append(end) if i == 29: ...
CLASS_DEF VAR ASSIGN VAR NUMBER FUNC_DEF NONE ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR IF VAR N...
Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2." Same with some writers, she wants to make an example with some certain output...
N = int(input()) b = bin(N)[2:][::-1] count = len(b) - 1 def print_matrix(m): print(len(m)) for i in range(len(m)): print("".join(m[i])) m = [["N" for i in range(2 * len(b) + count)] for j in range(2 * len(b) + count)] for i in range(count - 1): val = len(m) - count + i m[val][val + 1] = "Y"...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER FUNC_CAL...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) x = list(map(int, input().split())) my_arr = list() my_list = list() res = 0 my_arr = [0] * 1000000 my_list = [0] * 1000000 arr2 = list(range(1000001)) my_arr[x[0]] = 0 my_list[x[0]] += 1 prev1 = 0 xr = 0 pos = 0 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def prefix(lis): pre = [lis[0]] for i in range(1, len(lis)): pre.append(pre[i - 1] + lis[i]) sum = 0 for i in range(1, len(lis)): sum = sum + (i * lis[i] - pre[i - 1] - i) return sum t = int(input()) for q in range(t): n = int(input()) arr = list(map(int, input().split())) ...
FUNC_DEF ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
class C: def __init__(self, k): self.sum = k + 1 self.cnt = 1 self.res = 0 def nxt(self, k): self.res += k * self.cnt - self.sum self.sum += k + 1 self.cnt += 1 t = int(input()) for _ in range(t): n = int(input()) d = {} x = 0 for i, v in enume...
CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER 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 DICT ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
x = int(input()) for m in range(x): y = int(input()) l = list(map(int, input().split(" "))) count = 0 for i in range(y - 1): f = l[i] for j in range(i + 1, y): f = f ^ l[j] if f == 0: count += j - i print(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 STRING 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 ASSIGN VAR BIN_OP VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): q = 0 n = int(input()) a = list(map(int, input().split())) x = [] x.append(0) for i in range(n): x.append(x[i] ^ a[i]) p = dict() for i in range(n + 1): p[x[i]] = [] for i in range(n + 1): p[x[i]].append(i) for k, v in p...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN 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 EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) xor = [] xor.append(arr[0]) for i in range(1, n): xor.append(xor[i - 1] ^ arr[i]) di = {} for i in range(n): if xor[i] not in di: di[xor[i]] = [] di[xor[i]].append(i) ...
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 LIST EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR DICT FOR VAR FUNC_...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for ankit in range(t): n = int(input()) arr = list(map(int, input().split())) ans = 0 m = 0 xorArr = [(0) for _ in range(n)] mp = dict() xorArr[0] = arr[0] for i in range(1, n): xorArr[i] = xorArr[i - 1] ^ arr[i] for i in range(n): tmp = m ^ xorArr[i]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL V...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for i in range(int(input())): n = int(input()) l = list(map(int, input().split())) XOR = 0 d = {} res = 0 d[0] = [0, 1] for i in range(len(l)): XOR ^= l[i] if XOR in d: res += d[XOR][1] * i - d[XOR][0] d[XOR][0] += i + 1 d[XOR][1] += 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 ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR BIN_OP B...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def tppp(ivvv): nmmm = 0 if 0 in ivvv.keys(): ivvv[0] += [-1] for key, indlll in ivvv.items(): indlll.sort(reverse=True) length = len(indlll) - 1 l = len(indlll) for i in indlll: nmmm += length * i length -= 2 nmmm = nmmm - int(l * (l -...
FUNC_DEF ASSIGN VAR NUMBER IF NUMBER FUNC_CALL VAR VAR NUMBER LIST NUMBER FOR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER R...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) lst = list(map(int, input().split())) pr_xor = [0] * 10**6 pr_xor[0] = 1 last_index = [0] * 10**6 last_index[0] = -1 prev_xor_cnt = [0] * 10**6 prev_xor_cnt[0] = 1 prev_ans = [0] * 10**6 xor_val = 0 ans = 0 for idx, ele in en...
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 BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR B...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) c = 0 s = set() for i in range(0, n - 1): for k in range(1, n): x = 0 for y in a[i : k + 1]: x ^= y if x == 0: for j in range(i + 1, k + 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 ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for i in range(int(input())): a = int(input()) b = [x for x in map(int, input().split())] c = [0] * a c[0] = b[0] count = 0 for j in range(1, a): c[j] = c[j - 1] ^ b[j] dic = dict() for k in range(a): ans = 0 n = 0 if c[k] not in dic.keys(): di...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSI...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for t in range(int(input())): n = int(input()) l = [int(j) for j in input().split()] d = {(0): [1, 0]} v = 0 count = 0 for i in range(n): v = v ^ l[i] if v in d: count = count + i * d[v][0] - d[v][1] d[v][0] += 1 d[v][1] += i + 1 else: ...
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 DICT NUMBER LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) ans = 0 prefix_xor = [] z = 0 prefix_xor.append(0) for i in range(n): z = z ^ a[i] prefix_xor.append(z) p_dict = dict() for i in range(n + 1): p_dict[prefix_xor[i]] = [] for...
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 ASSIGN VAR LIST ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def xor(arr, n): result = 0 arrxor = [(0) for _ in range(n)] arrxor[0] = arr[0] i = 1 while i < n: arrxor[i] = arrxor[i - 1] ^ arr[i] i += 1 mydict = {} mydict[0] = [-1] for ind, elem in enumerate(arrxor): if elem in mydict: mydict[elem].append(ind) ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER LIST NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
import itertools def findsubsets(s, n): return tuple(itertools.combinations(s, n)) def xorfunc(low, hi, a): xor1 = 0 for i in range(low, hi + 1): xor1 ^= a[i] if xor1 == 0: return hi - low else: return 0 t = int(input()) for i in range(t): n = int(input()) a = i...
IMPORT FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR VAR IF VAR NUMBER RETURN BIN_OP VAR VAR RETURN 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_CALL VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) + 1 a = [0] + list(map(int, input().split())) for i in range(1, n): a[i] ^= a[i - 1] r = {} ans = 0 r[0] = 1, 0 for i in range(1, n): cnt, sm = r.get(a[i], (0, 0)) ans += cnt * (i - 1) - sm r[a[i]] = cnt + 1, sm +...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FO...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: n = int(input()) arr = list(map(int, input().split())) pxor = [0] for i in range(n): pxor += [arr[i] ^ pxor[i]] d = dict() for i in range(n + 1): if pxor[i] in d.keys(): d[pxor[i]][2] = (i - d[pxor[i]][1]) * d[pxor[i]][0] + d[pxor[i]][2] ...
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 LIST NUMBER FOR VAR FUNC_CALL VAR VAR VAR LIST BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR FUNC_CAL...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t > 0: n = int(input()) inp = [int(i) for i in input().split()] t = t - 1 xorarr = [0] * n xorarr[0] = inp[0] mydict = dict() mydict[xorarr[0]] = 1 for i in range(1, n): xorarr[i] = xorarr[i - 1] ^ inp[i] if xorarr[i] not in mydict: mydi...
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 ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) ans = 0 m = [0] * n for i in range(n): if i == 0: m[i] = l[i] else: m[i] = m[i - 1] ^ l[i] d = {} c = 0 for i in l: c = c ^ i for i in range(n - 1,...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP V...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) a = tuple(map(int, input().split())) prefix = [0] for item in a: temp = prefix[-1] ^ item prefix.append(temp) m = {} m[0] = 1, 0 ans = 0 for i in range(1, len(prefix)): try: ans += m[prefix[i]][0] * ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for i in range(t): n = int(input()) lst = list(map(int, input().rstrip().split())) xlst = [(0) for j in range(n)] xlst[0] = lst[0] for j in range(1, n): xlst[j] = xlst[j - 1] ^ lst[j] xlst.insert(0, 0) di = {} for j in xlst: di[j] = [] for j in range(...
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 ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def dictt(arr): Dict = {} Dict[0] = [-1] for i, val in enumerate(arr): if val not in Dict: Dict[val] = [i] else: Dict[val].append(i) count = 0 for keys in Dict: s = len(Dict[keys]) if s >= 2: k = s - 1 j = s - 1 ...
FUNC_DEF ASSIGN VAR DICT ASSIGN VAR NUMBER LIST NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR LIST VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR VAR VA...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
from itertools import combinations t = int(input()) for c in range(t): n = int(input()) a = list(map(int, input().split())) l = [0] for i in range(n): l.append(a[i] ^ l[-1]) d = {} for j in range(n + 1): if l[j] in d: d[l[j]] += [j] else: d[l[j]] ...
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 LIST NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for i in range(t): n = int(input()) a = list(map(int, input().split())) d = [a[0]] c = 0 v, r = {}, {} v[d[0]] = 0 r[d[0]] = 0 for j in range(1, n): d.append(d[j - 1] ^ a[j]) v[d[j]] = 0 r[d[j]] = 0 for k in range(n): if v[d[k]] > 0: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR DICT DICT ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def count_subarrays(l): res = 0 p = [] p.append(0) for i in range(1, len(l)): p.append(p[i - 1] + l[i - 1]) for i in range(1, len(l)): res += i * l[i] - p[i] - i return res def special_case(l): res = 0 for i in l: res += i return res def solve(): arr =...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def find_coeffs(n): coeffs = [(0) for _ in range(n)] for i in range(1, n + 1): coeffs[i - 1] = i + (n - i) * i return coeffs def find_diff(indices): diff = [(0) for _ in range(len(indices) - 1)] for i in range(1, len(indices)): diff[i - 1] = int(indices[i] - indices[i - 1]) ret...
FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR N...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): N = int(input()) List = [int(x) for x in input().split()] Prefix = [] Temp = List[0] Prefix.append(List[0]) for i in range(1, N): Temp = List[i] ^ Temp Prefix.append(Temp) ans = 0 Dict = {(0): list()} Dict[0].append(0) Dict[0].append(...
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 LIST ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER AS...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): size = int(input()) given = [0] [given.append(int(i)) for i in str(input()).split(" ")] s = 0 ans = 0 count = [0] * (10**6 + 1) sum = [0] * (10**6 + 1) for index, element in enumerate(given): s ^= element ans += count[s] * index - sum[s...
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 NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def rev_index(myList): V = {} for index, val in enumerate(myList): if val not in V.keys(): V[val] = [index] else: V[val] += [index] return V def No_tri(IV): num = 0 if 0 in IV.keys(): IV[0] += [-1] for key, IL in IV.items(): IL.sort(rever...
FUNC_DEF ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR ASSIGN VAR VAR LIST VAR VAR VAR LIST VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER IF NUMBER FUNC_CALL VAR VAR NUMBER LIST NUMBER FOR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VA...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) x = [0] p = [[0, 0]] prev = 0 ans = 0 counter = 0 for i in range(1, n + 1): x.append(x[i - 1] ^ l[i - 1]) p.append([x[i], i]) p = sorted(p) for i in range(1, len(p)): ...
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 LIST NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP V...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) xor = [0] for i in range(n): last = xor[-1] xor.append(last ^ arr[i]) d = {} for i in range(len(xor)): if xor[i] not in d: d[xor[i]] = [i] else: d[xor[i]]....
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 LIST NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) xorsum = [] xor = 0 xorsum.append(xor) for i in range(len(a)): xor ^= a[i] xorsum.append(xor) xordict = dict() for i in range(len(xorsum)): if xorsum[i] in xordict: xord...
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 LIST ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: n = int(input()) z = input().split() for i in range(n): z[i] = int(z[i]) XOR = 0 prefix = [0] * n for i in range(n): XOR = XOR ^ z[i] prefix[i] = XOR dict1 = {} for i in range(n): dict1.setdefault(prefix[i], []).append(i) coun...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: t -= 1 s = int(input()) lis = list(map(int, input().split(" "))) xor_lis = [(0) for i in range(len(lis) + 1)] i = 1 for v in lis: xor_lis[i] = xor_lis[i - 1] ^ v i += 1 dic = {} for i, val in enumerate(xor_lis): if val in dic.keys(): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR V...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) xor = [0] * n xor[0] = a[0] m = a[0] for i in range(1, n): xor[i] = xor[i - 1] ^ a[i] m = max(m, xor[i]) v = [] ans = 0 sum = [0] * (m + 1) for j in range(m + 2): v.ap...
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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_O...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) xorArr = [(0) for _ in range(n)] xorArr[0] = l[0] for i in range(1, n): xorArr[i] = xorArr[i - 1] ^ l[i] vec = [] dic = {} count = 0 dic[0] = [-1] for i in range(n): if dic.ge...
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 VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: t = t - 1 n = int(input()) arr = list(map(int, input().split())) mydict = {} x = [0] * (n + 1) y = 0 for i in range(len(arr)): x[i + 1] = y ^ arr[i] y = x[i + 1] for i in range(len(x)): if x[i] in mydict: mydict[x[i]].append(i...
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 DICT ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) arr = list(map(int, input().strip().split())) prefix_xor = [arr[0]] for i in range(1, len(arr)): prefix_xor.append(prefix_xor[-1] ^ arr[i]) xor_map = {(0): [1, 0]} total_triplets = 0 for index, elem in enumerate(prefix_xor): ...
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 ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR DICT NUMB...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) b = list(map(int, input().split())) a = list() x1 = b[0] a.append(0) a.append(b[0]) for i in range(1, n): x1 ^= b[i] a.append(x1) c = {} for i in range(len(a)): c.setdefault(a[i], []).append(i) x, x3 = 0...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR E...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for t in range(int(input())): n = int(input()) li = list(map(int, input().split())) sol = 0 p_s, c_s = li[0], 0 tmp = dict() tmp[p_s] = [0, 1] for i in range(1, n): c_s = p_s ^ li[i] if c_s == 0: sol += i if c_s in tmp.keys(): sol += tmp[c_s][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 ASSIGN VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: n = int(input()) arr = list(map(int, input().split())) prefix = [0] * n prefix[0] = arr[0] for i in range(1, n): prefix[i] = arr[i] ^ prefix[i - 1] pos = {(0): [0]} for i in range(n): if prefix[i] not in pos: pos[prefix[i]] = [i + 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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR DICT N...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def sumPairs(arr, n): sum = 0 for i in range(n - 1, -1, -1): sum += i * arr[i] - (n - 1 - i) * arr[i] return sum - n * (n - 1) // 2 R = lambda: map(int, input().split()) t = int(input()) for _ in range(t): n = int(input()) xs = list(map(int, input().split())) xor = 0 dict = {(0): [...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR VAR RETURN BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
T = int(input()) for _ in range(0, T): N = int(input()) arr = list(map(int, input().split())) prexor = [] cnt = 0 prexor.append(0) tp = 0 for i in range(N): tp ^= arr[i] prexor.append(tp) dict1 = dict() for i in range(0, len(prexor)): sm = prexor[i] if...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER 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 LIST ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASS...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def prefixXor(arr): output = [0] temp = 0 out = dict() out[0] = [1, 0] ans = 0 for item in range(len(arr)): temp ^= arr[item] output.append(temp) if not output[item + 1] in out.keys(): out[output[item + 1]] = [0, 0] count = out[output[item + 1]][0] ...
FUNC_DEF ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER LIST NUMBER NUMBER ASSIGN VAR VAR VAR BIN_O...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for testcase in range(int(input())): n = int(input()) a = [0] + list(map(int, input().split())) sum = [0] * 2000020 cnt = [0] * 2000020 s = 0 ans = 0 cnt[0] = 1 sum[0] = 1 for i in range(1, len(a)): s ^= a[i] ans += i * cnt[s] - sum[s] cnt[s] += 1 sum[...
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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
final_result = [] def get_no_of_triplets(array): result = 0 aux_array = array length = len(array) hash_table = {} for i in range(1, length): aux_array[i] = aux_array[i] ^ aux_array[i - 1] for i in range(length): if aux_array[i] in hash_table: hash_table[aux_array[i]...
ASSIGN VAR LIST FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST VAR FOR VAR FUNC_CALL VAR FUNC_CALL ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def gudv(n, l): c = 0 b = 0 d = {} d[0] = [0, 1] for i in range(n): b = b ^ l[i] if b in d: c += d[b][1] * i - d[b][0] d[b][0] += i + 1 d[b][1] += 1 else: d[b] = [i + 1, 1] print(c) for i in range(int(input())): n = in...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR NUMBER VAR VAR NUMBER BIN_OP VAR NUMBER VAR VAR NUMBER NUMBER ASSIGN VAR VAR LIST BIN_OP VAR NUMBER NUMBER EXP...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for i in range(t): n = int(input()) l = list(map(int, input().split())) l1 = [] fin = 0 for j in range(n): l1.append(0) d1 = {} d2 = {} d3 = {} d4 = {} d5 = {} d6 = {} l1[0] = l[0] for j in range(1, n): l1[j] = l1[j - 1] ^ l[j] d1[...
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 LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) s = 0 c = {(0): [0]} for i, x in enumerate(a): s ^= x c.setdefault(s, []).append(i + 1) s = 0 for k, v in c.items(): l = len(v) - 1 if not l: continue x = su...
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 ASSIGN VAR DICT NUMBER LIST NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL FUNC_CALL VAR VAR LIST BIN_OP VAR NUMBER ASSIGN VAR NUMBER...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) px = [0] x = 0 d = {(0): [0]} for i in range(n): x = x ^ l[i] px.append(x) if x not in d: d[x] = [i + 1] else: d[x].append(i + 1) gsum = 0 for ...
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 LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT NUMBER LIST NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VA...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split(" "))) pair = {} pair[0] = [-1] pair[a[0]] = [0] for i in range(1, n): a[i] = a[i - 1] ^ a[i] if a[i] in pair: pair[a[i]].append(i) else: pair[a[i]] = [i] ans = 0 ...
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 DICT ASSIGN VAR NUMBER LIST NUMBER ASSIGN VAR VAR NUMBER LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def maker_dictttt(a): ind = {} for i in range(len(a)): try: if ind[a[i]]: ind[a[i]].append(i) except KeyError: ind[a[i]] = [i] return ind def nC2(n): return int(n * (n - 1) / 2) def ardderr(arr): rest = 0 n = len(arr) prefix = -(n -...
FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST VAR RETURN VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: n = int(input()) arr = list(map(int, input().split())) pxor = [0] for i in range(n): pxor += [arr[i] ^ pxor[i]] m = max(pxor) count = [0] * (m + 1) ind = [-1] * (m + 1) val = [0] * (m + 1) res = [0] * (m + 1) for i in range(n + 1): val[px...
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 LIST NUMBER FOR VAR FUNC_CALL VAR VAR VAR LIST BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN ...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def passwr(length, guddu): password = 0 values = {} compute = guddu[0] values[compute] = [1, 1] j = 1 while j != length: compute = compute ^ guddu[j] try: if not compute: password += j password += values[compute][1] * j - values[compute][0]...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR VAR NUMBER ASSIGN VAR VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR LIST BIN_OP VAR VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER NUMBER ASS...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t > 0: t = t - 1 n = int(input()) l = [] l = [int(x) for x in input().split()] prefix = [] prefix.append(l[0]) xor_vals = {} i_s = {} ans = 0 for i in range(1, n): prefix.append(prefix[i - 1] ^ l[i]) for i in range(0, n): if prefix[i] ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBE...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
def xorContest(seq): ans = 0 count = {} bad_count = {} pre_xor = [None] * (len(seq) + 1) pre_xor[0] = 0 for i in range(1, len(seq) + 1): pre_xor[i] = pre_xor[i - 1] ^ seq[i - 1] for i in range(len(pre_xor)): xor = pre_xor[i] ans = ( ans + i * (...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR BIN_OP LIST NONE BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VA...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
test_cases = int(input()) for test in range(test_cases): n = int(input()) seq = list(map(int, input().split())) triplets = 0 res = [(0) for _ in range(n + 1)] for i in range(1, n + 1): res[i] = res[i - 1] ^ seq[i - 1] xors = {} for i in range(n + 1): if res[i] not in xors: ...
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 ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_...
Guddu was participating in a programming contest. He only had one problem left when his mother called him for dinner. Guddu is well aware how angry his mother could get if he was late for dinner and he did not want to sleep on an empty stomach, so he had to leave that last problem to you. Can you solve it on his behalf...
t = int(input()) while t: n = int(input()) ans = 0 li = list(map(int, input().split())) li = [0] + li xor = [0] for i in range(1, n + 1): xor.append(xor[i - 1] ^ li[i]) di = dict() for i in range(0, n + 1): if xor[i] in di: di[xor[i]].append(i) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NU...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
s = input() chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" counts = [ 729, 243, 243, 81, 243, 81, 81, 27, 243, 81, 81, 27, 81, 27, 27, 9, 243, 81, 81, 27, 81, 27, 27, 9, 81, 27, 27, ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING 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 NUMBER NUMBER NUMBER NUMBER NUMBER NU...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
import sys def convert(x): if x >= "A" and x <= "Z": return ord(x) - ord("A") + 10 if x >= "a" and x <= "z": return ord(x) - ord("a") + 36 if x >= "0" and x <= "9": return ord(x) - ord("0") if x == "-": return 62 return 63 def ones(n): r = 0 while n != 0: ...
IMPORT FUNC_DEF IF VAR STRING VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER IF VAR STRING VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER IF VAR STRING VAR STRING RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF VAR STRING RETURN NUMBER RETURN NUMBER ...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
import sys def minp(): return sys.stdin.readline().strip() alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" V = dict() for i in range(len(alpha)): for j in range(len(alpha)): k = i & j V[k] = V.get(k, 0) + 1 s = minp() r = 1 for i in range(len(s)): k = alpha.fin...
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def noof0(strin): s = 0 l = len(strin) for item in strin: if item == str(0): s += 1 return s + 6 - l string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" array = [] for item in string: array.append(item) def g(a, n, m): if n == 0: return 1 ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR FUNC_CALL VAR NUMBER VAR NUMBER RETURN BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR STRING ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR BIN_...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
from sys import stdin result = 1 MD = 10**9 + 7 def charToInt(c): assert len(c) == 1 val = -1 if c in "0123456789": val = int(c) elif c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": val = ord(c) - 55 elif c in "abcdefghijklmnopqrstuvwxyz": val = ord(c) - 61 elif c == "-": v...
ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER IF VAR STRING A...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
string = input() def entre(i, a, b): return ord(i) >= ord(a) and ord(i) <= ord(b) resp = 1 for char in string: if entre(char, "0", "9"): i = ord(char) - ord("0") elif entre(char, "A", "Z"): i = ord(char) - ord("A") + 10 elif entre(char, "a", "z"): i = ord(char) - ord("a") + 3...
ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CA...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
conversaoBase64 = {"-": 62, "_": 63} for j in range(0, 10): conversaoBase64[str(j)] = j j = 10 for i in range(ord("A"), ord("Z") + 1): conversaoBase64[chr(i)] = j j += 1 j = 36 for i in range(ord("a"), ord("z") + 1): conversaoBase64[chr(i)] = j j += 1 palavra = list(input()) cont = 0 for letra in pa...
ASSIGN VAR DICT STRING STRING NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
mod = pow(10, 9) + 7 ans = 1 d = {} string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" for i in range(64): for j in range(64): if i & j in d: d[i & j] += 1 else: d[i & j] = 1 s = input() for i in s: x = string.index(i) ans = ans % mod * (d[x] ...
ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
s = input() bit, mp, ID, res, MOD = {}, {}, 0, 1, int(1000000000.0 + 7) for i in range(10): bit[chr(i + ord("0"))] = ID ID += 1 for i in range(26): bit[chr(i + ord("A"))] = ID ID += 1 for i in range(26): bit[chr(i + ord("a"))] = ID ID += 1 bit["-"] = ID bit["_"] = ID + 1 for i in range(64): ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR DICT DICT NUMBER NUMBER FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR STRING VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR STRING VAR VAR NUMBER FOR VAR...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
A = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" Z = [0] * 64 for i in range(64): r = 0 for j in range(64): for k in range(64): if i == j & k: r += 1 Z[i] = r r = 1 for c in input(): r = r * Z[A.index(c)] % 1000000007 print(r)
ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def main(): s = input() number = "" ans = 1 for c in s: if c >= "0" and c <= "9": number = bin(int(c))[2:] elif c >= "A" and c <= "Z": number = bin(ord(c) - 55)[2:] elif c >= "a" and c <= "z": number = bin(ord(c) - 61)[2:] elif c == "-"...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def count(num): string = bin(num)[2:] return string.count("0") + 6 - len(string) key = [(3 ** count(x)) for x in range(64)] dic = {} for i in range(10): dic[chr(ord("0") + i)] = key[i] for i in range(26): dic[chr(ord("A") + i)] = key[i + 10] for i in range(26): dic[chr(ord("a") + i)] = key[i + 36]...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP BIN_OP FUNC_CALL VAR STRING NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER A...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def Bina(n): s = "" while n != 0: s += str(n % 2) n = n // 2 return s def Zeros(b): ones = 0 for i in range(b.__len__()): if "1" == b[i]: ones += 1 return 6 - ones total = 1 alphabet = list("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-")...
FUNC_DEF ASSIGN VAR STRING WHILE VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR IF STRING VAR VAR VAR NUMBER RETURN BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR DICT ASSIGN VAR NUMBER...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
print( 3 ** sum( 6 - bin( {"-": 62, "_": 63}.get(c, ord(c) - 7 * (c > "9") - 6 * (c > "Z") - 48) ).count("1") for c in input() ) % 1000000007 )
EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL FUNC_CALL VAR FUNC_CALL DICT STRING STRING NUMBER NUMBER VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR BIN_OP NUMBER VAR STRING BIN_OP NUMBER VAR STRING NUMBER STRING VAR FUNC_CALL VAR NUMBER
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
z = input() l = [] for x in z: if ord(x) >= ord("0") and ord(x) <= ord("9"): l.append(ord(x) - ord("0")) elif ord(x) >= ord("A") and ord(x) <= ord("Z"): l.append(ord(x) - ord("A") + 10) elif ord(x) >= ord("a") and ord(x) <= ord("z"): l.append(ord(x) - ord("a") + 36) elif ord(x) =...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CA...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
word = input() count = 0 for s in word: count = count - 2 if s == "0": count += 8 elif s == "1": count += 7 elif s == "2": count += 7 elif s == "3": count += 6 elif s == "4": count += 7 elif s == "5": count += 6 elif s == "6": count...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRI...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
s = input() ans = 1 for x in s: if 48 <= ord(x) <= 57: now = int(x) elif 65 <= ord(x) <= 90: now = ord(x) - 55 elif 97 <= ord(x) <= 122: now = ord(x) - 61 elif x == "-": now = 62 else: now = 63 for i in range(6): if now & 2**i == 0: ans...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NU...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
s = input().strip() m = {} for i in range(10): m[str(i)] = i for i in range(ord("Z") - ord("A") + 1): m[chr(ord("A") + i)] = 10 + i for i in range(ord("z") - ord("a") + 1): m[chr(ord("a") + i)] = 36 + i m["-"] = 62 m["_"] = 63 zero_bits = 0 for c in s: n = m[c] for i in range(6): zero_bits +...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL V...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
mod = 10**9 + 7 resp = 1 s = input() def between(n, a, b): return n >= a and n <= b for i in s: if between(i, "0", "9"): i = ord(i) - ord("0") elif between(i, "A", "Z"): i = ord(i) - ord("A") + 10 elif between(i, "a", "z"): i = ord(i) - ord("a") + 36 elif i == "-": ...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN VAR VAR VAR VAR FOR VAR VAR IF FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STR...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" mp = {} for i in range(len(chars)): mp[chars[i]] = i zero = 0 s = input() for i in range(len(s)): zero += sum([(i == "0") for i in format(mp[s[i]], "06b")]) print(str(pow(3, zero, int(1000000000.0 + 7))))
ASSIGN VAR STRING ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BI...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def get(s): try: return int(s) except: if s == "-": return 62 elif s == "_": return 63 elif s.isupper(): return ord(s) - 55 else: return ord(s) - 61 arr = [ 6, 5, 5, 4, 5, 4, 4, 3, 5, ...
FUNC_DEF RETURN FUNC_CALL VAR VAR IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER IF FUNC_CALL VAR RETURN BIN_OP FUNC_CALL VAR VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
f = lambda x: 7 - len(bin(x)) + bin(x).count("0") d = {str(i): f(i) for i in range(10)} for i in range(65, 91): d[chr(i)] = f(i - 55) for i in range(97, 123): d[chr(i)] = f(i - 61) d["_"], d["-"], s, m = 0, 1, 1, 10**9 + 7 for i in input(): s *= 3 ** d[i] s %= m print(s)
ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
s = input() ans = [(0) for i in range(64)] for i in range(len(ans)): temp = bin(i) ans[i] = temp.count("0") - 1 + (6 - (len(temp) - 2)) pri = 10**9 + 7 count = 1 for i in range(len(s)): if s[i].isdigit(): r = bin(int(s[i])) r = r[2:] count = count * pow(3, ans[int(s[i])], pri) ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP FUNC_CALL VAR STRING NUMBER BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CAL...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" d = {} cnt = 0 for i in chars: d[i] = cnt cnt += 1 s = input() ans = 1 mod = 10**9 + 7 for i in s: x = bin(d[i]) x = x.split("b") x = x[1] p = 0 for j in x: if j == "0": ans = ans * 3 % mod ...
ASSIGN VAR STRING ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR S...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
d = {} def init(): l = [] for item in range(10): l.append(str(item)) for item in range(ord("A"), ord("Z") + 1): l.append(chr(item)) for item in range(ord("a"), ord("z") + 1): l.append(chr(item)) l.append("-") l.append("_") for i, item in enumerate(l): d[item...
ASSIGN VAR DICT FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR F...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def toi(c): if c >= "0" and c <= "9": return ord(c) - ord("0") if c >= "A" and c <= "Z": return ord(c) - ord("A") + 10 if c >= "a" and c <= "z": return ord(c) - ord("a") + 36 if c == "-": return 62 if c == "_": return 63 s = input() q = [0] * 64 for i in ran...
FUNC_DEF IF VAR STRING VAR STRING RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF VAR STRING VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER IF VAR STRING VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING RETURN ...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
ls = [0] * 100010 for i in range(64): for j in range(64): ls[i & j] += 1 s = input() ss = 1 for i in s: if ord(i) >= ord("a") and ord(i) <= ord("z"): ss *= ls[ord(i) - ord("a") + 36] elif ord(i) >= ord("A") and ord(i) <= ord("Z"): ss *= ls[ord(i) - ord("A") + 10] elif ord(i) >= o...
ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NU...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
x = 10**9 + 7 y = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" s = input() count = 0 for i in s: b = bin(int(y.find(i)))[2:] count += b.zfill(6).count("0") print(3**count % x)
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def main(): l = [0] * 123 for i, c in enumerate( "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" ): l[ord(c)] = "{:0>6b}".format(i).count("0") print(pow(3, sum(l[ord(c)] for c in input()), 1000000007)) main()
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
d = [0] * 64 for i in range(64): for j in range(64): d[i & j] += 1 s = input() ans = 1 for i in s: if "0" <= i <= "9": ans *= d[int(i)] elif "A" <= i <= "Z": ans *= d[ord(i) - ord("A") + 10] elif "a" <= i <= "z": ans *= d[ord(i) - ord("a") + 10 + 26] elif i == "-": ...
ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF STRING VAR STRING VAR VAR FUNC_CALL VAR VAR IF STRING VAR STRING VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER IF STRIN...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
all = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" s = input() ans = 1 for c in s: pos = all.find(c) cnt = int(0) cnt += (pos + 1) % 2 pos //= 2 cnt += (pos + 1) % 2 pos //= 2 cnt += (pos + 1) % 2 pos //= 2 cnt += (pos + 1) % 2 pos //= 2 cnt += (pos + 1)...
ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBE...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
s = input() m = dict() a = dict() m["-"] = 62 m["_"] = 63 for i in range(10): m[str(i)] = i for i in range(26): m[chr(65 + i)] = 10 + i for i in range(26): m[chr(97 + i)] = 36 + i for x in range(64): for j in range(64): a[x & j] = a.get(x & j, 0) + 1 ans = 1 for c in s: ans = ans * a.get(m[c...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING NUMBER ASSIGN VAR STRING NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUN...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
word = input() mod = 1000000007 res = 1 for i in word: if ord(i) >= 48 and ord(i) <= 57: i = ord(i) - 48 elif ord(i) >= 65 and ord(i) <= 90: i = ord(i) - 55 elif ord(i) >= 97 and ord(i) <= 122: i = ord(i) - 61 elif ord(i) == 45: i = 62 else: i = 63 for j i...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER AS...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
num = list(range(10)) bword = list(range(10, 36)) sword = list(range(36, 62)) bigconst = 65 smallconst = 97 ans = 1 s = input() for i in range(len(s)): if s[i] >= "0" and s[i] <= "9": k = int(s[i]) elif s[i] >= "A" and s[i] <= "Z": k = bword[ord(s[i]) - bigconst] elif s[i] >= "a" and s[i] <=...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR FUNC_...
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bit...
def conv(d): if "0" <= d <= "9": return int(d) if "A" <= d <= "Z": return 10 + ord(d) - ord("A") if "a" <= d <= "z": return 36 + ord(d) - ord("a") if d == "-": return 62 return 63 cnt = [0] * 64 for a in range(64): for b in range(64): cnt[a & b] += 1 ans...
FUNC_DEF IF STRING VAR STRING RETURN FUNC_CALL VAR VAR IF STRING VAR STRING RETURN BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF STRING VAR STRING RETURN BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR STRING IF VAR STRING RETURN NUMBER RETURN NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FU...