Ticket 5933
Problem 1671 -d
View hacks & all small testcases

Unable to dry run this testcase?
Try making a new request with small values of n_high, t_high, *_high, etc.


Retry
Input
2
4 2
2 38 46 69 
4 14
87 43 13 62 
Expected Output
68
147
Generator Parameters
1 4 3 10 7 5 10