description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) l = [int(e.strip()) for e in input().strip().split()] ans = [] a = {} for pp in l: if pp in a: a[pp] += 1 else: a[pp] = 1 mx = 0 id = 0 for i, j in a.items(): if j > mx: mx = j id = i for i in range(len(l)): if l[i] == id: id = i break for...
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 ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR F...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
from sys import stdin def mostFrequent(arr, n): Hash = dict() for i in range(n): if arr[i] in Hash.keys(): Hash[arr[i]] += 1 else: Hash[arr[i]] = 1 max_count = 0 res = -1 for i in Hash: if max_count < Hash[i]: res = i max_coun...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR RETURN VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUN...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) ints = [0] * (2 * 10**5 + 1) max_ = 0 argmax = 0 for i in a: ints[i] += 1 if ints[i] > max_: max_ = ints[i] argmax = i print(n - ints[argmax]) flag = True for i, value in enumerate(a): if value == argmax and flag: flag = False ...
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 BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = list(map(int, input().split())) el = -1 max0 = 0 cnt = [0] * 1000000 for el in arr: cnt[el] += 1 for i in range(1000000): if cnt[i] > max0: el = i max0 = cnt[i] for i in range(n): if arr[i] == el: pos = i break print(n - cnt[el]) for i in range(pos, n -...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) cnt = [0] * (2 * 10**5 + 1) ind = [0] * (2 * 10**5 + 1) for i in range(n): cnt[a[i]] += 1 ind[a[i]] = i m = max(cnt) i_m = ind[cnt.index(m)] distinct = n - m print(distinct) i = i_m for j in range(i_m + 1, n): if a[j] != a[i]: if a[j] > a[i]: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def solve(a): d = {} for i in a: if i in d: d[i] += 1 else: d[i] = 1 m = 0 elem = 0 for i in d: if d[i] > m: m = d[i] elem = i print(len(a) - m) start = -1 for i in range(len(a)): if a[i] == elem: ...
FUNC_DEF ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR FO...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) d = {} for i in a: if d.get(i) is not None: d[i] += 1 else: d[i] = 1 max_k = -1 max_v = -1 for k in d: if d[k] > max_v: max_v = d[k] max_k = k idx = -1 for id_, i in enumerate(a): if i == max_k: idx = id_ ...
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 FOR VAR VAR IF FUNC_CALL VAR VAR NONE VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def check(line): lst = sorted(line, key=lambda s: int(s)) for i in range(2, len(lst)): if lst[i] == lst[i - 2]: return False return lst def main(): n_row = input() line = input() num = line.strip(" ").split(" ") num = [int(i) for i in num] dic = {} for i in num:...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER RETURN NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR DIC...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
N = int(input()) a = list(map(int, input().split())) ma = {} for n in a: if n in ma: ma[n] += 1 else: ma[n] = 1 le = -1 lo = 0 for k in ma: if ma[k] >= lo: le = k lo = ma[k] df = N - lo if df == 0: print(df) exit(0) moves = [] print(df) for i in range(N): if a[i] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER E...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) num = [int(x) for x in input().split(" ")] help = dict() used = set() for i in range(n): if num[i] not in used: help[num[i]] = 1 used.add(num[i]) else: help[num[i]] += 1 w = 0 for i in range(n): c = help[num[i]] if c > w: w = c ans = num[i] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = input() a = input().split() a = [int(i) for i in a] counter = dict() for i in a: if i in counter: counter[i] = counter[i] + 1 else: counter[i] = 1 _max = -1 target = 0 for key, value in counter.items(): if value > _max: target = key _max = value position = [] for i, value...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR LI...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = [int(x) for x in input().split()] cnt = {} for x in arr: if x in cnt: cnt[x] += 1 else: cnt[x] = 1 mx_num, mx_cnt = max(cnt.items(), key=lambda x: x[1]) first_index = 0 for i, x in enumerate(arr): if mx_num == x: first_index = i break print(n - mx_cnt) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR B...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def counter(l, n): maxi, first_index, num = 0, 0, 0 d = {} for i in range(n): try: d[l[i]][0] += 1 except: d[l[i]] = [1, i + 1] if d[l[i]][0] > maxi: maxi = d[l[i]][0] num = l[i] first_index = d[l[i]][1] return [maxi, fi...
FUNC_DEF ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR LIST NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR NUMBER VAR ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR VAR NUMBER RETURN LIST VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) cnt = [0] * 200005 M = 0 key = 0 for i in a: cnt[i] += 1 if key < cnt[i]: M = i key = cnt[i] print(N - key) stack = [] idx = 0 for i in a: if i != M: stack.append(i) else: break ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) pa = [0] * 200050 mx = -1 ele = -1 for i in a: pa[i] += 1 for i in range(len(pa)): if pa[i] > mx: mx = pa[i] ele = i t = len(a) - mx fi = a.index(ele) ite = fi - 1 print(t) while ite >= 0: if a[ite] > ele: print(2, ite + 1, ite + 2...
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [int(i) for i in input().split()] counts = {} max_cnt = 0 max_value = -1 indd = -1 for ij in range(n): i = a[ij] if i not in counts: counts[i] = 0 counts[i] += 1 if counts[i] > max_cnt: max_cnt = counts[i] max_value = i indd = ij print(n - max_cnt) fo...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [int(s) for s in input().split()] cts = {} maxct = 1 maxn = a[0] for ai in a: cts[ai] = cts.get(ai, 0) + 1 if cts[ai] > maxct: maxct = cts[ai] maxn = ai print(n - maxct) def sweep(st, en, step): for i in range(st, en, step): if a[i + step] < a[i]: p...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR FUNC_DEF FOR VAR FU...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) cnt = [0] * 200001 for x in a: cnt[x] += 1 mx = max(cnt) val = -1 for x in a: if cnt[x] == mx: val = x index = -1 for i, x in enumerate(a): if x == val: index = i break answer = [] for i in reversed(range(index)): if a[i] > val...
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 NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR AS...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) In = input().split() arr = [] dicr = {} for i in range(n): arr.append(int(In[i])) if dicr.get(int(In[i])): dicr[int(In[i])] += 1 else: dicr[int(In[i])] = 1 maxValue = max(dicr.keys(), key=lambda k: dicr[k]) print(n - dicr[maxValue]) for i in range(arr.index(maxValue), 0, -1)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
d = {} n = int(input()) l = list(map(int, input().split())) ll = sorted(l) mid = n // 2 li = [] mx = -1 for i in l: d[i] = d.get(i, 0) + 1 for i in d: if d[i] > mx: mx = d[i] med = i for i in range(n): if l[i] == med: ind = i break for i in range(ind - 1, -1, -1): if l[i]...
ASSIGN VAR DICT 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 VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = [int(x) for x in input().split()] cnt = list(sorted(arr)) same_val = cnt[0] same_num = 1 max_same_num = 1 for i in range(1, n): if cnt[i] == cnt[i - 1]: same_num += 1 else: same_num = 1 if same_num > max_same_num: max_same_num = same_num same_val = cnt[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR VAR AS...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
a = int(input()) s = [int(x) for x in input().split()] d = {} n = 0 for i in range(a): d[s[i]] = 0 for i in s: d[i] += 1 x = 0 it = 0 for i in d: if d[i] > it: x = i it = d[i] c = s.index(x) for i in s: if i != x: n += 1 print(n) for i in range(c - 1, -1, -1): if s[i] < x: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUN...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
N = int(input()) A = [int(a) for a in input().split()] B = [0] * (2 * 10**5 + 10) for a in A: B[a] += 1 ma = 0 mai = 0 for i in range(len(B)): if B[i] > ma: ma = B[i] maa = i for i in range(N): if A[i] == maa: mai = i break print(N - ma) for i in range(mai)[::-1]: if A[i]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
import sys n = int(input()) arr = list(map(int, input().split())) noCounts = [0] * (2 * 10**5 + 1) for i in arr: noCounts[i] += 1 tmp = max(noCounts) print(n - tmp) x = noCounts.index(tmp) a = arr.index(x) for i in range(a, 0, -1): if arr[i] < arr[i - 1]: print(2, i, i + 1) arr[i - 1] = arr[i] ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) d = {} mx = 0 q = 0 ans = [] for i in a: if i not in d: d[i] = 1 else: d[i] += 1 if d[i] > q: q = d[i] mx = i for i in range(n): if a[i] == mx: ind = i break print(n - d[mx]) for i in range(ind - 1, -1, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) g = {} for q in a: g[q] = g.get(q, 0) + 1 max_quantity = max(g, key=lambda x: g[x]) print(len(a) - g[max_quantity]) index_max = a.index(max_quantity) for q in range(index_max - 1, -1, -1): if a[q] > max_quantity: print(2, q + 1, q + 2) else: ...
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 FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_C...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def main(): n = int(input()) arr = list(map(int, input().split())) dct = {} k = -1 m = 0 for i in range(n): try: dct[arr[i]] += 1 except: dct[arr[i]] = 1 if dct[arr[i]] > m: m = dct[arr[i]] k = arr[i] print(n - m) fo...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR BI...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) l = [*map(int, input().split())] cnt = [0] * 200001 for i in l: cnt[i] += 1 mx = num = -1 for i in range(200001): if mx < cnt[i]: mx = cnt[i] num = i idx = -1 for i in range(n): if num == l[i]: idx = i break res = [] for i in range(idx - 1, -1, -1): if l[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) count = {} for i in a: count[i] = count.get(i, 0) + 1 el = 0 ma = 0 for k in count: if count[k] > ma: ma = count[k] el = k ind = 0 for i in range(len(a)): if a[i] == el: ind = i break if len(count) == 1: print(0) else: ...
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 FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) l = [int(i) for i in input().split(" ")] count = {} for i in l: if i in count: count[i] += 1 else: count[i] = 1 count_to_list = [(count[k], k) for k in count] count_to_list.sort(reverse=True) most_frequent_count, most_frequent = count_to_list[0] move_count = n - most_frequent_co...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) l = list(map(int, input().split())) dict = {} for i in l: try: dict[i] += 1 except: dict[i] = 1 maks = 0 eleman = 0 for i in dict: if dict[i] > maks: maks = dict[i] eleman = i indeks = [] for i in range(n): if l[i] == eleman: indeks.append(i) prin...
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 FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def most_freq(a): s = {} for i in range(len(a)): s[a[i]] = 0 for i in range(len(a)): s[a[i]] += 1 l = 0 d = 0 for key in s: if s[key] > l: l = s[key] d = key return d n = int(input()) a = list(map(int, input().split())) s = most_freq(a) p = a...
FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
num = int(input().strip()) numbers = [int(i) for i in input().strip().split()] num_dict = dict() for i in numbers: if i not in num_dict: num_dict[i] = 1 else: num_dict[i] += 1 max_number = 0 max_index = 0 for i in num_dict: if num_dict[i] > max_number: max_index = i max_numbe...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) s = list(map(int, input().split())) cnt = dict() for x in s: if x not in cnt: cnt[x] = 1 else: cnt[x] += 1 mx = -1 x = -1 for k in cnt: if mx < cnt[k]: mx = cnt[k] x = k print(n - mx) for i in range(s.index(x) - 1, -1, -1): if s[i] > x: print(2, i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) A = list(map(int, input().split())) A = [-1] + A vec = [[] for i in range(200005)] for i in range(1, n + 1): vec[A[i]].append(i) mx, num = 0, 0 for i in range(200005): mx = max(mx, len(vec[i])) if mx == len(vec[i]): num = i ans = [] for i in range(vec[num][0] - 1, 0, -1): if A[i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASS...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) l = list(map(int, input().split())) hash = {} max = 0 ans = 0 for i in l: try: hash[i] except: hash[i] = 1 else: hash[i] += 1 if hash[i] > max: max = hash[i] ans = i posn = [] for i in range(n): if l[i] == ans: posn.append(i) z = posn[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR EXPR VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def _f(n, arr): number_count_map = {} for a in arr: if number_count_map.get(a, None) is None: number_count_map[a] = 1 else: number_count_map[a] += 1 max_number = list(number_count_map.keys())[0] for dict_key in list(number_count_map.keys()): if number_coun...
FUNC_DEF ASSIGN VAR DICT FOR VAR VAR IF FUNC_CALL VAR VAR NONE NONE ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST IF VAR NUMBER VAR EXPR FUNC_CALL VAR LIST NUMBER NUMBER FOR VAR FUN...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
N = int(input()) arr = input() arr = [int(x) for x in arr.split(" ")] freq = {} max_f = 0 max_num = 0 for num in arr: if num not in freq: freq[num] = 1 else: freq[num] += 1 if freq[num] > max_f: max_num = num max_f = freq[num] target = max_num tar_idx = -1 equ = N - max_f for...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = list(map(int, input().split())) cnts = [0] * 200001 best, best_cnt, idx = None, 0, None for i in range(n): cnts[arr[i]] += 1 if cnts[arr[i]] > best_cnt: best, best_cnt, idx = arr[i], cnts[arr[i]], i moves = [] for i in range(idx, 0, -1): if arr[i - 1] < best: moves.app...
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 NUMBER ASSIGN VAR VAR VAR NONE NUMBER NONE FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) d = {} for c in a: d[c] = d.get(c, 0) + 1 km = a[0] for c in d: if d[c] > d[km]: km = c pos = 0 for i in range(n): if a[i] == km: pos = i break print(n - d[km]) for i in range(pos + 1, n): if a[i] > km: print(2, i + 1, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIG...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) v = [int(x) for x in input().split()] hist = {} for x in v: hist.setdefault(x, 0) hist[x] += 1 target = max(hist, key=lambda x: hist[x]) print(len(v) - hist[target]) start = v.index(target) for i in range(start, len(v)): if v[i] == target: continue if v[i] < target: op =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [int(x) for x in input().split()] d = {} for ai in a: d[ai] = d[ai] + 1 if d.get(ai) else 1 mai = max(d, key=d.get) mi = a.index(mai) s = [] x = 1 while True: f1 = False f2 = False if mi - x >= 0: f1 = True if a[mi - x] > mai: s.append(f"2 {mi - x + 1} {m...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER ASSIGN ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
def mp(): return map(int, input().split()) n = int(input()) a = list(mp()) c = [0] * (2 * 10**5 + 1) for i in a: c[i] += 1 idx = 0 for i in range(2 * 10**5 + 1): if c[i] > c[idx]: idx = i for i in range(n): if a[i] == idx: idx = i break ans = [] for i in range(idx - 1, -1, -1):...
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUM...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [(-1) for i in range(n)] a[0:n] = map(int, input().split()) c = [(0) for i in range(200001)] maxc = 0 for number in a: c[number] += 1 maxc = max(maxc, c[number]) target = c.index(maxc) print(n - maxc) position = a.index(target) i = position - 1 while i >= 0: if a[i] > target: pr...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
IN = input rint = lambda: int(IN()) rlist = lambda: list(map(int, IN().split())) n = rint() a = rlist() f = [0] * 2 * 10**5 + [0] for c in a: f[c] += 1 j = a.index(f.index(max(f))) ans = [] def add(x, y, z): ans.append((x, y, z)) def check(x, y): if a[x] < a[y]: add(0, x, y) if a[x] > a[y]: ...
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP LIST NUMBER NUMBER BIN_OP NUMBER NUMBER LIST NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
N = int(input()) nums = [int(i) for i in input().split(" ")] count = dict() m = [0, 0] for n in nums: if count.get(n) is None: count[n] = 0 count[n] += 1 if count[n] > m[0]: m = [count[n], n] idx = [0] for i in range(N): if nums[i] == m[1]: idx.append(i) print(N - m[0]) for j in ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NONE ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_C...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = list(map(int, input().split())) d = {} for i in arr: if i in d: d[i] += 1 else: d[i] = 1 mm = 0 xx = 0 for key, value in d.items(): if value > mm: xx = key mm = value if mm == 1: xx = min(arr) pos = [] for i in range(len(arr)): if arr[i] == xx: ...
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 FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) s = [int(x) for x in input().split()] L = sorted(s) c = 1 G = [] for i in range(1, len(L)): if L[i] == L[i - 1]: c = c + 1 else: G.append((c, L[i - 1])) c = 1 G.append((c, L[-1])) tg = -1 tgg = -1 for i in range(0, len(G)): if G[i][0] > tgg: tgg = G[i][0] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) A = list(map(int, input().split())) S = set(A) D = {} for i in A: if i in list(D.keys()): D[i] += 1 else: D[i] = 1 p = sorted(list(D.items()), key=lambda x: x[1]) max_number = p[-1][0] first_index = A.index(max_number) print(len(A) - p[-1][1]) for i in range(first_index - 1, -1,...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = list(map(int, input().split())) dict1 = {} for i in range(n): try: dict1[arr[i]] += 1 except: KeyError dict1[arr[i]] = 1 count = 0 maxval = -1 for i in dict1.keys(): if dict1[i] > count: maxval = i count = dict1[i] index1 = arr.index(maxval) i =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) d = dict() target = 0 count_max = 0 for i in range(n): l = d.get(a[i]) if l: l.append(i) else: l = [i] d[a[i]] = l if count_max < len(l): count_max = len(l) target = a[i] pos_max = d[target] print(n - len(pos_ma...
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 NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR ASSIGN VAR VAR VAR VAR IF VAR FUNC_CALL VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [int(i) for i in input().split()] maxi1 = a[0] d = dict((i, 0) for i in a) for i in range(n): d[a[i]] += 1 if d[a[i]] > d[maxi1]: maxi1 = a[i] for i in range(n): if a[i] == maxi1: maxi = i s = "" c = 0 for i in range(maxi - 1, -1, -1): if a[i] < a[maxi]: c +=...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR STRI...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [int(item) for item in input().split()] m = {key: (0) for key in a} for x in a: m[x] += 1 mx = -1 e = -1 for i in range(n): if m[a[i]] > mx: mx = m[a[i]] e = a[i] last = -1 ans = 0 ops = [] for i in range(n): if a[i] == e and i > last + 1: for k in range(i - 1, l...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR VAR FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) l = list(map(int, input().split())) dct = {} for i in range(n): if l[i] in dct: dct[l[i]].append(i) else: dct[l[i]] = [i] a = n - len(dct[l[0]]) num = l[0] for i in dct: if n - len(dct[i]) < a: a = n - len(dct[i]) num = i prev = -1 print(a) for x in dct[num]:...
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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF BIN_OP VAR...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) arr = [int(x) for x in input().split()] d = {} for i in arr: if i in d: d[i] += 1 else: d[i] = 1 maxi = 0 for i in d: if d[i] >= maxi: maxi = d[i] ele = i if True: mid = arr.index(ele) ans = [] for i in range(mid - 1, -1, -1): if arr[i] > ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_C...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) numbers = list(map(int, input().split())) frequency = {} for i in numbers: if i in frequency: frequency[i] += 1 else: frequency[i] = 1 items = list(frequency.items()) items.sort(key=lambda x: x[1]) m = items[-1][0] index = numbers.index(m) res = [] for i in range(index, 0, -1): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) d = {} mv = 0 for i in range(n): d[a[i]] = d.get(a[i], 0) + 1 if d[a[i]] > mv: mv = d[a[i]] mk = a[i] mi = i ans = [] for i in range(mi + 1, n): if a[i] == mk: continue if a[i] > mk: ans.append((2, i + 1, i)) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) n1 = list(map(int, input().split())) newdict = {} for i in n1: if i in newdict.keys(): newdict[i] += 1 else: newdict[i] = 1 greatest = 0 maxi = 0 for i in newdict.keys(): if newdict[i] > maxi: maxi = newdict[i] greatest = i if maxi == 1: greatest = max(n1...
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 FOR VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER ASSIGN ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) dic = {} maxim = 0 val = 0 for i in a: if i not in dic: dic[i] = 1 else: dic[i] += 1 if dic[i] > maxim: maxim = dic[i] for i in dic: if dic[i] == maxim: val = i break pos = a.index(val) k = len(a) - maxim print(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR FOR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = [int(_) for _ in input().split()] freq = {} for item in a: if item in freq: freq[item] += 1 else: freq[item] = 1 most_occ = max(freq, key=lambda x: freq[x]) index_center = a.index(most_occ) print(len(a) - a.count(most_occ)) for i in range(index_center, 0, -1): if a[i - 1...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VA...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
TN = 1 def solution(): n = int(input()) a = list(map(int, input().split())) klv = {} keys = [] for i in a: try: x = klv[i] except: keys.append(i) klv[i] = 1 else: klv[i] += 1 lcur = 0 cur = 0 for i in keys: ...
ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR A...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) d = dict() target = 0 count_max = 0 for i in range(n): c = d.get(a[i], 0) c += 1 d[a[i]] = c if count_max < c: count_max = c target = a[i] first = 0 for i in range(n): if a[i] == target: first = i break print(n - co...
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 NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) nums = list(map(int, input().split())) count = dict() for i in range(n): if nums[i] in count.keys(): count[nums[i]][0] += 1 count[nums[i]].append(i) else: count[nums[i]] = [1] count[nums[i]].append(i) currCount = 1 currElem = nums[0] currInd = [0] for key in coun...
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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST NUMBER EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER A...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
amount = int(input()) array = [int(s) for s in input().split()] counter = [0] * (2 * 10**5 + 1) for i in range(len(array)): counter[array[i]] += 1 idx = -1 max_counter = -1 for i in range(len(counter)): if counter[i] > max_counter: max_counter = counter[i] idx = i indices = [] for i in range(len...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().rstrip().split())) p = dict() for i in a: if i in p: p[i] += 1 else: p[i] = 1 b = list(p.values()) flag = 0 value = 0 index = -1 freq = 0 for i in p: if p[i] > freq: freq = p[i] value = i if freq > 1: flag = 1 index = a.index(val...
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 FUNC_CALL VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) m = list(map(int, input().split())) l = [0] * (2 * 10**5 + 3) l1 = [[] for i in range(2 * 10**5 + 1)] ma = 0 a = 0 ansm = [] ans = 0 for i in range(n): l[m[i]] += 1 l1[m[i]].append(i) if l[m[i]] > a: ma = m[i] a = l[m[i]] for j in range(l1[ma][0] - 1, -1, -1): ans += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
import sys input = sys.stdin.readline def main(): n = int(input()) a = list(map(int, input().split())) if len(set(a)) == 1: print(0) return d = {} for i in range(n): if a[i] in d: d[a[i]].add(i) else: d[a[i]] = {i} max_el, length = 0, 0 ...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR V...
You are given an array $a$ consisting of $n$ integers. You can perform the following operations arbitrary number of times (possibly, zero): Choose a pair of indices $(i, j)$ such that $|i-j|=1$ (indices $i$ and $j$ are adjacent) and set $a_i := a_i + |a_i - a_j|$; Choose a pair of indices $(i, j)$ such that $|i-j|=...
n = int(input()) a = list(map(int, input().split())) maxi = 0 el = -1 d = dict() for i in a: if i in d: d[i] += 1 if d[i] > maxi: maxi = d[i] el = i else: d[i] = 1 if d[i] > maxi: maxi = d[i] el = i print(n - maxi) for i in range(a....
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input("")) a = list(map(int, input().split())) b = list(map(int, input().split())) c = [0] * n for i in range(n): if a[i] == 0: a[i] = n * 20 else: c[a[i] - 1] = -1 if b[i] == 0: b[i] = n * 20 else: c[b[i] - 1] = i d = c.copy() l = b[-1] ll = l f = 0 for i in rang...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUM...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) _ = input() d = list(map(int, input().split())) m = -n z = -1 for i, v in enumerate(d): if not v: z = -1 continue if z >= 0 and v != i - z + 1: z = -1 elif v == 1: z = i y = m m = max(m, i - v + 2) if z == 0: print(0) elif z > 0 and y <= -n + ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR ASSIGN ...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) if n == 1: if a[0] == 0: print(0) exit() else: print(1) exit() yes = True pos = -1 for i in range(n - 2, -1, -1): if b[i] == 1: pos = i break elif b[i] + 1 == b[i + 1]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSI...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
def solve(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(n): if b[i] == 1: if b[i:] == [x for x in range(1, n - i + 1)]: for j in range(i): if b[j] == 0: continue ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = list(map(int, input().split())) c = list(map(int, input().split())) b = dict(zip(c, range(n))) pos_one = b[1] if 1 in b else -1 if 1 in b: is_sorted = True for i in range(pos_one + 1, n): if c[i] != c[i - 1] + 1: is_sorted = False break if is_sorted: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR VAR NUMBER NUMBER IF NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_C...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) l = -1 r = n moment = [0] * (n + 1) max_post = 1 while b[(-max_post - 1) % n] != 0 and b[(-max_post - 1) % n] + 1 == b[-max_post]: max_post += 1 if b[-max_post] != 1: max_post = 0 for i in range(n): moment[b[i]] = i + 1...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER BI...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
import sys input = sys.stdin.readline N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) tmp = B[-1] ok = True if tmp != 0: for i in reversed(range(N)): b = B[i] if tmp - (N - 1 - i) > 0: if b != tmp - (N - 1 - i): ok = False for...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP VA...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
def get_int_list(): return list(map(int, input().split())) def get_max_repeats(l): if len(l) == 0: return 0 repeats = 1 max_repeats = 1 last_element = l[0] for i in range(1, len(l)): if l[i] == last_element: repeats += 1 else: if repeats > max_re...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR IF ...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
N = int(input()) a_list = list(map(int, input().split())) b_list = list(map(int, input().split())) getting = [0] * (N + 1) flg = False for i in range(N): b = b_list[i] getting[b] = i + 1 if flg and b_list[i - 1] != b - 1: flg = False if b == 1: flg = True if flg: start = b_list[-1] +...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF ...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) (*hand,) = map(int, input().split()) (*pile,) = map(int, input().split()) dist = [0] * (n + 1) for index, card in enumerate(pile): if card != 0: dist[card] = index + 1 def is_valid(): if dist[1] == 0: numbers_placed = 0 else: base = dist[1] for i in range(2...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER FUNC_DEF IF VAR NUMBER NUMBER ASSIGN VAR NUMBER AS...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) f = True if 1 in b: j = b.index(1) for i in range(n - j): d = i + 1 - b[j + i] if d != 0: break else: s = -2 for k in range(j): if b[k] != 0 and b[k] - k <= n - (j...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR BIN_OP...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) table = [0] * (N + 1) for i in range(N): if b[i]: table[b[i]] = i + 1 last = N - table[1] + 1 islast = 1 if table[1] == 0: last = 0 islast = 0 for i in range(1, last + 1): ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASS...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
import sys n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) if max(B) == 0: print(n) sys.exit() if 1 in B: x = B.index(1) y = n - x + 1 for i in range(x, n): if B[i] != i - x + 1: break else: for i in range(x): if B...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR IF NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = [int(v) for v in input().split()] b = [int(v) for v in input().split()] c = 0 d = {} f = 0 for j in range(n): d[a[j]] = 1 j = n - 1 while j > 0: if b[j] == b[j - 1] + 1 and b[j] != 1: j = j - 1 else: break if b[j] == 1 and j > 0: p = b[-1] + 1 f = 1 elif b[j] == ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR VAR BIN_OP...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) f = False if list(range(1, b[-1] + 1)) == b[-b[-1] :]: f = True s = set(a) for i in range(n - b[-1]): if b[-1] + i + 1 in s: s.add(b[i]) else: f = False break if f...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR ...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) arr1 = list(map(int, input().split())) arr2 = list(map(int, input().split())) arr3 = [0] mini = n + 1 for i in range(0, len(arr2)): if arr2[i] < mini and arr2[i] != 0: mini = arr2[i] if mini == n + 1: print(len(arr1)) exit() q = n + 1 a = 0 b = 0 m = 0 for i in range(0, len(arr2)): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = [int(x) for x in input().split()] b = [int(x) for x in input().split()] r = 0 for ai in a: if ai != 0: r = max(r, n - ai + 1) b1 = [0] * (n + 1) b2 = [0] * (n + 1) bset = set() for i in range(n): if b[i] != 0: b2[b[i]] = i + 1 + n - b[i] + 1 b1[b[i]] = i + 1 - b[i] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = [(0 if i == 0 else n - i + 1) for i in map(int, input().split())] b = list(map(int, input().split())) t = True s = 0 if 1 in b: i = 0 while b[i] != 1: b[i] = 0 if b[i] == 0 else i + n - b[i] + 2 i += 1 s = i while i < n - 1: if b[i + 1] == b[i] + 1: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF NUMBER VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR VAR VAR VA...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
from sys import exit N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) def checkran(X): m = X[-1] if m == 0: return 0 t = m for x in X[::-1]: if x != t: return 0 t -= 1 if t == 0: return m def check(X, k)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR VAR FOR VAR VAR NUMBER IF VAR VAR RETURN NUMBER VAR NUMBER IF VAR NUMBER RETU...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
import sys input = sys.stdin.readline sys.setrecursionlimit(10000) n = int(input()) a_list = list(map(int, input().split())) b_list = list(map(int, input().split())) def get_min(start_idx, l): min_value = -1 min_index = start_idx for i in range(start_idx, n): v = l[i] if v != 0 and (min_v...
IMPORT ASSIGN VAR VAR EXPR FUNC_CALL 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR IF VAR N...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) inhand = [(0) for i in range(2 * n + 2)] if 1 in b: loc1 = b.index(1) asc = 1 for i in range(loc1, n): if b[i] > asc: asc = 1 break if b[i] == asc: asc += 1 moves ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER IF NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CA...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
def ain(): return map(int, input().split()) def lin(): return list(ain()) def plist(l): for x in l: print(x, end=" ") print() def indexof(l, v, l3): return l3[v] n = int(input()) l1 = lin() l2 = lin() l3 = [-1] * (n + 1) l4 = [0] * (n + 1) for i in range(n): x = l2[i] if x !=...
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR FUNC_DEF RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_O...
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands are given. The remaining n...
for _ in range(1): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) k = b[n - 1] for i in range(k): if b[n - i - 1] != k - i: k = 0 ma = 0 for i in range(n - k): if b[i] == 0: continue if b[i] - k - 1 <= ...
FOR VAR FUNC_CALL 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR ASSIGN V...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
n, k = list(map(int, input().split())) a = input().split() names = [chr(ord("A") + i) for i in range(26)] + [ (chr(ord("A") + i) + chr(ord("a") + i)) for i in range(26) ] ans = [names[i] for i in range(n)] for i in range(k - 1, n): if a[i - k + 1] == "NO": ans[i] = ans[i - k + 1] print(*ans)
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR VAR FUNC_CALL VAR NUMBER A...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
def name(n): return chr(ord("A") + n % 26) + chr(ord("a") + n // 26) def main(): n, k = map(int, input().split()) arr = list(map(str, input().split())) if arr.count("YES") == 0: for i in range(n): print("Max ", end="") return ans = ["" for i in range(n)] x = arr.ind...
FUNC_DEF RETURN BIN_OP FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
def get(x): return chr(ord("A") + x // 26) + chr(ord("a") + x % 26) read = lambda: map(int, input().split()) n, k = read() a = input().split() ans = [0] * n num = 1 for i in range(k - 1): ans[i] = num num += 1 for i in range(k - 1, n): cur = a[i - k + 1] if cur == "YES": num += 1 a...
FUNC_DEF RETURN BIN_OP FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR ...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
n, k = map(int, input().split()) a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" names = [] for x in a: names.append(x) names.append(x + x.lower()) names = names[:n] s = input().split() for i in range(n - k + 1): if s[i] == "NO": names[i + k - 1] = names[i] print(" ".join(names))
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR STRING ASSIGN VAR BIN_OP BIN_OP VA...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
names = [(chr(i + 65) + chr(j + 97)) for i in range(26) for j in range(26)] n, m = map(int, input().split()) ans = names[: m - 1] j = m - 1 k = 0 for i in input().split(): if i == "YES": ans.append(names[j]) j += 1 else: ans.append(ans[k]) k += 1 print(" ".join(ans))
ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING EXPR ...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
l = [ "Aa", "Ab", "Ac", "Ad", "Ae", "Af", "Ag", "Ah", "Ai", "Aj", "Ak", "Al", "Am", "An", "Ao", "Ap", "Aq", "Ar", "As", "At", "Au", "Av", "Aw", "Ax", "Ay", "Az", "Aaa", "Abb", "Acc", "Add", "Aee",...
ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STR...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
n, k = map(int, input().split()) l_o = input().split() a_n = ["A"] for i in range(1, n): diff = i - 25 if i >= 25 else 0 a_n += [ chr(ord("A") + i - (26 if diff != 0 else 0)) + ("" if diff == 0 else chr(ord("a") + diff)) ] for i in range(n - k + 1): if l_o[i] == "NO": a_n[i + k -...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR LIST BIN_OP FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR STRING VAR VAR NUMBER NUMBER NUMBER VAR NUMBER STRING FUNC_CALL VAR...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
n, k = map(int, input().split()) words = [] for i in range(ord("A"), ord("Z") + 1): for j in range(ord("a"), ord("z") + 1): words.append(chr(i) + chr(j)) our = input().split() res = [i for i in range(n)] for j in range(50): for i in range(len(our)): if our[i] == "NO": res[i] = res[i ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CAL...
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
n, k = map(int, input().split()) names = [] for i in range(ord("a"), ord("z") + 1): names.append("A" + chr(i)) for i in range(ord("a"), ord("z") + 1): names.append("B" + chr(i)) pos = 0 a = input().split() ans = [] for i in range(k - 1): ans.append(names[pos]) pos += 1 for i in range(n - k + 1): if ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CA...