description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
from sys import stdin input = stdin.readline n, k = map(int, input().split()) a = list(map(int, input().split())) vals = [[] for i in range(2 * 10**5 + 1)] b = [a[i] for i in range(n)] s = set() for i in range(n): cnt = 0 while b[i] > 0: s.add(b[i]) vals[b[i]].append(cnt) b[i] //= 2 ...
ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
from itertools import islice _, k = tuple(map(int, input().split())) arr = list(map(int, input().split())) counts = [None] * (2 * 10**5 + 1) def append_counts(xx, cnt): if counts[xx] is None: counts[xx] = [] counts[xx].append(cnt) for a in arr: cur = 0 x = a while x > 0: append_...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER FUNC_DEF IF VAR VAR NONE ASSIGN VAR VAR LIST EXPR FUNC_CALL VAR VAR VAR FOR VAR VAR ASSIGN VAR NUMBER ASS...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) G = [] for _ in range(2 * 10**5 + 100): G.append([]) c = 0 for i in A: if len(G[i]) < k: G[i].append(0) while True: c += 1 f = True for i in range(n): if A[i]: A[i] //= 2 if len(G[A[i]]...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CA...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort() d = {} for i in range(len(a)): temp = a[i] curr = 0 while temp: if temp not in d or d[temp][0] < k: if temp in d: d[temp][0] += 1 d[temp][1] += curr else: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR IF VAR VAR VAR VAR NUMBER VAR IF VAR VAR VAR VAR NUMBER NUMBER VAR VAR NUMBER VA...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
import sys n, k = map(int, sys.stdin.readline().split()) a = list(map(int, sys.stdin.readline().split())) xs = [0] for i in range(n): x = a[i] while x != 0: xs.append(x) x = x // 2 xs = list(set(xs)) op_cnts = dict() for x in xs: op_cnts[x] = [] for i in range(n): cnt = 0 start = a[...
IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VA...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] vals = [[] for i in range(200 * 1000 + 11)] for i in a: cur = 0 x = i while x > 0: vals[x].append(cur) cur += 1 x //= 2 answer = 1000000000 for i in range(200 * 1000): vals[i].sort() if len(vals[i]...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR ...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = [int(i) for i in input().split()] a = sorted([int(i) for i in input().split()]) numbers = [[0, 0] for i in range(a[-1] + 1)] for i in range(n): op = 0 while a[i] > 0: if numbers[a[i]][0] < k: numbers[a[i]][0] += 1 numbers[a[i]][1] += op a[i] //= 2 op += 1 ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER NUMBE...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
def get_ans(n, k, array): logging = {(0): []} for i in array: steps = 0 temp = i while temp > 0: if temp not in logging.keys(): logging[temp] = [steps] else: logging[temp].append(steps) temp = temp // 2 steps...
FUNC_DEF ASSIGN VAR DICT NUMBER LIST FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER IF VAR FUNC_CALL VAR ASSIGN VAR VAR LIST VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR ...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
def deep(mas, pref, k): deepmas = [] s = 0 for el in mas: if el[: len(pref)] == pref: deepmas.append(el) if len(deepmas) <= k: s += len(el) - len(pref) if len(deepmas) >= k: return min(s, deep(deepmas, pref + "0", k), deep(deepmas, pref + "1", k)) ...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR BIN_OP VAR STRING VAR FUNC_CALL VAR VAR BIN_OP VAR STRING VAR RETURN NUMB...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
from sys import stdin input = stdin.readline n, k = map(int, input().split()) arr = [*map(int, input().split())] cnt = [(0) for i in range(200001)] for i in range(n): cnt[arr[i]] += 1 arr.sort() p = [[] for i in range(200001)] for i in range(n): t = 1 while arr[i]: arr[i] //= 2 p[arr[i]].ap...
ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBE...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
from sys import stdin input = stdin.readline inf = 1000 * 1000 * 1000 n, k = list(map(int, input().split())) a = [int(i) for i in input().split()] b = [] for i in range(200001): b.append([]) for i in a: ctr = 0 while i > 0: b[i].append(ctr) i //= 2 ctr += 1 b[i].append(ctr) res ...
ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR LIST FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER EXPR FUNC_CALL ...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = map(int, input().split()) a = sorted(list(map(int, input().split()))) cnt = dict() sum = dict() res = n * 20 for x in a: y = x cur = 0 while True: if y == 0: break if y not in cnt: cnt[y] = 0 sum[y] = 0 if cnt[y] < k: cnt[y] += 1...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 VAR NUMBER FOR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE NUMBER IF VAR NUMBER IF VAR VAR ASSIGN VAR VAR NUMBE...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
def mp(): return map(int, input().split()) def f(a, b): res = 0 while b > a: b //= 2 res += 1 if b != a: res = -1 return res n, k = mp() a = sorted(list(mp())) m = max(a) + 1 b = [0] * m c = [0] * m for i in a: x = i cnt = 0 while x > 0: if c[x] < k: ...
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
import sys input = sys.stdin.readline MOD = 1000000007 MOD2 = 998244353 ii = lambda: int(input().strip("\n")) si = lambda: input().strip("\n") dgl = lambda: list(map(int, input().strip("\n"))) f = lambda: map(int, input().strip("\n").split()) il = lambda: list(map(int, input().strip("\n").split())) ls = lambda: list(i...
IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
from sys import stdin def input(): return next(stdin) def main(): n, k = map(int, input().split()) aa = [int(a) for a in input().split()] aa.sort() valmap = [[0, 0] for _ in range(200001)] for a in aa: if add_to_map(a, 0, k, valmap): i = 0 while a > 0: ...
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NU...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
from sys import stdin, stdout input = stdin.readline t = 1 for _ in range(t): n, p = map(int, input().split()) a = [int(x) for x in input().split()] vals = set() dict = {} for i in a: k = 0 while i: if i in dict: dict[i].append(k) else: ...
ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR LIST VAR EXPR...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
def main(): (n, m), d = map(int, input().split()), {} for i in map(int, input().split()): t = 0 while i: d.setdefault(i, [1000000000]).append(t) i >>= 1 t += 1 print(min(sum(sorted(v)[:m]) for v in d.values())) main()
FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR DICT FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR EXPR FUNC_CALL FUNC_CALL VAR VAR LIST NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR EXPR FUNC...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = map(int, input().split()) s = [int(x) for x in input().split()] kk = [] uni = dict() for i in range(0, len(s)): N = 2 * s[i] c = -1 while N > 0: c += 1 N = N // 2 if uni.get(N) == None: uni[N] = [c] kk.append(N) else: uni[N].append(c...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF FUNC_CA...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
def main(): n, m = map(int, input().split()) aa, bb = [m] * 200001, [0] * 200001 for i in sorted(map(int, input().split())): aa[i] -= 1 t = 0 while i: t += 1 i //= 2 if aa[i] <= 0: continue aa[i] -= 1 bb[i] +...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST VAR NUMBER BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR VAR NUMBER VAR VAR VAR EXPR FUNC_CALL V...
The only difference between easy and hard versions is the number of elements in the array. You are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down (in other words, in one move you can set $a_i := \lfloor\frac{a_i}{2}\rfloor$). You can perform such...
n, k = map(int, input().split()) l = list(map(int, input().split())) l.sort() out = 10000000000 + 7 d = [[] for i in range(0, max(l) + 1)] if k != 1: for i in l: c = 0 while i: d[i].append(c) c += 1 i //= 2 for i in d: if len(i) >= k: out =...
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 EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR EXPR FUNC_CALL VAR...
A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF). During the battle, every second the monster's HP decrease by max(0, ATK_{Y} - DEF_{M}), while Yang's HP decreases by ...
hy, ay, dy = map(int, input().split()) hm, am, dm = map(int, input().split()) h, a, d = map(int, input().split()) s = 1 << 30 for da in range(max(0, dm - ay + 1), max(0, hm - ay + dm) + 1): for dd in range(max(0, am - dy) + 1): dh = max(0, (am - dy - dd) * ((hm - 1) // (ay + da - dm) + 1) - hy + 1) ...
ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER BIN_OP FUNC_CALL VAR NUMBER BIN_O...
A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF). During the battle, every second the monster's HP decrease by max(0, ATK_{Y} - DEF_{M}), while Yang's HP decreases by ...
h1, a1, d1 = map(int, input().split(" ")) h2, a2, d2 = map(int, input().split(" ")) H, A, D = map(int, input().split(" ")) ans = 100000000 for a in range(a1, 201): if a - d2 <= 0: continue for d in range(d1, 102): if a2 - d <= 0: ans = min(ans, (a - a1) * A + (d - d1) * D) el...
ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF BIN_...
A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF). During the battle, every second the monster's HP decrease by max(0, ATK_{Y} - DEF_{M}), while Yang's HP decreases by ...
I = lambda: list(map(int, input().split())) R = list(range(999)) q, w, e = I() r, t, y = I() a, b, c = I() print( min( i * b + j * c + max(0, (r // (w + i - y) + bool(r % (w + i - y))) * (t - e - j) - q + 1) * a for i in R for j in R if w + i > y ) )
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def main(): t = int(input()) for _ in range(t): n = int(input()) prev = -1 ans = [] for i in range(1, 40000): v = n // i if v == prev: break ans.append(v) prev = v for i in range(v - 1, -1, -1): a...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUN...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) a = set() k = n**0.5 for i in range(1, int(k) + 1): a.add(i) a.add(n // i) a.add(0) print(len(a)) print(*sorted(list(a)))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) mid = int(n**0.5) if n // mid > mid: print(2 * mid + 1) else: print(2 * mid) i = 0 while i <= mid: print(i, end=" ") i += 1 i = mid while i > 0: if n // i > mid: print(n // i, end=" ") ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR VAR STRING VAR NUMBER ASSIG...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys reader = (int(s.rstrip()) for s in sys.stdin) def rating(n): m = n ans = [0, 1] ndiv = 2 while True: brick = n // ndiv if not brick: break ndiv = n // brick ans.append(ndiv) ndiv += 1 return ans t = next(reader) for _ in range(t): ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL V...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in [0] * int(input()): n = int(input()) a = [i for i in range(int(n ** (1 / 2) + 1))] + [ int(n / i) for i in range(1, int(n ** (1 / 2) + 1)) ] a = sorted(list(set(a))) print(len(a)) print(" ".join([str(x) for x in a]))
FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR F...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
q = int(input()) for _ in range(q): w = int(input()) e = [1] for i in range(2, int(w**0.5) + 1): if w // e[-1] != w // i: e.append(i) r = [] for i in range(len(e)): r.append(w // e[i]) e = set(e + r + [0]) print(len(e)) print(*sorted(e))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) lis = [] i = n + 1 while i > 0: a = n // i lis.append(a) i = n // (a + 1) print(len(lis)) print(*lis)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
from sys import stdin def iin(): return int(stdin.readline()) def lin(): return list(map(int, stdin.readline().split())) def check(a): sa = set() for i in range(a + 1, 0, -1): sa.add(a // i) return sa def main(): t = iin() while t: t -= 1 n = iin() ans...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for qwertyuiop in range(int(input())): n = int(input()) q = set() for i in range(1, 2 * int(n**0.5) + 7): q.add(n // i) q.add(n // (n // i + 1)) q.add(0) print(len(q)) print(*sorted(list(q)))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBE...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for i in range(int(input())): n = int(input()) s = set([0, n]) for j in range(int(n**0.5)): s.add(n // (j + 1)) s.add(j + 1) print(len(s)) print(*sorted(s))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR LIST NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) aaa = set() aaa.add(0) for i in range(1, int(n**0.5) + 1): aaa.add(n // i) aaa.add(i) print(len(aaa)) print(*sorted(aaa))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_C...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
tst = int(input()) for i in range(0, tst): n = int(input()) ans = 1 l = 1 p = [] while l <= n: ans += 1 l = n // (n // l) p.append(n // l) l += 1 p.append(0) p.reverse() print(len(p)) print(" ".join(str(x) for x in p))
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for tc in range(int(input())): n = int(input()) i = 1 S = {0} while i * i <= n: S.add(n // i) if i > n % i: S.add(i) i += 1 print(len(S)) for x in sorted(S): print(x)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys input = lambda: sys.stdin.readline().rstrip() for _ in range(int(input())): n = int(input()) s = set([0]) for i in range(1, int(n**0.5) + 1): v = n // i s.add(v) s.add(i) print(len(s)) print(*sorted(s))
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) i = 1 also = [] sqrN = int(n**0.5) while n // i > sqrN: also.append(n // i) i += 1 also.reverse() print(int(n**0.5) + len(also) + 1) for i in range(sqrN + 1): print(i, end=" ") for d in also: print(d, end=...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) k = int(n**0.5) b = [0] for i in range(1, k + 1): b.append(i) b.append(n // i) b = list(set(b)) print(len(b)) print(*sorted(b))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) if n == 1: print(2) print(0, 1) else: k = int(n**0.5) b = set(range(0, k + 1)) for i in range(k, 1, -1): b.add(n // i) b.add(n) b = sorted(list(b)) print(len(b)) print(" ".join(...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_C...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def print_seq(n): t = n + 1 pi = n - 1 ls = [] ls.append("0") ls.append("1") i = n // 2 while i > 1: t = n // i ls.append(str(t)) i = n // (n // i + 1) if n != 1: ls.append(str(n)) print(len(ls)) print(" ".join(ls)) return def main(): t =...
FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_C...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) lst = [i for i in range(1, int(n ** (1 / 2) + 1))] r = [str(elem) for elem in sorted(list(set(lst + [(n // i) for i in lst])))] print(len(r) + 1) print( 0, " ".join( [str(elem) for elem in sorted(list(set(lst + [(n // i) for ...
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 NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
T = int(input()) for t in range(T): N = int(input()) V = {0} A = [0] for i in range(1, int(N**0.5) + 1): if i not in V: A.append(i) V.add(i) if N // i not in V: A.append(N // i) V.add(N // i) print(len(A)) print(*sorted(A))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BI...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) l = [0, n] k = 1 ans = 1 last = n while k < n: k += 1 if n // k == last: k = n // last else: ans += 1 last = n // k l.append(last) l.sort() print(len(l)) print...
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 VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) l = set() l.add(0) for i in range(1, int(pow(n, 0.5)) + 10): t = n // i l.add(t) if t != 0: l.add(n // t) l = sorted(list(l)) print(len(l)) print(*l)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR A...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def kek(n): l = [0] l2 = [] i = 1 while i * i < n: l.append(i) if n // i != i: l2.append(n // i) i += 1 if i * i == n: l.append(i) l2.reverse() l += l2 return l def main(): for _ in range(int(input())): n = int(input()) l ...
FUNC_DEF ASSIGN VAR LIST NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL V...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def solve(): n = int(input().strip()) sqrt = int(n**0.5) ar = [] for i in range(sqrt + 1): ar.append(i) if n // sqrt != sqrt: ar.append(n // sqrt) for i in range(sqrt - 1, 0, -1): ar.append(n // i) print(len(ar)) print(" ".join(list(map(str, ar)))) t = int(input...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) s = set([]) for i in range(1, int(n**0.5) + 1): if n // i != 0: s.add(int(n / i)) s.add(i) s.add(0) l = list(s) l.sort() print(len(l)) print(*l)
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 LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) k = 1 ans = {0} while k <= n: ys = n // k t = n // ys ans.add(t) k = t + 1 print(len(ans)) print(*ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) a = [] d = {} for i in range(1, int(n**0.5 + 1)): if i not in d.keys(): a.append(i) d[i] = 1 if n // i not in d.keys(): a.append(n // i) d[n // i] = 1 a.sort() print(len(a) + 1) pri...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF BIN_OP VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) s = set() s.add(0) i = 1 while i * i <= n: s.add(i) s.add(n // i) i += 1 print(len(s)) print(*sorted(list(s)))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) k = set() a = 1 b = n // a listrating = set([0]) while a < b: listrating.add(n // a) listrating.add(n // b) a += 1 b = n // a listrating.add(n // a) listrating.add(n // b) listrating = list(listrating) ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR LIST NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR F...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) l1 = [] a = n for i in range(1, int(n**0.5) + 1): a = n // i l1.append(a) if n == (int(n**0.5) + 1) ** 2 - 1: a -= 1 while a: a -= 1 l1.append(a) print(len(l1)) l1.reverse() for i in l1: pr...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER NU...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def solve(): n = int(input()) s = int(n**0.5) ans = {0} for i in range(1, s + 1): ans.add(i) ans.add(n // i) ans.add(n) print(len(ans)) print(" ".join([str(el) for el in sorted(ans)])) for _ in range(int(input())): solve()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL V...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): vis = set() s = set() n = int(input()) for i in range(1, int(n**0.5) + 2): if n // i not in vis: vis.add(n // i) s.add(n // i) res = sorted(s) res = list(range(res[0] - 1, -1, -1))[::-1] + res print(len(res)) print(*res)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR A...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) if n <= 1000005: l = [0, 1] for k in range(n - 1, 0, -1): a = n // k if a > l[-1]: l.append(a) print(len(l)) print(*l) else: l = [x for x in range(1001)] for k in range(1000...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) out = [] for i in range(t): n = int(input()) out = ["0"] start = n + 1 end = n while start > 0 and end > 0 and int(n / start) != int(n / end): out.append(str(int(n / end))) start = int(n / int(n / end)) end = min(start - 1, int(n / (int(n / end) + 1))) pr...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for I in range(t): n = int(input()) ans = [0] * 10**5 d = 1 count = 0 while d * d - 1 <= n: ans[count] = n // d d += 1 count += 1 d = ans[count - 1] for i in range(d - 1, -1, -1): ans[count] = i count += 1 print(count) print(" ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER FOR V...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
sp = lambda: list(map(int, input().split())) si = lambda: int(input()) TESTCASES = int(input()) for tc in range(TESTCASES): n = si() ints = set(range(int(n**0.5) + 1)) for i in range(int(n**0.5) + 1, 0, -1): ints.add(n // i) ints = sorted(list(ints)) print(len(ints)) print(" ".join(map(s...
ASSIGN VAR FUNC_CALL VAR 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in range(t): n = int(input()) lst = [0] for j in range(1, n + 1): tmp = int(n // j) lst.append(tmp) if tmp * tmp <= n: for k in range(tmp + 2): if k * k <= n: lst.append(k) break lst = list(set(lst...
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 FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input().strip()) for i in range(t): n = int(input().strip()) result = ["0", "1"] it = 1 while it != n: it += 1 m = n // it it = n // m result.append(str(it)) print(len(result)) print(" ".join(result))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST STRING STRING ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR V...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
from sys import stdin, stdout casos = int(stdin.readline().strip()) for case in range(casos): n = int(stdin.readline().strip()) x = int(pow(n, 0.5)) ans = [i for i in range(x + 1)] for i in range(x, 0, -1): y = n // i if y != ans[-1]: ans.append(y) stdout.write("%d\n" % ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR NUMBER EXPR FUNC_C...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) while t != 0: n = int(input()) list1 = [0] i = 1 while i <= n: p = n // i if n // p == i: list1.append(i) i += 1 else: list1.append(n // p) i = n // p + 1 print(len(list1)) print(*list1) t -= 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) s = {0, 1} for i in range(1, int(n**0.5) + 1): k = n // i b = n // k s.add(k) s.add(b) print(len(s)) s2 = list(s) s2.sort() print(*s2)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def bsearch(st, en, n, x): k = (st + en) // 2 if n // k < x: if st == en: return k return bsearch(st, k, n, x) return bsearch(k + 1, en, n, x) def solve(): n = int(input()) x = n ans = [str(x)] while x > 1: k = bsearch(0, n, n, x) x = n // k ...
FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR IF VAR VAR RETURN VAR RETURN FUNC_CALL VAR VAR VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST FUNC_CALL VAR VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys input = sys.stdin.readline for _ in range(int(input())): n = int(input()) ls = {0} for i in range(1, int(n**0.5) + 1): ls.add(n // i) ls.add(n // (n // i)) print(len(ls)) print(*sorted(ls))
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys input = sys.stdin.readline def main(): t = int(input()) for _ in range(t): N = int(input()) ans = [] ans.append(0) p = 0 pn = 0 for i in range(1, int(N**0.5) + 1): x = N // i if x != p and x != pn: ans.append(x...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for you in range(t): n = int(input()) l = [] i = 1 while i * i <= n: if i == n // i: l.append(i) else: l.append(i) l.append(n // i) i += 1 l.sort() print(len(l) + 1) print(0, end=" ") for i in l: print(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 LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in range(t): n = int(input()) answers = set() answers.add(n) x = 1 while x <= n // 2 + 1: target = n // x left = x right = (n + 1) // target + 1 ans = x while left <= right: mid = (left + right) // 2 if n // mid =...
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 EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in range(t): n = int(input()) l = [x for x in range(int(n ** (1 / 2)) + 1)] + [ int(n / i) for i in range(1, int(n ** (1 / 2)) + 1) ] s = set(l) k = list(s) k.sort() m = [str(x) for x in k] print(len(k)) print(" ".join(m))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER AS...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
di = {} for _ in range(int(input())): n = int(input()) if n in di: print(di[n][0]) print(di[n][1]) continue s1 = set() s1.add(1) s1.add(n) s1.add(0) min = n i = 2 while i <= min: next = n // i min = next s1.add(next) if n // nex...
ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHI...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys try: sys.stdin = open("input.txt", "r") sys.stdout = open("output.txt", "w") except: pass input = sys.stdin.readline for _ in range(int(input())): n = int(input()) ans = [0] div = n while div >= 1: val = n // div if ans[-1] != val: ans.append(val) ...
IMPORT ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(0, int(input())): n = int(input()) answers = [0] i = 1 j = int(n ** (1 / 2)) while i < j: answers.append(i) answers.append(n // i) i += 1 answers.append(j) if n // j != j: answers.append(n // j) answers.sort() print(len(answers)) pri...
FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
from sys import stdin, stdout t = int(input()) for _ in range(t): n = int(input()) a = [] L = [i for i in range(int(n ** (1 / 2) + 1))] + [ int(n / i) for i in range(1, int(n ** (1 / 2) + 1)) ] a = list(map(str, sorted(list(set(L))))) print(len(a)) print(*a)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) rts = [0] for i in range(1, int(n**0.5) + 1): rts.append(n // i) rts.append(i) rts = set(rts) print(len(rts)) print(" ".join([str(x) for x in sorted(rts)]))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) ret = {0} d = 1 while d * d <= n: ret.update((n // d, d)) d += 1 print("%d\n%s" % (len(ret), " ".join(map(str, sorted(ret)))))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR FUNC_CALL STRING FUNC_CALL VAR VAR FUNC_CALL VAR VAR
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys input = sys.stdin.readline t = int(input()) for testcases in range(t): n = int(input()) ANS = [n // 1] for i in range(2, n): ANS.append(n // i) if n / (i - 1) - n / i < 1: break A = list(range(0, ANS[-1])) + sorted(set(ANS)) print(len(A)) print(*A)
IMPORT ASSIGN VAR VAR 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 BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for t in range(int(input())): n = int(input()) arr = [0] div = n next = 1 while div > 0: div = n // next if div != 0: no = n // div next = no + 1 arr.append(no) print(len(arr)) print(*arr)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXP...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for query in range(t): n = int(input()) mylist = [0] mylist2 = [] counter = 1 total = 1 mystring = "" while True: if counter + 1 > int(n / counter + 1): break mylist.append(counter) total = total + 1 if counter == int(n / counter):...
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 ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING WHILE NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR N...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in range(0, t): n = int(input()) ln = [0] oned = False sqt = n // int(n**0.5) on = -1 for j in range(1, max(2, int(n**0.5) + 1)): if n // j != on: ln.append(n // j) if n // j == 1: oned = True on = n // j for j in...
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 LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) set_ = set() for i in range(1, int(n**0.5) + 10): set_.add(n // i) li = sorted(list(set_)) num = li[0] li2 = [i for i in range(num)] print(len(li2) + len(li)) print(*(li2 + li))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
T = int(input()) for _ in range(T): n = int(input()) ans = [] if n == 1: print(2) print(0, 1) continue elif n == 2: print(3) print(0, 1, 2) continue elif n == 3: print(3) print(0, 1, 3) continue k = n // 2 a = 2 l = ...
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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FU...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys input = sys.stdin.readline t = int(input()) for i in range(t): ret = set() n = int(input()) ret.add(0) i = 1 while i * i <= n: tmp = n // i if n // tmp == i: ret.add(i) ret.add(n // i) i += 1 ans = list(ret) ans.sort() print(len(ans...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) ans = [] i = 1 while i < n: if len(ans) != 0: if ans[-1] == n // i: break ans.append(n // i) i += 1 if len(ans) == 0: print(2) print("0 1") continue for i in range(ans[-1] -...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF FUNC_CALL VAR VAR NUMBER IF VAR NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING F...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for t in range(int(input())): n = int(input()) i = 1 a = set() while i * i <= n: a.add(n // i) i += 1 for j in range(i): if j not in a: a.add(j) a = list(a) a.sort() print(len(a)) print(*a)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in range(0, t): n = int(input()) L = [0, 1] if n == 1: print(2) print(*L) else: y = int(n**0.5) L = [i for i in range(y + 1)] for i in range(y + 1, 0, -1): x = n // i if L[-1] < x: L.append(x) ...
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 LIST NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) s, l = [0], [] for d in range(1, n // 2 + 2): if n // d <= s[-1]: break l.append(n // d) if d >= l[-1]: break s.append(d) s += l[::-1] print(len(s)) print(" ".join(str(i) for i in s))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST NUMBER LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in " " * t: n = int(input()) r = {0, 1, n} d = 2 while d * d <= n: r.add(n // d) r.add(n // (n // d)) d += 1 print(len(r)) print(*sorted(r))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR BIN_OP STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for i in range(int(input())): n = int(input()) l = [0] l2 = [] x = int(n**0.5) for i in range(1, x + 1): l.append(i) l.append(n // i) l.sort() print(len(set(l))) s1 = set([]) for i in l: if i not in s1: l2.append(i) s1.add(i) el...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline def solve(): n = int(input()) ans = set() ans.add(0) ans.add(1) ans.add(n) i = 2 while i * i <= n: if n / i == n // i: ans.add(int(i)) ans.add(int(n // i)) else: ans.add(...
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR V...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) aa = [] ind = 1 while True: aa.append(n // ind) if len(aa) >= 2: if aa[-1] == aa[-2]: for i in range(aa[-1], -1, -1): aa.append(i) break ind += 1 print(len(set...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR IF FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER E...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
from sys import stdin def input(): return stdin.readline()[:-1] for _ in range(int(input())): n = int(input()) output = [n] while output[-1] != 1: l, r = 1, n while l < r: mid = (l + r) // 2 if n // mid < output[-1]: r = mid else: ...
FUNC_DEF RETURN FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR WHILE VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMB...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
import sys input = sys.stdin.buffer.readline def solution(): n = int(input()) x = int(n**0.5) l = [0] i = 1 while i <= x: a = n // i l.append(i) l.append(a) i += 1 l = list(set(l)) l.sort() print(len(l)) print(*l) for _ in range(int(input())): ...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FU...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for I in range(t): n = int(input()) a = set() for i in range(1, int(n**0.5) + 1): a.add(i) a.add(n // i) a.add(0) print(len(a)) a = sorted(list(a)) for i in a: print(i, end=" ") print()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR ...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): N = int(input()) S = set() S.add(0) S.add(N) for i in range(1, int(N**0.5) + 1): S.add(i) S.add(int(N // i)) print(len(S)) L = sorted(S) for i in L: print(i, end=" ") print()
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_C...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for i in range(t): n = int(input()) s = set() f = [] for j in range(1, int(n**0.5) + 1): d = n // j e = n // (n // j) if d not in s: s.add(d) f.append(d) if e not in s: s.add(e) f.append(e) f.append(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 ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXP...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) for _ in range(t): n = int(input()) ans = set() for i in range(1, n + 2): if n // i not in ans: ans.add(n // i) else: ans = ans.union(set(list(range(0, n // i)))) break print(len(ans)) print(" ".join(map(str, sorted(ans))))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
t = int(input()) while t: t -= 1 n = int(input()) ans = [] i = 0 while i * i <= n: ans.append(i) if i: ans.append(n // i) i += 1 ans = list(set(ans)) ans.sort() print(len(ans)) print(*ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_C...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
for _ in range(int(input())): n = int(input()) a = set() i = 1 while i * i <= n: a.add(n // i) a.add(i) i += 1 a.add(n) a.add(0) a = list(a) a.sort() print(len(a)) print(*a)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VA...
On the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawin...
def main(): n = int(input()) num = n // 2 ans = [0, 1] prev = 1 l = 2 while num > 0: temp = n // num if temp != prev: l += 1 prev = temp ans.append(temp) num = n // (temp + 1) else: num -= 1 print(l) prin...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ...