All submissions for this problem are available.
This weekend Gopal is going for a movie festival and he wants to watch exactly 3 movies. Gopal should spend Rs. Ci to watch i th movie. Now he got only Rs. K and he wants to spend that optimally. Gopal want to know in how many ways he can select 3 movies such that they cost exactly Rs. K in total. Two ways are considered same if the same set of movies are chosen in different order.
First line contains T, number of test cases.
First line each test case contains two space separated integers N and K, Total number of movies that will be screened in the
festival and amount of money that Gopal has.
In next 2N lines, 2 * i - 1 th line contains name of the movie Si, and 2 * i th line contains an integer Ci, money to be spent for watching i th movie.
For each test case output single line containing the solution as single integer.
- Name of the movie contains only Upper-case and Lower-case English letter and spaces.
- You can consider that name of a movie will be unique.
- 1 <= T <= 10
- 3 <= N <= 5*102
- 0 <= K <= 103
- 1 <= |Si| <= 50
- 0 <= Ci <= 100
1 3 90 Dhoom Three 30 Ra One 10 Nayak 50
|Time Limit:||0.133333 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, GO|
Fetching successful submissions