description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) lst = list(map(int, input().split())) final = [] for i in lst: if i % k != 0: final.append(i % k) val = {} for i in final: if i not in val: val[i] = 1 else: val[i] += 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBE...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, k = map(int, input().split()) A = list(map(int, input().split())) B = [] for i in A: B.append((k - i % k) % k) B.sort() i = 1 while i < n: j = i if B[i] != 0 and B[i] == B[i - 1]: ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
test_case = int(input()) for _ in range(test_case): size, div = map(int, input().split()) arr = list(map(int, input().split())) s = {(arr[i] % div): (0) for i in range(size)} for i in arr: if i % div: s[i % div] += 1 x = 0 for i in s.keys(): x = max(x, s[i] * div - i)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 BIN_OP VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBE...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def turns(n, k, a): remainders_count = dict() majority_remainder_count = 0 majority_remainder = k + 1 for num in a: if num % k == 0: continue if num % k in remainders_count: remainders_count[num % k] += 1 else: remainders_count[num % k] = 1 ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR BIN_OP VAR VAR VAR ASSIGN VAR FU...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for i in range(int(input())): n, k = map(int, input().split(" ")) nums = list(map(int, input().split(" "))) zeroRem = 0 remOcc = {} for i in nums: rem = i % k if rem == 0: zeroRem += 1 else: remOcc[k - rem] = remOcc.setdefault(k - rem, 0) + 1 if ze...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP FU...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys input = sys.stdin.readline for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for i in range(n): if a[i] % k != 0: x = k - a[i] % k if x not in d: d[x] = 1 else: ...
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR IF VAR VAR A...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) d = {(k - 1): 0} for i in a: if i % k: if k - i % k not in d: d[k - i % k] = 0 d[k - i % k] += 1 m = max(d, key=lambda x: (d[x], x)) print(k * (d[m] ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT BIN_OP VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR IF BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBE...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for i in range(int(input())): n, k = input().split(" ") n, k = int(n), int(k) A = input().split(" ") for j in range(n): A[j] = int(A[j]) % k A.sort() ma = 1 rema = A[0] tem = 1 for j in range(1, n): if A[j] == 0: continue if A[j] == A[j - 1]: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBE...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] = (k - a[i] % k) % k a.sort() i = a.count(0) mv = a[n - 1] while i < n: cv, cnt = a[i], 1 while i + 1 < n and a[i + 1] == a[i]: mv = ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from sys import stdin, stdout def zero_remainder_array(n, k, a): dic = {} maxcnt = 0 maxa = 0 for v in a: vk = k - v % k if vk == k: continue if vk not in dic: dic[vk] = 0 dic[vk] += 1 if dic[vk] > maxcnt: maxcnt = dic[vk] ...
FUNC_DEF ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF VAR VAR VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP BIN_OP BIN_OP V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): l = list(map(int, input().split())) n, k = l[0], l[1] l = list(map(int, input().split())) for i in range(n): if l[i] % k > 0: l[i] = k * (l[i] // k) + k - l[i] else: l[i] = 0 if l == [0] * n: print(0) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def findMin(ele, ans, k): left = 0 right = 10**9 best = None while left <= right: mid = (left + right) // 2 if mid * k + ele not in ans: best = mid * k + ele right = mid - 1 else: left = mid + 1 return best I = lambda: list(map(int, input...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NONE WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def solve(): n, k = map(int, input().split()) a = [int(x) for x in input().split()] used = {} ans = 0 for i in a: if i % k != 0: if i % k in used: ans = max(ans, k * (used[i % k] + 1) - i % k + 1) used[i % k] += 1 else: ...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NU...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys input = lambda: sys.stdin.readline().rstrip() for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for i in a: if i % k != 0: v = k * (i // k + 1) - i if v not in d: d[v] = 0 d[v]...
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) arr = list(map(int, input().split())) for i in range(n): arr[i] = k - arr[i] % k if arr[i] == k: arr[i] = 0 counts = {} for i in arr: if i not in counts.keys(): counts[i] = 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR VAR VAR IF VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR DICT FOR VAR...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
n = int(input()) while n > 0: l, d = input().split() l, d = int(l), int(d) arr = [int(x) for x in input().split()] for i in range(len(arr)): arr[i] = (d - arr[i] % d) % d lookup = dict() for ele in arr: if ele not in lookup: lookup[ele] = 1 else: l...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] = (k - a[i] % k) % k m = {} for elem in a: if elem > 0: m[elem] = 1 + m.get(elem, 0) maxx = 0 for elem in m: maxx = max(maxx, elem + ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR NUMBER ASSIGN VAR VAR BIN_OP ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) dp = {} for x in a: if x % k: t = k - x % k dp[t] = dp.get(t, 0) + 1 dp[0] = 0 cycles = max(dp.values()) ind = 0 if cycles == 0: print(0) else: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT FOR VAR VAR IF BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
T = int(input()) for tc in range(1, T + 1): n, k = map(int, input().split()) data = list(map(int, input().split())) modDict = dict() for i in range(len(data)): mod = k - data[i] % k if mod != k: if mod not in modDict: modDict[mod] = 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP 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 FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR IF V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for tt in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) d = dict() for i in arr: x = i % k if x != 0: if i % k in d: d[i % k] += 1 else: d[i % k] = 1 ans = 0 for i in d.keys(): ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER IF BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from sys import stdin input = stdin.readline for _ in range(int(input())): n, k = map(int, input().split()) a = [int(x) for x in input().split()] d = dict() maxx, maxxx = 0, 0 for x in a: now = k - x % k if now in d.keys(): d[now] += 1 else: d[now] = ...
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR FUNC_CALL VAR VAR VAR NUMBER AS...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for i in range(int(input())): n, k = map(int, input().strip().split()) a = list(map(int, input().strip().split())) d = dict.fromkeys(list(map(lambda x: k - x % k, a)), 0) for i in a: d[k - i % k] += 1 ans = 0 for i in d: if i % k != 0: ans = max(i + 1 + (d[i] - 1) * k...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR NUMBER FOR VAR VAR VAR BIN_OP VAR BIN_OP VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) dct = {} l = 0 for i in arr: rem = i % k if rem != 0: if rem in dct: dct[rem] += 1 else: l += 1 dct[rem] = 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER IF VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER A...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
r = lambda: map(int, input().split()) (t,) = r() for _ in [0] * t: n, k = r() a = [*r()] s = {(i % k): (0) for i in a} for i in a: if i % k: s[i % k] += 1 f = max(1 - i + k * s[i] for i in s.keys()) print(f if f > 1 else 0)
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR VAR FOR VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR BIN_O...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) A = list(map(int, input().split())) m = {} for i in range(n): if A[i] % k == 0: continue temp = A[i] % k temp = k - temp if m.get(temp) == None: m[temp] = 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF F...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for i in range(t): n, k = map(int, input().split()) b = list(map(int, input().split())) d = dict() p = 0 for j in range(n): if b[j] % k != 0: if b[j] % k in d.keys(): d[b[j] % k] += 1 else: d[b[j] % k] = 1 p...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR FUNC_CALL V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
cases = int(input()) for _ in range(cases): n, k = list(map(int, input().strip().split())) arr = list(map(int, input().strip().split())) d = {} for elem in arr: rem = elem % k if rem != 0: rem = k - rem if rem in d: d[rem] += 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def solve(a, k): ctr = dict() for x in a: add = (k - x % k) % k ctr[add] = ctr.get(add, 0) + 1 ans = 0 for i, c in ctr.items(): if i != 0: ans = max(ans, 1 + i + k * (c - 1)) return ans t = int(input()) for _ in range(t): n, k = map(int, input().split()) ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP NUMBER VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
T = int(input()) for test in range(T): n, k = map(int, input().split()) l = list(map(int, input().split())) dct = {} for el in l: try: dct[el % k] += 1 except KeyError: if el % k != 0: dct[el % k] = 1 try: max_el = max(dct.values()) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 DICT FOR VAR VAR VAR BIN_OP VAR VAR NUMBER VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
T = int(input()) for t in range(T): n, k = (int(i) for i in input().split()) last = {} maxx = 0 for i in input().split(): a = int(i) if a > k: if a % k == 0: x = a else: x = (a // k + 1) * k else: x = k y...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = [(int(i) % k) for i in input().split()] b = {} b[0] = 0 for i in a: if i not in b.keys(): b[i] = 1 else: b[i] += 1 mx = 0 mx_ind = 0 for i in b.keys(): if i == 0: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER NUMBER FOR VAR VAR IF VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER A...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
a = int(input()) d = {} while a: d.clear() a = a - 1 n, k = map(int, input().split()) lis = list(map(int, input().split())) for i in range(len(lis)): it = lis[i] if it % k != 0: if k - it % k in d: d[k - it % k] += 1 else: d[k -...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT WHILE VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP 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 FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP VAR VAR NUMBER...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
tt = int(input()) for loop in range(tt): n, k = map(int, input().split()) a = list(map(int, input().split())) dic = {} for i in a: if i % k != 0: if k - i % k not in dic: dic[k - i % k] = 0 dic[k - i % k] += 1 mi = None for i in dic: if mi ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBER V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for i in range(t): n, k = input().split() n, k = int(n), int(k) inp = [int(j) for j in input().split()] dict = {} cnt = 0 answer = 0 for i in range(len(inp)): if inp[i] % k == 0: cnt = cnt + 1 else: temp = k - inp[i] % k if...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) b = [] for i in range(n): a[i] = a[i] % k if a[i] != 0: b.append(k - a[i]) if len(b) == 0: print(0) else: b.sort() v = {} for i in ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) new = [0] * n arr.sort() new = dict() for i in range(n): new.setdefault(k - arr[i] % k if arr[i] % k != 0 else 0, 0) new[k - arr[i] % k if arr[i] % k != 0 else 0] += 1 ans = 0...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 BIN_OP LIST NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMB...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) s = list(map(int, input().split())) ll = [] for i in s: if i % k != 0: ll.append(i) for i in range(0, len(ll)): ll[i] = ll[i] % k if len(ll) == 0: print(0) continue ll.sort() ans = ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) i = 0 while i < t: n, k = map(int, input().split()) arr = list(map(int, input().split())) has = {(0): 0} for x in arr: a = x % k if a == 0: if a in has.keys(): has[a] = has[a] + 1 else: has[a] = 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE 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 DICT NUMBER NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER IF VAR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = list(map(int, input().split())) a = list(map(lambda x: str((k - int(x)) % k), input().split())) dic = {} for ae in a: if ae != "0": if ae in dic: dic[ae][0] += 1 else: dic[ae] = [0, int(ae)] ma...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FUNC_CALL VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR STRING IF VAR VAR VAR VAR NUMBER...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) def num_changes(numbers, divisor): for i in range(len(numbers)): numbers[i] = divisor - numbers[i] % divisor numbers.sort() to_add = [[numbers[0], 0]] for elem in numbers: if to_add[-1][0] == elem: to_add[-1][1] += 1 else: to_add.append(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST LIST VAR NUMBER NUMBER FOR VAR VAR IF VAR NUMBER NUMBER VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR LIST VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = input() t = int(t) while t: t = t - 1 st = input() n, k = map(int, st.split()) pt = input() lst = [int(m) for m in pt.split()] dic = {} MAX = -1 for i in range(0, n): re = lst[i] % k if re == 0: continue if re not in dic: dic[re] = 0 ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_O...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from sys import stdin for _ in range(int(input())): n, k = map(int, input().split()) l = list(map(int, stdin.readline().split())) l.sort() a = [] for e in l: if e % k != 0: a.append(e % k) a.sort() x = 0 moves = 0 dict = {} pp = [0] for e in a: if...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASS...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for test in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) b = [0] * n for i in range(n): b[i] = (k - a[i] % k) % k b.sort() result = 0 minresult = 0 mc = 0 mmc = 0 c = 0 tek = 0 s = False s1 = True for i in...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys input = sys.stdin.buffer.readline t = int(input()) for _ in range(t): n, k = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] requiredTopUps = dict() for i in range(n): remainder = arr[i] % k if remainder != 0: if k - remainder not in requ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR NUMBER IF BIN_OP VAR VAR FU...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) cases = [] for i in range(t): n, kay = input().split(" ") n = int(n) kay = int(kay) vals = input().split(" ") vals = [(int(x) % kay) for x in vals if int(x) % kay != 0] cases.append((n, kay, vals)) for c in cases: arr = c[2].copy() k = c[1] moves = 1 x = 1 if...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
m = int(input()) while m: m -= 1 a, b = map(int, input().split()) l = list(map(int, input().split())) d = {} for i in l: if i % b != 0: d.setdefault(b - i % b, 0) d[b - i % b] += 1 ma = 0 for i, j in d.items(): ma = max(i + (j - 1) * b, ma) if ma =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR 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 DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR BIN_OP VAR VAR N...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for t in range(int(input())): n, k = map(int, input().split()) a = [((k - int(s) % k) % k) for s in input().split()] d = dict() for i in a: if i != 0: d.setdefault(i, 0) d[i] += 1 x = [(i + k * (d[i] - 1)) for i in d] if len(x) == 0: print(0) else: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_O...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from sys import stdin inp = lambda: stdin.readline().strip() t = int(inp()) for _ in range(t): n, k = [int(x) for x in inp().split()] a = [int(x) for x in inp().split()] ar = [] for i in a: if i % k: ar.append(i) ar.sort(key=lambda x: x % k) rem = dict() for i in ar: ...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys input = sys.stdin.readline f = lambda: list(map(int, input().strip("\n").split())) res = [] for _ in range(int(input())): n, k = f() inp = f() cnt = {} for i in inp: if not i % k: continue cnt[k - i % k] = cnt.get(k - i % k, 0) + 1 if cnt.keys(): num =...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP FUNC...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from sys import stdin def inp(): return stdin.readline().strip() t = int(inp()) for _ in range(t): n, k = [int(x) for x in inp().split()] ar = [int(x) for x in inp().split()] dic = dict({}) sett = set({}) ans = 0 bad = set({}) for i in ar: if i not in sett: sett.a...
FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 DICT ASSIGN VAR FUNC_CALL VAR DICT ASSIGN VAR NUMBER ASSIGN VAR FUNC_CAL...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) d = dict() a = list(map(int, input().split())) for i in range(n): d.setdefault(a[i] % k, 0) d[a[i] % k] += 1 ans = 0 for i in d: if i != 0: ans = max(ans, (d[i] - 1) * k + (k - i)) if 0 in d an...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR NUMBER FO...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys def func(t, k): for i in range(0, sys.maxsize, k): if i >= t: break return i t = int(input()) for _ in range(t): n, k = map(int, input().split()) mp = dict() temp = map(int, input().split()) for i in temp: if func(i, k) - i not in mp: mp[fun...
IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER VAR VAR IF VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) new = [] d = {} for i in range(n): if a[i] % k == 0: pass else: x = k - a[i] % k if d.get(x): y = d[x] * k + x ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR IF ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def check(l, k): for i in l: if i % k != 0: return False return True t = int(input()) for _ in range(t): n, k = list(map(int, input().split())) a = list(map(int, input().split())) d = dict() if check(a, k): print(0) continue for i in a: if i % k ...
FUNC_DEF FOR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FUNC_CALL VAR IF FUNC_CALL VAR V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for x in a: r = x % k if r != 0: d[k - r] = d.get(k - r, 0) + 1 rems = [] ans = 0 for x in d: o = d[x] t = (o - 1) * k + x ans = max(a...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER AS...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for i in range(t): n, m = map(int, input().split()) l = list(map(int, input().split())) randomarr = [] for j in range(n): hj = l[j] % m if hj == 0: hj = 0 else: hj = m - hj randomarr.append(hj) dictio = dict() for k in rand...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR E...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): X, Y = map(int, input().split()) arr = list(map(int, input().split())) dict = {} flag = True for i in arr: if i % Y != 0: flag = False break if flag: print(0) continue for i in arr: if i % Y == 0: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR NUMBER FOR VAR VAR IF BIN_OP VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
TC = int(input()) for tc in range(TC): N, K = map(int, input().split()) A = list(map(lambda x: int(x) % K, input().split())) M = {(0): -1} for a in A: if a != 0: if a in M: M[a] += K else: M[a] = K - a print(max(M.values()) + 1)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT NUMBER NUMBER FOR VAR VAR IF VAR NUMBER IF VAR VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] = (k - a[i] % k) % k D = {} for i in range(n): if a[i] != 0: if a[i] in D: D[a[i]] += 1 else: D[a[i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
T = int(input().rstrip()) def solve(arr, k): mod_arr = [(i % k) for i in arr] mod_d = {} for i in arr: res = (k - i) % k if res != 0: if res not in mod_d: mod_d[res] = 1 else: mod_d[res] += 1 x = 0 num_moves = 0 while len(...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF VAR NUMBER IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from itertools import groupby for _ in range(int(input())): n, k = [int(_) for _ in input().split()] a = [int(_) for _ in input().split()] rems = sorted((_ % k for _ in a), key=lambda x: -x) rems = [[k, len(list(v))] for k, v in groupby(rems)] x = 0 done = 0 i = 0 while done != n: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSI...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
from sys import stdin for _ in range(int(stdin.readline())): n, k = list(map(int, stdin.readline().split())) a = list(map(int, stdin.readline().split())) d = {} res = 0 for i, v in enumerate(a): if v % k == 0: continue else: t = k - v % k if t not...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) ar = list(map(int, input().split())) for i in range(n): ar[i] = ar[i] % k ar.sort() i = 0 ans = -1 while i < n: temp = k - ar[i] if ar[i] == 0: temp = 0 while i + 1 < n and ar...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR AS...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): liStr = input().split() n = int(liStr[0]) k = int(liStr[1]) liStr = input().split() arr = [] for i in liStr: arr.append(int(i)) remArr = [] toAdd = [] for i in arr: remArr.append(i % k) for i in remArr: if i == k or i == 0: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for t in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) table = set() remtable = {} for i in a: if i % k != 0: rem = k - i % k if rem in remtable: last = remtable[rem][-1] remtable[rem].append(...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 ASSIGN VAR DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR VAR N...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) d = dict() for i in range(n): if a[i] % k == 0: continue else: s = a[i] // k + 1 p = s * k - a[i] d[p] = d.get(p, 0) + 1 m = 0 for k1...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() dic = {} c = 0 for i in range(n): if arr[i] % k == 0: continue else: try: dic[arr[i] % k] += k except: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def list_input(): return list(map(int, input().split())) def multiple_input(): return map(int, input().split()) for _ in range(int(input())): n, k = multiple_input() a = list_input() rem = {} for i in a: reminder = i % k if reminder == 0: reminder = k if k...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR VAR IF ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): if a[i] % k != 0: a[i] = k - a[i] % k else: a[i] = 0 if a.count(0) == n: print(0) continue a.sort() v = {} maxi = 0 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR NUMBER ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for i in range(t): n, k = map(int, input().split()) l = list(map(int, input().split())) l.sort() d = {} for j in l: r = j % k if r: if k - r in d: d[k - r] = d[k - r] + 1 else: d[k - r] = 1 z = float("-inf")...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) lst = [int(x) for x in input().split()] d = {} for i in lst: d[i % k] = d.get(i % k, 0) + 1 try: d.pop(0) except: pass if d != {}: mx = max(d.values()) res = [] for i, j in d.items(...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR DICT ASSIGN VAR FUN...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
s = int(input()) for i in range(0, s): x, y = input().split() x = int(x) y = int(y) n = input().split() l = {} for i in range(0, x): r = y - int(n[i]) % y if r != y: if r not in l.keys(): l[r] = 1 else: l[r] += 1 if l ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP FUNC_CALL VAR VAR VAR VAR IF VAR VAR I...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = [((k - x) % k % k) for x in map(int, input().split())] s = {} s[0] = -1 for i in a: if i == 0: continue if i not in s: s[i] = i else: ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER NUMBER FOR VAR VAR IF VAR NUMBER IF VAR VAR ASSI...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
T = int(input()) while T > 0: n, k = map(int, input().split()) arr = list(map(int, input().split())) dic = {} for x in arr: temp = x % k if temp > 0: need = k - temp if need not in dic: dic[need] = 0 dic[need] += 1 res = 0 c = 0...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBE...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def main(): t = int(input()) for _ in range(t): n, k = map(int, input().split()) l = list(map(int, input().split())) for i in l: if i % k != 0: break else: print(0) continue s = {} for i in l: if i < ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for ts in range(t): l, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] f = {} fm = 0 fr = 0 for i in a: if i % k != 0: f[i % k] = f.get(i % k, 0) + 1 if f[i % k] > fm or f[i % k] == fm and i % k < fr: fm...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR B...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def solve(arr, n, k): aux = {} for i in arr: if i % k != 0: if k - i % k not in aux: aux[k - i % k] = 1 else: aux[k - i % k] += 1 ans = -1 for i in aux: ans = max(ans, i + (aux[i] - 1) * k) print(ans + 1) t = int(input()) for ...
FUNC_DEF ASSIGN VAR DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSI...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def cast(cre, typ): return type(typ)(map(cre, typ)) def input_ilst(): return cast(int, input().split()) def input_slst(): return input().split() def solution(): for t in range(int(input())): n, k = input_ilst() lst = input_ilst() dic = {} ans = 0 for e in ls...
FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = [int(x) for x in input().split()] b = [] dic = {} m = 0 for i in a: if i % k == 0: b.append(0) else: b.append(k - i % k) tmp = k - i % k if dic.get(tmp): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) arr = {} for i in a: arr[i % k] = arr.get(i % k, 0) + 1 m = 0 for i in arr: if i: m = max(m, k * arr[i] - i) if m: print(m + 1) else: print(m)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR ASSIG...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
outputs = [] for __ in range(int(input())): n, k = list(map(int, input().split())) A = list(map(int, input().split())) A = list(filter(lambda y: y % k != 0, A)) d = {} for i in A: num = k - i % k d[num] = d.get(num, 0) + 1 maxm = 0 for i in d.keys(): if d.get(i) > 1: ...
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR B...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for i in range(t): n, k = map(int, input().split()) ai = list(map(int, input().split())) ai = [((k - ai[i] % k) % k) for i in range(n)] ai.sort() num = 1 ans = 1 ans2 = ai[-1] + 1 - (ai[-1] == 0) for j in range(n): if ai[j] != 0: break j += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER AS...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) q = [] for i in x: if k - i % k != k: q.append(k - i % k) q.sort() if len(q) == 0: print(0) else: c = q[0] for i in range(1, len(q)): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF BIN_OP VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR IF FUN...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def f(k, arr): a_m_dict = {} for a in arr: m = a % k if m: a_m_dict[k - m] = a_m_dict.get(k - m, 0) + 1 if not a_m_dict: return 0 result = 0 for key, v in a_m_dict.items(): result = max(result, key + (v - 1) * k) return result + 1 t = int(input()) fo...
FUNC_DEF ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER IF VAR RETURN NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR NUMBER VAR RETURN BIN_OP VAR NUMBER ASSIGN VAR FUNC...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def solve(): n, k = map(int, input().split()) a = [int(x) for x in input().split()] m = dict() res = 0 for i in range(n): if a[i] % k == 0: continue x = k - a[i] % k m[x] = m.get(x, 0) + 1 for key, v in m.items(): p = key + (v - 1) * k res = ma...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for j in range(t): n, k = map(int, input().split()) aa = [int(a) for a in input().split()] fin = [] for i in aa: fin.append(k - i % k) x = 0 d = {} for i in fin: if i == k: continue elif i in d: d[i] += 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR VAR IF VAR VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def solution1(): for tangocharlie in range(int(input())): xx, yy, nn = map(int, input().split()) p = nn // xx k = p * xx + yy while k > nn: p -= 1 k = p * xx + yy print(k) def solution2(): for tangocharlie in range(int(input())): nnn = in...
FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CA...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = [int(i) for i in input().split()] temp = 0 used = {} ans = 0 for i in range(n): if a[i] % k != 0: a[i] = k - a[i] % k if a[i] not in used: used[a[i]] = 0 used[a[i]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def main(): for t in range(int(input())): n, k = map(int, input().split()) a = [int(i) for i in input().split()] rem = {} for i in a: if i % k not in rem: rem[i % k] = 0 rem[i % k] += 1 maxAns = 0 if 0 in rem: del re...
FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF NUMBER VAR VAR NU...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
import sys t = int(sys.stdin.readline()) ans_arr = [] for i in range(t): [n, k] = [int(x) for x in sys.stdin.readline().split()] arr = [int(y) for y in sys.stdin.readline().split()] a = [] for w in range(n): if arr[w] % k != 0: a.append(arr[w] % k) d = {} mx = -2 flag = ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def solve(): n, k = map(int, input().split()) lst = list(map(int, input().split())) lst2 = [(lst[i] % k) for i in range(n)] lst2.sort() lastelem = -1 colvo = 0 mxcolvo = 0 mxnum = 0 for i in lst2: if i == 0: continue if lastelem == i: colvo += ...
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 BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER IF VAR VAR VAR NUM...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) rem = [] for i in range(n): if a[i] % k != 0: rem.append(k - a[i] % k) arr = {} if not rem: print(0) continue for el in rem: try: _ = arr...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR DICT IF VAR EXP...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def Foo(): n, k = [int(x) for x in input().split()] a = [int(x) for x in input().split()] b = [0] * len(a) for i in range(len(a)): rem = a[i] % k b[i] = k - rem if rem != 0 else rem b.sort() startI = 0 for i in range(len(b)): if b[i] != 0: startI = i ...
FUNC_DEF 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 BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR VAR NUMBER BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for test in range(int(input())): n, k = map(int, input().split()) a = [int(i) for i in input().split()] res_dict = {} for i in a: if i % k != 0: res = k - i % k if res in res_dict: res_dict[res] += 1 else: res_dict[res] = 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) while t: n, k = map(int, input().split()) a = list(map(int, input().split())) b = [] for i in range(0, n): if a[i] % k != 0: b.append(a[i] % k) b.sort() ans = 0 i = 0 while i < len(b): cnt = 0 while i < len(b) - 1 and b[i + 1] == b[i]:...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR N...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) while t: n, k = map(int, input().split()) lst = list(map(int, input().split())) dic = {} for i in range(n): x = lst[i] % k if x == 0: continue y = k - x dic[y] = 0 for i in range(n): x = lst[i] % k if x == 0: co...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for p in range(int(input())): n, k = input().split() n = int(n) k = int(k) arr = input().split() arr = list(map(int, arr)) ans = [] dic = {} for d in arr: if d % k == 0: continue if k - d % k not in dic: dic[k - d % k] = 0 dic[k - d % k] +=...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR BIN_OP V...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
for i in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) d = {} for i in range(n): if k - a[i] % k not in d and k - a[i] % k != k: d[k - a[i] % k] = 1 elif k - a[i] % k != k: d[k - a[i] % k] += 1 mx = -1 ind = 0 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR ...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
def zeroRemainder(a, n, k): hash_map = {} for i in range(n): if a[i] % k in hash_map: hash_map[a[i] % k] += 1 else: hash_map[a[i] % k] = 1 cnt = 0 if 0 in hash_map: del hash_map[0] if not hash_map: return 0 for i in hash_map: cnt = ...
FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF NUMBER VAR VAR NUMBER IF VAR RETURN NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR RETURN VAR NUMBER BIN_OP VAR NUMBER NUMBE...
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
t = int(input()) rem = {} for _ in range(t): n, k = map(int, input().split()) rem.clear() for num in [int(num) for num in input().split()]: if num % k not in rem: rem[num % k] = 1 else: rem[num % k] += 1 mx = 0 for p in rem.items(): if p[0]: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FU...