description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
y = int(input()) ans = [] p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] c = [0] * len(p) for i in range(y): n = int(input()) al = input().split() m = list(map(int, al)) c = [0] * n for j in range(n): q = m[j] for t in range(len(p)): if q % p[t] == 0: c[j] =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) colors = [(0) for _ in range(n)] for i in range(n): for prime in primes: if a[i] % prime == 0: colors[i] = prime counter = 0 ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CAL...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) colors = {} color = 1 ans = [] for num in arr: d = None for j in range(2, num): if num % j == 0: d = j break if d not in colors: co...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR IF VAR VAR AS...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(0, int(input())): n = int(input()) l = list(map(int, input().split())) ans = [] currno = 1 d = {} mt = 0 for i in l: for k in range(0, 11): j = p[k] if i % j == 0: if d.get(j, -1) == -...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUM...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
class P1332B: def solve(self, a): primes = 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 m = 1 color = [(-1) for _ in range(len(a))] for p in primes: update = False for i, ai in enumerate(a): if color[i] == -1 and ai % p == 0: col...
CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER IF V...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def gp(x): for i in range(2, x): if x % i == 0: return i return -1 for _ in range(int(input())): n = int(input()) A = list(map(int, input().split())) D = [(0) for i in range(11)] for i in range(n): x = P.index(gp(A[i]))...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUN...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys input = sys.stdin.readline LI = lambda: list(map(int, input().strip("\n").split())) MI = lambda: map(int, input().strip("\n").split()) SI = lambda: input().strip("\n") II = lambda: int(input().strip("\n")) for _ in range(II()): n = II() a = LI() clr = {} primes = [2, 3, 5, 7, 11, 13, 17, 19,...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) start = 2 end = 999 primes = [] for val in range(start, end + 1): if val > 1: for n in range(2, val): if val % n == 0: break else: primes.append(val) for pp in range(0, t): n = int(input()) ip = list(map(int, input().split())) visi...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys def set_debug(debug_mode=False): if debug_mode: fin = open("input.txt", "r") fout = open("output.txt", "w") sys.stdin = fin sys.stdout = fout set_debug(False) p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for i in range(int(input())): input() a = [ min((...
IMPORT FUNC_DEF NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CAL...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31} for _ in range(t): n = int(input()) arr = [int(x) for x in input().split()] colors = [(0) for x in range(n)] for p in primes: for ind, item in enumerate(arr): if not colors[ind] and item % p == 0: colo...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR VAR FOR VAR VAR FUNC_CA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] n = int(input()) for a in range(n): usedColors = 0 colorKey = {} length = int(input()) nums = list(map(int, input().split())) answer = "" for b in nums: for c in range(len(primes)): if b % primes[c] == 0: if c ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING FOR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) x = list(map(int, input().split())) ans, used, num = [0] * 1002, [0] * 12, [0] * 12 v = [] for i in x: for i2 in range(11): if i % p[i2] == 0: ans[i] = i2 + 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR BIN_OP LIST NUMBER NUMBER BIN_OP LIST...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) c = [] d = {} ans = "" t = max(a) count = 0 for i in range(n): for j in range(2, t + 1): if a[i] % j == 0: if j in d: ans += str(d[j]) + " " ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR N...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for ttt in range(int(input())): n = int(input()) arr = list(map(int, input().split())) res = [0] * n count = 1 prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for i in range(len(prime)): ok = 0 for j in range(n): if arr[j] % prime[i] == 0: if res[j] =...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL V...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) a = list(map(int, input().split())) b = [0] * n track = 1 for p in primes: flag = 0 for i in range(n): if a[i] % p == 0: if b[i] == 0: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
I = input for _ in [0] * int(I()): I() a = [ next(p for p in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31) if int(x) % p < 1) for x in I().split() ] b = [*{*a}] print(len(b), *(b.index(x) + 1 for x in a))
ASSIGN VAR VAR FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) primes = "2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31".split(", ") primes = list(map(int, primes)) while t: t -= 1 n = int(input()) arr = list(map(int, input().split())) asig = {} ans = [(0) for _ in range(n)] col = 0 for i, num in enumerate(arr): for p in primes: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBE...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def GCD(x, y): while y: x, y = y, x % y return x def main(): test = int(input()) for t in range(test): n = int(input()) l = [int(i) for i in input().split(" ")] c = [(0) for i in range(len(l))] num = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] color = 1...
FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) xx = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) aa = list(map(int, input().split())) x = [(0) for i in range(n)] y = set() jj = 0 for i in aa: k = 1 for j in xx: if i % j == 0: ind = k ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for i in range(int(input())): input() a = [ min((i + 1 for i in range(11) if a % p[i] == 0), default=10**4) for a in map(int, input().split()) ] sa = sorted(set(a)) print(len(sa)) print(*[(sa.index(x) + 1) for x in a])
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR VAR NUMBER BIN_OP NUMBER NUMBER VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL V...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def getPrime(num): for i in range(0, 11): prime = primes[i] if num % prime == 0: return prime for _ in range(t): n = int(input()) al = list(map(int, input().split())) primeused = [] for i in range(len(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] t = int(input()) for i in range(t): n = int(input()) numbers = [int(i) for i in input().split()] colored_primes = [-1] * 11 colors = [] color = 1 for number in numbers: for i in range(len(primes)): if number % primes[i] == 0: ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
ans = [] for _ in range(int(input())): n = int(input()) u = list(map(int, input().split())) a = [0] * n pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] dct = dict() ind = 1 for i in range(n): for j in range(11): if u[i] % pr[j] == 0: if j in dct.keys(): ...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def primeFacorize(x): p = [7, 11, 13, 17, 19, 23, 29, 31, 37] ans = [] t = 0 for i in p: if x % i == 0: t = i break return [t, x // t] for _ in range(int(input())): n = int(input()) array = list(map(int, input().split())) count = [0, 0, 0] ansarray =...
FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR RETURN LIST VAR BIN_OP VAR 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 F...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
minPrimeDiv = [(1) for i in range(0, 1001)] for i in range(2, 1001): if minPrimeDiv[i] != 1: continue else: for j in range(i, 1001, i): if minPrimeDiv[j] == 1: minPrimeDiv[j] = i def solve(l): col = {} ans = [] for num in l: primeDiv = minPrimeDi...
ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_DEF ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR B...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] for tc in range(t): n = int(input()) li = [int(inp) for inp in input().split(" ")] c = set() s = "" color = [(-1) for i in range(len(primes))] nextcolor = 1 for num in li: for i, prime in enumerate(primes): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for x in range(t): n = int(input()) a = list(map(int, input().split())) color_scheme = [(0) for i in range(len(a))] color = {} c = 0 for y in range(len(a)): if a[y] in color.keys(): color_scheme[y] = color[a[y]] else: for z in [2, 3, 5, 7,...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys primes = "2\t3\t5\t7\t11\t13\t17\t19\t23\t29\t31".replace("\n", "\t").split("\t") primes = [int(x) for x in primes] queries = int(sys.stdin.readline()) def queryFindFences(): colors = {} count = int(sys.stdin.readline()) heights = sys.stdin.readline().strip().split() complexNeighbors = [0]...
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL STRING STRING STRING STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR A...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] q = int(input()) while q != 0: q -= 1 all_col = dict() n = int(input()) lt = [int(x) for x in input().split()] used = 1 for i in range(n): k = lt[i] j = 0 while k % pr[j] != 0: j += 1 if pr[j] in all_col: ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for __ in range(t): n = int(input()) A = list(map(int, input().split())) groups = [[] for i in range(11)] ans = [0] * n calc = 1 fwasnt = 1 gigs = { (2): 1, (3): 2, (5): 3, (7): 4, (11): 5, (13): 6, (17): 7, (19...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT NUMBER NUMBER NUMBER N...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) p = [2, 3, 5, 7] for i in range(10, 38): k = 2 sqrt = i**0.5 while k <= sqrt and i % k != 0: k += 1 if k > sqrt: p.append(i) ans = [] counter = 0 for i in range(t): n = int(input()) nums = list(map(int, input().split())) now = [] for j in range(n): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR NUMBER VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) p = [1] * n f = [0] * n i = 2 y = max(l) while i <= y: for j in range(n): if l[j] % i == 0: if f[j] == 0: f[j] = 1 p[j] = i i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for i in range(int(input())): n = int(input()) a = list(map(int, input().split())) col = [0] * n d = dict() for t in range(len(a)): j = 2 isprime = True while j * j <= a[t]: if a[t] % j == 0: isprime = False break j += 1...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for i in range(0, t, 1): n = int(input()) a = list(map(int, input().split())) b = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] c = [[], [], [], [], [], [], [], [], [], [], []] for j in range(0, len(a)): for q in range(0, 11, 1): if a[j] % b[q] == 0: c...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST LIST LIST LIST LIST LIST L...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys t = -1 def input(): global t t += 1 return d[t] d = sys.stdin.readlines() k = int(input()) p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for i in range(k): n = int(input()) a = list(map(int, input().split())) answer = [-1] * n number = [-1] * 11 count = 1 for i in rang...
IMPORT ASSIGN VAR NUMBER FUNC_DEF VAR NUMBER RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def prime_list(n): sieve = [True] * n m = int(n**0.5) for i in range(2, m + 1): if sieve[i] == True: for j in range(i + i, n, i): sieve[j] = False return [i for i in range(2, n) if sieve[i] == True] def answer(compositeIntegers): n = len(compositeIntegers) m...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR NUMBER RETURN VAR VAR FUNC_CALL VAR NUMBER VAR VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) def primes(n): odds = range(3, n + 1, 2) sieve = set(sum([list(range(q * q, n + 1, q + q)) for q in odds], [])) return [2] + [p for p in odds if p not in sieve] for _ in range(t): input() arr = list(map(int, input().split())) s = set(arr) coloring = dict() color = 0 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR VAR LIST RETURN BIN_OP LIST NUMBER VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for _ in range(int(input())): n = int(input()) array = list(map(int, input().split())) result, colors, deviders, c_dict = ( [0] * n, 1, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31], {}, ) for i_elem, elem in enumerate(array): for i_devider, devider in enumerate(de...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP LIST NUMBER VAR NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER DICT FOR VAR VAR FUNC_CALL VA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for i in range(int(input())): a = int(input()) li = list(map(int, input().split())) c = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] d = [] e = [(0) for i in range(11)] l = 1 f = [(0) for i in range(11)] for i in li: for j in range(11): if i % c[j] == 0: i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR N...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def primes1(n): sieve = [True] * (n // 2) for i in range(3, int(n**0.5) + 1, 2): if sieve[i // 2]: sieve[i * i // 2 :: i] = [False] * ((n - i * i - 1) // (2 * i) + 1) return [2] + [(2 * i + 1) for i in range(1, n // 2) if sieve[i]] primes = primes1(40) for _ in range(int(input())): ...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR BIN_OP LIST NUMBER BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR VAR NUMBER BIN_OP NUMBER VAR NUMBER RETURN BIN_OP ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys input = sys.stdin.readline MOD = 1000000007 MOD2 = 998244353 ii = lambda: int(input().strip("\n")) si = lambda: input() 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(input().strip...
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 VAR 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 VAR FUNC_CALL VA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for i in range(t): n = int(input()) a = list(map(int, input().split())) d = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] used = [0] * 11 cur = 1 c = [0] * n for j in range(n): f = 0 for k in range(11): if not f and a[j] % d[k] == 0: f ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER A...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys I = lambda: int(input()) readline = lambda: sys.stdin.readline().strip("\n") RM = readmap = lambda x=int: map(x, readline().split(" ")) primes11 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(I()): n, l = I(), [*RM()] primes_used = {} sol = [0] * n for ind, i in enumerate(l): ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR LIST F...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) while t > 0: n = int(input()) x = input().split(" ") c = 1 l = [] d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for j in x: i = int(j) if i % 2 == 0: if d[0] == 0: d[0] = c c += 1 l.append(d[0]) elif i % 3 =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR N...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for _ in range(t): n = int(input()) A = [*map(int, input().split())] colors = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] color_idx = {} mx_idx = 1 res = [] for a in A: for c in colors: if not a % c: if c not in color_idx: ...
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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FOR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys def main(): import sys input = sys.stdin.buffer.readline P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(int(input())): N = int(input()) A = list(map(int, input().split())) ans = [0] * N seen = {} k = 1 for i, a in enumerate(A): ...
IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
a = int(input()) for _ in range(a): size = int(input()) ar = list(map(int, input().split())) g = 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 v = [0] * size z = [0] * 11 u = 0 for i in range(size): if ar[i] % 31 == 0: if z[0] == 0: u += 1 z[0] = ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMB...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def SieveOfEratosthenes(n): arr = [] prime = [(True) for i in range(n + 1)] p = 2 while p * p <= n: if prime[p] == True: for i in range(p * 2, n + 1, p): prime[i] = False p += 1 prime[0] = False prime[1] = False for p in range(n + 1): if pr...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
MOD = 998244353 T = 1 T = int(input()) for t in range(1, T + 1): n = int(input()) a = list(map(int, input().split())) p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] colour = {i: [] for i in range(1, 12)} for i in range(n): for j in range(11): if a[i] % p[j] == 0: co...
ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
from sys import stdin, stdout cin = stdin.readline cout = stdout.write mp = lambda: list(map(int, cin().split())) prime = [True] * 32 p = [] for i in range(2, 32): if prime[i]: p += [i] for j in range(i * 2, 32, i): prime[j] = False (t,) = mp() for _ in range(t): (n,) = mp() a =...
ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR LIST VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = set() for i in range(2, 1001): j = 2 isprime = True while j * j <= i: if i % j == 0: isprime = True break j += 1 if isprime: primes.add(i) def solve(): unused_primes = set(primes) prime_to_c = {} c = 0 n = int(input()) arr = ...
ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASS...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) colors = "" used = [0] * 11 count = 0 for ai in a: for i in range(11): if ai % primes[i] is 0: if used[i] is 0: ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER A...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(int(input())): n = int(input()) a = [int(x) for x in input().split()] res = [] used_colors = [] for e in a: for i, c in enumerate(used_colors, start=1): if e % c == 0: res.append(i) b...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR FOR VAR VAR FUNC_CALL VAR VAR NUMBER ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) first_11_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for i in range(t): n = int(input()) assignment = [] used = [(False) for i in range(11)] for x in map(int, input().split()): broken = False for i, prime in enumerate(first_11_primes): if x % prime == 0...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUM...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
test = int(input()) for i in range(test): n = int(input()) nums = [int(i) for i in input().split(" ")] primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] color = [0] * n col = 1 for i in primes: flag = 0 enter = 0 for j in range(n): if color[j] == 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 VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
input = __import__("sys").stdin.readline print = __import__("sys").stdout.write for _ in range(int(input())): n = int(input()) k = list(map(int, input().split())) tmp = [(False) for _ in range(n)] prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] used = [(False) for _ in range(11)] s = set() ...
ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys def input(): return sys.stdin.readline()[:-1] t = int(input()) divs = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) a = list(map(int, input().split())) b = [] cur = 1 used = [(0) for _ in range(11)] for x in a: for i, d in enumerate(divs)...
IMPORT FUNC_DEF RETURN FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR L...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for j in range(t): n = int(input()) a = [int(i) for i in input().split()] b = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] b1 = [0] * 11 s = 0 c = [0] * n for i in range(n): y = 0 while a[i] % b[y] != 0: y += 1 if b1[y] == 0: s += ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for q in range(int(input())): cind = 0 ind = [-1] * 11 n = int(input()) ans = [0] * n d = [int(i) for i in input().split()] for i in range(n): k = d[i] for j in range(11): if k % pr[j] == 0: if ind[j] == -1...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_C...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
z = int(input()) for i in range(z): n = int(input()) mas = list(map(int, input().split())) numbers = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] t = int(input()) for _ in range(t): n = int(input()) cs = [] c = 0 p_to_c = {} for a in input().split(): a = int(a) for i, prime in enumerate(primes): if a % prime == 0: if prime in p_to_c: ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
colors = [(0) for i in range(1001)] colors[0] = -1 colors[1] = -1 def isprime(n): for i in range(2, n): if n % i == 0: return False return True for c, i in enumerate([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]): for j in range(1001): if j % i == 0: colors[j] = c + 1 ...
ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR VAR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n = int(input()) a = [int(item) for item in input().split()] d = dict() primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] group = [[] for _ in range(11)] for i, item in enumerate(a): ok = False for j, p in...
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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
c = [0] * 1001 col = 1 for i in range(2, 1001): if c[i] == 0: for j in range(i * 2, 1001, i): if c[j] == 0: c[j] = col col += 1 def tc(): n = int(input()) a = [int(x) for x in input().split()] if n <= 11: print(n) print(" ".join(map(str, rang...
ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for _ in range(int(input())): l = { (2): 0, (3): 0, (5): 0, (7): 0, (11): 0, (13): 0, (17): 0, (19): 0, (23): 0, (29): 0, (31): 0, } n = int(input()) m = [int(x) for x in input().split()] x = 1 for i in range...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSI...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
from sys import stdin, stdout s = "" for _ in range(int(input())): n = int(input()) ls = list(map(int, stdin.readline().split())) pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] ans = [(0) for i in range(n)] mx = 0 f = True for i in pr: for j in range(n): if ans[j] == 0: ...
ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NU...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) h = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) a = list(map(int, input().split())) d = [] m = set() g = [] for i in a: for j in range(11): if i % h[j] == 0: d.append(j + 1) m.add(h[j]) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) while t: n = int(input()) a = input().split() a = list(map(lambda x: int(x), a)) d = {} for i in range(n): j = 2 while j * j <= a[i]: if a[i] % j == 0: break j += 1 if j not in d: d[j] = [] d[j].appe...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def fc(n): for p in primes: if n % p == 0: return p raise ValueError for _ in range(int(input())): input() arr = list(map(int, input().split())) s = set() ps = [] for e in arr: f = fc(e) s.add(f) ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF FOR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIG...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
N = int(input()) pr = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, ] Ans = "" for i in range(N): n = int(input()) q = list(map(int, input().split())) c = [...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
from sys import stdin input = stdin.readline q = int(input()) for rwerew in range(q): n = int(input()) l = list(map(int, input().split())) pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] odp = [] secik = set() for i in range(n): for j in range(11): if l[i] % pr[j] == 0: ...
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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
kek = { (2): 1, (3): 2, (5): 3, (7): 4, (11): 5, (13): 6, (17): 7, (19): 8, (23): 9, (29): 10, (31): 11, } for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) res = [] used_col = set() for el in a: for k in sorted(kek...
ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CAL...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) k = 1 ans = [0] * n for i in range(2, 1001): f = 0 for j in range(n): if l[j] % i == 0 and ans[j] == 0: ans[j] = k f = 1 if f == 1: k += ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
l = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(int(input())): n = int(input()) div = {} col = [0] * n m = 1 a = list(map(int, input().split())) for j in range(11): for i in range(n): if a[i] % l[j] == 0 and col[i] == 0: col[i] = m ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
from sys import stdin, stdout t = int(stdin.readline()) for query in range(t): n = int(stdin.readline()) composites = stdin.readline().split() primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] ans = [] used = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] counter = 0 for x in range(n): ans.appen...
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 FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(int(input())): n = int(input()) lis = list(map(int, input().split())) ans = [] for i in lis: for j in range(11): if i % prime[j] == 0: ans.append(j + 1) break k = set(ans) aa = len...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_numb...
IMPORT ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
c = set() for i in range(1001): j = 2 while j * j <= i: if i % j == 0: while i % j == 0: i = i // j c.add(j) j += 1 if i != 1: c.add(i) c = sorted(list(c))[1:12] for test in range(int(input())): n = int(input()) a = list(map(int, input(...
ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC_CAL...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def f(A): n = len(A) C = [0] * n B = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] a = 1 for j in range(11): r = 0 for i in range(n): if A[i] % B[j] == 0 and C[i] == 0: C[i] = a r = 1 if r > 0: a += 1 print(a - 1) ret...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR V...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [False] * 1010 for i in range(2, 1010): n = 0 while i * (i + n) < 1010: primes[i * (i + n)] = True n += 1 final = [] for i in range(len(primes)): if not primes[i]: final.append(i) final.pop(0) final.pop(0) t = int(input()) for _ in range(t): n = int(input()) arr = [i...
ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def modifyarr(arr): for i in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]: j = i * i while j <= 1000: if arr[j] == 1: arr[j] = i j += i arr = [(1) for i in range(1001)] modifyarr(arr) t = int(input()) for you in range(t): n = int(input()) l = input().spl...
FUNC_DEF FOR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR WHILE VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR AS...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys readline = sys.stdin.readline def prsh(N): prime = [2] for L in range(3, N): for p in prime: if not L % p: break if p > L ** (1 / 2): prime.append(L) break return prime PRIME = prsh(32) pn = 11 T = int(readline()...
IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR VAR IF BIN_OP VAR VAR IF VAR BIN_OP VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR F...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def primes(n): is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, int(n**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False return [i for i in range(n + 1) if is_prime[i]] def make_...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER RETURN VAR VAR FUNC_CALL VAR BIN_OP VAR NUM...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
I = input for _ in [0] * int(I()): I() m = 0 d = {} c = [] for x in I().split(): p = next(p for p in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31) if int(x) % p < 1) if (p in d) < 1: m += 1 d[p] = m c += (d[p],) print(m, *c)
ASSIGN VAR VAR FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) c = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) a = list(map(int, input().split())) count = 0 ans = {} res = [] for i in a: for j in c: if i % j == 0: if j not in ans: count += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR LIST FOR VA...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) m = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] temp = [] for i in range(n): for j in range(11): if l[i] % m[j] == 0: temp.append(m[j]) break ans = [] b =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_C...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
import sys input = sys.stdin.readline primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) for i in range(n): for j in range(11): if arr[i] % primes[j] == 0: arr[i] = j + 1 ...
IMPORT ASSIGN VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR N...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def getLowestMultiple(i): c = 2 while True: if i % c == 0: return c if c * c > i: return None c += 1 cases = int(input()) for i in range(cases): arrayLength = len(input()) numbers = [int(x) for x in input().split(" ")] numberset = set(sorted(numbers)...
FUNC_DEF ASSIGN VAR NUMBER WHILE NUMBER IF BIN_OP VAR VAR NUMBER RETURN VAR IF BIN_OP VAR VAR VAR RETURN NONE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_C...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def main(): t = int(input()) for __ in range(t): n = int(input()) a = list(map(int, input().split())) b = [] count = 0 color = {} for i in a: j = 2 while j * j <= i: if i % j == 0: b.append(j) ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) def sieve(n): ass = [] is_prime = [True] * (n + 1) is_prime[0] = False is_prime[1] = False for i in range(2, int(n**0.5) + 1): if not is_prime[i]: continue for j in range(i * 2, n + 1, i): is_prime[j] = False for i in range(n + 1): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
d = { (2): 1, (3): 2, (5): 3, (7): 4, (11): 5, (13): 6, (17): 7, (19): 8, (23): 9, (29): 10, (31): 11, (37): 12, } for _ in range(int(input())): n = int(input()) ans = [(-1) for i in range(n)] l = list(map(int, input().split())) c = 1 for i in d: ...
ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def some(n, delims, answer, count, table): for delimIdx in range(len(delims)): if n % int(delims[delimIdx]) == 0: if delims[delimIdx] not in table: table[delims[delimIdx]] = str(count) count += 1 answer.append(table[delims[delimIdx]]) retur...
FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR RETURN VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR F...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def solve(): n = int(input()) array = list(map(int, input().split())) dic = {} res = [] x = 1 for a in array: for i in range(11): if a % prime[i - 1] == 0: res.append(i) if i not in dic.keys():...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER 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 ASSIGN VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] ans = [] for i in range(0, t): n = int(input()) A = list(map(int, input().split())) answer = [(0) for i in range(0, n)] color = 1 for j in range(0, 11): flag = 0 for k in range(0, n): if answer[k] == 0 and A[k]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL V...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def main(): primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] n = int(input()) a = [] a = list(map(int, input().split())) dp = [] dp = [(-1) for _ in range(len(primes))] cnt = 0 for i in range(len(a)): for j in range(len(primes)): if a[i] % primes[j] == 0: ...
FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def primefactor(n): for i in range(2, int(n**0.5 + 1)): if n % i == 0: return i return -1 for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) b = [] indices = [] for i in range(n): ...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSI...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
def factors(a): m = [] i = 1 while i <= a: if a % i == 0: m.append(i) i += 1 return m def common(a, b): c = 0 for i in a: if i in b: c += 1 if c > 1: return True return False t = int(input()) for q in range(t): n = int(input...
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(int(input())): input() seq = [int(x) for x in input().split()] ans = [(0) for _ in range(len(seq))] m = 0 cmap = {} for i in range(len(seq)): for c, p in enumerate(pr): if seq[i] % p == 0: if c not i...
ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for x in range(t): n = int(input()) a = list(map(int, input().split())) k = [] for i in range(n): for g in range(len(p)): if len(k) == i and a[i] % p[g] == 0: k.append(p[g]) dif = [] for i in range(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_C...
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The following numbers aren't: 1, 2, 3, 17, 97. Alice is given a sequence of n composite numbers a_1,a_2,…,a_n. She wants to choos...
t = int(input()) sosu = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] for _ in range(t): n = int(input()) a = list(map(int, input().split())) ans = [] ans2 = 0 for i in range(n): for j in range(11): if a[i] % sosu[j] == 0: ans.append(j + 1) ans2 = max(j...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR ...