description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
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: n, x = [int(a) for a in input().split()] skill = [int(a) for a in input().split()] for i in range(n): if x % skill[i] == 0: skill[i] = x / skill[i] - 1 else: skill[i] = x // skill[i] skill.sort() count = 0 remaining_num = 0 for i in range(n): if skill[i] == 0: count += 1 elif remaining_num == skill[i]: count += 1 remaining_num = 0 else: remaining_num += 1 print(count) t -= 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER 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
for kek in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() for i in range(n): f = 0 if x % a[i] != 0: f += 1 a[i] = x // a[i] + f a.sort() ans = 0 com = 1 for i in a: if i == com: ans += 1 com = 1 else: com += 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR 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
for _ in range(int(input())): n, x = map(int, input().split()) l = list(map(int, input().split())) l = sorted(l, reverse=True) ans = 0 i = 0 while i < len(l): if l[i] >= x: ans += 1 else: count = 1 while count * l[i] < x and i < len(l) - 1: i += 1 count += 1 if count * l[i] >= x: ans += 1 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR 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())] a = [*map(int, input().split())] teams = 0 a.sort(reverse=True) pointer = 0 case = False for i in range(0, n): if a[i] < x: case = True l = i break else: teams += 1 if teams == n: print(teams) elif case: pointer = l ans = 0 mi = 10**9 count = 0 for j in range(pointer, n): ans += a[j] count += 1 if a[j] < mi: mi = a[j] if count * mi >= x: teams += 1 ans = 0 mi = 10**9 count = 0 print(teams) else: pointer = 0 ans = 0 mi = 10**9 count = 0 for j in range(pointer, n): ans += a[j] count += 1 if a[j] < mi: mi = a[j] if count * mi >= x: teams += 1 ans = 0 mi = 10**9 count = 0 print(teams)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR IF VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER 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): s = input() n, k = [int(x) for x in s.split()] s = input() arr = [int(x) for x in s.split()] arr.sort() count = 0 j = 1 for i in range(n - 1, -1, -1): if arr[i] * j >= k: count += 1 j = 1 else: j += 1 print(count)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR 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 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
from sys import stdin inp = lambda: stdin.readline().strip() t = int(inp()) for _ in range(t): n, x = [int(x) for x in inp().split()] a = [int(x) for x in inp().split()] a.sort(reverse=True) team = [] minimum = 10**9 + 1 ans = 0 for i in a: team.append(i) minimum = min(i, minimum) if minimum * len(team) >= x: ans += 1 team = [] minimum = 10**9 + 1 print(ans)
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER 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 z in range(int(input())): n, x = map(int, input().split()) a = sorted(map(int, input().split()), reverse=True) c = i = 0 while i < n: m = l = 0 while i < n and m < x: l += 1 m = l * a[i] i += 1 if m >= x: c += 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 NUMBER ASSIGN VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR NUMBER WHILE VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR NUMBER IF 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
import sys def input(): return sys.stdin.readline().rstrip() def input_split(): return [int(i) for i in input().split()] testCases = int(input()) answers = [] for _ in range(testCases): n, x = input_split() arr = input_split() arr.sort() arr.reverse() num_teams = 0 done = False current = 0 while current < n: count = 1 while arr[current] * count < x: current += 1 count += 1 if current >= n: done = True break if done: break num_teams += 1 current += 1 ans = num_teams answers.append(ans) print(*answers, sep="\n")
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR 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
def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(" "))) def solve(): n, x = read_ints() a = read_ints() a.sort() size = 0 teams = 0 while len(a) != 0: if a.pop() * (size + 1) < x: size += 1 else: size = 0 teams += 1 return teams T = read_int() for _ in range(T): print(solve())
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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 def r(): return stdin.readline().strip() def r_t(tp): return map(tp, r().strip().split()) def r_l(tp): return list(r_t(tp)) def solve(n, x, A): A.sort(reverse=True) i, ans = 0, 0 while i < n and A[i] >= x: ans, i = ans + 1, i + 1 ini = i - 1 while i < n: if (i - ini) * A[i] >= x: ans, ini = ans + 1, i i += 1 return ans def main(): cases = int(r()) for case in range(cases): n, x = r_t(int) A = r_l(int) print(solve(n, x, A)) main()
FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR IF BIN_OP BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER VAR 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 VAR ASSIGN VAR FUNC_CALL VAR 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
for _ in range(int(input())): x, y = [int(a) for a in input().split()] ar = list(map(int, input().split()))[:x] ar.sort(reverse=True) s = 0 k = 0 for i in range(x): if ar[i] >= y: s = s + 1 elif (k + 1) * ar[i] >= y: k = 0 s = s + 1 else: k = k + 1 print(s)
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 FUNC_CALL FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP 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 f = lambda: list(map(int, input().split())) res = [] for _ in range(int(input())): n, x = f() a = sorted(f(), reverse=True) c = 1 ans = 0 for i in a: if i * c >= x: ans += 1 c = 0 c += 1 res.append(ans) print("\n".join(map(str, res)))
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER 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 EXPR FUNC_CALL VAR FUNC_CALL STRING 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()) l = list(map(int, input().split())) l.sort() m = 10**9 + 1 k = 0 cnt = 0 while len(l) > 0: s = l.pop() k = k + 1 if s < m: m = s if k * m >= x: cnt = cnt + 1 k = 0 m = 10**9 + 1 print(cnt)
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 BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER 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 mi(): return map(int, input().split()) def ii(): return int(input()) def li(): return list(map(int, input().split())) def si(): return input().split() t = ii() for _ in range(t): n, x = mi() a = li() a.sort(reverse=True) ans = 0 ind = -1 for i in range(n): if a[i] * (i - ind) >= x: ans += 1 ind = i print(ans)
FUNC_DEF RETURN FUNC_CALL VAR VAR 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 RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR 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 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
t = int(input()) for i in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() m = 1 count, j = 0, 0 a = a[::-1] while j <= len(a) - 1: if a[j] * m >= x: count += 1 m = 1 j += m else: m += 1 j += 1 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER 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
def teams(n, x, a): A = sorted(a, reverse=True) cnt, cur = 0, 1 for i in A: if i * cur >= x: cnt += 1 cur = 0 cur += 1 return cnt t = int(input()) for _ in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) print(teams(n, x, a))
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 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
def solve(arr, x): arr.sort(reverse=True) cnt = 0 temp = [] i = 0 while i < len(arr): temp.append(arr[i]) if temp[-1] * len(temp) >= x: cnt += 1 temp.clear() i += 1 else: i += 1 print(cnt) def main(): t = int(input()) for i in range(t): n, x = list(map(int, input().split())) solve(list(map(int, input().split())), x) main()
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR 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 EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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 for _ in range(int(input())): n, k = map(int, stdin.readline().rstrip().split(" ")) l = list(map(int, stdin.readline().rstrip().split(" "))) l.sort(reverse=True) le = 0 t = 0 singles = True for i in range(n): if singles: if l[i] >= k: t += 1 else: singles = False le = 1 else: le += 1 if l[i] * le >= k: t += 1 le = 0 print(t)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER 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 = input() t = int(t) def solve(n, x, arr): arr = sorted(arr, reverse=True) n_teams = 0 cnt = 0 while cnt < n: if arr[cnt] >= x: n_teams += 1 cnt += 1 else: cpk = 1 while cnt < n and arr[cnt] * cpk < x: cpk += 1 cnt += 1 if cnt < n and arr[cnt] * cpk >= x: n_teams += 1 cnt += 1 else: break print(n_teams) return for i in range(t): n, x = map(int, input().split()) arr = list(map(int, input().split())) solve(n, x, arr)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN 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 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
import sys input = lambda: sys.stdin.readline().rstrip() for _ in range(int(input())): n, x = map(int, input().split()) a = sorted([int(x) for x in input().split()]) ans = 0 while a and a[-1] >= x: ans += 1 a.pop() i = len(a) - 1 l = 1 while i >= 0: if a[i] * l >= x: ans += 1 l = 0 i -= 1 l += 1 print(ans)
IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR 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
def solve_testcase(n: int, x: int, skills: list): skills = sorted(skills, reverse=True) new_team_members = 0 teams = 0 team_size = 1 min_skill = (x - 1) // team_size + 1 for i in range(n): new_team_members += 1 if new_team_members == team_size: if skills[i] >= min_skill: teams += 1 new_team_members = 0 else: team_size += 1 min_skill = (x - 1) // team_size + 1 print(teams) def input_testcase(): n, x = [int(term) for term in input().split()] skills = [int(term) for term in input().split()] return n, x, skills t = int(input()) for i in range(t): solve_testcase(*input_testcase())
FUNC_DEF VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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(0, t): nx = input() nx = nx.split(" ") n = int(nx[0]) x = int(nx[1]) a = input() a = a.split(" ") a = list(map(int, a)) a.sort(reverse=True) teams = 0 j = 1 for i in range(0, len(a)): score = j * a[i] if score >= x: teams += 1 j = 1 else: j += 1 print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL 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 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
for _ in range(int(input())): n, x = map(int, input().split()) lis = list(map(int, input().split())) lis = sorted(lis) count = 0 while lis: ncount = 0 mi = 1000000000.0 while lis and ncount * mi < x: mi = lis.pop() ncount += 1 if ncount * mi >= x: count += 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 ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER 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
for _ in range(int(input())): n, x = map(int, input().split()) arr = list(map(int, input().split())) arr = sorted(arr, reverse=True) arr.insert(0, -1) temp = 0 count = 0 for i in range(1, n + 1): if arr[i] * (i - temp) >= x: count += 1 temp = i 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 ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER 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
def main(): n, m = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=True) ans = 0 cnt = 0 i = 0 while i < n: cnt += 1 if cnt * a[i] >= m: ans += 1 cnt = 0 i += 1 print(ans) return def test(): t = int(input()) while t: main() t -= 1 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR EXPR FUNC_CALL VAR VAR NUMBER 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
def f(i): i = int(i) return x // i + (x % i != 0) for w in range(int(input())): n, x = map(int, input().strip().split()) brr = list(map(f, input().strip().split())) brr.sort() value, c = 0, 0 for i in range(n): c += 1 if brr[i] <= c: value += 1 c -= brr[i] print(value)
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR RETURN BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR VAR VAR NUMBER 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
n = int(input()) for i in range(0, n): o = input().rstrip().split(" ") p = input().rstrip().split(" ") x = int(o[1]) p.sort(key=int, reverse=True) ans = 0 tot = 0 for j in range(0, len(p)): A = int(p[j]) ans += 1 if ans * A >= x: ans = 0 tot += 1 print(tot)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER 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
t = int(input()) while t > 0: t -= 1 n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=True) k = 1 team = 0 for i in range(len(a)): if a[i] * k < x: k += 1 else: team += 1 k = 1 print(team)
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 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 FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER 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 = map(int, input().split(" ")) num = input().split(" ") nums = [] for j in num: nums.append(int(j)) nums.sort(reverse=True) ans = 0 length = 1 for j in range(n): if nums[j] * length >= x: ans += 1 length = 1 else: length += 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 STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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
for t in range(int(input())): n, x = map(int, input().split()) a = [] ans = 0 for num in input().split(): if int(num) >= x: ans += 1 else: a.append(int(num)) a.sort(reverse=True) nop = 1 for z in range(len(a)): val = nop * a[z] if val >= x: ans += 1 nop = 0 nop += 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 LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR 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
from sys import stdin def iinput(): return int(stdin.readline()) def minput(): return map(int, stdin.readline().split()) def linput(): return list(map(int, stdin.readline().split())) t = iinput() while t: t -= 1 n, x = minput() a = linput() a.sort(reverse=True) i = 0 temp = 0 m = 0 cnt = 0 while i < n: m += 1 temp = a[i] if m * temp >= x: cnt += 1 m = 0 i += 1 print(cnt)
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 ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER ASSIGN VAR 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
from sys import stdin input = stdin.readline def solve(): _, x = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse=True) ans = 0 cnt = 0 for i in a: k = (x + i - 1) // i if cnt + 1 >= k: cnt -= k - 1 ans += 1 else: cnt += 1 print(ans) def main(): t = int(input()) for _ in range(t): solve() main()
ASSIGN VAR VAR 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR IF BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR NUMBER 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
import sys def use_fast_io(): import sys class InputStorage: def __init__(self, lines): lines.reverse() self.lines = lines def input_func(self): if self.lines: return self.lines.pop() else: return "" input_storage_obj = InputStorage(sys.stdin.readlines()) return input_storage_obj.input_func input = use_fast_io() t = int(input()) for __ in range(t): n, x = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() team_count = 0 while arr: cur_count = 1 cur_val = arr.pop() while arr and cur_count * cur_val < x: cur_val = arr.pop() cur_count += 1 if cur_count * cur_val >= x: team_count += 1 print(team_count)
IMPORT FUNC_DEF IMPORT CLASS_DEF FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_DEF IF VAR RETURN FUNC_CALL VAR RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR RETURN VAR ASSIGN VAR FUNC_CALL 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 NUMBER WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR WHILE VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER 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
t = int(input()) for _ in range(t): n, x = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() ans = [0] * (n + 1) for i in range(n - 1, -1, -1): req = 0 if x % arr[i] == 0: req = int(x / arr[i]) else: req = int(x / arr[i]) + 1 if i + req > n: continue ans[i] = 1 + ans[i + req] print(max(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 ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR VAR BIN_OP NUMBER VAR BIN_OP VAR VAR 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
for testcase in range(int(input())): n, x = map(int, input().split()) a = list(sorted(int(i) for i in input().split())) dp = [0] * (n + 2) for i in range(1, n + 1): dp[i] = max(dp[i], dp[i - 1]) required = (x + a[i - 1] - 1) // a[i - 1] if i + required <= n + 1: dp[i + required] = max(dp[i + required], dp[i] + 1) dp[n + 1] = max(dp[n], dp[n + 1]) print(dp[n + 1])
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP 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 f(a, b): if a % b == 0: return a // b else: return a // b + 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() table = [0] * n b = [0] * n for i in range(n): b[i] = f(x, A[i]) for i in range(n - 1, -1, -1): if b[i] > n - i: table[i] = 0 elif b[i] == n - i: table[i] = 1 else: table[i] = 1 + table[i + b[i]] print(max(table))
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 ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR NUMBER IF VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP NUMBER VAR BIN_OP VAR VAR VAR 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 solve(a, n, x): a.sort(reverse=True) cnt = 0 i = 0 while i < n: flag = True if a[i] >= x: cnt += 1 else: curr = 0 mx = a[i] while i < n and curr * mx < x: flag = False curr += 1 mx = min(a[i], mx) i += 1 if curr * mx >= x: cnt += 1 if flag: i += 1 return cnt t = int(input()) for _ in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) print(solve(a, n, x))
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER IF VAR 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
for _ in range(int(input())): a = input().split() n = int(a[0]) x = int(a[1]) A = list(map(int, input().split())) A.sort(reverse=True) lastmin = A[0] c = 0 lasti = 0 for i in range(1, n + 1): lastmin = min(lastmin, A[i - 1]) if (i - lasti) * lastmin >= x: c += 1 lasti = i lastmin = 10**10 print(c)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP NUMBER 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())) a.sort() ans = 0 last = n for i in range(n - 1, -1, -1): if x % a[i] == 0: b = x // a[i] else: b = x // a[i] + 1 if last - i >= b: ans += 1 last -= b 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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER 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, x = map(int, input().split()) lst = sorted(list(map(int, input().split())), reverse=True) mini = lst[0] count = 0 l = 1 for i in range(1, n): if mini * l >= x: count += 1 mini = lst[i] l = 1 else: mini = min(mini, lst[i]) l += 1 if mini * l >= x: count += 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER 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
for _ in " " * int(input()): a, b = map(int, input().split()) z = sorted(map(int, input().split()), reverse=True) s = c = 0 for i in range(a): c += 1 if c * z[i] >= b: s += 1 c = 0 print(s)
FOR VAR BIN_OP STRING 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 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
def function(n, x, nums): if n == 0: return 0 nums1 = sorted(nums, reverse=True) count = 0 l = [] c = 1 for j in nums1: if j * c >= x: count += 1 c = 0 c += 1 return count t = int(input()) for k1 in range(t): l = list(map(int, input().rstrip().split())) n = l[0] x = l[1] nums = list(map(int, input().rstrip().split())) print(function(n, x, nums))
FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER 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 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 q in range(t): s = input().split() n = int(s[0]) x = int(s[1]) s = input().split() for j in range(n): s[j] = int(s[j]) s.sort(reverse=True) l = [] for j in range(n): if x % s[j]: l.append(x // s[j] + 1) else: l.append(x // s[j]) a = 0 b = 0 i = 0 sum = 0 while i < n: if l[i] <= b - a + 1: b += 1 a = b sum += 1 else: b += 1 i += 1 print(sum)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN 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
import sys input = sys.stdin.buffer.readline def solution(): for _ in range(int(input())): n, m = map(int, input().split()) l = list(map(int, input().split())) l.sort() a = [] for i in range(n): x = m // l[i] if x * l[i] < m: x += 1 a.append(x - 1) cnt = 0 ans = 0 for i in range(n - 1, -1, -1): if a[i] <= cnt: cnt = 0 ans += 1 else: cnt += 1 print(ans) solution()
IMPORT ASSIGN VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER 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
t = int(input()) for foo in range(t): l = list(map(lambda x: int(x), input().strip().split(" "))) n, x = l[0], l[1] a = list(map(lambda x: int(x), input().strip().split(" "))) a.sort() ans = len([_ for _ in a if _ >= x]) if ans > 0: a = a[:-ans] if a == []: print(ans) continue nowlst = [] for i in range(len(a) - 1, -1, -1): nowlst.append(a[i]) if len(nowlst) * nowlst[-1] >= x: ans += 1 nowlst = [] print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR IF VAR LIST EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR NUMBER 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
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) tc = 0 a.sort(reverse=True) mi = 1000000000 i = 0 fg = 0 ct = 0 while i < n: if a[i] >= x: tc += 1 elif a[i] < x: if fg == 0: ct = 1 mi = a[i] fg = 1 elif fg == 1: ct += 1 mi = min(mi, a[i]) if ct * mi >= x: fg = 0 tc += 1 ct = 0 i += 1 print(tc)
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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN 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
for _ in range(int(input())): u, v = list(map(int, input().split())), list(map(int, input().split())) x = u[1] v.sort() ans = 0 for i in reversed(v): if i >= x: ans += 1 v.pop() else: break minsf = 10**9 + 1 cnt = 0 for i in reversed(v): minsf = min(minsf, i) cnt += 1 if minsf * cnt >= x: ans += 1 minsf = 10**9 + 1 cnt = 0 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER 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 solve(): t = int(input()) for _ in range(t): n, x = map(int, input().split()) S = [int(y) for y in input().split()] S.sort(reverse=True) team, cnt = 0, 0 for s in S: cnt += 1 if s * cnt >= x: team += 1 cnt = 0 print(team) solve()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER 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
for _ in range(int(input())): n, x = list(map(int, input().split())) mass = list(map(int, input().split())) mass = sorted(mass, reverse=True) buff = [] ans = 0 for item in mass: buff.append(item) if len(buff) * item >= x: buff = [] 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 FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR VAR ASSIGN VAR LIST 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()) ls = sorted(list(map(int, input().split())), reverse=True) ans = 0 team = [] for i in ls: if i >= x: ans += 1 else: team.append(i) if len(team) != 0: if team[-1] * len(team) >= x: ans += 1 team = [] 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER 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
def main(): for _ in range(int(input())): n, x = map(int, input().split()) arr = sorted(list(map(int, input().split()))) i = 0 j = n - 1 cnt = 0 curr = 1 while j - curr + 1 >= 0: if arr[j - curr + 1] * curr >= x: cnt += 1 j -= curr else: curr += 1 print(cnt) main()
FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 WHILE BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR NUMBER VAR VAR VAR NUMBER 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
def solve(): n, x = [int(x) for x in input().split()] skills = sorted([int(x) for x in input().split()], reverse=True) size = 0 ans = 0 for e in skills: if e * (size + 1) >= x: ans += 1 size = 0 else: size += 1 return ans T = int(input()) for case in range(T): print(solve())
FUNC_DEF 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 FOR VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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 def get(): return stdin.readline().strip() def getf(): return [int(i) for i in get().split()] def put(a, end="\n"): stdout.write(str(a) + end) def putf(a, sep=" ", end="\n"): stdout.write(sep.join(map(str, a)) + end) def solve(a, n, x): r = n ans = 0 for i in range(n - 1, -1, -1): if a[i] * (r - i) >= x: r = i ans += 1 return ans def main(): t = int(get()) for i in range(t): n, x = getf() a = getf() put(solve(sorted(a), n, x)) main()
FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_DEF STRING STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR 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 ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR 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 i in range(t): n, x = map(int, input().split()) l = [] l = [int(num) for num in input().split()] l.sort(reverse=True) m, g = 1, 0 for k in range(n): if l[k] * m >= x: g = g + 1 m = 1 else: m = m + 1 print(g)
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 LIST ASSIGN VAR FUNC_CALL VAR 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 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
t = int(input()) for _ in range(t): n, x = map(int, input().split()) a = list(map(lambda y: (x - 1) // int(y) + 1, input().split())) a.sort() cnt = 0 ans = 0 for k in a: cnt += 1 if k <= cnt: cnt = 0 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 BIN_OP BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER 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
for _ in range(int(input())): m, n = map(int, input().split()) c = 0 d = 0 l = [int(p) for p in input().split()] l.sort(reverse=True) for i in range(m): if l[i] >= n: c += 1 continue else: d += 1 if l[i] * d >= n: c += 1 d = 0 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR 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 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 helper(arr, n, x): arr.sort(reverse=True) count, teams = 1, 0 for i in range(n): if arr[i] * count >= x: teams += 1 count = 1 continue count += 1 return teams test = int(input()) for i in range(test): n, x = list(map(int, input().split())) arr = list(map(int, input().split())) ans = helper(arr, n, x) print(ans)
FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN 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 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 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 problemA(): n = int(input()) l = list(map(int, input().split())) i = 0 while i < n - 1 and l[i] > l[i + 1]: i += 1 if i == n - 1: print("NO") return j = i + 1 while j < n - 1 and l[j] < l[j + 1]: j += 1 if j == n - 1: print("NO") return print("YES") print(i + 1, j + 1, j + 2) def problemB(): s = input().strip() a = [0] * 3 for i in s: if i == "R": a[0] += 1 elif i == "S": a[1] += 1 else: a[2] += 1 m = max(a) if a[0] == m: print("P" * sum(a)) elif a[1] == m: print("R" * sum(a)) else: print("S" * sum(a)) def problemC(): a, b = list(map(int, input().split())) l = list(map(int, input().split())) l.sort(reverse=True) n = 0 t = 0 for i in range(a): n += 1 if l[i] * n >= b: t += 1 n = 0 print(t) cases = int(input()) for _ in range(cases): problemC()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR IF VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR FUNC_DEF 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 VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN 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
def sint(): return int(input()) def sints(): return map(int, input().split()) def sara(): return list(map(int, input().split())) def sstr(): s = input() return list(s[: len(s)]) def main(): tt = sint() while tt: tt -= 1 n, x = sints() ara = sara() ara.sort() i = n - 1 cnt = 0 while i >= 0: t = 0 while i >= 0: t += 1 if ara[i] * t >= x: cnt += 1 t = 0 i -= 1 if t == 0: break print(cnt) main()
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 ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR NUMBER 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
input_length = int(input()) while input_length != 0: num_string = str(input()) n, x = tuple(num_string.split()) n, x = int(n), int(x) the_string = str(input()) the_string_array = the_string.split() the_string_array = [int(x) for x in the_string_array] input_length -= 1 the_string_array = sorted(the_string_array, reverse=True) numpeople = 0 numgroups = 0 for i in range(0, n): numpeople += 1 curskill = numpeople * the_string_array[i] if curskill >= x: numgroups += 1 numpeople = 0 print(numgroups)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF 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()) def binary_search(arr, val, start, end): if start == end: if arr[start] > val: return start else: return start + 1 if start > end: return start mid = (start + end) // 2 if arr[mid] < val: return binary_search(arr, val, mid + 1, end) elif arr[mid] > val: return binary_search(arr, val, start, mid - 1) else: return mid for i in range(t): n, x = map(int, input().split()) inputarray = list(map(int, input().split())) inputarray = sorted(inputarray) teams = 0 pos = binary_search(inputarray, x, 0, n - 1) i = pos j = 2 teams += n - pos if pos == 0: print(teams) else: while i - j >= 0: if inputarray[i - j] * j >= x: teams += 1 i = i - j j = 2 else: j += 1 print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR VAR IF VAR VAR VAR RETURN VAR RETURN BIN_OP VAR NUMBER IF VAR VAR RETURN VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR WHILE BIN_OP VAR VAR NUMBER IF BIN_OP VAR BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP 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 solve(n, score, seq): seq.sort(reverse=True) teams = 0 temp = 0 for x in seq: temp += 1 if temp * x >= score: teams += 1 temp = 0 return teams for _ in range(int(input())): n, score = list(map(int, input().split())) seq = list(map(int, input().split())) print(solve(n, score, seq))
FUNC_DEF EXPR 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 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 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
def solve_3(A, x): A.sort() n = len(A) B = [] count = 0 for i in A: if i < x: B.append(i) else: count += 1 B.reverse() skore = 0 size = 0 for i in range(len(B)): size += 1 skore = size * B[i] if skore >= x: count += 1 skore = 0 size = 0 return count T = int(input()) for i in range(T): n, x = input().split() N = int(n) X = int(x) A = [int(i) for i in input().split()][:N] print(solve_3(A, X))
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL 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 RETURN VAR 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 VAR VAR FUNC_CALL FUNC_CALL 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
n = int(input()) for i in range(n): a, b = map(int, input().split()) c = sorted(list(map(int, input().split()))) j = 0 count = 0 m = 0 k = 0 for j in range(a - 1, -1, -1): if c[j] >= b: count = count + 1 else: k = k + 1 if c[j] * k >= b: k = 0 count = count + 1 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR VAR 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, print = sys.stdin.readline, sys.stdout.write for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans, temp, l = 0, [], 0 for i in range(n - 1, -1, -1): if a[i] >= x: ans += 1 else: temp.append(a[i]) l += 1 if l * temp[-1] >= x: l = 0 temp = [] ans += 1 print(str(ans) + "\n")
IMPORT ASSIGN VAR VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER LIST NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR LIST VAR NUMBER EXPR FUNC_CALL VAR BIN_OP 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
def solve(n, x, a): sorted_a = sorted(a) last_teams = 0 teams = 0 skills = [] while len(sorted_a) >= 1 and len(sorted_a) >= len(skills): c = -1 skills = [] while abs(c) <= len(sorted_a): skills.append(sorted_a[c]) if skills[-1] * len(skills) >= x: teams += 1 for j in range(abs(c)): sorted_a.pop(-1) break else: c -= 1 if last_teams == teams: break else: last_teams = teams print(teams) t = int(input()) while t: n, x = map(int, input().split()) a = [int(i) for i in input().split()] solve(n, x, a) t -= 1
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR 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
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() t = 0 for i in range(n): if a[i] >= x: t = 1 break if t == 1: b = a[i:] c = a[:i] else: b = [] c = a y = len(c) if y == 0: print(len(b)) else: min1 = 1 if x % c[0] == 0: min1 = x // c[0] else: min1 = x // c[0] + 1 i, k = 1, 1 teams = 0 while i < y: if k == min1: teams += 1 k = 1 if x % c[i] == 0: min1 = x // c[i] else: min1 = x // c[i] + 1 elif x % c[i] == 0: if x // c[i] <= min1 - k: min1 = x // c[i] k = 1 else: k += 1 elif x // c[i] + 1 <= min1 - k: min1 = x // c[i] + 1 k = 1 else: k += 1 i += 1 if k == min1: teams += 1 print(teams + len(b))
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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR NUMBER BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP 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
for t in range(int(input())): n, sum1 = map(int, input().split()) l1 = list(map(int, input().split())) l1.sort() l2 = [] team = 0 if sum(l1) < sum1: print(0) continue while len(l1) > 0: l2.append(l1[len(l1) - 1]) l1.pop(len(l1) - 1) if min(l2) * len(l2) >= sum1: team += 1 l2 = [] print(team)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF BIN_OP FUNC_CALL VAR 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
t = int(input()) for i in range(t): a = input().split() n, x = int(a[0]), int(a[1]) lst = [int(x) for x in input().split()] lst.sort() teams = 0 index = n j = 0 while index > 0: j += 1 if lst[index - 1] * j >= x: teams += 1 j = 0 index -= 1 print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER 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
I = lambda: map(int, input().split()) (t,) = I() for _ in [0] * t: n, x = I() c = a = 1 for i in sorted(I())[::-1]: if c * i >= x: a += 1 c = 1 else: c += 1 print(a - 1)
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP 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 sol(arr: list, x: int) -> int: idiot = [i for i in arr if i < x] ans = len(arr) - len(idiot) idiot.sort() prev = 0 while idiot: prev += 1 tail = idiot.pop() if tail * prev >= x: cursize = prev while idiot and idiot[-1] * cursize >= x: idiot.pop() prev += 1 ans += prev // cursize prev %= cursize return ans tmp = [] p = print def print(*args, **kwargs): tmp.append((args, kwargs)) def flush(): for args, kwargs in tmp: p(*args, **kwargs) return T = int(input()) for _ in range(T): n, x = map(int, input().split(" ")) arr = [*map(int, input().split(" "))] out = sol(arr, x) print(out) flush()
FUNC_DEF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR IF BIN_OP VAR VAR VAR ASSIGN VAR VAR WHILE VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR NUMBER VAR BIN_OP VAR VAR VAR VAR RETURN VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR VAR VAR FUNC_DEF FOR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR RETURN 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 LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING 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
for _ in range(int(input())): n, x = map(int, input().split()) arr = list(map(int, input().split())) arr = sorted(arr) team = 0 for i in arr[::-1]: if i >= x: team += 1 n -= 1 else: break start = n - 1 if arr[n - 1] * n < x: print(team) continue while start > -1: stop = -1 people = 0 for i in range(start, -1, -1): people += 1 if people * arr[i] >= x: team += 1 start = i - 1 stop = 0 people = 0 if stop == -1: start -= 1 print(team)
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 ASSIGN VAR NUMBER FOR VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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(arr, n, x, ans): arr.sort() teams = 0 size = 0 while arr: min_val = arr.pop() size += 1 if min_val * size >= x: teams += 1 size = 0 ans.append(teams) def main(): t = int(input()) ans = [] for i in range(t): n, x = map(int, input().split()) arr = list(map(int, input().split())) solve(arr, n, x, ans) for i in ans: print(i) main()
FUNC_DEF EXPR FUNC_CALL VAR ASSIGN 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 EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST 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 VAR VAR VAR VAR FOR 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
for i in range(int(input())): n, x = map(int, input().split()) l = list(map(int, input().split())) l.sort() count = 0 j = 1 while len(l) > 0: if l[-j] * j >= x: count += 1 for _ in range(j): l.pop() j = 1 elif j == len(l): break else: j += 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR FUNC_CALL 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 getArray(): return [int(x) for x in input().split()] def getInts(): return map(int, input().split()) for _ in range(int(input())): n, x = getInts() a = getArray() a.sort(reverse=True) cnt, ans = 0, 0 for d in a: cnt += 1 if d * cnt >= x: ans += 1 cnt = 0 print(ans)
FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER 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 = list(map(int, input().split())) integers = sorted(list(map(int, input().split()))) teams = 0 sub_team = [] team_length = 0 for i in range(n - 1, -1, -1): sub_team.append(integers[i]) team_length += 1 if sub_team[-1] * team_length >= x: teams += 1 sub_team = [] team_length = 0 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR LIST 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 solve(): n, x = map(int, input().split()) (*a,) = map(int, input().split()) a.sort() ans = 0 cnt = 0 for i in range(n - 1, -1, -1): cnt += 1 if a[i] * cnt >= x: ans += 1 cnt = 0 print(ans) t = int(input()) for _ in range(t): solve()
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN 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 BIN_OP VAR NUMBER NUMBER NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN 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
import sys input = sys.stdin.buffer.readline a = int(input()) for x in range(a): b, c = map(int, input().split()) d = list(map(int, input().split())) j = [] h = 0 for y in range(b): if d[y] < c: j.append(d[y]) h += 1 s = b - h j.sort(reverse=True) l = 1 for x in range(h): if l * j[x] >= c: s += 1 l = 1 else: l += 1 print(s)
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN 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
def numberofteam(arr): count = 0 arr_re = [arr[i] for i in range(n) if arr[i] < x] count += len(arr) - len(arr_re) new_arr = sorted(arr_re, reverse=True) num = 2 for i in range(1, len(new_arr)): if new_arr[i] * num >= x: count += 1 num = 1 else: num += 1 print(count) t = int(input()) for i in range(t): nx = list(map(int, input().strip().split())) n = int(nx[0]) x = int(nx[1]) arr = list(map(int, input().strip().split())) numberofteam(arr)
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR 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 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 VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL 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 = map(int, input().split()) arr = list(map(int, input().split())) arr.sort(reverse=True) cur = [arr[0]] count = 0 for i in range(1, n): length = len(cur) if length * cur[-1] < x: cur.append(arr[i]) else: count += 1 cur = [arr[i]] if len(cur) * cur[-1] >= x: count += 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 LIST VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR LIST VAR VAR IF BIN_OP FUNC_CALL VAR 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
import sys input = sys.stdin.readline I = lambda: list(map(int, input().split())) (t,) = I() for i in range(t): n, x = I() l = sorted(I()) an = 0 fl = 1 for i in range(n - 1, -1, -1): if l[i] > x: an += 1 elif l[i] * fl >= x: an += 1 fl = 1 else: fl += 1 print(an)
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR 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())): m, x = map(int, input().split()) arr = list(map(int, input().split())) arr = sorted(arr) ans, n = 0, 0 for i in range(len(arr) - 1, -1, -1): if arr[i] >= x: ans += 1 n = 0 else: n += 1 if arr[i] * n >= x: ans += 1 n = 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 FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER 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 hatt in range(t): n, x = [int(num) for num in input().split()] a = [int(num) for num in input().split()] a.sort() prevcoun = 0 team = 0 for i in range(n - 1, -1, -1): minnum = (x - 1) // a[i] + 1 if prevcoun + 1 >= minnum: prevcoun = prevcoun + 1 - minnum team += 1 else: prevcoun += 1 print(team)
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 ASSIGN VAR NUMBER ASSIGN 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 NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER 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
import sys def answer(n, x, a): num = 0 lindx = -1 a.sort(reverse=True) for i in range(n): if (i - lindx) * a[i] >= x: num += 1 lindx = i return num def main(): t = int(sys.stdin.readline()) while t: n, x = map(int, sys.stdin.readline().split()) a = list(map(int, sys.stdin.readline().split())) print(answer(n, x, a)) t -= 1 return main()
IMPORT FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER RETURN 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
for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() ans = 0 while len(a) != 0: if a[-1] >= x: a.pop() ans += 1 else: break p = 0 mi = 0 while len(a) > 0: mi = a.pop() p += 1 if mi * p >= x: ans += 1 mi = 0 p = 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 EXPR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR EXPR FUNC_CALL VAR 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 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
abc = int(input()) for x in range(abc): s = input().split(" ")[1] t = input().split(" ") s = int(s) t = [int(y) for y in t] t.sort() t = t[::-1] pointer = 0 teams = 0 groups = 1 while pointer < len(t): count = 0 Opointer = pointer while True: if t[pointer] >= s / groups: count += 1 pointer += 1 else: groups += 1 count = 0 pointer = Opointer if groups > len(t) - pointer: break continue if count == groups: teams += 1 break if groups > len(t) - pointer: break pointer = Opointer + count print(teams)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE NUMBER IF VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR VAR IF VAR VAR VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR VAR 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
def multiple_input(): return map(int, input().split()) def list_input(): return list(map(int, input().split())) for _ in range(int(input())): n, x = multiple_input() a = list_input() a.sort(reverse=True) i = 0 ans = 0 while i < n: if a[i] >= x: ans += 1 else: count = 1 flag = 0 while True: if a[i] * count >= x: flag = 1 break else: count += 1 i += 1 if i == n: break if flag == 1: ans += 1 i += 1 print(ans)
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 FOR VAR FUNC_CALL 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 WHILE VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER IF 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
t = int(input()) while t: line = input().split() n, x = int(line[0]), int(line[1]) a = input().split() a = list(map(int, a)) cnt = 0 a.sort() j = 1 for i in range(n - 1, -1, -1): if j * a[i] >= x: cnt += 1 j = 1 else: j += 1 print(cnt) t -= 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR 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 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 input = sys.stdin.buffer.readline def print(val): sys.stdout.write(str(val) + "\n") def prog(): for _ in range(int(input())): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() teams = 0 l = r = n - 1 while l >= 0: if r - l + 1 >= x / a[l]: l -= 1 r = l teams += 1 else: l -= 1 print(teams) prog()
IMPORT ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR 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 VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR NUMBER 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
In = input for _ in range(int(In())): n, x = map(int, In().split()) a = [int(i) for i in In().split()] a.sort(reverse=1) ans = 0 i = 0 while i < n: count = 1 while i < n and count * a[i] < x: i, count = i + 1, count + 1 if i < n: ans += 1 i += 1 print(ans)
ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP 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()) a = [*map(int, input().split())] a.sort(reverse=True) i = 0 ans = 0 mult = 1 pers = 0 while i < n: if a[i] * (pers + 1) < x: pers += 1 i += 1 elif a[i] * (pers + 1) >= x: ans += 1 pers = 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 LIST 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 NUMBER WHILE VAR VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER 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 inpy = [int(x) for x in sys.stdin.read().split()] t = inpy[0] index = 1 for _ in range(t): n, x = inpy[index], inpy[index + 1] nums = inpy[index + 2 : index + 2 + n] index += 2 + n nums.sort(reverse=True) res, cnt = 0, 0 for i in nums: cnt += 1 if i * cnt >= x: cnt = 0 res += 1 print(res)
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR VAR NUMBER 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
for _ in range(int(input())): n, x = map(int, input().split()) a = map(int, input().split()) b = sorted(map(lambda v: (x - 1) // v + 1, a)) res = 0 pos = -1 cur = 1 while cur + pos < n: if b[cur + pos] <= cur: pos += cur res += 1 else: cur += 1 print(res)
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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR VAR 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
import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [([c] * b) for i in range(a)] def list3d(a, b, c, d): return [[([d] * c) for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[([e] * d) for j in range(c)] for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] def Yes(): print("Yes") def No(): print("No") def YES(): print("YES") def NO(): print("NO") INF = 10**19 MOD = 10**9 + 7 for _ in range(INT()): N, K = MAP() A = LIST() A.sort(reverse=1) ans = 0 cnt = 1 for a in A: if a * cnt >= K: ans += 1 cnt = 1 else: cnt += 1 print(ans)
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL VAR BIN_OP VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF NONE RETURN VAR NONE FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF EXPR FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR STRING FUNC_DEF EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 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 = list(map(int, input().split())) l = list(map(int, input().split())) l.sort() dp = [0] * n for i in range(n - 1, -1, -1): if i == n - 1: if l[i] >= x: dp[i] = 1 else: dp[i] = 0 else: f = x // l[i] + bool(x % l[i]) if i + f - 1 < n: dp[i] = 1 else: dp[i] = 0 if i + f < n: dp[i] = dp[i] + dp[i + f] print(max(dp))
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 ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR 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
t = input() T = int(t) id = 0 while id < T: s = input() sd = s.split(" ") a = input() arr = a.split(" ") n = int(sd[0]) k = int(sd[1]) ls = list() for b in arr: ls.append(int(b)) ls.sort() ls.reverse() cnt = 1 ans = 0 for b in ls: if cnt * b >= k: ans = ans + 1 cnt = 1 else: cnt = cnt + 1 print(ans) id = id + 1
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR 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 EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP 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, arr): arr = sorted(arr) res = 0 temp_length_so_far = 0 for i in range(n - 1, -1, -1): temp_length_so_far += 1 if arr[i] * temp_length_so_far >= x: res += 1 temp_length_so_far = 0 return res T = int(input()) for _ in range(T): n, x = map(int, input().split()) arr = map(int, input().split()) print(solve(n, x, arr))
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN 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()) ans = [] for i in range(t): n, x = map(int, input().split()) skills = list(map(int, input().split())) skills.sort(reverse=True) j = 0 teams = 0 while j < n: counter = 1 while j < n and counter * skills[j] < x: j += 1 counter += 1 if j < n: teams += 1 j += 1 ans.append(teams) for i in ans: print(i)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST 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 WHILE VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR 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
input = __import__("sys").stdin.readline for _ in range(int(input())): n, x = map(int, input().split()) s = sorted(map(int, input().split()), reverse=True) i = ans = 0 c = 1 while i < n: if c * s[i] >= x: ans += 1 c = 1 else: c += 1 i += 1 print(ans)
ASSIGN VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR 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 _ in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) a.sort() k = 0 j = n - 1 for i in range(n - 1, -1, -1): if a[i] >= x: k += 1 j -= 1 else: break r = 1 while j >= 0: if a[j] * r < x: j -= 1 r += 1 else: k += 1 j -= 1 r = 1 print(k)
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 FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR