Ticket 14810
Problem 1679 -b
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
8 10
8 9 3 9 4 7 5 8 
1 5 5
2 9
2 5
1 4 9
1 2 6
2 7
2 2
2 9
1 1 8
2 1
Expected Output
54
72
40
44
45
56
16
72
71
8
Generator Parameters
--n_high 9 --n_low 1 --q_high 15 --q_low 1 --val_high 9 --val_low 1 --x_high 9 --x_low 1