description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
One day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of $n$ different flavors. A bag of the $i$-th flavor costs $a_i$ burles.
The store may run out of some flavors, so you'll decide which one to buy after arriving there. But there are two major flaws in thi... | INF = 1000000000000000000
def sol1(A):
max3 = 0
for x in A:
if x % 3 == 0:
x -= 3
max3 = max(max3, x // 3)
else:
max3 = max(max3, x // 3)
return 2 + max3
def sol2(A):
max3 = 0
for x in A:
if x % 3 == 1:
return INF
ma... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER RETURN BIN_OP NUMBER VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VA... |
One day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of $n$ different flavors. A bag of the $i$-th flavor costs $a_i$ burles.
The store may run out of some flavors, so you'll decide which one to buy after arriving there. But there are two major flaws in thi... | T = int(input())
for i in range(T):
n = int(input())
l = list(map(int, input().split()))
l.sort()
isMod1 = False
isMod2 = False
one = l[0] == 1
smaller = False
for j in range(n):
if l[j] % 3 == 1:
isMod1 = True
elif l[j] % 3 == 2:
isMod2 = True
... | 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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUM... |
One day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of $n$ different flavors. A bag of the $i$-th flavor costs $a_i$ burles.
The store may run out of some flavors, so you'll decide which one to buy after arriving there. But there are two major flaws in thi... | for _ in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
r = (max(a) + 2) // 3
ans = r + 1
for take_ones in range(3):
for take_twos in range(3):
loop_ans = 0
for i in range(n):
cur_ans = 10**9
if a[i] % 3 == ... | 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 BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC... |
One day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of $n$ different flavors. A bag of the $i$-th flavor costs $a_i$ burles.
The store may run out of some flavors, so you'll decide which one to buy after arriving there. But there are two major flaws in thi... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
answer = max(a)
for i in range(2):
s = set(j for j in range(i + 1))
for j in range(3):
if j > 0:
t = set()
for item in s:
t.add(item + 2)
... | 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 FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF 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... | import sys
input = lambda: sys.stdin.readline().rstrip()
def I():
return [int(iI) for iI in input().split()]
def II():
return int(input())
def SI():
return [i for i in input()]
for _ in range(II()):
n = II()
a = I()
k = 1
ans = [0] * len(a)
for i in range(2, 32):
flag = ... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST 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... | for i in range(int(input())):
n = int(input())
primes = {
(2): 0,
(3): 0,
(5): 0,
(7): 0,
(11): 0,
(13): 0,
(17): 0,
(19): 0,
(23): 0,
(29): 0,
(31): 0,
}
l = list(map(int, input().split()))
for j in primes:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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 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... | primes = [
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,
101,
103,
107,
109,
113,
127,
131,
137,
139,
149,
151,
157,
1... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER 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 = lambda: int(input())
M = lambda: map(int, input().split())
L = lambda: list(M())
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(I()):
n = I()
a = L()
li = []
use = [False] * 11
for i in range(n):
for j in range(11):
if a[i] % p[j] == 0:
li.append(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN 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... | d = {i: (0) for i in range(1001)}
pos = 1
v = int(1001**0.5) + 1
for i in range(2, v):
if d[i] == 0:
d[i] = i
for j in range(i * i, 1001, i):
if j % i == 0:
d[j] = i
cases = int(input())
for t in range(cases):
n = int(input())
a = list(map(int, input().split()))
... | ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL 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 getPrime(x):
for i in range(2, x):
if x % i == 0:
return i
return -1
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for T in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
used = [(False) for x in range(11)]
for i in range(n):
x =... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL 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... | P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
T = int(input())
for _ in range(T):
N = int(input())
A = [int(a) for a in input().split()]
X = [-1] * N
D = [-1] * 11
for i, a in enumerate(A):
for j, p in enumerate(P):
if a % p == 0:
X[i] = j
if D[j] <... | 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 VAR ASSIGN VAR BIN_OP 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... | def getPrimes(n):
count = 0
primes = [True] * (n + 1)
primes[0] = primes[1] = False
for i in range(2, n + 1):
if primes[i]:
count += 1
j = 2
while i * j <= n:
primes[i * j] = False
j += 1
return primes
def solve(arr, prime... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER 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... | t = int(input())
for _ in range(0, t):
n = int(input())
l = list(map(int, input().split()))
s = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
z = []
f = []
maxi = 1
for i in l:
for k, j in enumerate(s):
if i % j == 0:
if not j in f:
f.append... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN 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... | for _ in " " * int(input()):
a = int(input())
z = []
k = {}
for i in map(int, input().split()):
for j in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]:
if i % j == 0:
if j not in k:
k[j] = len(k) + 1
z += [k[j]]
break
... | FOR VAR BIN_OP STRING 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 VAR FUNC_CALL FUNC_CALL VAR FOR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER IF BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR BIN_OP 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... | primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
t = int(input())
for i in range(0, t):
n = int(input())
a = list(map(int, input().split()))
ans = []
d = []
len_d = 0
for k in range(0, n):
flag = 0
if k == 0:
for p in range(0, 11):
if a[k] % prime... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST 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())
prime = [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 = [11] * n
cnt = 1
for i in range(11):
flag = False
for j in range(n):
if a[j] % prime[i] == 0:
flag = True
... | 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... | from sys import stdin
def solve(n, a):
k = 0
c = [0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
h = [0] * n
d = {}
for i in range(1, 12):
for j in range(n):
if a[j] == -1:
continue
if a[j] % c[i] == 0:
if c[i] not in d:
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN 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... | primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
R = lambda: map(int, input().rstrip().split())
for _ in range(int(input())):
n = int(input())
a = list(R())
ans = []
colours = {}
l = 0
for x in a:
for i in range(11):
if x % primes[i] == 0:
color = colours.get... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL 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 FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT 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... | cs = [(-1) for i in range(1001)]
cnt = 0
for i in range(2, 1001):
if cs[i] == -1:
cnt += 1
for j in range(2 * i, 1001, i):
if cs[j] == -1:
cs[j] = cnt
t = int(input())
for _ in range(t):
n = int(input())
A = list(map(int, input().split()))
used = list(set([cs[... | ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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... | def ndc(k):
t = int(k**0.5)
for i in range(2, t + 1):
if k % i == 0:
return i
return k
kl = int(input())
for l in range(kl):
rz = []
s = set()
A = {}
nr = 0
n = int(input())
a = [int(i) for i in input().split()]
for i in range(n):
prd = ndc(a[i])
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL 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... | t = int(input())
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
while t:
t -= 1
n = int(input())
a = [int(x) for x in input().split()]
d = {}
c = 0
ans = []
for i in range(n):
flag = 0
temp = -1
for j in p:
if a[i] % j == 0:
if j in d.keys():... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR LIST 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... | import sys
input = lambda: sys.stdin.readline().rstrip()
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
an = 0
ans = []
tw = 0
tr = 0
sem = 0
p = 0
od = 0
trin = 0
dev = 0
dvtr = 0
dvd = 0
tro = 0
trse = 0
semnad = 0
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER 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... | p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
l = []
lst = []
for i in range(int(input())):
input()
for i1, j in enumerate(map(int, input().split())):
for n in p:
if j % n == 0:
if n in l:
lst.append(l.index(n) + 1)
break
... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF VAR VAR 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... | import sys
input = sys.stdin.readline
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
Q = int(input())
Query = []
for _ in range(Q):
N = int(input())
A = list(map(int, input().split()))
Query.append((N, A))
for N, A in Query:
ans = []
Nums = {}
for a in A:
for i, p in enumerate(primes... | IMPORT ASSIGN VAR VAR 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 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 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... | from sys import stdin
def find_smallest_factor(n):
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for p in primes:
if n % p == 0:
return p
def choose_colours(num_list):
factor_list = list(map(find_smallest_factor, num_list))
unique_factors = list(set(factor_list))
prime2co... | FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN 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... | def solve(array):
current = 1
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
ans = [(-1) for i in range(len(array))]
for prime in primes:
used = False
for i in range(len(array)):
if ans[i] == -1:
if array[i] % prime == 0:
ans[i] = curren... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR 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())
for i in range(t):
n = int(input())
lis = list(map(int, input().split()))
clr_map = [(0) for i in range(n)]
maxi = max(lis)
j = 2
clr = 1
while j * j <= maxi:
look = False
for k in range(n):
if lis[k] % j == 0:
if clr_map[k] == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR ASSIGN VAR NUMBER 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... | primes = []
for i in range(2, 1001):
flag = True
for j in range(2, int(i**0.5) + 1):
if i % j == 0:
flag = False
if flag:
primes.append(i)
t = int(input())
while t:
n = int(input())
a = list(map(int, input().split()))
color = [(0) for i in range(n)]
m = 1
for ... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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... | t = int(input())
for tt in range(t):
n = int(input())
a = list(map(int, input().split(" ")))
is_coloured = list([0] * n)
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for pp in primes:
col = max(is_coloured) + 1
for i in range(n):
if is_coloured[i] == 0 and a[i] % pp ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER 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... | import sys
input = sys.stdin.readline
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()))
used = [False] * 11
Ans = []
for a in A:
for idx_primes, p in enumerate(primes):
if a % p == 0:
... | IMPORT ASSIGN VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER 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... | t = int(input())
for i in range(t):
n = int(input())
l1 = list(map(int, input().split()))
colors = list()
r = [0] * len(l1)
for i in range(2, 1000):
a = 1
for color in colors:
if i % color == 0:
a = 0
break
if a:
colors.... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR 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... | t = int(input())
for i in range(t):
n = int(input())
l = list(map(int, input().split()))
d = [(0) for _ in range(n)]
r = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
m = 1
for s in r:
a = False
for i in range(n):
if l[i] % s == 0 and d[i] == 0:
d[i] = 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 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 NUMBER NUMBER NUMBER NUMBER NUMBER 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 get(x):
for i in range(2, x):
if x % i == 0:
return i
return -1
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(int(input())):
n = int(input())
a = list(map(lambda x: pr.index(get(int(x))), input().split()))
used = [0] * 11
for i in a:
used[i] = 1
... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
m = 0
d = {}
for i in range(n):
for j in range(11):
if a[i] % pr[j] == 0:
if j in d:
a[i] = d[j]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT 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())
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for case_num in range(t):
n = int(input())
a = list(map(int, input().split(" ")))
used = set()
color = []
for i in a:
for prime in primes:
if i % prime == 0:
color.append(prime)
use... | 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 STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST 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... | for _ in range(int(input())):
n = int(input())
a = [int(o) for o in input().split()]
kk = 1
ans = [0] * n
i = 2
while i <= 1000:
flag = 0
for j in range(n):
if ans[j] == 0 and a[j] % i == 0:
ans[j] = kk
flag = 1
if flag == 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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER BIN_OP VAR 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... | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split(" ")))
prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
res = [(-1) for _ in range(n)]
current_color = 1
if len(arr) <= 11:
print(n)
for i in range(1, n + 1):
print(i, end=" ")
pr... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF 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... | def factor(i):
pr = []
e = 2
while e**2 <= i:
if i % e == 0:
pr.append(e)
while i % e == 0:
i = i // e
e += 1
if i > 1:
pr.append(i)
return pr
def solve():
n = int(input())
nums = list(map(int, input().split()))
numf = lis... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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... | T = int(input())
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(T):
n, co = int(input()), list(map(int, input().split()))
color, vis = [0] * n, {}
for i in range(n):
for j in range(11):
if co[i] % p[j] == 0:
if j not in vis.keys():
vis[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 VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR DICT FOR 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):
a = int(input())
l = list(map(int, input().split()))
d = []
c = []
m = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for j in l:
for k in p:
if j % k == 0:
if k in d:
c.append(d.index(k) + 1)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER 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... | for _ in " " * int(input()):
n = int(input())
a = list(map(int, input().split()))
lst = [0] * n
prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
color = 1
for i in range(15):
f = 0
for j in range(n):
if lst[j] == 0:
if a[j] % prime[i] =... | FOR VAR BIN_OP STRING 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 NUMBER NUMBER NUMBER NUMBER 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... | a = int(input())
for _ in range(a):
b = int(input())
c = [int(i) for i in input().split()]
d = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
e = []
ans = []
for i in c:
for j in d:
if i % j == 0:
if not j in e:
ans.append(str(len(e) + 1))
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 LIST FOR VAR VAR FOR 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... | def primes(c):
primes = []
p = 2
while c >= p * p:
if c % p == 0:
primes.append(p)
c = c // p
elif p == 2:
p += 1
else:
p += 2
if c != 1:
primes.append(c)
return primes
def pick(map, c):
if not c in map:
ma... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF IF VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN VAR VAR ASSIGN 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... | import sys
ea = 1001
prime_numbers = [True] * ea
for i in range(2, int(ea**0.5) + 1):
if prime_numbers[i] == True:
for j in range(i * 2, ea, i):
prime_numbers[j] = False
prime = []
for i in range(2, int(ea**0.5) + 1):
if prime_numbers[i] == True:
prime.append(i)
composite_numbers = ... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER 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... | import sys
input = sys.stdin.buffer.readline
first11Primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
def getSmallestPrimeFactor(x):
for p in first11Primes:
if x % p == 0:
return p
t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
ans = [... | IMPORT ASSIGN VAR VAR 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 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 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... | x = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
m = [0] * n
for i in range(n):
for j in range(len(x)):
if l[i] % x[j] == 0:
m[i] = j + 1
s = set(m)
print(len(s))
d = {x: y for ... | 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 FOR VAR FUNC_CALL VAR VAR FOR 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... | I = lambda: list(map(int, input().split()))
p = [0] * 501
pr = []
for i in range(2, 501):
n = i
for j in range(2, int(n**0.5) + 1):
if n % j == 0:
break
else:
p[i] = 1
pr.append(i)
for _ in range(int(input())):
(n,) = I()
l = I()
c = [0] * n
ck = [0] * 11
... | 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 ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL 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... | def getpos(li, e):
s = len(li)
for i in range(s):
if li[i] == e:
return i + 1
a = [1] * 33
a[0] = a[1] = 0
for i in range(2, 6):
if a[i] == 1:
for j in range(i * i, 33, i):
a[j] = 0
prime = []
for i in range(33):
if a[i] == 1:
prime.append(i)
t = int(inp... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR RETURN BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST 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())
sin_usar = []
usar = []
primos = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
dif = []
mostrar = []
for i in range(0, t):
c = int(input())
d = input()
b = ""
for i in range(0, c):
sin_usar.append(d.split(" ")[i])
for i in range(0, c):
for j in range(0, len(primos)):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING 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... | primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
checked = [0] * n
col = 1
cnt = 0
for p in primes:
if cnt > 0:
col += 1
cnt = 0
for j in range(n):
if not checked[j... | 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER 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... | primes = 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31
def algo(inp, n):
result = []
colors = [None] * 11
for i in range(n):
for j in range(11):
if inp[i] % primes[j] == 0:
result.append(j + 1)
colors[j] = True
break
print(colors.count(True)... | ASSIGN VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NONE NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER EXPR 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... | import sys
t = int(input())
inp = [line.strip().split() for line in reversed(sys.stdin.readlines())]
ans = []
markers = []
simple_numbers = []
for i in range(2, 100):
flag = True
j = 2
while j * j <= i:
if i % j == 0:
flag = False
break
j += 1
if flag:
si... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST 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 E... |
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()))
color = [0] * n
m = 0
setup = set()
def run(x):
global m
for i in range(n):
if not color[i] and a[i] % x == 0:
color[i] = m + 1
setup.add(x)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR 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())
a = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(t):
n = int(input())
ans = []
count = 0
dict = {}
l = [int(i) for i in input().split()]
for u, e in enumerate(l):
for f in a:
if e % f == 0:
if f not in dict:
dict... | 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 ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR 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 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
t = int(input())
for _ in range(t):
n = int(input())
mapped = {p: [] for p in primes}
arr = list(map(int, input().split()))
for i in range(n):
for p in primes:
if arr[i] % p == 0:
mapped[p].append(i)
id_color = 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 VAR LIST VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FO... |
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())
numbers = []
for i in range(1000):
numbers.append(i + 1)
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
div = {}
for i in primes:
for j in numbers:
if j % i == 0:
div[j] = i
numbers.remove(j)
for i in range(t):
group = []
pairs = {}
n = int(input()... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR DICT FOR VAR VAR FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR EXPR 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... | for _ in range(int(input())):
n = int(input())
c = list(map(int, input().split()))
temp = {
(2): 12,
(3): 12,
(5): 12,
(7): 12,
(11): 12,
(13): 12,
(17): 12,
(19): 12,
(23): 12,
(29): 12,
(31): 12,
}
count = 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 DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER 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... | def sieve():
plist = [2]
for i in range(3, 500, 2):
prime = True
for p in plist:
if i % p == 0:
prime = False
break
if prime:
plist.append(i)
return plist
def pair(plist, lim=1000):
plistcpy = list(plist)
pairs = []
... | FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR 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... | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
ans = [-1] * n
curr_col = 1
for p in prime:
got = 0
for i in range(n):
if ans[i] != -1:
continue
if arr[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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR 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 simple_nums(n):
lst = [(True) for x in range(n + 1)]
lst[0] = False
lst[1] = False
for i in range(len(lst)):
if lst[i]:
for k in range(i * 2, len(lst), i):
lst[k] = False
lst2 = []
for i in range(len(lst)):
if lst[i]:
lst2.append(i)
... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR EXPR ... |
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 x in range(int(input())):
n = int(input())
li = list(map(int, input().split()))
lis = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
ali = []
ma = {}
ans = 0
for i in li:
for j in lis:
if i % j == 0:
try:
ali.append(ma[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 NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR FOR 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... | t = int(input())
for _ in range(t):
n = int(input())
l = list(map(int, input().split()))
col = 0
ans = []
di = {
(2): 0,
(3): 0,
(5): 0,
(7): 0,
(11): 0,
(13): 0,
(17): 0,
(19): 0,
(23): 0,
(29): 0,
(31): 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 ASSIGN VAR LIST ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER 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... | primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
t = int(input())
for case in range(t):
n = int(input())
a = [int(x) for x in input().split(" ")]
ans = []
for c in a:
for i in range(11):
if c % primes[i] == 0:
ans.append(i + 1)
break
m = len(set(a... | 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 STRING ASSIGN VAR LIST FOR VAR VAR FOR VAR FUNC_CALL 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... | for _ in range(int(input())):
q = int(input())
s = list(map(int, input().split()))
colors = []
ans = []
for n in s:
i = 0
while i < len(colors) and n % colors[i]:
i += 1
if i < len(colors):
ans.append(i + 1)
else:
i = 2
... | 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 LIST FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR 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... | t = int(input())
primes = list(range(2, 1003))
for i in range(2, int(1002**0.5) + 1):
if i in primes:
j = i * i
while j <= 1002:
try:
primes.remove(j)
except:
pass
j += i
for _ in range(t):
n = int(input())
a = list(map(int,... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP NUMBER NUMBER NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR 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... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
color = [0] * n
for i in range(n):
for j in range(2, 32):
if l[i] % j == 0:
color[i] = j
break
dic = {}
count = 1
for i in range(n):
if dic.get(color... | 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 FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR DICT 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 SieveOfErathosthenes(n=1000):
prime = [1] * (n + 1)
res = [[] for i in range(n + 1)]
p = 2
while p * p <= n:
if prime[p]:
for i in range(2 * p, n + 1, p):
prime[i] = 0
res[i].append(p)
p += 1
return res
def solve(a):
c = [0] * len... | FUNC_DEF NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN 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 solve(a):
c = [0] * len(a)
m = []
for p in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]:
for j in range(len(a)):
if a[j] % p == 0 and c[j] == 0:
if p not in m:
m.append(p)
c[j] = len(m)
print(len(m))
print(" ".join([str(e) for e... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR EXPR 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 is_used(prime):
for i in range(len(used)):
if prime == used[i]:
return i
return -1
T = int(input())
for _ in range(T):
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
used = []
n = int(input())
c = 0
arr = [int(x) for x in input().split()]
for i in range(n):
... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR RETURN VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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... | def smallestDivisor(n):
if n % 2 == 0:
return 2
i = 3
while i * i <= n:
if n % i == 0:
return i
i += 2
return n
for i in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
list_of_color = []
for i in a:
list_of_color.... | FUNC_DEF IF BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN VAR VAR NUMBER RETURN 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 VAR VAR FUNC_CALL FUNC_CALL VAR 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... | primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
def solve(nums, n):
prime_dict = {p: [] for p in primes}
colors = [0] * n
largest_color = 0
for ind, num in enumerate(nums):
for p in primes:
if num < p:
break
if num % p == 0:
if prime_di... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR VAR LIST VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR FOR VAR VAR IF VAR VAR IF BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN 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... | pr = []
for i in range(2, 500):
for j in range(2, i):
if i % j == 0:
break
else:
pr.append(i)
t = int(input())
for q in range(t):
m = 0
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(len(a)):
if a[i] == 0:
con... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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 t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
elem = [0] * n
check = [False] * 11
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for i in range(n):
for j in range(11):
if a[i] % primes[j] == 0:
elem[i] = primes[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 BIN_OP LIST NUMBER NUMBER 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
def sieve_of_eratosthenes(n):
all_prime = []
prime = [(True) for i in range(n + 1)]
p = 2
while p * p <= n:
if prime[p]:
for i in range(p * p, n + 1, p):
prime[i] = False
p += 1
for p in range(2, n):
if prime[p]:
... | 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 FOR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR EXPR FUNC_CALL VAR VAR RETURN VAR ASSIGN 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 colorize(n):
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for p in range(len(primes)):
if n % primes[p] == 0:
return p
t = int(input())
for test in range(t):
n = int(input())
lst = [int(i) for i in input().split()]
ans = [colorize(i) for i in lst]
conv = list(set(a... | FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER RETURN 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 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 find_nod(number):
i = 2
while i <= number:
if number % i == 0:
return i
i += 1
t = int(input())
for i in range(t):
n = int(input())
numbers = [int(i) for i in input().split()]
output = [(0) for i in numbers]
n_colors = 0
divs = []
for j, number in enumer... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR NUMBER RETURN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST 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... | t = int(input())
parr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(t):
oarr = []
carr = []
n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
for j in range(11):
if arr[i] % parr[j] == 0:
oarr += [parr[j]]
if par... | 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 LIST ASSIGN VAR LIST 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 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 = input().split()
for j in range(n):
a[j] = int(a[j])
s = []
s.append(2)
s.append(3)
s.append(5)
s.append(7)
s.append(11)
s.append(13)
s.append(17)
s.append(19)
s.append(23)
s.append(29)
s.append(3... | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL 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... | from sys import stdin
for _ in range(int(stdin.readline())):
n = int(stdin.readline())
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
l = [[] for _ in range(11)]
arr = list(map(int, stdin.readline().split()))
ans = [0] * n
for x in range(n):
for d in range(11):
if arr[x] % pr... | FOR VAR FUNC_CALL VAR FUNC_CALL 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 ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST 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())
for iii in range(t):
n = int(input())
m = list(map(int, input().split()))
ans = [0] * n
pr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
cv = []
for i in range(11):
cv.append([])
for i in range(n):
for j in range(11):
if m[i] % pr[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 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 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... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
x = [2, 3, 5, 7, 11]
d = {}
y = [1, 4, 6, 8, 9, 10]
z = [13, 17, 19, 23, 29, 31]
ans = []
k = 1
for i in range(n):
for j in range(5):
if a[i] % x[j] == 0:
if x[j] no... | 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 ASSIGN VAR DICT ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST 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... | from sys import stdin, stdout
input = stdin.readline
for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = max(a)
prime = [(1) for i in range(b + 1)]
i = 2
while i * i <= b:
if prime[i] == 1:
for j in range(i * i, b + 1, i):
i... | ASSIGN 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR 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 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... | prime = []
for i in range(2, 32):
temp = True
for j in range(2, i // 2 + 1):
if i % j == 0:
temp = False
break
else:
continue
if temp:
prime.append(i)
x = int(input())
for i in range(x):
y = int(input())
ans = [0] * 11
temp1 = list(map(... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL 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 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... | def isPrime(n):
i = 2
while i * i <= n:
if n % i == 0:
return False
i += 1
return True
prime = [2]
for i in range(3, 1000, 2):
if isPrime(i):
prime.append(i)
l = [i for i in range(4, 1001) if i not in prime]
for _ in range(int(input())):
n = int(input())
a =... | FUNC_DEF ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL 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... | primes = 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31
T = int(input())
while T > 0:
n = int(input())
arr = map(int, input().split())
ans = []
mp = {}
cnt = 1
for num in arr:
for p in primes:
if num % p == 0:
ans.append(p)
if p not in mp:
... | ASSIGN VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR FOR 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... | prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for ii in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
ans = []
ind = 0
flag = [0] * 13
c = 0
for i in range(n):
for j in range(len(prime)):
if arr[i] % prime[j] == 0:
if flag[... | 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 ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST 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... | def get_primes(k):
p = [True] * (k + 1)
p[0] = False
p[1] = False
for i in range(1, k + 1):
if p[i]:
for j in range(2, k // i + 1):
p[i * j] = False
pr = []
for i in range(k + 1):
if p[i]:
pr.append(i)
return pr
p = get_primes(1001)
t... | 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 VAR NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF 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... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().rstrip().split()))
l = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
d = {}
chk = {}
t = 1
for i in range(len(a)):
for j in range(len(l)):
if a[i] % l[j] == 0:
d[i] = j + 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR DICT 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... | from sys import stdin, stdout
t = int(stdin.readline().strip())
P = {a: (0) for a in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]}
for _ in range(t):
n = int(stdin.readline().strip())
alist = list(map(int, stdin.readline().split()))
for p in P:
P[p] = 0
used = 0
ans = []
for a in alist:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR 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... | primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
def first_factor(x):
for p in primes:
if x % p == 0:
return p
return 0
t = int(input())
output = ""
for i in range(t):
m = 0
factors = []
tuples = []
res = ""
n = int(input())
A = [int(x) for x in input().split(" "... | 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 RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR STRING 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... | p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for _ in range(int(input())):
n = int(input())
m = 0
a = []
c = {}
for x in map(int, input().split()):
for i, d in enumerate(p):
if 0 == x % d:
a += (i,)
c[i] = 0
break
for i, x in en... | 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 NUMBER ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF 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... | t = int(input())
while t != 0:
n = int(input())
A = list(map(int, input().split()))
d = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
res = [0] * n
i = 0
while i < 11:
j = 0
while j < n:
if A[j] % d[i] == 0:
res[j] = i + 1
j += 1
i += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE 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... | t = int(input())
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for i in range(t):
n = int(input())
nums = list(map(int, input().split()))
sol = [(0) for k in range(n)]
for i in range(n):
for j in range(11):
if nums[i] % primes[j] == 0:
sol[i] = j + 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 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... | p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
def slv(a):
cd = {}
ans = []
for i in a:
for pp in p:
if i % pp == 0:
if pp not in cd:
cd[pp] = len(cd) + 1
ans.append(cd[pp])
break
print(len(cd))
print(" ".join([s... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR VAR FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL 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... | from sys import stdin
input = iter(stdin.readlines()).__next__
spf = [(i if i % 2 == 1 else 2) for i in range(0, 1001)]
for i in range(3, 32, 2):
if spf[i] == i:
for j in range(i * i, 1001, i):
if spf[j] == j:
spf[j] = i
t = int(input())
for _ in range(t):
n = int(input())
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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... | lcd = [(0) for k in range(1001)]
for k in range(1, 1001):
for p in range(2, k + 1):
if k % p == 0:
lcd[k] = p
break
for t in range(int(input())):
n = int(input())
ar = [int(x) for x in input().split()]
s = set()
for k in range(n):
s.add(lcd[ar[k]])
ar[... | ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR 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 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... | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
dct = {}
m = 1
arr1 = []
for n1 in arr:
check = -1
n2 = int(n1**0.5)
for j in range(2, n2 + 1, 1):
if n1 % j == 0:
check = 0
if j in dct.keys()... | 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 NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER 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... | def factor(n):
for i in range(2, n + 1):
if n % i == 0:
return i
return n
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
colors = [(0) for i in range(11)]
current = 0
ans = []
for i in a:
found = 0
for j in r... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN 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 NUMBER VAR FUNC_CALL VAR NUMBER 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... | def sieve(n):
a = [1] * (n + 1)
a[0] = a[1] = 0
i = 2
while i * i <= n:
if a[i]:
j = i * i
while j <= n:
a[j] = 0
j += i
i += 1
return a
for _ in range(int(input())):
p = sieve(40)
n = int(input())
a = list(map(int... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR WHILE VAR VAR ASSIGN VAR VAR NUMBER VAR VAR VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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())
for _ in range(t):
n = int(input())
l = list(map(int, input().split()))
k = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
r = []
for i in range(n):
for j in range(11):
if l[i] % k[j] == 0:
r.append(j + 1)
break
p = set(r)
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 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.