description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | for _ in range(int(input())):
n = int(input())
min1 = [0] * (n + 1)
max1 = [0] * (n + 1)
l = list(map(int, input().split()))
for i in l:
if i > 0:
min1[i - 1] += 1
if i != 0:
max1[0] += n - i + 1
max1[i] -= n - i + 1
if i < n:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER IF VAR NUMBER... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | T = int(input())
for tr in range(T):
N = int(input())
A = list(map(int, input().split(" ")))
BCount = [0] * (N + 1)
Bmin = [-1] * N
Bmax = [-1] * N
for i in range(N):
BCount[A[i]] += 1
Nmin = N
Nmax = 0
for i in range(N):
Nmin -= BCount[i]
Nmax += BCount[i] * ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | for t in range(int(input())):
n = int(input())
minn = [0] * (n + 1)
maxl = [0] * (n + 1)
maxr = [0] * (n + 1)
x1 = map(int, input().split())
for x in x1:
minn[0] += 1
minn[x] -= 1
maxl[0] += n - x + 1
maxl[x] -= n - x + 1
maxr[n - 1] += n - x
maxr[... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR VAR NUMBER NUMBER VAR ... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | def update(d, l, r, x):
d[l] += x
d[r + 1] -= x
for i in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
mn = [(0) for i in range(n + 1)]
mx = [(0) for i in range(n + 1)]
for i in a:
if i != 0:
update(mn, 0, i - 1, 1)
update(mx, 0... | FUNC_DEF VAR VAR VAR VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR VAR IF VAR ... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | for _ in range(int(input())):
n = int(input())
li = list(map(int, input().split()))
presum = [0] * n
maxl = [0] * n
maxr = [0] * n
for i in range(n):
maxl[0] += n - li[i] + 1
maxr[-1] += n - li[i]
if li[i] < n:
presum[li[i]] -= 1
maxl[li[i]] -= n -... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR NUMBER BIN_OP BIN_OP VAR VAR VAR... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | import sys
input = lambda: sys.stdin.readline()
T = int(input())
for _ in range(T):
n = int(input().strip())
a = list(map(int, input().strip().split()))
a.sort()
a2 = []
dic = {}
for i in a:
if i not in dic.keys():
dic[i] = 1
if a2 != n:
a2.append... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR VAR IF VAR FUNC_CALL VAR ASSIGN VAR VA... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | t = int(input())
for a in range(t):
n = int(input())
l = list(map(int, input().split()))
s = [0] * n
p = [n**2 - sum(l)] * n
for i in range(n):
if l[i] < n:
s[l[i]] += 1
p[l[i]] -= n - l[i]
for i in range(n):
max = p[i]
min = s[i]
if i < n ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | t = int(input())
for ti in range(t):
n = int(input())
mex = list(map(int, input().split()))
mexcount = [0] * (n + 1)
for m in mex:
mexcount[m] = mexcount[m] + 1
mexsum = [0] * (n + 1)
mexcountsum = [0] * (n + 1)
mexsum[0] = 0
mexcountsum[0] = mexcount[0]
for i in range(1, n +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSI... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | t = int(input())
while t > 0:
t -= 1
n = int(input())
a = [int(x) for x in input().split()]
h = [(0) for x in range(n + 1)]
d = [(0) for x in range(n + 1)]
post = [(0) for x in range(n + 1)]
h[0] = n
for i in range(n):
x = a[i]
h[x] -= 1
d[x] = d[x] - n + x - 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER 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 BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NU... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | def main():
n = int(input())
arr = list(map(int, input().split()))
mn = [0] * (n + 1)
mx = [0] * (n + 1)
mxr = [0] * (n + 1)
for i in range(n):
a = arr[i]
mn[0] += 1
mn[a] -= 1
mx[0] += n - a + 1
mx[a] -= n - a + 1
mxr[n - 1] += n - a
mxr[a... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBE... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | T = int(input())
for _ in range(T):
N = int(input())
maxrarr = [(0) for i in range(N + 1)]
flag = 0
call = 1
bool = True
arr = list(map(int, input().split()))
maxlarr = [(0) for i in range(N + 1)]
minarr = [(0) for i in range(N + 1)]
for i in range(N):
minarr[0] += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_O... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | for h in range(int(input())):
n = int(input())
x = list(map(int, input().split()))
sure = [0] * n
r = [0] * n
l = [0] * n
for i in x:
if i + 1 < n:
r[i + 1] += n - i
if i - 1 >= 0:
l[i - 1] += n - i
if i - 1 >= 0:
sure[i - 1] += 1
f... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR VAR IF BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER BIN... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
a.sort()
sumVal = sum(a)
j = 0
for i in range(n):
while j < n and a[j] < i:
j += 1
k = j
if j < n and i == a[j]:
while k < n and a[k] == i:
k += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR IF VAR VAR VAR VAR V... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | for _ in range(int(input())):
n = int(input())
arr = sorted(list(map(int, input().split())))
freq = [(0) for i in range(n + 1)]
atleast = [(0) for i in range(n)]
extra = sum([(n - e) for e in arr])
for e in arr:
freq[e] += 1
tmp = 0
for i in range(n, 0, -1):
tmp += freq[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FOR VAR ... |
There are N hidden integer arrays of length N each. You are given the mex of each of these N arrays.
Ashish likes lower bounds and Kryptonix likes upper bounds. So, for each 0 ≤ i ≤ N-1, find:
The least possible number of occurrences of i across all the arrays
The most possible number of occurrences of i across all th... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
least = (n + 1) * [0]
most = (n + 69) * [0]
for x in arr:
least[0] += 1
most[0] += n - x + 1
least[x] -= 1
most[x] -= n - x + 1
most[x +... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER LIST NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER LIST NUMBER FOR VAR VAR VAR NUMBER NUMBER VAR NUMBER BIN_O... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
smalls = [(l[i] - i) for i in range(n)]
tols = [(l[i] - i + p - 1) for i in range(p - 1, n)]
smol = max(smalls)
tol = min(tols)
out = list(range(smol, tol))
print(len(out))
print(" ".join(map(str, out))) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR A... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
ansls = []
mx = max(a)
for i in range(1, mx + 1):
anstmp = 1
for j in range(n)[::-1]:
if a[j] - j > i:
anstmp = 0
else:
anstmp *= n - max(i, a[j]) + i - (n - j - 1)
anstmp %=... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def read_list():
return list(map(int, input().strip().split(" ")))
def print_list(l):
print(" ".join(map(str, l)))
n, p = read_list()
a = read_list()
a.sort()
mi = max(a[i] - i for i in range(n))
res = []
ll = []
x = mi
now = x
i = 0
dic = [[-1]]
for step in range(n):
while i < n and now >= a[i]:
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
num = [0] * 5001
for i in a:
num[i] += 1
for i in range(5000):
num[i + 1] += num[i]
ans = []
for x in range(1, 2001):
temp = 1
candy = x
for i in range(x, x + n):
temp *= num[candy] - (i - x)
temp %= p
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import stdin, stdout
def main():
n, p = map(int, stdin.readline().split())
ary = list(map(int, stdin.readline().split()))
mxm = max(ary)
mnm = min(ary)
offset = max(mnm, mxm - n)
m = 2 * n
cf = [0] * m
xs = [1] * m
ibi = [0] * m
for elem in ary:
idx = max(0, el... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
mx = -float("inf")
for i in range(n):
if a[i] - i > mx:
mx = a[i] - i
imx = i
flag = True
nmx = -float("inf")
for i in range(p - 1, n):
if mx + i - (p - 1) >= a[i]:
flag = False
break
nmx = max(nmx,... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRIN... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
a.sort()
result = []
_min = 0
for i in range(len(a) - 1, -1, -1):
if _min <= a[i] - i:
_min = a[i] - i
_max = a[-1]
for i in range(len(a) - 1, p - 2, -1):
if _max >= p - 2 - i + a[i]:
_max = p - 2 - i + a[i]
result ... | ASSIGN 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 EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
m = max(a)
x = m - n + 1
lis = []
for i in range(x, m):
l = []
for e in a:
w = e - i
if w <= 0:
l.append(n)
else:
l.append(n - w)
l.sort()
am = True
for j in range(n):
if (l[j... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CAL... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
def calc(x):
global n, p, a
o = [0] * (n + 1)
for i in a:
o[max(0, min(n, i - x))] += 1
s = 0
ans = 1
for i in range(n):
s += o[i]
if s <= 0:
return 0
ans = ans * s % p
s -=... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def ican(a, x):
k = x
wr = 0
for i in range(len(a)):
if a[i] <= k:
wr += 1
else:
wr -= a[i] - k
k = a[i]
if wr < 0:
return False
wr += 1
return True
def bnpleft(a):
r = max(a)
l = -1
while r - l > 1... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER RETURN NUMBER VAR NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = sys.stdin.readline
n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = []
for x in range(min(a), max(a) + 1):
stack = 0
j = -1
turn = 0
pre_j = -1
flag = True
flag2 = True
while j < n:
while j + 1 < n and x + turn >= a[j + 1]:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NU... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def places(num, v):
if num >= v + n:
return 0
if num < v:
return n
return n - (num - v)
def check(num):
for i in range(n - 1, -1, -1):
count = max(0, places(b[i], num) - (n - 1 - i))
if count % p == 0:
return True
return False
n, p = map(int, input().s... | FUNC_DEF IF VAR BIN_OP VAR VAR RETURN NUMBER IF VAR VAR RETURN VAR RETURN BIN_OP VAR BIN_OP VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR VAR VAR BIN_OP BIN_OP VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | lis = input().split()
n, p = int(lis[0]), int(lis[1])
lis = input().split()
a = [0] * n
for i in range(n):
a[i] = int(lis[i])
a.sort()
xminn = a[0]
for i in range(1, n):
xminn = max(a[i] - i, xminn)
for i in range(n):
a[i] = min(xminn - a[i] + 1 + i, i + 1)
lenn = n
i = p
while i <= n:
lenn = min(i - a[... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUN... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def asterism(p, a):
n, m, M = len(a), 1, max(a) - 1
for i in range(n):
m = max(m, a[i] - i)
for i in range(n - p + 1):
M = min(M, a[p + i - 1] - i - 1)
print(max(0, M - m + 1))
for i in range(m, M + 1):
print(i, end=" ")
asterism(int(input().split()[1]), sorted([int(i) for ... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
def input():
return sys.stdin.readline().rstrip()
def input_split():
return [int(i) for i in input().split()]
n, p = input_split()
arr = input_split()
maxi = max(arr)
count = 0
is_div = [(1) for i in range(maxi + 1)]
freqs = [(0) for i in range(4002)]
for a in arr:
freqs[a] += 1
for i in ra... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR V... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def solve():
n, p = LI()
a = LI()
a.sort()
ap = [i for i in a[p - 1 :]]
ap = [(ap[i] - i) for i in range(len(ap))]
M = min(ap)
b = [(a[i] - i) for i in range(n)]
m = max(b)
ans = list(range(m, M))
... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def solve(n, p, array):
array.sort()
array1 = [(i + 1 - array[i]) for i in range(n)]
m = min(array1)
min_x = 1 - min(m, 0)
valid = [(1) for i in range(n)]
max_v = n - 1
for i in range(n):
a = array1[i] + min_x
if (i + 1) % p == 0:
max_v = min(array[i] - min_x - 1,... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF BIN_OP BIN_OP VAR N... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import stdin
n, p = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
a.sort()
x = 0
aa = []
j = 0
for i in range(n):
if x + i < a[i]:
x = a[i] - i
if a[i] != a[j]:
aa.append((a[j], i - j))
j = i
else:
aa.append((a[j], n - j))
C = 2000
c, d = 0... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR V... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def solution(n, a, p):
result = []
r = []
a.sort()
for i in range(n):
r.append(-a[i] + i + 1)
remainder = []
for i in range(p):
remainder.append(0)
for i in range(p - 1, n):
n_a_re = (p - r[i]) % p
remainder[n_a_re] += 1
min_x = 1 - n + a[n - 1]
for i ... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, k = list(map(int, input().strip().split()))
list1 = list(map(int, input().strip().split()))
list1.sort()
maxima = list1[n - 1]
m = dict()
curr = 1
count = 0
for i in range(n):
if list1[i] != curr:
for j in range(curr, list1[i]):
m[j] = count
curr = list1[i]
count += 1
for j in ran... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR FOR VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = sys.stdin.readline
def judge1(x):
c = 0
ri = 0
now = x
for _ in range(n):
while ri < n:
if a[ri] <= now:
c += 1
ri += 1
else:
break
if c == 0:
return False
c -= 1
now... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR WHILE VAR V... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def binary(arr, x, n, p):
less = 0
for i in range(n):
while less < n and x + i >= arr[less]:
less += 1
C = less - i
if C <= 0:
return -1
if C >= p:
return 1
return 0
def help():
n, p = map(int, input().split(" "))
arr = list(map(i... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER RETURN NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def solve(n, p, x, a):
res_ptn = 1
r = 0
for l in range(n):
while r < n and a[r] <= x + l:
r += 1
res_ptn *= r - l
res_ptn %= p
return res_ptn != 0
n, p = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
ans = []
for x in range(1, 2000 + 2... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR VAR RETURN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASS... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cur_pass = 0
for i in range(n):
cur_pass = max(a[i] - i, cur_pass)
min_pass = cur_pass
ans = []
done = True
l = cur_pass
r = a[-1]
while l <= r:
mid = (l + r) // 2
cur_pass = mid
i = 0
while i < n and a[i] <= cur_pass:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR NUMBER... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
a.sort()
result = []
for x in range(a[-1]):
fail = 0
for i in range(len(a) - 1, -1, -1):
if x + i < a[i]:
fail = 1
break
elif p <= min(i + 1, i - (a[i] - x - 1)):
fail = 1
... | ASSIGN 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 EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF BIN_OP VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
for i in range(2000, 0, -1):
a += [i]
xarr = [0] * 2001
for i in range(n):
xarr[a[i]] += 1
for i in range(1, 2001):
xarr[i] += xarr[i - 1]
count = 0
good = []
for x in range(1, max(a) + 1):
counts = 0
for i in range(x, x + n):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER VAR LIST VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER VAR VAR VAR BIN_OP VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def places(num, v):
if num >= v + n:
return 0
if num < v:
return n
return n - (num - v)
def check(num):
for i in range(n - 1, -1, -1):
count = max(0, places(b[i], num) - (n - 1 - i))
if count == 0:
return True
if count % p == 0:
return Fa... | FUNC_DEF IF VAR BIN_OP VAR VAR RETURN NUMBER IF VAR VAR RETURN VAR RETURN BIN_OP VAR BIN_OP VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR VAR VAR BIN_OP BIN_OP VAR NUMBER VAR IF VAR NUMBER RETURN NUMBER IF BIN_OP VAR VAR NUMBER RETURN NUM... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import *
input = stdin.readline
for _ in range(1):
n, p = map(int, input().split())
a = list(map(int, input().split()))
m = max(a)
d = [0] * 4005
for i in a:
d[i] += 1
w = []
for i in range(m - n + 1, m + 1):
v = 0
for j in range(i):
v += d[j]
... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
s = sorted(map(int, input().split()))
for i in range(n):
s[i] -= i
mn = max(s)
for i in range(n):
s[i] += p - 1
mx = min(s[p - 1 :])
ans = [*range(mn, mx)]
print(len(ans))
print(*ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST FUNC_CALL VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = sys.stdin.readline
MAX = 2001
N, P = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = []
for x in range(1, MAX + 1):
tmp = 1
for i, a in enumerate(A):
cantake = max(min(x + N - a, N) - i, 0)
tmp = tmp * cantake % P
if tmp != 0:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CAL... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
ansls = []
mx = max(a)
mn = max([(a[i] - i) for i in range(n)])
ansmx = -1
for j in range(p - 1, n)[::-1]:
ansmx = max(ansmx, n - max(mn, a[j]) + mn - (n - j - 1))
while ansmx < p:
ans += 1
ansls.append(mn)
mn += 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP V... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = []
for x in range(1, 2001):
fail = 0
pointer = 0
for i in range(n):
while pointer < n - 1 and x + i - a[pointer + 1] >= 0:
pointer += 1
if (pointer + 1 - i) % p == 0:
fail = 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR VAR BIN_OP VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = sys.stdin.readline
n, p = map(int, input().split())
A = sorted(map(int, input().split()))
MAX = A[-1]
start = max(A[0], MAX - (n - 1))
S = []
ind = 0
for c in range(start, MAX + 1):
while ind < n and A[ind] <= c:
ind += 1
S.append(ind)
ANS = []
for i in range(len(S)):
if S[i] >= ... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER WHILE VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def fa(a, x, p):
k = x
wr = 0
for i in range(len(a)):
if a[i] <= k:
wr += 1
else:
nk = wr // p * p
wr -= a[i] - k
if wr < nk:
return False
k = a[i]
if wr < 0:
return False
wr +... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR IF VAR VAR RETURN NUMBER ASSIGN VAR VAR VAR IF VAR NUMBER RETURN NUMBER VAR NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_C... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import stdin, stdout
def asterism(n, p, a):
res = []
a.sort()
l = a[n - 1]
for i in range(n - 1, -1, -1):
l = max(a[i], l)
l -= 1
l += 1
minl = l
if check(bs(minl, a), minl, a, p):
return res
h = max(minl, a[n - 1] - 1)
while l < h:
m = (l +... | FUNC_DEF ASSIGN VAR LIST EXPR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP VAR NU... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import stdin
input = stdin.readline
n, p = list(map(int, input().split()))
c = list(map(int, input().split()))
dobre = []
for x in range(1, 2001):
dobry = True
miejsca = []
for i in range(n):
eps = max(c[i] - x, 0)
cyk = max(n - eps, 0)
miejsca.append(cyk)
if min(miejsc... | ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSI... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import stdin, stdout
def main():
n, p = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
a.sort()
factp = [1] * p
for i in range(2, p):
factp[i] = factp[i - 1] * i % p
mxm = max(a)
ht = [0] * (mxm + 1)
for elem in a:
ht[elem] = ht... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BI... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
startno = l[-1] - n + 1
ans = []
for i in range(startno, l[-1] + 1):
ind = 0
flag = True
for j in range(n):
while ind < n and l[ind] <= i + j:
ind += 1
if ind >= n:
if p <= n - j:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR W... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = sys.stdin.readline
n, p = map(int, input().split())
A = sorted(map(int, input().split()))
MAX = A[-1]
start = max(A[0], MAX - (n - 1))
S = []
ind = 0
for c in range(start, MAX + 1):
while ind < n and A[ind] <= c:
ind += 1
S.append(ind)
SS = [(S[i] - i) for i in range(len(S))]
MAX = 1... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER WHILE VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = lambda: sys.stdin.readline().rstrip()
n, p = map(int, input().split())
A = sorted([int(i) for i in input().split()])
st = A[0]
gl = 2001
Ans = []
for i in range(st, gl):
for j, a in enumerate(A):
if i + j < a or min(j + 1, i + j - a + 1) >= p:
break
else:
Ans.appe... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR FUNC_CALL VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
lines = sys.stdin.readlines()
n, p = map(int, lines[0].strip().split(" "))
arr = list(map(int, lines[1].strip().split(" ")))
arr.sort()
counter = {}
for a in arr:
if a not in counter:
counter[a] = 0
counter[a] += 1
lower = max(arr[-1] - n + 1, 1)
l, r = lower - 1, arr[-1] + 1
def check(val... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = min(a)
j = max(a)
ans = 0
b = []
while i < j:
k = 0
f = 1
while k < n:
if a[k] <= i:
s = n
else:
s = n + i - a[k]
s -= k
if s <= 0:
f = 0
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def smallest_winner(matrix, starting_x, x):
for m in matrix:
if m > x:
starting_x += m - x
x += m - x
x += 1
return starting_x
def biggest_winner(matrix, p, maxi):
for i in range(len(matrix)):
if i + p - 1 >= len(matrix):
break
maxi = min... | FUNC_DEF FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR NUMBER RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
ans = []
for i in range(1, 3001):
f = 1
num = i
for j in range(n):
lo, hi = 0, n - 1
h = 0
while lo <= hi:
m = (lo + hi) // 2
if num >= arr[m]:
h = m - j + ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR N... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = sorted(map(int, input().split()))
b = []
i = 0
while i < len(a):
j = i
while j < len(a) and a[j] == a[i]:
j += 1
b.append((a[i], j - i))
i = j
l = a[-1] - n
r = a[-1]
s = [0] * (r - l + n)
cc = n
ci = r - 1 + n
for i in range(len(b) - 1, -1, -1):
cj = b[i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | from sys import stdin
def bSearch(val, a):
low = 0
high = len(a) - 1
while low <= high:
mid = (low + high) // 2
if a[mid] > val:
high = mid - 1
else:
low = mid + 1
return high + 1
n, p = [int(x) for x in stdin.readline().split()]
a = sorted([int(x) for... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
lines = sys.stdin.readlines()
n, p = map(int, lines[0].strip().split(" "))
arr = list(map(int, lines[1].strip().split(" ")))
arr.sort()
counter = {}
for a in arr:
if a not in counter:
counter[a] = 0
counter[a] += 1
lower = max(arr[-1] - n + 1, 1)
a, b, c, d = lower - 1, -1, -1, arr[-1] + 1
... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = lambda: sys.stdin.readline().rstrip()
n, p = map(int, input().split())
A = sorted([int(i) for i in input().split()])
A = [(A[i] - int(i)) for i in range(n)]
AA = [A[-1]]
for i in range(n - 1):
AA.append(min(AA[-1], A[n - 2 - i]))
AA = AA[::-1]
Ans = []
for i in range(max(A), max(A) + p + 1):
... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VA... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def is_good(a, i):
for j in range(n):
choices = min(n, n - a[n - j - 1] + i) - j
if choices % p == 0 or choices < 0:
return False
return True
n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
good_integers = []
for i in range(a[-1]):
if is_good(a, i)... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF BIN_OP VAR VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EX... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
arr = []
for x in range(a[0], a[-1]):
pretendents = [[]]
bias = 0
for i in range(n):
if a[i] <= x + bias:
pretendents[-1].append(a[i])
else:
change = a[i] - (x + bias)
for __ in ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR LIST LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a = sorted(a)
ans = []
for start in range(1, 2001):
mul = 1
l = 0
for i in range(n):
got = start + i
while l < n and a[l] <= got:
l += 1
mul = mul * (l - i) % p
if mul % p != 0:
ans... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUM... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def help():
n, p = map(int, input().split(" "))
arr = list(map(int, input().split(" ")))
arr.sort()
final = []
for x in range(1, max(arr)):
value = 0
elements = []
curr = 0
j = 0
while j < n:
if arr[j] <= x + value:
curr += 1
... | FUNC_DEF ASSIGN VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def solve():
n, p = LI()
a = LI()
a.sort()
ans = []
for x in range(a[0], a[-1] + 1):
fx = 1
y = x
j = 0
for i in range(n):
while j < n and a[j] <= y:
j += 1
... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = [int(i) for i in input().split()]
lst = [int(i) for i in input().split()]
m, r = 0, float("inf")
lst.sort()
for i in range(n):
m = max(m, lst[i] - i)
if i + 1 >= p:
r = min(r, lst[i] - i + p - 1)
print(max(0, r - m))
print(*list(range(m, r))) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR IF BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_O... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def func(length, prime):
nums = sorted(map(int, input().split()))
mini = max(nums[0], nums[-1] - length + 1)
xs = list(range(mini, min(mini + length, nums[-1] + 1)))
L = len(xs)
idxs = [0] * length
for i in range(L - 1, -1, -1):
if xs[i] == nums[-1]:
idxs[-1] = length - i
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | a = [int(x) for x in input().split()]
enemies = [int(x) for x in input().split()]
n = a[0]
p = a[1]
initial = max(enemies) - n + 1
i = initial
c_out = ""
counter = 0
ilist = [
len([(0) for x in enemies if x <= y]) for y in range(initial, max(enemies) + 1)
]
while i <= max(enemies):
if i > initial:
ilist... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR VAR FUNC_... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def s(enemy_list, prime, n_enemies):
good = []
enemy_list = sorted(enemy_list)
i = 0
k = 0
k_list = []
while i < n_enemies:
if k >= enemy_list[i]:
i += 1
else:
k += 1
k_list.append(i)
k_list += [n_enemies] * n_enemies
minimum = max(min(... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR BIN_OP LIST VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | N, P = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = []
for x in range(A[0], A[-1] + 1):
i = 0
n = 0
b = x
for _ in range(N):
while i < N and A[i] <= b:
i += 1
n += 1
if n % P == 0:
break
n -= 1
b += 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR VAR VAR ... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
m = max(a[i] - i for i in range(n))
M = a[p - 1] - 1
ban = [(0) for i in range(p)]
ans = []
query = [(a[i] - 1 - i, 1, -100) for i in range(n)]
for x in range(m, M + 1):
query.append((x, 0, -100))
for i in range(n):
query.append((a[i]... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN V... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
left = 0
right = 10**9 + 1
while right - left > 1:
mid = left + (right - left) // 2
x = mid
flag = 1
for i in range(n):
if a[i] <= x:
x += 1
else:
flag = 0
break
if flag:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER F... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
input = sys.stdin.readline
n, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
mn = 0
mx = 2000
for i in range(n):
d = a[i] - i
mn = max(d, mn)
if i >= p - 1:
d2 = a[i] - i + p - 1
mx = min(mx, d2)
print(max(mx - mn, 0))
for i in range(mn, mx):
print... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR BIN_OP VAR NUMBER ASSIG... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def main():
n, p = [int(i) for i in input().split()]
a = [int(elem) for i, elem in enumerate(input().split())]
a = sorted(a)
ans = []
mx = a[n - 1]
base = a[0]
for i in range(base, mx):
flag = True
for j in range(n):
if i + j < a[j]:
flag = False
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR I... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | import sys
INF = 10**18
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print("Yes")] if b else print("No"))
YESNO = lambda b: bool([print("YES")] if b else print("NO"))
int1 = lambda x: int(x) - 1
class BIT:
def __init__(self, n):
self.num = n
self.dat = [0... | IMPORT ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR LIST FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR LIST FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER CLASS... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
m = l[-1]
b = [0] * (2 * n - 1)
ind = 0
for i in range(2 * n - 1):
while ind < n and l[ind] <= i + m - n + 1:
ind += 1
b[i] = ind
chuje = [0] * p
for i in range(m - n + 1, m + 1):
chuje[(i - b[i - m + n - 1]) % p] += 1
dob... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER WHILE VAR VAR VAR VAR... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | def smallest_winner(matrix):
starting_x = 1
x = 1
for m in matrix:
if m > x:
starting_x += m - x
x += m - x
x += 1
return starting_x
def biggest_winner(matrix, p):
maxi = matrix[-1]
for i in range(len(matrix)):
if i + p - 1 >= len(matrix):
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR FUNC_... |
This is the easy version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she ha... | n, p = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
x = arr[-1]
y = arr[-1] - n + 1
array = [0] * n
lis = [([0] * n) for i in range(n)]
for i in range(n):
for j in range(i + 1, n):
lis[i][j] = arr[j] - arr[i]
for i in range(n):
s = 0
for j in range(n):
if ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR ... |
Tennis is a popular game. Consider a simplified view of a tennis game from directly above. The game will appear to be played on a 2 dimensional rectangle, where each player has his own court, a half of the rectangle. Consider the players and the ball to be points moving on this 2D plane. The ball can be assumed to alwa... | EPS = 1e-08
for t in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
b = list(map(int, input().split()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
t_exit = l[0] / v[0]
for i in range(1, n):
if v[i] > 0:
t_exit = min(... | ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR 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 F... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
There are two types of vaccines available: Covaxin and Covishield.
A black marketeer has X coins and wants to buy as many vaccines as possible. Due to the black marketing concerns, government has enforced the following poli... | import sys
import time
start_time = time.time()
try:
sys.stdin = open("input.txt", "r")
except:
pass
input = sys.stdin.readline
I = int(input())
def check(a, b, c, d, t, x):
l = 0
r = t
while r >= l:
m = (l + r) // 2
n = t - m
p = 2 * a * m + b * m * (m - 1)
q = 2 ... | IMPORT IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR BIN_OP BIN_OP VAR V... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
There are two types of vaccines available: Covaxin and Covishield.
A black marketeer has X coins and wants to buy as many vaccines as possible. Due to the black marketing concerns, government has enforced the following poli... | I = int(input())
x, a, b, c, d = map(int, input().split())
p, q, r, s, t, m = map(int, input().split())
def cost_vaccine(a, b, i):
return a * i + b * i * (i - 1) / 2
for _ in range(I):
k = (2 * (a - c) + (d - b)) / (2 * d)
a1 = b**2 / d + b
a2 = 2 * a + 2 * b * c / d - 2 * b + 2 * k * b
a3 = d *... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sorted([[a[i] * b[i], b[i]] for i in range(n)], key=lambda x: x[0])
def find(i1, i2):
if i1 > i2:
return i1
mid = (i1 + i2) // 2
ss = m - sum(
[
((i[0] - mid) // i[1] + ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_DEF IF VAR VAR RETURN VAR ASSI... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def find(A, B, N, M, k):
for i in range(N):
b = max(0, A[i] - k // B[i])
M -= b
return M >= 0
def binary(A, B, N, M):
low = 0
high = 10**18
while low < high:
mid = (low + high) // 2
if find(A, B, N, M, mid):
high = mid
else:
low = mid... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR VAR RETURN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | n, m = [int(x) for x in input().split()]
a, b = [], []
ma, mb = 0, 0
for x in input().split():
a.append(int(x))
if ma < int(x):
ma = int(x)
for x in input().split():
b.append(int(x))
if mb < int(x):
mb = int(x)
l = 0
r = ma * mb
while l <= r:
mid = (r - l) // 2 + l
k = 0
for ... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST LIST ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR FUNC_C... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
lo, hi = 0, 0
for i in range(n):
hi += a[i] * b[i]
def check(mid):
x = 0
for i in range(n):
x += max(a[i] - mid // b[i], 0)
if x <= m:
return True
return False
while lo <= hi:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VA... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def chk(mid, A, B, C, n, c):
count = 0
for i in range(n):
if C[i] > mid:
count += A[i] - mid // B[i]
if count <= c:
return True
return False
for _ in range(1):
n, c = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().s... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN V... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def succeed(mid, m):
d = mid
z = m
k = 0
for i in range(n):
if a[i] * b[i] > d:
v = a[i] * b[i] - d
if v % b[i]:
u = v // b[i] + 1
else:
u = v // b[i]
z -= u
if z < 0:
k = 1
break
... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER IF VAR RETURN NUMBER RETUR... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | t = input().split()
N = int(t[0])
M = int(t[1])
candies_list = []
balloon_list = []
balloons = input().split()
candies = input().split()
low = 0
mid = 0
max_val = 0
for i in range(N):
balloon_list.append(int(balloons[i]))
for i in range(N):
candies_list.append(int(candies[i]))
for i in range(N):
cost = ball... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VA... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | n, m = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
L, R = 0, 10**20
while L < R:
mid = (L + R) // 2
temp = m
for i in range(n):
temp -= max(0, a[i] - mid // b[i])
if temp < 0:
L = mid + 1
else:
R = mid
print(L) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CA... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def check(mid):
s = 0
for i in range(n):
curr = max(0, a[i] - mid // b[i])
s += curr
return s
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
low = 0
high = max(a) * max(b)
while low <= high:
mid = (low + high) // 2
val = che... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def good(maxcan, n, m, balls, cand):
cntballons = 0
for i in range(n):
ball_Onday = balls[i] - maxcan // cand[i]
cntballons += max(0, ball_Onday)
if cntballons > m:
return False
return True
def minCandiesAppy(n, m, balloons, candies):
left = 0
right = 0
for ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def balloons(a, b, candy):
total = 0
for ai, bi in zip(a, b):
if bi == 0:
continue
else:
total += max(ai - candy // bi, 0)
return total
def main():
n, m = map(int, input().strip().split())
a = list(map(int, input().split()))
b = list(map(int, input().spl... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR V... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def ans(a, b, n, m, mid, c):
i = 0
count = 0
while i < n:
if c[i] > mid:
count += a[i] - mid // b[i]
if m < count:
return False
i += 1
return True
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c ... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR IF VAR VAR RETURN NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [(a[i] * b[i]) for i in range(n)]
ans = 0
lo = 0
hi = max(c)
while lo <= hi:
mid = (lo + hi) // 2
bal = 0
for i in range(n):
if b[i] == 0:
continue
bal += max(0, a[i] - mi... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VA... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def bal_needed(a, b, candies):
c = 0
for i in range(len(a)):
if b[i] == 0:
continue
c += max(a[i] - candies // b[i], 0)
return c
def solve(a, b, n, m):
right, left = 0, 0
for i in range(n):
right = max(right, a[i] * b[i])
while left < right:
mid = (l... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NU... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def check(a, b, mid, m, n):
temp = 0
for i in range(n):
if a[i] * b[i] > mid:
temp += a[i] - mid // b[i]
if m < temp:
return 0
return 1
n, m = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
start = 0
end = start... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUN... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Appy loves balloons! She wants you to give her balloons on each of $N$ consecutive days (numbered $1$ through $N$); let's denote the number of balloons Appy wants on day $i$ by $A_{i}$. The problem is that you only h... | def cond(n, m, a, b, x):
y = 0
for i in range(n):
if a[i] * b[i] > x:
y += a[i] - x // b[i]
if y > m:
return False
return True
def binSearch(n, m, a, b, x):
low = 0
high = x
r = x
while low <= high:
mid = (low + high) // 2
if ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.