description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
from itertools import accumulate
def main():
t = int(sys.stdin.readline())
for _ in range(t):
n, k, z = [int(x) for x in sys.stdin.readline().split(" ")]
a = [int(x) for x in sys.stdin.readline().split(" ")]
prefix = list(accumulate(a))
best = 0
for t in rang... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER AS... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.readline
T = int(input())
for testcase in range(1, T + 1):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
res = 0
ma = [0] * n
for i in range(k + 1):
res += a[i]
if i > 0:
ma[i] = max(ma[i - 1], a[i] + a[i - 1])
s... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline
def calc(mani, arr):
n, k, z = mani
scores = []
pairs = []
for i in range(k):
pairs.append(arr[i] + arr[i + 1])
for i in range(0, z + 1):
if k - 2 * i + 1 <= 0:
continue
max_pair = max(pair... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR V... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | cases = int(input())
for i in range(cases):
l1 = input().split(" ")
n = int(l1[0])
k = int(l1[1])
z = int(l1[2])
l2 = input().split(" ")
arr = []
for a in l2:
arr.append(int(a))
ans = 0
if z == 0:
ans = sum(arr[0 : k + 1])
print(ans)
continue
if k ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VA... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | def walk(arr, k, l):
ans = 0
for t in range(l + 1):
mx = 0
temp = 0
if k - 2 * t < 0:
continue
for j in range(0, k - 2 * t + 1):
if j < len(arr) - 1:
mx = max(mx, arr[j] + arr[j + 1])
temp += arr[j]
ans = max(ans, temp +... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER V... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for i in range(t):
n, k, z = map(int, list(input().split()))
a = list(map(int, list(input().split())))
l = 0
for j in range(min(z + 1, k // 2 + 1)):
x = sum(a[: k - 2 * j + 1])
d = 0
for m in range(k - 2 * j + 1):
c = sum(a[m : m + 2])
if ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NU... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin
for _ in range(int(stdin.readline())):
n, k, z = map(int, stdin.readline().split())
arr = list(map(int, stdin.readline().split()))
su = [0]
for i in arr:
su.append(su[-1] + i)
fin = su[k + 1]
for i in range(1, k):
ans = su[i + 1]
K, Z = k - i, z
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for _ in range(t):
n, k, z = map(int, input().split())
x = list(map(int, input().split()))
s = 0
for i in range(z + 1):
temp = 0
p = k + 1 - 2 * i
summ = 0
for j in range(p):
summ += x[j]
if j < n - 1:
temp = max(te... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER V... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
b = a[:]
for i in range(1, n):
a[i] += a[i - 1]
for i in range(1, k + 1):
m = min(z, (k - i + 1) // 2)
r = m... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BI... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for i in range(t):
n, k, z = map(int, input().split())
l = list(map(int, input().split()))
m_score = sum(l[: k + 1])
if z >= 1:
s = 0
for i in range(k - 2):
if i >= 0:
s = max(s, l[i] + l[i + 1])
if k >= 2:
m_score = max(m_... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR N... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
n, k, z = map(int, input().split())
A = list(map(int, input().split()))
B = [(0) for i in range(n)]
B[0] = A[0]
for i in range(1, n):
B[i] = A[i] + B[i - 1]
ans = A[0]
ans1 = A[0]
for i in range(1, n):
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASS... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for s in range(t):
n, m, k = map(int, input().split())
b = list(map(int, input().split()))
m += 1
dp = [[(0) for i in range(m + 1)] for j in range(k + 1)]
b = [0] + b
add = 0
for i in range(1, m + 1):
dp[0][i] = b[i] + add
add += b[i]
maxi = dp[0][m]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUM... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | def main():
t = int(input())
for _ in range(t):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
M = 0
z *= 2
pref = []
pref_sum = 0
for j in range(n):
pref_sum += a[j]
pref.append(pref_sum)
for i in r... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VA... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | ans = []
for _ in range(int(input())):
n, k, z = map(int, input().split())
u = list(map(int, input().split()))
z = min(z, k // 2)
x = k - 2 * z
if x == 0:
x = 1
mx = 0
for i in range(1, x + 1):
mx = max(mx, u[i] + u[i - 1])
for i in range(1, n):
u[i] += u[i - 1]
... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for i in range(t):
n, k, z = map(int, input().split())
arr = list(map(int, input().split()))
arr_sum = [(arr[a] + arr[a + 1]) for a in range(n - 1)]
maximum = 0
for j in range(min(z + 1, k // 2 + 1)):
maximum = max(
sum(arr[: k - 2 * j + 1]) + max(arr_sum[: k - 2... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUN... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
s = [0]
for i in range(n):
s.append(s[len(s) - 1] + a[i])
for i in range(1, k + 1):
m = s[i + 1]
if 2 * z == k - i:
m += (a[i - 1] + a[i]) * z
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR VAR FOR V... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for test in range(t):
n, k, z = map(int, input().split())
arr = list(map(int, input().split()))
dp = [[[0, 0] for i in range(z + 1)] for j in range(n)]
dp[0][0][0] = arr[0]
m = 0
for j in range(z + 1):
for i in range(n):
if i > 0:
dp[i][j] = [... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER NUMBER VAR NUM... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin
input = stdin.readline
def answer(z):
dp = [0]
for i in range(1, k + 1):
dp.append(max(dp[i - 1], a[i] + a[i - 1]))
total = sum(a[: k + 1])
ans = total
c = 0
for i in range(k - 1, -1, -2):
if z - c == 0:
break
total -= a[i] + a[i + 1]
... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
b = list(map(int, input().split()))
sm = []
s = sum(b[: k + 1])
z1 = max(1, k - 2 * z)
s1 = sum(b[: z1 + 1])
sm.append(s)
for i in range(1, k + 1):
m = min((k - i + 1) // 2, z)
m1 = min((k - i) // 2, z)
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CA... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
n, k, z = map(int, input().split())
ls = list(map(int, input().split()))
sm, mxpr, mx = ls[0], 0, 0
for i in range(1, 1 + k):
sm += ls[i]
mxpr = max(mxpr, ls[i - 1] + ls[i])
if (k - i) % 2:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR VAR VAR VAR AS... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
a = [int(i) for i in input().split()]
maxx = 0
p = []
for i in range(z + 1):
r = k + 1 - 2 * i
ans = 0
maxx = 0
for j in range(r):
if j + 1 < n:
maxx = max(maxx, a[j] + a[j +... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
while t:
n, k, z = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
k_sum = sum(a[0 : k + 1])
pre = [a[0]]
for i in range(1, k + 1):
pre.append(pre[-1] + a[i])
maxi = a[0]
curr = a[0]
for i in range(1, k + 1):
left = k - i
c... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BI... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for _ in range(t):
n, k, z = map(int, input().split())
A = list(map(int, input().split()))
score = sum(A[: k + 1])
pairsMax = []
for i in range(k):
if i == 0:
pairsMax.append(A[i] + A[i + 1])
else:
pairsMax.append(max(A[i] + A[i + 1], pairsMax... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_O... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin
def readline():
return stdin.readline()
tests = int(readline())
def solve(n, k, z, a):
p = [0]
for v in a:
p.append(v + p[-1])
s = a[0]
res = a[0]
for i in range(1, min(n, k + 1)):
s += a[i]
r = (k - i) // 2
loop = min(z, r)
cur... | FUNC_DEF RETURN FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIG... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for i in range(t):
n, k, z = input().split()
n = int(n)
k = int(k)
z = int(z)
arr = input().split()
arr = list(map(int, arr))
best = []
for i in range(len(arr) - 1):
best.append(arr[i] + arr[i + 1])
for i in range(1, len(best)):
best[i] = max(best[i],... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_O... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
ar = list(map(int, input().split()))
ans = 0
pre = [ar[0]]
mx = [ar[0] + ar[1]]
for i in range(1, len(ar)):
pre.append(pre[i - 1] + ar[i])
for i in range(1, len(ar) - 1):
mx.append(max(mx[i - 1], ar[i] + ar[i +... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n, k, z = map(int, input().split())
a = [0] + list(map(int, input().split()))
dp = [[(0) for i in range(n + 1)] for j in range(z + 1)]
for i in range(z + 1):
for j in range(1, n + 1):
if j - 1 + i * 2 > k:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUM... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
n, k, z = map(int, input().split())
A = list(map(int, input().split()))
l = 2 * (z + 1)
D = [[[0, -1] for j in range(l)] for _ in range(k + 1)]
D[0][0] = [A[0], 0]
for i in range(1, k + 1):
for j in range(1, l, 2... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_C... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for _ in range(t):
n, k, z = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
best = -1
best_pair = -1
acc = a[0]
used = 1
for prev, cur in zip(a[:-1], a[1:]):
used += 1
if prev + cur > best_pair:
best_pair = prev + cur
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBE... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
n, k, z = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
maxpair = [(0) for _ in range(n + 1)]
for i in range(1, n):
maxpair[i] = max(maxpair[i - 1], arr[i - 1] + arr[i])
z = min(z, k... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
ls = list(map(int, input().split()))
mx = ls[0] + ls[1]
mxscr = 0
pre = ls[0]
for i in range(1, k + 1):
pre += ls[i]
mx = max(mx, ls[i] + ls[i - 1])
scr = pre + mx * min((k - i) // 2, z)
if k - (i +... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR ASS... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | rw = int(input())
for qwe in range(rw):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
p = []
pref = []
q = 0
for i in range(n):
q += a[i]
pref.append(q)
for i in range(1, n):
if k < i:
break
if k == i:
p.append... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CAL... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for i in " " * int(input()):
n, k, z = map(int, input().split())
L = list(map(int, input().split()))
mx = sum(L[: k + 1])
sumL = []
for j in range(n - 1):
sumL.append(L[j] + L[j + 1])
for j in range(z):
if k <= 2 * j + 1:
break
count = max(sumL[: k - 2 * j - 1... | FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR B... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.readline
for f in range(int(input())):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
sc = a[0]
gob = [0] * n
i = 0
while i < k:
i += 1
sc += a[i]
gob[i] = a[i] + a[i - 1]
mxsc = sc
zcop = z
for j in range... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER VAR VAR VAR ASSIGN VA... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
pref = [arr[0]]
for i in range(1, len(arr)):
pref.append(pref[-1] + arr[i])
ans = arr[0]
for i in range(1, k + 1):
kleft = k - i
here_sum = pref[i]
ad... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER FOR VAR... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
A = list(map(int, input().split()))
if z == 0:
print(sum(A[0 : k + 1]))
else:
sum0 = A[0]
sum0 += sum(A[1 : k + 1])
mxn = sum0
for i in range(1, min(z + 1, k // 2 + 1)):
mx = A[0] + A[1]... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMB... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | def solve(arr, k, z):
pre = [0]
for i in arr:
pre.append(pre[-1] + i)
ans = 0
for i in range(1, len(arr)):
moves = k - i
s = pre[i]
left = min(z * 2, moves)
s += (arr[i] + arr[i - 1]) * (left // 2) + left % 2 * arr[i - 1]
movesleft = moves - left
s... | FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_O... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin, stdout
input = stdin.readline
mp = lambda: map(int, input().split())
it = lambda: int(input())
for i in range(it()):
a, b, c = mp()
li = list(mp())
ans = 0
for j in range(c + 1):
max_pos = b - 2 * j
if max_pos >= 0:
mx_2_ele = 0
sm = 0
... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR IF VAR ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | def solve():
n, steps, left = map(int, input().split())
scores = [int(x) for x in input().split()]
sum = 0
ans = 0
maxPair = 0
for i in range(steps + 1):
if i < n - 1:
maxPair = max(maxPair, scores[i] + scores[i + 1])
sum += scores[i]
if i % 2 == steps % 2:
... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR VAR ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
s = [0]
for x in a:
s += (x + s[-1],)
ans = 0
i = 0
ans = 0
while i < k:
sum = s[i + 1] - s[0]
mv = k - i
hf = mv // 2
l = min(z, hf)
sum ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BI... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.buffer.readline
def print(val):
sys.stdout.write(str(val) + "\n")
def prog():
for _ in range(int(input())):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
total = 0
psum = [0]
for i in range(n):
psum.a... | IMPORT ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FU... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for ii in range(t):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
rightStop = []
leftStop = [0]
s = sum(a[: k + 1])
rightStop.append(s)
init = 1
while init <= z:
tempMoves = k - 2 * init + 2
if k - 2 * init >= 0:
left... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | T = int(input())
def solve():
maxleft = min(k // 2, z)
val = 0
for i in range(maxleft + 1):
temp = sum(a[: k + 1 - 2 * i])
temp += i * max(apair[: k + 1 - 2 * i])
val = max(val, temp)
return val
for test in range(T):
n, k, z = map(int, input().split())
a = [int(x) for... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR BIN_OP VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER BIN_OP NUMBER VAR ASSIGN VAR FUNC_CAL... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
sys.setrecursionlimit(10**5)
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 [... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER 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... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | def compute_score(a, k, z):
ans = a[0]
pair = a[0] + a[1]
sum_ = a[0]
for i in range(1, k + 1):
pair = max(pair, a[i - 1] + a[i])
sum_ += a[i]
lefts = min((k - i) // 2, z)
rem = a[i - 1] if k - i - 2 * lefts > 0 and lefts < z else 0
ans = max(ans, lefts * pair + s... | FUNC_DEF ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMB... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
a = list(map(int, input().split()))
sc = []
sums = 0
for i in range(n):
sums += a[i]
sc.append(sums)
b = []
for i in range(1, k + 1):
cnt = k - i
if cnt % 2 == 0:
if z >= cnt // 2:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BI... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = list(map(int, input().split()))
arr = list(map(int, input().split()))
pref = []
s = 0
for i in range(n):
s += arr[i]
pref.append(s)
ans = [pref[k]]
for i in range(1, k + 1):
ansNow = pref[i]
byRotating = 0
haveMo... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR VAR FOR VAR F... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
l = list(map(int, input().split()))
rr = 0
tt = l[0] + l[1]
if k >= 2 * z:
pls = sum(l[2 : k - 2 * z + 1])
if z == 0:
print(sum(l[: k + 1]))
else:
for i in range(1, k + 1):
c = k - i
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP BIN_OP VAR BIN_O... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for testcase in range(t):
n, k, z = map(int, input().split())
A = list(map(int, input().split()))
sumTill = []
ss = 0
for a in A:
sumTill.append(ss + a)
ss = ss + a
total = A[0] + A[1]
options = [(1, 1, 0, total, False)]
maxi = total
for i in range(1,... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
n, k, z = map(int, input().split())
k += 1
(*a,) = map(int, input().split())
ans = sum(a[:k])
s = a[0]
pref = [0] * (n + 1)
for i in range(n):
pref[i] = pref[i - 1] + a[i]
for i in range(1, n):
... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR A... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
arr = list(map(int, input().split()))
total = 0
sum = 0
r = k
res = []
rem = k - z * 2
if rem <= 0:
l = 0
else:
l = rem + 1
for i in range(l):
total += arr[i]
for i in range(k):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASS... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | def abc(l, i, n, k, m):
if k == 0:
return 0
if i == n - 1:
if k:
if m:
return l[i] + abc(l, i - 1, n, k - 1, m - 1)
return l[i]
return 0
if i == 0:
return l[0] + abc(l, i + 1, n, k - 1, m)
if m == 0:
return l[i] + abc(l, i +... | FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR BIN_OP VAR NUMBER IF VAR IF VAR RETURN BIN_OP VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN VAR VAR RETURN NUMBER IF VAR NUMBER RETURN BIN_OP VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR IF VAR NUMBER RE... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for _ in range(t):
n, k, z = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
a_max = list(a)
a_res = list(a)
for i in range(1, n):
a_res[i] += a_res[i - 1]
if n > 1:
a_max[0] = a[0] + a[1]
for i in range(1, n - 1):
a_max[i] =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR ... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | t = int(input())
for _ in range(t):
n, k, z = map(int, input().split())
A = list(map(int, input().split()))
C = [0] * n
S = [0] * n
S[0] = A[0]
for i in range(1, n):
C[i] = max(C[i - 1], A[i] + A[i - 1])
S[i] = S[i - 1] + A[i]
ans = -(10**18)
for i in range(z + 1):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER V... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | for _ in range(int(input())):
n, k, z = map(int, input().split())
arr = list(map(int, input().split()))
cons = []
for i in range(1, k + 1):
cons.append(arr[i] + arr[i - 1])
out = []
while z > -1:
if k - 2 * z + 1 > 0:
m = max(cons[: k - 2 * z + 1])
out.app... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST WHILE V... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | from sys import stdin
t = int(stdin.readline().strip())
for _ in range(t):
n, k, z = list(map(int, stdin.readline().strip().split(" ")))
A = list(map(int, stdin.readline().strip().split(" ")))
max_score = sum(A[0 : k + 1])
for z_val in range(1, z + 1):
if k + 1 - 2 * z_val < 1:
cont... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CA... |
You are given an array $a_1, a_2, \dots, a_n$, consisting of $n$ positive integers.
Initially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move can only be performed if $x... | import sys
input = sys.stdin.readline
def main():
t = int(input())
for _ in range(t):
N, K, Z = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ruiseki = [A[0]]
for i in range(1, N):
ruiseki.append(ruiseki[-1] + A[i])
ans = ruiseki[K... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR V... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | import sys
n = int(sys.stdin.readline())
s = list(map(int, sys.stdin.readline().split()))
s1 = {}
print = sys.stdout.write
for i in range(n):
if s[i] in s1:
s1[s[i]].append(i)
else:
s1[s[i]] = [i]
s2 = [i for i in s1 if len(s1[i]) == 1]
ls2 = len(s2)
if ls2 % 2 == 1 and ls2 == n:
print("NO\... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
s = [int(el) for el in input().split()]
x = []
y = []
z = []
for i in range(n):
if s[i] in x:
y[x.index(s[i])] += 1
z[x.index(s[i])].append(i)
else:
x.append(s[i])
y.append(1)
z.append([])
z[len(z) - 1].append(i)
k = y.count(1)
l = n - k - y.count... | 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 ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = list(map(int, input().split()))
rec = [0] * 1000
one = 0
for i in range(n):
rec[a[i]] += 1
for i in range(1000):
if rec[i] == 1:
one += 1
if one % 2 != 0 and max(rec) <= 2:
print("NO")
elif one % 2 != 0:
print("YES")
t = ""
k = 0
flag = True
for i in range(n)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER EXP... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
l = list(map(int, input().split()))
c = ["c"] * n
d = {}
for i in l:
if i in d:
d[i] = d[i] + 1
else:
d[i] = 1
t1 = 0
c1 = 0
tl = []
cl = []
for i in d:
if d[i] == 1:
t1 += 1
tl.append(i)
if d[i] > 2:
c1 += 1
cl.append(i)
if t1 % 2 == 1 an... | 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 STRING VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
si = list(map(int, input().split()))
nums = [0] * 101
for i in range(n):
nums[si[i]] += 1
num1 = 0
numnot12 = 0
for i in range(101):
num1 += int(nums[i] == 1)
numnot12 += int(nums[i] > 2)
if numnot12 == 0 and num1 % 2 == 1:
print("NO")
else:
print("YES")
num2 = num1 % 2
num1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER I... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
numbers = list(map(int, input().split(" ")))
odd = 0
count = [0] * 101
three = 0
assign = ["A"] * (n + 1)
for number in numbers:
count[number] += 1
if count[number] == 1:
odd += 1
elif count[number] == 2:
odd -= 1
elif count[number] == 3 and not three:
three = nu... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST STRING BIN_OP VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER I... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(i) for i in input().split()]
cnt = cnt3 = 0
B = False
kek = True
for i in a:
if a.count(i) == 1:
cnt += 1
if a.count(i) >= 3:
cnt3 += 1
if cnt % 2 == 0:
print("YES")
for i in a:
if a.count(i) == 1:
if B:
print("B", end="")
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING FOR VAR VAR IF FUNC_CA... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
A = list(map(int, input().split()))
D = dict((A[i], A.count(A[i])) for i in range(n))
S = [""] * n
q = True
if list(D.values()).count(1) % 2:
q = False
else:
q = True
p = True
for k in D:
if D[k] == 1:
if p:
S[A.index(k)] = "A"
else:
S[A.index(k)] = "... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER IF BIN_OP FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIG... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | import sys
def main():
_ = sys.stdin.readline()
s = list(map(int, sys.stdin.readline().strip().split(" ")))
freq = [0] * 101
for i in s:
freq[i] += 1
ans = [0] * len(s)
currMulti = 0
for i, v in enumerate(s):
if freq[v] == 1:
ans[i] = currMulti
currM... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR VA... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | cnt = [(0) for i in range(101)]
n = int(input())
s = input().split()
l = [int(s[i]) for i in range(n)]
for i in l:
cnt[i] += 1
small = 0
large = 0
for i in range(1, 101):
if cnt[i] == 1:
small += 1
elif cnt[i] > 2:
large += 1
largenum = i
if small % 2 == 1 and large == 0:
print("... | ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VA... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = list(map(int, input().split()))
z = ["A"] * len(a)
d = {}
for i in a:
if i in d.keys():
d[i] += 1
else:
d[i] = 1
ka, kb = 0, 0
for i, x in enumerate(a):
if d[x] == 1:
if ka > kb:
z[i] = "B"
kb += 1
else:
z[i] = "A"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF ... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(x) for x in input().split()]
m = {}
for aa in a:
if aa in m:
m[aa] += 1
else:
m[aa] = 1
count = 0
trick = False
for k in m:
if m[k] == 1:
count += 1
elif m[k] > 2:
trick = True
if count % 2 == 1:
if trick:
count += 1
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER IF VAR ... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
line = input()
list = [(int(s) - 1) for s in line.split()]
count = [(0) for i in range(0, 100)]
for x in list:
count[x] = count[x] + 1
one = []
two = []
greater = []
first_greater = -1
for i in range(0, 100):
c = count[i]
if c == 1:
one.append(i)
elif c == 2:
two.append(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER N... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | a = int(input())
ans = [(0) for i in range(101)]
z = list(map(int, input().split()))
for i in range(len(z)):
ans[z[i]] += 1
if ans.count(1) % 2 == 1:
s = ""
if len(z) - ans.count(1) - 2 * ans.count(2) == 0:
print("NO")
else:
print("YES")
flag = 0
tra = 0
for i in ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR STRING IF BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR ... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | N = int(input())
arr = [int(x) for x in input().split()]
cnt = [(0) for i in range(102)]
for x in arr:
cnt[x] += 1
dp = [[[(-1) for i in range(102)] for j in range(102)] for k in range(102)]
jawab = [(-1) for i in range(102)]
def kucing(pos, nA, nB):
global dp
if dp[pos][nA][nB] == -1:
if pos > 10... | 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 NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FUNC_DEF IF VAR VA... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
s = list(map(int, input().split()))
unik = []
dui = []
tinbeshi = []
for i in range(n):
if s.count(s[i]) == 1:
unik.append(s[i])
elif s.count(s[i]) == 2:
dui.append(s[i])
else:
tinbeshi.append(s[i])
dui = set(dui)
tin = list(set(tinbeshi))
if len(unik) % 2 == 1 and l... | 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 FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | num_numbers = int(input())
numbers = list(input().split())
appear_once = set()
appear_twice = set()
appear_multiple = set()
for number in numbers:
if number not in appear_multiple:
if number in appear_twice:
appear_multiple.add(number)
appear_twice.remove(number)
elif number ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR V... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
c = [0] * 101
a = [int(i) for i in input().split()]
for i in range(n):
c[a[i]] += 1
if n == c.count(1) + c.count(2) * 2:
if c.count(1) % 2 == 1:
print("NO")
else:
print("YES")
k = c.count(1) // 2
for i in range(n):
if c[a[i]] == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR NUMBER NUMBER IF BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR STRING E... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | s = input()
s = input()
s1 = s.split()
l = [int(i) for i in s1]
d = {}
for i in l:
if i not in d:
d[i] = 1
else:
d[i] = d[i] + 1
cnt = 0
for i in d:
if d[i] == 1:
cnt = cnt + 1
if cnt % 2 == 1:
flag = 0
for i in d:
if d[i] >= 3:
flag = 1
break
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIG... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
s = list(map(int, input().split()))
d = {}
mt = False
mti = -1
for i in range(len(s)):
if s[i] not in d:
d[s[i]] = 1
else:
d[s[i]] += 1
if d[s[i]] > 2:
mt = True
mti = i
good = []
for i in d.keys():
if d[i] == 1:
good.append(i)
if len(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN ... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
try:
d[i] += 1
except:
d[i] = 1
x = list(d.values())
if x.count(1) % 2 == 0:
print("YES")
c = 0
ans = [""] * n
for i in range(n):
if d[l[i]] == 1:
if c:
ans[i] = "B"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIS... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(i) for i in input().split()]
cnt = 0
cnt1 = 0
q = list()
for i in a:
if i not in q:
q.append(i)
if a.count(i) == 1:
cnt += 1
elif a.count(i) > 2:
cnt1 += 1
if cnt % 2 == 1 and cnt1 == 0:
print("NO")
else:
nums = list()
g = list()
... | 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 NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
s = list(map(int, input().split()))
cnt = [0] * 105
for i in range(n):
cnt[s[i]] += 1
cnt_nice = 0
for i in range(105):
if cnt[i] == 1:
cnt_nice += 1
if cnt_nice % 2 == 0:
print("YES")
tmp = cnt_nice / 2
res = ""
for i in range(n):
if cnt[s[i]] != 1 or tmp > 0 an... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING AS... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(s) for s in input().split()]
goodElems = 0
Scope = [0] * 101
Bscope = [False] * 101
for i in range(n):
Scope[a[i]] += 1
for elem in Scope:
if elem == 1:
goodElems += 1
if goodElems == 0:
print("YES")
for i in range(n):
print("A", end="")
elif goodElems % 2 == 0:... | 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 NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FU... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
l = list(map(int, input().split()))
freq = {}
for i in l:
if i in freq:
freq[i] += 1
else:
freq[i] = 1
cnt1, cnt3 = 0, 0
for i in freq:
if freq[i] == 1:
cnt1 += 1
if freq[i] >= 3:
cnt3 += 1
if cnt1 & 1 and cnt3 == 0:
print("NO")
else:
print("YES")... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER EXPR FU... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(_) for _ in input().split()]
cnt = {}
for x in set(a):
cnt[x] = len([y for y in a if y == x])
one = []
more = []
for x, c in cnt.items():
if c == 1:
one.append(x)
elif c >= 3:
more.append(x)
oneset = set(one)
last = "B"
first = True
ans = []
if more or len(one) % 2 ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR A... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
l = list(map(int, input().split()))
d = {}
for x in l:
d[x] = d.get(x, 0) + 1
k = 0
k1 = 0
for x in d:
if d[x] == 1:
k += 1
elif d[x] > 2:
k1 += 1
if k % 2 != 0 and k1 == 0:
print("NO")
exit()
print("YES")
s = ""
p = False
if k % 2 != 0:
p = True
for x in l:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBE... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(i) for i in input().split()]
da = {}
o = list("Z" * n)
for i in a:
if i in da:
da[i] += 1
else:
da[i] = 1
sc = 0
dc = 0
mc = 0
scl = []
dcl = []
mcl = []
for i in da:
if da[i] == 1:
sc += 1
scl.append(i)
elif da[i] == 2:
dc += 1
d... | 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 FUNC_CALL VAR BIN_OP STRING VAR FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(x) for x in input().split()]
d = {}
for x in a:
if x in d:
d[x] += 1
else:
d[x] = 1
kol = 0
kol1 = 0
for key in d:
if d[key] == 1:
kol += 1
if d[key] > 2:
kol1 += 1
if kol % 2 == 1 and kol1 == 0:
print("NO")
exit(0)
print("YES")
if kol % ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR NUMBER EXP... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | def ip():
return int(input())
def ipp():
return map(int, input().split())
def sar():
return list(ipp())
def pars(a):
print("".join(list(map(str, a))))
print("\r")
def parl(a):
print("\r".join(list(map(str, a))))
print("\r")
T = 1
for _ in range(T):
n = ip()
d = {}
cn = ... | 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 FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CAL... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
S = list(map(int, input().split()))
D = set(S)
nice = 0
dp = [(0) for i in range(102)]
for i in D:
if S.count(i) == 1:
nice += 1
dp[i] = S.count(i)
if nice % 2 == 0:
d = 0
s = ""
for i in S:
if dp[i] == 1 and d < nice // 2:
s = s + "A"
d += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR N... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | def rmap():
return map(int, input().split())
def rlist():
return list(map(int, input().split()))
def rdi():
return int(input())
n = rdi()
line = rlist()
cnt = [0] * 101
once = 0
triple_ind = 0
triple = 0
for elem in line:
cnt[elem] += 1
if cnt[elem] == 1:
once += 1
elif cnt[elem] =... | 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR V... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
try:
d[i] += 1
except KeyError:
d[i] = 1
nice = 0
gt2elem = -1
for i in d.keys():
if d[i] == 1:
nice += 1
elif d[i] > 2:
gt2elem = i
if nice % 2 == 0 or gt2elem != -1:
x = 0
ans = []
for i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR IF BIN_OP VAR NUMBER NUMB... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | r = input
n = int(r())
a = [int(x) for x in r().split()]
cnt = [0] * (100 + 1)
A = []
B = []
res = ""
for i in a:
cnt[i] += 1
for i, j in enumerate(a):
if cnt[j] == 1:
A.append(i)
if cnt[j] > 2:
B.append(i)
pr = [0] * (n + 1)
if len(A) % 2 == 0:
len2 = len(A) // 2
res = "YES\n"
f... | ASSIGN 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 BIN_OP NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR STRING FOR VAR VAR VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = list(map(int, input().split()))
count = [(0) for _ in range(101)]
multisetA = [(0) for _ in range(101)]
multiset = [[], []]
ans = ["YES", "NO"]
one = []
two = []
more = []
idex = 0
for v in a:
count[v] += 1
for i in range(1, 101):
if count[i] == 1:
one.append(i)
elif count[i] ==... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST LIST LIST ASSIGN VAR LIST STRING STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VA... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
b = list(map(int, input().split()))
d = dict()
for j in range(n):
if b[j] in d.keys():
d[b[j]] += 1
else:
d[b[j]] = 1
p = 0
q = -1
for j in range(n):
if d[b[j]] == 1:
p += 1
elif d[b[j]] > 2:
q = j
r = 0
c = ["A"] * n
if p % 2 == 0:
for j in range(n):... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER VAR NUMBE... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(x) for x in input().split()]
res = ["A"] * n
cnt = [0] * 101
for i in a:
cnt[i] += 1
good_num = cnt.count(1)
bad_above_2 = False
for i in range(101):
if cnt[i] > 2:
bad_above_2 = True
break
if good_num % 2 == 0 or bad_above_2 > 0:
print("YES")
to_b = False
f... | 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 STRING VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP V... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | def vasya_and_multisets(v):
m = dict()
for e in v:
m[e] = m.get(e, 0) + 1
ones = 0
has_gt2 = False
for e in m.values():
if e == 1:
ones += 1
if e > 2:
has_gt2 = True
odd_ones = ones % 2 == 1
if odd_ones and not has_gt2:
print("NO")
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
a = [int(x) for x in input().split()]
INDEX = {}
for k in set(a):
INDEX[k] = []
for i in range(n):
INDEX[a[i]].append(i)
add = 0
IS = True
pAns = [None] * n
one = 0
ONE1 = {(True): [], (False): []}
Over2 = {(True): [], (False): []}
for j in INDEX.values():
t = len(j)
if t > 2:
a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR NUMBER ASSIGN VAR DICT NUM... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | n = int(input())
arr = list(map(int, input().split()))
count = [0] * 101
unique = 0
multiple = 0
answer = ""
for i in range(n):
count[arr[i]] += 1
for i in range(1, len(count)):
if count[i] == 1:
unique += 1
elif count[i] > 2:
multiple += 1
if unique % 2 == 0:
multi = 0
for j in rang... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER IF... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | def is_unique(a):
global multi
return True if multi.count(a) == 1 else False
def is_semiunique(a):
global multi
return True if multi.count(a) > 2 else False
n = int(input())
multi = list(map(int, input().split()))
uniques = []
semi_uniques = []
for i in range(n):
if is_unique(multi[i]):
... | FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER NUMBER 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 ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VA... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | from sys import exit, stdin, stdout
def sin():
return stdin.readline().rstrip()
def listInput():
return list(map(int, sin().split()))
def printBS(li):
if not li:
return
for i in range(len(li) - 1):
stdout.write("%d " % li[i])
stdout.write("%d\n" % li[-1])
n = int(sin())
li = ... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR RETURN FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP STRING VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN ... |
Vasya has a multiset s consisting of n integer numbers. Vasya calls some number x nice if it appears in the multiset exactly once. For example, multiset \{1, 1, 2, 3, 3, 3, 4\} contains nice numbers 2 and 4.
Vasya wants to split multiset s into two multisets a and b (one of which may be empty) in such a way that the q... | from sys import stdin, stdout
n = int(stdin.readline())
vl = list(map(int, stdin.readline().split()))
sze = 110
a, b = [], []
used = [[] for i in range(sze)]
cnta, cntb = 0, 0
for i in range(n):
used[vl[i]].append(i)
used.sort(key=lambda x: len(x))
for i in range(sze):
if len(used[i]) == 1:
if cnta < c... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR LIST LIST ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.