Company: Stripe
Difficulty: easy
Guildmaster Ella — Counting Balanced Parties Ella is the chief of the guild, and she has N adventurers who have different skill levels. She is required to form a party of three members, considering the fact that in each party the difference between the minimal and maximal members' skill levels should not exceed the number R . Count correctly how many options there are for Ella to assemble the parties. Two options are different when the sets of three adventurers are different; the order in which the three members are listed does not matter. Input Format The first line contains two space-separated integers N and R — the number of adventurers and the maximum difference allowed between the weakest and the strongest member of a successful party. The next line contains N space-separated integers S[0], S[1], ..., S[N-1] representing the skill levels of the adventurers. Each skill level is unique and strictly increases in value. Output Format Print a single integer, which represents the number