Double Burgers Editorial - May-CookOff 2021 , BURGER

I think the problem can be taken in analogy as greedy version of coin change problem cause
taking the larger step will automatically cover smaller ones with less number of steps

Your code give TLE too .

100
48932 846930887
32542 1714636916
75708 424238336
87755 1649760493
21508 1189641422
89193 1350490028
10947 1102520060
36888 1967513927
82681 1540383427
11819 1303455737
26514 521595369
14776 1726956430
92463 861021531
28281 233665124
20288 468703136
46080 1801979803
63523 635723059
11112 1125898168
75890 2089018457
2996 1656478043
95146 1653377374
81544 1914544920
52713 756898538
85779 1973594325
81234 2038664371
33060 184803527
48092 1424268981
3861 749241874
58893 42999171
98447 135497282
22768 2084420926
28671 1827336328
237 1159126506
2609 1632621730
18920 1433925858
10477 84353896
37927 2001100546
57111 1548233368
90723 1585990365
62986 760313751
17576 356426809
73339 1889947179
84015 709393585
43174 1918502652
92793 1474612400
59041 1264095061
19917 1843993369
38804 1984210013
51083 1749698587
36415 1956297540
90334 463480571
21021 1975960379
19182 1892066602
55854 927612903
41428 603570493
75497 660260757
95156 485560281
4941 593209442
3124 894429690
99167 1947346620
26687 270744730
48430 1633108118
23008 2007905772
6892 822890676
68782 791698928
24364 498777857
73650 524872354
64465 1572276966
47105 1703964684
39690 1600028625
16247 2040332872
27807 1120048830
41110 515530020
24343 1573363369
80861 2077486716
80285 1631518150
58807 289700724
94287 168002246
96219 439493452
36176 1760243556
24756 1622597489
101205 338888229
46058 438792351
28190 269441501
79623 116087765
18649 155324915
63336 1982275857
44224 387346492
19338 841148366
45496 1760281937
72347 1186452552
44700 971899229
31584 213975408
49921 1626276122
17253 2130794396
26574 1884661238
86770 1350573794
20685 1605894429
87082 1987231012
3079 1784639530
1 Like