Under construction

Still being built. Things may change

Big Three Total

Interview

Time limit3sMemory limit1024 MB

Summary
Count teams whose three members each have rating at least L and whose ratings sum to at least K, then print the members of each qualifying team.
Level

Easy3 of 10

Topics
Implementation, Array
Solved
No attempts yet

Problem

In weight training, the big three total is the sum of the weights you lift in the squat, bench press, and deadlift. But the contestants of the International Collegiate Programming Contest (ICPC), where three people form one team, measure the big three in a somewhat unusual way: they compare the members' Codeforces ratings, which express each member's skill as a number.

In the weight training world there is an unwritten rule that anyone whose big three total does not exceed 500kg cannot wear clothes of the brand 'Under Armour', and rumor has it that an 'Under Armour enforcement squad' exists to crack down on such people. Sogang ICPC Team, benchmarking this, wants to create a VIP club that a team cannot join if the sum of its three members' Codeforces ratings is less than KK.

Under such a condition, however, even if one of the three members has a much lower rating, all three can join the VIP club as long as the other two have high enough ratings. The club president Lim Jihwan, judging that everyone who joins the club should be above a certain level, allowed only teams whose every member's rating is at least L\boldsymbol{L} and whose three members' ratings sum to at least K\boldsymbol{K} to join.

Jihwan, swamped by student council work and club union work, has no time to manage the VIP club's membership. For Jihwan, find the number of applicant teams that can join the VIP club, and print the ratings of the VIP members.

Input

The first line gives the integers NN, KK, and LL. NN is the number of teams, KK is the club joining condition on the sum of the three members' ratings, and LL is the club joining condition on an individual rating. (1≤N≤500 0001 \leq N \leq 500\ 000, 0≤K≤12 0000 \leq K \leq 12\ 000, 0≤L≤4 0000 \leq L \leq 4\ 000)

From the second line, NN lines follow, one team per line, each giving integers x_1x\_1, x_2x\_2, x_3x\_3 that represent the ratings of the members of a team applying to the VIP club. (0≤x_1,x_2,x_3≤4 0000 \leq x\_1,x\_2,x\_3 \leq 4\ 000)

Output

On the first line, print the number of teams that can join the VIP club.

On the second line, print the ratings of the VIP members in the order they were given, separated by spaces.

Examples1

  1. Example 1

    Input
    5 5000 1600
    1621 1928 1809
    2300 2300 1499
    1805 1211 1699
    1600 1700 1800
    1792 1617 1830
    
    Expected output
    3
    1621 1928 1809 1600 1700 1800 1792 1617 1830