description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else. You are to determine the minimum time needed for all n people to get to the office with keys. Assume that people move a unit distance per 1 second. If two people reach a key at the same time, only one of them can take the key. A person can pass through a point with a key without taking it. Input The first line contains three integers n, k and p (1 ≀ n ≀ 1 000, n ≀ k ≀ 2 000, 1 ≀ p ≀ 109) β€” the number of people, the number of keys and the office location. The second line contains n distinct integers a1, a2, ..., an (1 ≀ ai ≀ 109) β€” positions in which people are located initially. The positions are given in arbitrary order. The third line contains k distinct integers b1, b2, ..., bk (1 ≀ bj ≀ 109) β€” positions of the keys. The positions are given in arbitrary order. Note that there can't be more than one person or more than one key in the same point. A person and a key can be located in the same point. Output Print the minimum time (in seconds) needed for all n to reach the office with keys. Examples Input 2 4 50 20 100 60 10 40 80 Output 50 Input 1 2 10 11 15 7 Output 7 Note In the first example the person located at point 20 should take the key located at point 40 and go with it to the office located at point 50. He spends 30 seconds. The person located at point 100 can take the key located at point 80 and go to the office with it. He spends 50 seconds. Thus, after 50 seconds everybody is in office with keys.
N, M, P = map(int, input().split(" ")) A = list(map(int, input().split(" "))) B = list(map(int, input().split(" "))) A = sorted(A) B = sorted(B) def check(HAHA): vis = [(False) for _ in range(N)] res = 0 for i in range(M): for ii in range(N): x = abs(A[ii] - B[i]) x += abs(P - B[i]) if vis[ii] == True or x > HAHA: continue res += 1 vis[ii] = True break return res == N ret = -1 l = 0 r = int(3000000000.0) while l <= r: md = l + r >> 1 if check(md): ret = md r = md - 1 else: l = md + 1 print(ret)
ASSIGN VAR 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR IF VAR VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER RETURN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else. You are to determine the minimum time needed for all n people to get to the office with keys. Assume that people move a unit distance per 1 second. If two people reach a key at the same time, only one of them can take the key. A person can pass through a point with a key without taking it. Input The first line contains three integers n, k and p (1 ≀ n ≀ 1 000, n ≀ k ≀ 2 000, 1 ≀ p ≀ 109) β€” the number of people, the number of keys and the office location. The second line contains n distinct integers a1, a2, ..., an (1 ≀ ai ≀ 109) β€” positions in which people are located initially. The positions are given in arbitrary order. The third line contains k distinct integers b1, b2, ..., bk (1 ≀ bj ≀ 109) β€” positions of the keys. The positions are given in arbitrary order. Note that there can't be more than one person or more than one key in the same point. A person and a key can be located in the same point. Output Print the minimum time (in seconds) needed for all n to reach the office with keys. Examples Input 2 4 50 20 100 60 10 40 80 Output 50 Input 1 2 10 11 15 7 Output 7 Note In the first example the person located at point 20 should take the key located at point 40 and go with it to the office located at point 50. He spends 30 seconds. The person located at point 100 can take the key located at point 80 and go to the office with it. He spends 50 seconds. Thus, after 50 seconds everybody is in office with keys.
n, k, p = map(int, input().split()) a = sorted(list(map(int, input().split()))) b = sorted(list(map(int, input().split()))) res = 1000000000000000.0 for i in range(k - n + 1): ma = 0 for j in range(n): te = abs(a[j] - b[i + j]) + abs(b[i + j] - p) ma = max(ma, te) res = min(res, ma) print(res)
ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else. You are to determine the minimum time needed for all n people to get to the office with keys. Assume that people move a unit distance per 1 second. If two people reach a key at the same time, only one of them can take the key. A person can pass through a point with a key without taking it. Input The first line contains three integers n, k and p (1 ≀ n ≀ 1 000, n ≀ k ≀ 2 000, 1 ≀ p ≀ 109) β€” the number of people, the number of keys and the office location. The second line contains n distinct integers a1, a2, ..., an (1 ≀ ai ≀ 109) β€” positions in which people are located initially. The positions are given in arbitrary order. The third line contains k distinct integers b1, b2, ..., bk (1 ≀ bj ≀ 109) β€” positions of the keys. The positions are given in arbitrary order. Note that there can't be more than one person or more than one key in the same point. A person and a key can be located in the same point. Output Print the minimum time (in seconds) needed for all n to reach the office with keys. Examples Input 2 4 50 20 100 60 10 40 80 Output 50 Input 1 2 10 11 15 7 Output 7 Note In the first example the person located at point 20 should take the key located at point 40 and go with it to the office located at point 50. He spends 30 seconds. The person located at point 100 can take the key located at point 80 and go to the office with it. He spends 50 seconds. Thus, after 50 seconds everybody is in office with keys.
n, k, p = map(int, input().split()) a = [] b = [] temp = input().split() for i in range(n): a.append(int(temp[i])) temp = input().split() for i in range(k): b.append(int(temp[i])) list.sort(a) list.sort(b) mini = 0 for i in range(k - n + 1): maxi = 0 cur = 0 for j in range(n): if p >= a[j]: if a[j] > b[i + j]: cur = p + a[j] - 2 * b[i + j] elif b[i + j] > p: cur = 2 * b[i + j] - p - a[j] else: cur = p - a[j] elif b[i + j] > a[j]: cur = 2 * b[i + j] - p - a[j] elif b[i + j] < p: cur = p + a[j] - 2 * b[i + j] else: cur = a[j] - p if cur > maxi: maxi = cur if maxi < mini or i == 0: mini = maxi print(mini)
ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP NUMBER VAR BIN_OP VAR VAR IF VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP VAR VAR VAR VAR VAR IF VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP NUMBER VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else. You are to determine the minimum time needed for all n people to get to the office with keys. Assume that people move a unit distance per 1 second. If two people reach a key at the same time, only one of them can take the key. A person can pass through a point with a key without taking it. Input The first line contains three integers n, k and p (1 ≀ n ≀ 1 000, n ≀ k ≀ 2 000, 1 ≀ p ≀ 109) β€” the number of people, the number of keys and the office location. The second line contains n distinct integers a1, a2, ..., an (1 ≀ ai ≀ 109) β€” positions in which people are located initially. The positions are given in arbitrary order. The third line contains k distinct integers b1, b2, ..., bk (1 ≀ bj ≀ 109) β€” positions of the keys. The positions are given in arbitrary order. Note that there can't be more than one person or more than one key in the same point. A person and a key can be located in the same point. Output Print the minimum time (in seconds) needed for all n to reach the office with keys. Examples Input 2 4 50 20 100 60 10 40 80 Output 50 Input 1 2 10 11 15 7 Output 7 Note In the first example the person located at point 20 should take the key located at point 40 and go with it to the office located at point 50. He spends 30 seconds. The person located at point 100 can take the key located at point 80 and go to the office with it. He spends 50 seconds. Thus, after 50 seconds everybody is in office with keys.
def list_input(): return list(map(int, input().split())) def map_input(): return map(int, input().split()) def map_string(): return input().split() n, k, p = map_input() a = list_input() b = list_input() a.sort() b.sort() ans = 1000000000000000000 for i in range(k - n + 1): cur = 0 c1 = 0 c2 = i while c1 < n: cur = max(abs(a[c1] - b[c2]) + abs(b[c2] - p), cur) c1 += 1 c2 += 1 ans = min(ans, cur) print(ans)
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 FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def lower_bound(a, ele): l = 0 r = len(a) - 1 n = len(a) ans = n while l <= r: mid = l + (r - l) // 2 if a[mid] >= ele: r = mid - 1 ans = mid else: l = mid + 1 return ans T = int(input()) for ii in range(T): n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() x = lower_bound(a, k) ans = n - x a = a[:x] l = 0 for i in a[-1::-1]: l += 1 if l * i >= k: ans += 1 l = 0 print(ans)
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR NUMBER NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
T = int(input()) for _ in range(T): N, X = list(map(int, input().strip().split())) arr = list(map(int, input().strip().split())) arr.sort(reverse=True) count = 0 size = 0 for i in range(N): size += 1 if arr[i] * size >= X: count += 1 size = 0 print(count)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for i in range(t): n, x = [int(x) for x in input().split()] l = [int(x) for x in input().split()] l.sort() l.reverse() ans = 0 st = 0 j = 0 while st + j + 1 <= n: if l[st + j] * (j + 1) >= x: ans = ans + 1 st = st + j + 1 j = 0 else: j = j + 1 print(ans)
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 EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP BIN_OP VAR VAR NUMBER VAR IF BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for k in range(t): n, x = [int(x) for x in input().split()] a = [int(x) for x in input().split()] a = sorted(a, reverse=True) c = 0 curC = 0 curMin = a[0] for i in a: if i >= x: c += 1 else: curC += 1 curMin = i if curC * curMin >= x: c += 1 curC = 0 curMin = a[0] print(c)
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 VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, k = map(int, input().split()) num = list(map(int, input().split())) num = sorted(num, reverse=True) ans, cnt = 0, 1 for s in num: if s * cnt >= k: ans += 1 cnt = 0 cnt += 1 print(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 FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): n, x = map(int, input().split(" ")) a = list(map(int, input().split(" "))) a.sort(reverse=True) s = 0 t = [] count = 0 for y in range(n): s = s + 1 if a[y] * s >= x: count = count + 1 s = 0 print(count)
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 STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def test(): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() c = 1 ans = 0 for i in range(n, 0, -1): if c * a[i - 1] >= x: c -= int((x + a[i - 1] - 1) / a[i - 1]) ans += 1 c += 1 print(ans) q = int(input()) for i in range(q): test()
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 NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import stdin, stdout t = int(stdin.readline().strip()) for _ in range(t): n, x = map(int, stdin.readline().split()) a = list(map(int, stdin.readline().split())) a.sort(reverse=True) c, ans = 0, 0 for i in range(n): if a[i] >= x: ans += 1 else: c += 1 if a[i] * c >= x: ans += 1 c = 0 stdout.write("{}\n".format(ans))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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 NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
s = int(input()) while s != 0: s -= 1 a, b = list(map(int, input().split())) l = sorted(list(map(int, input().split())), reverse=True) res, mul = 0, 1 for x in l: if x * mul >= b: res += 1 mul = 0 mul += 1 print(res)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): n, x = map(int, input().split()) a = sorted(list(map(int, input().split()))) a.reverse() i, cur, ans = 0, 0, 0 while i < n: if a[i] * (cur + 1) >= x: ans += 1 cur = 0 else: cur += 1 i += 1 print(ans)
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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHILE VAR VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() b = n - 1 g = 0 c = 1 while b >= 0: if c * a[b] >= x: g += 1 c = 1 else: c += 1 b -= 1 print(g)
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 BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
var_d = lambda: map(int, input().split()) (V,) = var_d() while V: an, ax = var_d() var_a = sorted(var_d()) iy = 0 while var_a: var_c = 1 while var_a and var_c * var_a[-1] < ax: var_c += 1 var_a.pop() if var_a: iy += 1 var_a.pop() print(iy) V -= 1
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR NUMBER
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) while t: t -= 1 n, x = map(int, input().split()) lis = sorted(list(map(int, input().split())), reverse=True) c = 0 stop = n - 1 for i in range(n): if lis[i] >= x: c += 1 else: stop = i break i = 1 while stop < n and stop + i < n: if i < n and lis[stop + i] * (i + 1) >= x: c += 1 stop += i + 1 i = 1 else: i += 1 print(c)
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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR IF VAR VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.readline T = int(input()) for _ in range(T): n, x = [int(inp) for inp in input().strip().split(" ")] numbers = [int(inp) for inp in input().strip().split(" ")] numbers = sorted(numbers)[::-1] current_count = 0 team_count = 0 for num in numbers: current_count += 1 if current_count * num >= x: team_count += 1 current_count = 0 print(team_count)
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 FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for t in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() c = 0 i = n - 1 while i >= 0: prod = a[i] if prod >= x: c += 1 i = i - 1 else: test = 0 j = 1 while prod < x and j <= i: prod = a[i - j] * (j + 1) if prod >= x: test = 1 j = j + 1 if test == 1: c += 1 i = i - j print(c)
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 NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) MAX = 9999999999 for _ in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=True) ans = 0 current = 0 cur_min = MAX for i in range(n): cur_min = min(cur_min, a[i]) current += 1 if cur_min * current >= x: ans += 1 cur_min = MAX current = 0 print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for tc in range(int(input())): n, x = input().split(" ") n, x = int(n), int(x) A = input().split(" ") for i in range(n): A[i] = int(A[i]) A.sort(reverse=True) ans = 0 start = 0 end = 0 while start < n: while end < n and A[end] * (end - start + 1) < x: end += 1 if end < n and A[end] * (end - start + 1) >= x: ans += 1 start = end + 1 print(ans)
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 FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE VAR VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import stdin, stdout input = stdin.readline tc = int(input()) for t in range(tc): minimum = int(input().split()[1]) programmers = list(map(int, input().split())) maximumTeams = 0 position = 1 programmers.sort() programmers.reverse() for i in range(len(programmers)): if programmers[i] >= minimum: maximumTeams = maximumTeams + 1 elif programmers[i] * position >= minimum: maximumTeams = maximumTeams + 1 position = 1 else: position = position + 1 print(maximumTeams)
ASSIGN VAR 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 NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def solution(arr, k): arr.sort(reverse=True) count, curr = 0, 1 for i in arr: if curr * i >= k: count = count + 1 curr = 0 curr = curr + 1 return count for _ in range(int(input())): n, k = map(int, input().split()) arr = [int(x) for x in input().split()] print(solution(arr, k))
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN 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 EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for cn in range(1, int(input()) + 1): n, x = map(int, input().split()) S = list(map(int, input().split())) S = reversed(sorted(S)) curr = 0 num_teams = 0 for s in S: curr += 1 if curr * s >= x: num_teams += 1 curr = 0 print(num_teams)
FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL 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 FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for i in range(int(input())): n, x = map(int, input().split()) num = list(sorted(map(int, input().split()))) z = 0 ans = 0 for i in range(n): z += 1 if z * num[n - i - 1] >= x: ans += 1 z = 0 print(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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for it in range(int(input())): n, x = [int(i) for i in input().split()] a = [int(i) for i in input().split()] a.sort(reverse=True) i = 0 ans = 0 last = 0 while i < n: last = i while i < n and (i - last + 1) * a[i] < x: i += 1 if i == n: break ans += 1 i += 1 print(ans)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR WHILE VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) l = sorted(list(map(int, input().split())), reverse=True) s = [] m = 0 for i in range(n): if l[i] >= x: m += 1 else: s.append(l[i]) slen = len(s) i = 0 j = 1 while i < slen: if s[i] * j >= x: m += 1 j = 0 j += 1 i += 1 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for i in range(t): ch = input() L = [int(i) for i in ch.split()] n, x = L[0], L[1] ch = input() L = [int(i) for i in ch.split()] nb = 0 L.sort(reverse=True) a = -1 for i in range(n): if (i - a) * L[i] >= x: nb += 1 a = i print(nb)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, x = list(map(int, input().split())) a = list(map(int, input().split())) a.sort(reverse=True) i = 0 b = 1 d = 0 while i < n: if b * a[i] >= x: b = 1 i += 1 d += 1 else: i += 1 b += 1 print(d)
IMPORT ASSIGN VAR VAR 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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def ans(X, A): A = sorted(A)[::-1] i = 0 ret = 0 curr_length = 0 curr_min = None while i < len(A): curr_length += 1 curr_min = A[i] i += 1 if curr_length * curr_min >= X: ret += 1 curr_length = 0 curr_min = None return ret T = int(input()) for t in range(T): N, X = input().split(" ") N = int(N) X = int(X) A = input().split(" ") A = list(map(int, A)) print(ans(X, A))
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NONE WHILE VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NONE RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR 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 FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) ans = [] for _ in range(t): a = input().split(" ") n = int(a[0]) x = int(a[1]) arr = input().split(" ") for i in range(n): arr[i] = int(arr[i]) arr = sorted(arr, reverse=True) count = 0 mini = 1000000000 nos = 0 for i in range(n): nos += 1 mini = min(mini, arr[i]) if mini * nos >= x: count += 1 nos = 0 mini = 9999999999 ans.append(count) for i in range(len(ans)): print(ans[i])
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): n, k = map(int, input().split()) l = sorted(list(map(int, input().split()))) l = l[::-1] c = 0 j = 1 for i in range(n): s = l[i] * j if s >= k: s = 0 j = 1 c = c + 1 else: j += 1 print(c)
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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for i in range(int(input())): n, x = map(int, input().split()) arr = [int(i) for i in input().split()] arr.sort(reverse=True) count = 0 sum = 0 new = [] for i in arr: if i >= x: count += 1 else: new.append(i) if i * len(new) >= x: count += 1 new = [] print(count)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import stdin for _ in range(int(stdin.readline())): n, x = map(int, stdin.readline().split()) arr = sorted(list(map(int, stdin.readline().split())), reverse=True) i = val = cou = ans = 0 while i != n: cou += 1 val = arr[i] * cou if val >= x: ans += 1 cou = 0 i += 1 print(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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.buffer.readline t = int(input()) for _ in range(t): n, x = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] arr.sort(reverse=True) cnts = 0 start = -1 for i in range(n): if arr[i] * (i - start) >= x: cnts += 1 start = i print(cnts)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, m = map(int, input().split()) h, g = 1, 0 ar = sorted(map(int, input().split()), reverse=True) for x in range(n): if ar[x] * h >= m: g += 1 h = 1 else: h += 1 print(g)
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 VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ t = int(input()) for _ in range(t): n, X = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() mn = int(10000000000.0) size = 0 teams = 0 while len(arr): last = arr.pop() size += 1 mn = min(mn, last) if size * mn >= X: teams += 1 mn = int(10000000000.0) size = 0 print(teams)
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() dp = [0] * (n + 1) for i in range(n - 1, -1, -1): num = (x - 1) // a[i] + 1 if i + num <= n: dp[i] = max(1 + dp[i + num], dp[i + 1]) else: dp[i] = dp[i + 1] print(dp[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 EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys def get_line(): return list(map(int, sys.stdin.readline().strip().split())) def in1(): return int(input()) for _ in range(in1()): n, x = map(int, input().split()) a = get_line() d = {} c = 0 l = 0 for i in range(n): t1 = x // a[i] if x % a[i] != 0: t1 += 1 if t1 not in d.keys(): d[t1] = [a[i]] else: r = d[t1] r.append(a[i]) d[t1] = r b = sorted(d.items()) for i in range(len(b)): if b[i][0] == 0 or b[i][0] == 1: c += len(b[i][1]) else: t2 = len(b[i][1]) l += t2 if l >= b[i][0]: t1 = l // b[i][0] c += t1 l -= t1 * b[i][0] print(c)
IMPORT FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FOR 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 DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF VAR FUNC_CALL VAR ASSIGN VAR VAR LIST VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER NUMBER VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER VAR VAR VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) ans = 0 l = [] for i in range(n): if a[i] < x: l.append(a[i]) else: ans += 1 count = 0 l.sort() while l: k = l.pop() count += 1 if k * count >= x: ans += 1 count = 0 print(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 NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys try: t = int(input()) for _ in range(t): n, x = map(int, input().split()) l = [int(x) for x in input().split()] i = 0 l.sort(reverse=True) count = 0 while i < n: mn = l[i] c = 1 while i < n and mn * c < x: i += 1 if i < n: c += 1 mn = min(mn, l[i]) if mn * c >= x: count += 1 i += 1 print(count) except EOFError: pass
IMPORT 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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) lst = [int(x) for x in input().split()] lst = sorted(lst) group = 0 i = len(lst) - 1 while i > 0: ln = 1 while True: if ln * lst[i] >= x: group += 1 i -= 1 break else: ln += 1 if i != 0: i -= 1 else: break if i == 0 and lst[i] >= x: group += 1 print(group)
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 VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR NUMBER VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) ar = list(map(int, input().split())) c = 0 k = [] pos = 0 ar.sort(reverse=True) for i in range(n): if ar[i] >= x: c += 1 else: break k = ar[c:] pos = 0 for i in range(len(k)): if k[i] * (i + 1 - pos) >= x: c += 1 pos = i + 1 print(c)
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 NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): n, x = map(int, input().split()) l = list(map(int, input().split())) l.sort() c = 0 i = n - 1 while l and l[-1] >= x: l.pop() c += 1 i -= 1 while i >= 0: cur = l[i] count = 1 while i > -1 and cur * count < x: count += 1 i -= 1 if i == -1: break cur = l[i] if i < 0: break i -= 1 c += 1 print(c)
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 NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR NUMBER VAR EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER BIN_OP VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = [int(i) for i in input().split()] lst = [int(i) for i in input().split()][:n] lst.sort() k, tmp = 0, 1 for i in range(n - 1, -1, -1): if lst[i] * tmp >= x: k += 1 tmp = 1 else: tmp += 1 print(k)
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 VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = tuple(map(int, input().split())) arr = sorted(list(map(int, input().split()))) arr2 = [(x // i if n % i == 0 else x // i + 1) for i in arr] last, cnt = n, 0 for i in range(n - 1, -1, -1): if last - i >= arr2[i]: last = i cnt += 1 print(cnt)
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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def make_teams(n, x, skill): skill.sort(reverse=True) i = 0 groups = 0 while i != n: team = skill[i] mem = 1 while x > team * mem: mem += 1 i += 1 if i == n: return groups team = skill[i] groups += 1 i += 1 return groups t = int(input()) for i in range(t): n, x = map(int, input().split()) skill = list(map(int, input().split())) print(make_teams(n, x, skill))
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR RETURN VAR ASSIGN VAR VAR VAR VAR NUMBER VAR NUMBER 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): n, x = map(int, input().split()) l = list(map(int, input().split())) l.sort(reverse=True) c = 0 nl = list() for i in range(n): if l[i] >= x: c += 1 else: nl.append(l[i]) v = 1 for i in range(len(nl)): if nl[i] * v >= x: v = 1 c += 1 else: v += 1 print(c)
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for tt in range(t): n, d = input().split() n = int(n) d = int(d) x = input() a = x.split() for r in range(len(a)): a[r] = int(a[r]) a.sort(reverse=True) i = 1 s = 0 for j in range(0, len(a)): if a[j] * i >= d: s = s + 1 i = 1 else: i = i + 1 print(s)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR 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 VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.readline for _ in range(int(input())): n, x = map(int, input().split()) A = sorted(map(int, input().split()), reverse=True) c = 0 r = 0 for v in A: c += 1 if c * v >= x: r += 1 c = 0 print(r)
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def need(skill, x): if x % skill == 0: return x // skill else: return x // skill + 1 t = int(input()) for i in range(t): n, x = input().split() n = int(n) x = int(x) lista = input().split() for j in range(n): lista[j] = int(lista[j]) lista.sort() teams = 0 members = 0 i = n - 1 while i >= 0: if members >= need(lista[i], x) - 1: members -= need(lista[i], x) - 1 teams += 1 i -= 1 else: i -= 1 members += 1 print(teams)
FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) while t > 0: t -= 1 n, skill = map(int, input().split()) ppl = [int(x) for x in input().split()] ppl.sort() ppl = ppl[::-1] count, teams = 0, 0 for p in ppl: if p > skill: teams += 1 else: count += 1 if p * count >= skill: teams += 1 count = 0 print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.readline inp, ip = lambda: int(input()), lambda: [int(w) for w in input().split()] for _ in range(inp()): n, k = ip() x = ip() x.sort(reverse=True) ct = 0 prev = -1 for i in range(n): if x[i] >= k: ct += 1 continue if prev == -1: prev = i continue if (i - prev + 1) * x[i] >= k: ct += 1 prev = -1 print(ct)
IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR IF BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import stdin, stdout outputs = [] for __ in range(int(stdin.readline().strip())): n, x = map(int, stdin.readline().strip().split()) arr = list(map(int, stdin.readline().strip().split())) arr.sort() prev_size = 0 res = 0 while arr: prev_size += 1 if arr[-1] >= x: prev_size -= 1 arr.pop() res += 1 else: req = x // arr[-1] if x % arr[-1] == 0 else x // arr[-1] + 1 if req > prev_size: arr.pop() else: prev_size -= req arr.pop() res += 1 outputs.append(res) for output in outputs: stdout.write(f"{output}\n")
ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL 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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER IF VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER NUMBER BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys I = lambda: map(int, sys.stdin.readline().split()) pr = lambda x: sys.stdout.write(f"{x}\n") def solve(): n, x, c, l = *I(), 0, 0 a = sorted([*I()], reverse=True) for i, y in enumerate(a): if y * (i - l + 1) >= x: l = i + 1 c += 1 pr(c) def main(): for _ in range(*I()): solve() main()
IMPORT ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR LIST FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
dp = list() m = 0 def left_bound(x): m = len(dp) L = 0 R = m - 1 while L < R: M = L + R + 1 >> 1 if dp[M] >= x: R = M - 1 else: L = M if dp[L] < x: return L else: return -1 def right_bound(x): L = 0 R = len(dp) - 1 while L < R: M = L + R >> 1 if dp[M] <= x: L = M + 1 else: R = M if dp[L] > x: return L else: return len(dp) def amount(x): return right_bound(x) - left_bound(x) def solve(t): if not t: return dp.clear() n, x = map(int, input().split()) a = list(map(int, input().split())) for i in range(0, n): dp.append(x // a[i] + (not x % a[i] == 0)) m = len(dp) dp.sort() res = 0 cnt = 0 for i in range(0, m): if i > 0 and dp[i] == dp[i - 1]: continue res += (right_bound(dp[i]) - i + cnt) // dp[i] cnt = (right_bound(dp[i]) - i + cnt) % dp[i] print(int(res)) solve(t - 1) t = int(input()) solve(t)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR IF VAR VAR VAR RETURN VAR RETURN NUMBER 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 VAR IF VAR VAR VAR RETURN VAR RETURN FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR RETURN EXPR 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 NUMBER VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = [int(a) for a in input().split()] progs = [int(a) for a in input().split()] progs.sort() progs = reversed(progs) ans = 0 tsize = 0 for p in progs: tsize += 1 score = tsize * p if score >= x: tsize = 0 ans += 1 print(ans)
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 EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
a = int(input("")) for i in range(0, a): n, x = map(int, input().split()) skill = list(map(int, input().split())) skill.sort(reverse=True) i = 0 count = 0 ans = 0 while i < n: count = count + 1 p = count * skill[i] if p >= x: ans = ans + 1 count = 0 i = i + 1 print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def tell(l, a, min_s): c = 0 t = 0 l.sort(reverse=True) for i in range(a): if l[i] * c >= min_s: t += 1 c = 0 else: c += 1 if l[i] * c >= min_s: t += 1 c = 0 return t number_o_v = int(input()) for i in range(number_o_v): a, min_s = list(map(int, input().split(" "))) l = list(map(int, input().split(" "))) s = tell(l, a, min_s) print(s)
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER RETURN VAR 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 STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, m = map(int, input().split(" ")) l = list(map(int, input().split(" "))) l.sort() a = 0 c = 1 for i in range(n - 1, -1, -1): if l[i] * c >= m: a = a + 1 c = 1 else: c = c + 1 print(a)
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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() ans = 0 n -= 1 while n >= 0: tmp = 1 while arr[n] * tmp < x and n >= 0: n -= 1 tmp += 1 if arr[n] * tmp >= x and n >= 0: ans += 1 n -= 1 print(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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for t in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a, reverse=True) pref = [(0) for i in range(n)] for i in range(n): pref[i] = (x + a[i] - 1) // a[i] teams = 0 start = 0 for i in range(n): if i - start + 1 >= pref[i]: teams += 1 start = i + 1 print(teams)
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 VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def find(A, x): if min(A) >= x: return len(A) A = sorted(A)[::-1] ans = 0 for i in range(len(A)): if A[i] < x: break else: ans += 1 cur_len = 1 for j in range(i + 1, len(A)): cur_len += 1 if cur_len * A[j] >= x: ans += 1 cur_len = 0 return ans for _ in range(int(input())): n, x = list(map(int, input().strip().split())) A = list(map(int, input().strip().split())) print(find(A, x))
FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER RETURN VAR 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for i in range(int(input())): n, x = map(int, input().split()) a = sorted(list(map(int, input().split())), reverse=True) t = 0 y = 0 while len(a) > 0 and y <= len(a) - 1: if a[y] * (y + 1) >= x: t += 1 for b in range(y + 1): del a[0] y = 0 else: y += 1 print(t)
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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys sys.setrecursionlimit(10**5) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] for _ in range(II()): n, x = MI() aa = LI() ans = 0 cnt = 0 aa.sort(reverse=True) for a in aa: cnt += 1 if a * cnt >= x: ans += 1 cnt = 0 print(ans)
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
list_ans = [] for _ in range(int(input())): n, x = map(int, input().split()) list1 = list(map(int, input().split())) list1.sort(reverse=True) b = 0 ans = 0 for i in range(n): a = list1[i] b += 1 if a * b >= x: ans += 1 b = 0 list_ans.append(ans) print(*list_ans, sep="\n")
ASSIGN VAR LIST 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
T = int(input()) for t in range(0, T): array = [] n, x = map(int, input().split()) array = list(map(int, input().split())) array.sort(reverse=True) team = 0 member = 0 required = 0 for i in range(0, n): member = member + 1 if x % array[i] == 0: num = int(x / array[i]) - 1 else: num = int(x / array[i]) required = num + 1 if member == required: team = team + 1 member = 0 required = 0 print(team)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR LIST 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=True) ans, start = 0, 0 for i in range(n): if (i - start + 1) * a[i] >= x: start = i + 1 ans += 1 print(ans)
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 NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
T = int(input()) for t in range(T): line = input().split(" ") n, x = int(line[0]), int(line[1]) a = (int(val) for val in input().split(" ")) a = sorted(a) teams = 0 cand_min = 0 cand_num = 0 while len(a) > 0: cand_min = a.pop() cand_num += 1 if cand_min * cand_num >= x: teams += 1 cand_num = 0 print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys def rs(): return sys.stdin.readline().rstrip() def ri(): return int(sys.stdin.readline()) def ria(): return list(map(int, sys.stdin.readline().split())) def ws(s): sys.stdout.write(s) sys.stdout.write("\n") def wi(n): sys.stdout.write(str(n)) sys.stdout.write("\n") def wia(a, sep=" "): sys.stdout.write(sep.join([str(x) for x in a])) sys.stdout.write("\n") def can(t, n, x, a): cnt = 0 mx = 10**9 + 1 c = 0 mn = mx for i in range(n): c += 1 mn = min(mn, a[i]) if c * mn >= x: cnt += 1 c = 0 mn = mx if cnt >= t: return True return False def solve(n, x, a): a = sorted(a, reverse=True) lo = 0 hi = n + 1 while hi > lo + 1: mid = (lo + hi) // 2 if can(mid, n, x, a): lo = mid else: hi = mid return lo def main(): for _ in range(ri()): n, x = ria() a = ria() wi(solve(n, x, a)) main()
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING FUNC_DEF STRING EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for _ in range(t): l = list(map(int, input().split())) n, x = l[0], l[1] l = list(map(int, input().split())) l.sort(reverse=True) count = 0 key = 0 val = 0 for i in range(n): val += l[i] count += 1 if count * l[i] >= x: val = 0 count = 0 key += 1 print(key)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def single_trial(skills, x): rev_skills = sorted(skills, reverse=True) mem, count = 1, 0 for s in rev_skills: if s * mem >= x: count += 1 mem = 1 else: mem += 1 return count t = int(input()) trials = [] trial_skills = [] for i in range(t): [n, x] = [int(i) for i in input().split()] trials.append([n, x]) skills = [int(i) for i in input().split()] trial_skills.append(skills) for i in range(t): result = single_trial(trial_skills[i], trials[i][1]) print(result)
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def f(n, m): if n % m == 0: return n // m else: return n // m + 1 t = int(input()) while t > 0: t = t - 1 n, x = map(int, input().split()) a = input() A = list(map(int, list(a.split()))) A.sort() dp = [0] * n if f(x, A[n - 1]) <= 1: dp[n - 1] = 1 for i in range(n - 2, -1, -1): y = f(x, A[i]) if y < n - i: dp[i] = 1 + dp[i + y] elif y == n - i: dp[i] = 1 print(max(dp))
FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER 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 VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP NUMBER VAR BIN_OP VAR VAR IF VAR BIN_OP VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def test(a, n, x): a = sorted(a, reverse=True) cur, res = 1, 0 for i in a: if cur * i >= x: res += 1 cur = 0 cur += 1 return res t = int(input()) res = [0] * t for i in range(t): n, x = map(int, input().split()) a = list(map(int, input().strip().split()))[:n] res[i] = test(a, n, x) for i in range(t): print(res[i])
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER 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 FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, b = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() arr.reverse() p = 0 ct = 0 ans = 0 for i in range(n): p += arr[i] ct += 1 if ct * arr[i] >= b: ct = 0 p = 0 ans += 1 print(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 EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() a = a[::-1] ans = 0 count = 0 mi = 999999999999 for i in range(n): if count * mi >= x: ans += 1 count = 1 mi = a[i] else: count += 1 mi = a[i] if count * mi >= x: ans += 1 print(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 EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
tc = int(input()) for _ in range(tc): n, x = (int(x) for x in input().split()) arr = sorted([int(x) for x in input().split()], reverse=True) groups = 0 group_size = 1 while arr: v = arr.pop(0) if v >= x: groups += 1 elif v * group_size >= x: groups += 1 group_size = 1 else: group_size += 1 print(groups)
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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys lines = [] for line in sys.stdin: if "exit" == line.rstrip().lower(): break lines.append(line) t = int(lines[0]) for case in range(1, 2 * t + 1, 2): l = [int(x) for x in lines[case].split(" ")] n = l[0] x = l[1] a = [int(x) for x in lines[case + 1].split(" ")] a = sorted(a, reverse=True) num_teams = 0 np = 1 i = 0 while i < len(a): if a[i] * np >= x: num_teams += 1 np = 0 i += 1 np += 1 print(num_teams)
IMPORT ASSIGN VAR LIST FOR VAR VAR IF STRING FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def merge(arr, l, m, r): n1 = m - l + 1 n2 = r - m L = [0] * n1 R = [0] * n2 for i in range(0, n1): L[i] = arr[l + i] for j in range(0, n2): R[j] = arr[m + 1 + j] i = 0 j = 0 k = l while i < n1 and j < n2: if L[i] <= R[j]: arr[k] = L[i] i += 1 else: arr[k] = R[j] j += 1 k += 1 while i < n1: arr[k] = L[i] i += 1 k += 1 while j < n2: arr[k] = R[j] j += 1 k += 1 def mergeSort(arr, l, r): if l < r: m = (l + (r - 1)) // 2 mergeSort(arr, l, m) mergeSort(arr, m + 1, r) merge(arr, l, m, r) t = int(input()) for i in range(t): n, x = list(map(int, input().split())) arr = list(map(int, input().split())) mergeSort(arr, 0, n - 1) lis = [] for j in range(n): a = x // arr[j] b = x % arr[j] if b != 0: a += 1 lis.append(a) a = [0] dp = [0] * (n + 1) ans = 0 for j in range(2, n + 2): if lis[-j + 1] > j - a[-1] - 1: dp[-j] = dp[-j + 1] else: ans += 1 dp[-j] = ans a.append(j - 1) print(dp[0])
FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER FUNC_DEF IF VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR 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 EXPR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def solve(): n, x = map(int, input().split()) lst = list(map(int, input().split())) lst2 = [[i, (x + i - 1) // i] for i in lst] lst2.sort(reverse=True) havepeop = 0 ans = 0 for a, i in lst2: havepeop += 1 if havepeop >= i: ans += 1 havepeop -= i print(ans) for i in range(int(input())): solve()
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 LIST VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import gettrace, stdin if gettrace(): inputi = input else: def input(): return next(stdin)[:-1] def inputi(): return stdin.buffer.readline() def solve(): n, x = map(int, inputi().split()) aa = [int(a) for a in inputi().split()] aa.sort() np = 0 res = 0 while aa: np += 1 a = aa.pop() if a * np >= x: res += 1 np = 0 print(res) def main(): t = int(inputi()) for _ in range(t): solve() main()
IF FUNC_CALL VAR ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) while t > 0: t -= 1 n, x = input().split() n, x = int(n), int(x) ar = [int(op) for op in input().split()] ar = list(reversed(sorted(ar))) k = 0 ln = 1 for i in range(len(ar)): if ar[i] * ln >= x: k += 1 ln = 1 else: ln += 1 print(k)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for a in range(0, t): m = list(map(int, str(input()).split(" "))) members = list(map(int, str(input()).split(" "))) members.sort(reverse=True) minLim = m[1] curAmount = 1 ans = 0 for i in range(0, len(members)): if curAmount * members[i] >= minLim: ans += 1 curAmount = 0 curAmount += 1 print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def CreateTheTeams(n, x, a): c = 0 a.sort(reverse=True) l = 0 for i in range(n): l = l + 1 if a[i] * l >= x: c = c + 1 l = 0 return c t = int(input()) for tt in range(t): nx = list(map(int, input().rstrip().split())) a = list(map(int, input().rstrip().split())) ans = CreateTheTeams(nx[0], nx[1], a) print(ans)
FUNC_DEF ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import * input = stdin.readline t = int(input()) for _ in range(t): n, k = map(int, input().split()) p = list(map(int, input().split())) l = [] for i in p: x = k // i if k % i != 0: x += 1 l.append(x) l.sort() c = 0 i = 0 left = 0 while i < n: j = i + l[i] - 1 if j < n and l[j] == l[i]: c += 1 i = j + 1 elif left >= l[i] - 1: c += 1 left -= l[i] - 1 i += 1 else: left += 1 i += 1 print(c)
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 ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER IF VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR VAR NUMBER VAR NUMBER VAR BIN_OP VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
ans = "" for _ in range(int(input())): n, x = map(int, input().split()) a = sorted(list(map(int, input().split()))) i = 0 j = n - 1 cnt = 0 p = 1 m = a[j] while j > -1: if p * m >= x: cnt += 1 p = 0 j -= 1 p += 1 m = a[j] ans += str(cnt) + "\n" print(ans)
ASSIGN VAR STRING 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR WHILE VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
from sys import maxsize for _ in range(int(input())): n, x = list(map(int, input().split())) s = list(map(int, input().split())) s.sort() c = i = 0 arr = [] m = maxsize while s: t = s.pop() if t >= x: c += 1 else: i += 1 m = min(m, t) if m * i >= x: c += 1 i = 0 print(c)
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 EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR IF VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def compute(N, limit, lineup): counter = lineup[N - 1] ans = 0 multiplier = 1 j = 1 for i in range(N, 0, -1): if counter >= limit: ans += 1 counter = lineup[N - 1 - j] multiplier = 1 else: multiplier += 1 counter = lineup[N - 1 - j] * multiplier j += 1 return ans for i in range(int(input())): N, limit = [int(x) for x in input().split()] lineup = sorted([int(x) for x in input().split()]) print(compute(N, limit, lineup))
FUNC_DEF ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR NUMBER RETURN VAR 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = list(map(int, input().split())) arr = list(map(int, input().split())) arr.sort(reverse=True) haveNow = 1 teams = 0 for i in range(1, n): if haveNow * arr[i - 1] >= x: teams += 1 haveNow = 1 else: haveNow += 1 if haveNow * arr[-1] >= x: teams += 1 print(teams)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = map(int, input().split()) a = [*map(int, input().split())] a.sort(reverse=True) ans = team_size_rn = 0 min_rn = 1000000000.0 for i in a: min_rn = min(min_rn, i) team_size_rn += 1 if team_size_rn * min_rn >= x: ans += 1 team_size_rn = 0 min_rn = 1000000000.0 print(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 LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.readline def inp(): return int(input()) def inlt(): return list(map(int, input().split())) def insr(): s = input() return s[: len(s) - 1] def invr(): return map(int, input().split()) def solve(dim, t): n, x = dim t.sort() t.reverse() teams = 0 curr = 0 players = 0 for i in range(n): players += 1 curr = players * t[i] if curr >= x: teams += 1 curr = 0 players = 0 print(teams) T = inp() dims = [] tests = [] for _ in range(T): dims.append(inlt()) tests.append(inlt()) for i in range(T): solve(dims[i], tests[i])
IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for t in range(int(input())): n, x = map(int, input().split()) arr = list(map(int, input().split())) arr.sort(reverse=True) count = 0 i = 0 prog = 0 minim = 10**10 while i < n: ele = arr[i] prog += 1 minim = min(minim, ele) if prog * minim >= x: count += 1 prog = 0 minim = 10**10 i += 1 print(count)
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input("")) mat = [] nx = [] for i in range(t): nx.append(list(map(int, input().split()))) mat.append(list(map(int, input().split()))) for i in range(t): h = nx[i] tst = mat[i] n = h[0] x = h[1] tst1 = sorted(tst, reverse=True) num = 0 cnt = 0 for j in range(len(tst1)): num = num + 1 if num * tst1[j] >= x: cnt = cnt + 1 num = 0 print(cnt)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for i in range(t): n, x = [int(s) for s in input().split()] array = [int(s) for s in input().split()] array = sorted(array) new = [] ans = 0 for j in range(len(array)): if array[j] < x: new.append(array[j]) else: ans += 1 j = 0 tmp = 0 tmp_ans = 0 new = new[::-1] while j < len(new): tmp += 1 tmp_ans = new[j] * tmp if tmp_ans >= x: tmp = 0 tmp_ans = 0 ans += 1 j += 1 print(ans)
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 VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
for _ in range(int(input())): n, x = list(map(int, input().split())) a = list(map(int, input().split())) d = [] for i in a: if x % i == 0: d.append(x // i) else: d.append((x + i - 1) // i) ans, need, k = 0, -1, 0 d.sort() for i in d: if need == 0: ans += 1 k = 0 if i > need: need = i - k k += 1 need -= 1 if need == 0: ans += 1 print(ans)
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 LIST FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def solve(skills, X): skills.sort(reverse=True) ans = 0 w_min = float("inf") w_count = 0 for x in skills: w_min = x w_count += 1 if w_min * w_count >= X: ans += 1 w_min = float("inf") w_count = 0 return ans def main(): T = int(input()) for _ in range(T): _, X = list(map(int, input().split())) A = list(map(int, input().split())) ans = solve(A, X) print(ans) main()
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER RETURN VAR FUNC_DEF 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 VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
import sys input = sys.stdin.readline MOD = 1000000007 MOD2 = 998244353 ii = lambda: int(input().strip("\n")) si = lambda: input().strip("\n") dgl = lambda: list(map(int, input().strip("\n"))) f = lambda: map(int, input().strip("\n").split()) il = lambda: list(map(int, input().strip("\n").split())) ls = lambda: list(input().strip("\n")) lsc = lambda: list(input().strip("\n").split(" ")) lsi = lambda: [int(i) for i in ls()] let = "abcdefghijklmnopqrstuvwxyz" for _ in range(ii()): n, x = f() l = sorted(il(), reverse=True) ans = 0 cnt, temp = 0, 0 for i in range(n): cnt += 1 temp = l[i] if temp * cnt >= x: cnt = 0 ans += 1 print(ans)
IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
def createTeam(s, x): s.sort() j = len(s) - 1 num = 0 while s: if s[-1] >= x: num += 1 s.pop() else: break if len(s) > 1: put = 0 while s: m = s.pop() put += 1 if m * put >= x: num += 1 put = 0 return num t = int(input()) for i in range(t): n, x = map(int, input().split()) s = list(map(int, input().split())) print(createTeam(s, x))
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR IF VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for test in range(t): teams = 0 n, x = input().split() n, x = int(n), int(x) s = input().split() for q in range(n): s[q] = int(s[q]) s.sort(reverse=True) team = [] for i in s: team.append(i) if team[-1] * len(team) >= x: teams += 1 team = [] print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN 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 FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR
There are $n$ programmers that you want to split into several non-empty teams. The skill of the $i$-th programmer is $a_i$. You want to assemble the maximum number of teams from them. There is a restriction for each team: the number of programmers in the team multiplied by the minimum skill among all programmers in the team must be at least $x$. Each programmer should belong to at most one team. Some programmers may be left without a team. Calculate the maximum number of teams that you can assemble. -----Input----- The first line contains the integer $t$ ($1 \le t \le 1000$)Β β€” the number of test cases. The first line of each test case contains two integers $n$ and $x$ ($1 \le n \le 10^5; 1 \le x \le 10^9$)Β β€” the number of programmers and the restriction of team skill respectively. The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the skill of the $i$-th programmer. The sum of $n$ over all inputs does not exceed $10^5$. -----Output----- For each test case print one integer β€” the maximum number of teams that you can assemble. -----Example----- Input 3 5 10 7 11 2 9 5 4 8 2 4 2 3 4 11 1 3 3 7 Output 2 1 0
t = int(input()) for a0 in range(t): l = [int(i) for i in input().split()] n = l[0] x = l[1] l1 = [int(i) for i in input().split()] l1.sort() l1.reverse() curr = 1 a = 0 for i in l1: if curr * i >= x: a += 1 curr = 0 curr += 1 print(a)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR