Ticket 1711
Problem 1651 -f
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
6
1 8
2 9
9 1
5 3
6 8
2 7
5
0 7
5 3
6 7
8 9
9 8
Expected Output
0
Generator Parameters
--c_cap 1000000000 --c_high 9 --c_low 1 --h_cap 1000000000000 --h_high 9 --h_low 1 --n_cap 200000 --n_high 7 --n_low 1 --q_cap 200000 --q_high 5 --q_low 1 --r_cap 1000000000 --r_high 9 --r_low 1 --tj_cap 200000 --tj_high 9 --tj_low 0