Tests of CLEANUP2 (generated by gen.py + shapes.py). Group 1 = examples (0 points), groups 2-8 = subtasks 1-7.
Format of a test: N S E / A_0 .. A_{N-1} / B_0 .. B_{N-1} (S counted from 0); the .sol file holds the answer.
"needs: X" / "family teeth|stretch": the author's solution without walk shape X (solutions/wrong_*.cpp) fails the test.
"family lamteeth|teethS" (tests 137-142): Li Chao trees get deep and large, the author's hulls stay short.
"family concave" (tests 143-145): long hulls for solutions that keep the whole DP and query by binary search.
"family decay": many detours are needed (more than 2 for N = 42, 8 for N = 380, 16 for N = 1000 and 2500, 32 for
N = 6800); solutions that allow only a few detours fail.
"limit case": E = 0, tiny E, E far above 3N, N = 1, all values 10^6 (largest answer, 8 * 10^15).
groups=1-3,4-36,37-46,47-68,69-90,91-111,112-136,137-178

cleanup2.001  subtask 0, N = 8, S = 2, E = 11; example
cleanup2.002  subtask 0, N = 6, S = 3, E = 5; example
cleanup2.003  subtask 0, N = 5, S = 1, E = 14; example
cleanup2.004  subtask 1, N = 1, S = 0, E = 1; S: first, E: max, A: rand, B: rand
cleanup2.005  subtask 1, N = 2, S = 1, E = 1; S: last, E: one, A: rand, B: rand
cleanup2.006  subtask 1, N = 10, S = 4, E = 20; S: mid, E: max, A: rand, B: rand
cleanup2.007  subtask 1, N = 10, S = 9, E = 20; S: rand, E: max, A: blocks, B: spikes
cleanup2.008  subtask 1, N = 10, S = 1, E = 20; S: near_first, E: max, A: rand, B: dec
cleanup2.009  subtask 1, N = 10, S = 7, E = 20; S: rand, E: max, A: small, B: small
cleanup2.010  subtask 1, N = 9, S = 4, E = 20; S: mid, E: max, A: sparse, B: sawdown
cleanup2.011  subtask 1, N = 10, S = 9, E = 20; S: last, E: max, A: rand, B: inc
cleanup2.012  subtask 1, N = 10, S = 2, E = 20; S: rand, E: max, A: big, B: binary
cleanup2.013  subtask 1, N = 10, S = 0, E = 20; S: rand, E: max, A: zeros, B: vee
cleanup2.014  subtask 1, N = 8, S = 3, E = 20; S: mid, E: max, A: rand, B: lambda
cleanup2.015  subtask 1, N = 10, S = 6, E = 13; S: rand, E: max, A: rand, B: stairs
cleanup2.016  subtask 1, N = 8, S = 6, E = 12; needs: right_first
cleanup2.017  subtask 1, N = 8, S = 5, E = 12; needs: right_first (reversed)
cleanup2.018  subtask 1, N = 10, S = 3, E = 13; needs: right_first
cleanup2.019  subtask 1, N = 10, S = 5, E = 16; needs: right_first (reversed)
cleanup2.020  subtask 1, N = 9, S = 1, E = 14; needs: right_first
cleanup2.021  subtask 1, N = 7, S = 5, E = 10; needs: right_first (reversed)
cleanup2.022  subtask 1, N = 10, S = 4, E = 8; needs: detour
cleanup2.023  subtask 1, N = 9, S = 8, E = 12; needs: detour (reversed)
cleanup2.024  subtask 1, N = 9, S = 8, E = 11; needs: detour
cleanup2.025  subtask 1, N = 9, S = 8, E = 10; needs: detour (reversed)
cleanup2.026  subtask 1, N = 10, S = 9, E = 10; needs: detour
cleanup2.027  subtask 1, N = 10, S = 3, E = 8; needs: detour (reversed)
cleanup2.028  subtask 1, N = 6, S = 2, E = 7; needs: return
cleanup2.029  subtask 1, N = 8, S = 2, E = 10; needs: return (reversed)
cleanup2.030  subtask 1, N = 6, S = 4, E = 7; needs: return
cleanup2.031  subtask 1, N = 9, S = 2, E = 13; needs: far_max
cleanup2.032  subtask 1, N = 10, S = 1, E = 9; needs: far_max (reversed)
cleanup2.033  subtask 1, N = 8, S = 5, E = 11; needs: far_max
cleanup2.034  subtask 1, N = 1, S = 0, E = 0; limit case, S: first, values: rand
cleanup2.035  subtask 1, N = 10, S = 4, E = 0; limit case, S: mid, values: rand
cleanup2.036  subtask 1, N = 3, S = 1, E = 20; limit case, S: mid, values: rand
cleanup2.037  subtask 2, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: rand, B: equal
cleanup2.038  subtask 2, N = 8000, S = 7404, E = 4000; S: rand, E: half, A: sparse, B: equal
cleanup2.039  subtask 2, N = 8000, S = 0, E = 8000; S: first, E: max, A: rand, B: equal
cleanup2.040  subtask 2, N = 8000, S = 7999, E = 8000; S: last, E: n, A: blocks, B: equal
cleanup2.041  subtask 2, N = 7999, S = 7199, E = 8000; S: near_last, E: max, A: zeros, B: equal
cleanup2.042  subtask 2, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: rand, B: zero
cleanup2.043  subtask 2, N = 5000, S = 1545, E = 8000; S: rand, E: max, A: big, B: equal
cleanup2.044  subtask 2, N = 8000, S = 3999, E = 400; S: mid, E: tiny, A: big, B: equal
cleanup2.045  subtask 2, N = 8000, S = 3999, E = 8000; limit case, S: mid, values: max
cleanup2.046  subtask 2, N = 8000, S = 0, E = 8000; limit case, S: first, values: max
cleanup2.047  subtask 3, N = 50, S = 24, E = 50; S: mid, E: max, A: rand, B: rand
cleanup2.048  subtask 3, N = 50, S = 40, E = 50; S: rand, E: n, A: blocks, B: spikes
cleanup2.049  subtask 3, N = 50, S = 0, E = 50; S: first, E: 2n, A: rand, B: sawdown
cleanup2.050  subtask 3, N = 50, S = 49, E = 50; S: last, E: 3n, A: sparse, B: dec
cleanup2.051  subtask 3, N = 50, S = 49, E = 25; S: rand, E: half, A: big, B: lambda
cleanup2.052  subtask 3, N = 49, S = 24, E = 50; S: mid, E: 2n, A: small, B: small
cleanup2.053  subtask 3, N = 50, S = 5, E = 50; S: near_first, E: n, A: rand, B: stairs
cleanup2.054  subtask 3, N = 50, S = 17, E = 31; S: rand, E: rand, A: zeros, B: binary
cleanup2.055  subtask 3, N = 50, S = 24, E = 50; S: mid, E: n, A: big, B: vee
cleanup2.056  subtask 3, N = 50, S = 15, E = 50; S: rand, E: 2n, A: rand, B: sawup
cleanup2.057  subtask 3, N = 50, S = 44, E = 34; S: near_last, E: rand, A: blocks, B: rand
cleanup2.058  subtask 3, N = 50, S = 0, E = 50; S: first, E: max, A: rand, B: rand
cleanup2.059  subtask 3, N = 50, S = 49, E = 50; S: last, E: max, A: big, B: dec
cleanup2.060  subtask 3, N = 50, S = 2, E = 50; family teeth, seed 22
cleanup2.061  subtask 3, N = 50, S = 45, E = 49; family teeth, seed 29, reversed
cleanup2.062  subtask 3, N = 50, S = 11, E = 50; family teeth, seed 31
cleanup2.063  subtask 3, N = 32, S = 26, E = 48; family stretch0, seed 1000
cleanup2.064  subtask 3, N = 30, S = 19, E = 39; family stretch1, seed 1001, reversed
cleanup2.065  subtask 3, N = 30, S = 13, E = 48; family stretch2, seed 1002
cleanup2.066  subtask 3, N = 42, S = 40, E = 49; family decay, seed 1, reversed
cleanup2.067  subtask 3, N = 42, S = 0, E = 50; family decay, seed 2
cleanup2.068  subtask 3, N = 42, S = 40, E = 50; family decay, seed 3, reversed
cleanup2.069  subtask 4, N = 450, S = 0, E = 450; S: first, E: max, A: rand, B: rand
cleanup2.070  subtask 4, N = 450, S = 449, E = 450; S: last, E: max, A: blocks, B: spikes
cleanup2.071  subtask 4, N = 450, S = 0, E = 450; S: first, E: max, A: rand, B: sawdown
cleanup2.072  subtask 4, N = 450, S = 449, E = 450; S: last, E: max, A: sparse, B: dec
cleanup2.073  subtask 4, N = 450, S = 224, E = 450; S: mid, E: max, A: big, B: lambda
cleanup2.074  subtask 4, N = 450, S = 0, E = 450; S: first, E: max, A: small, B: small
cleanup2.075  subtask 4, N = 450, S = 323, E = 450; S: rand, E: 2n, A: rand, B: stairs
cleanup2.076  subtask 4, N = 450, S = 45, E = 450; S: near_first, E: max, A: zeros, B: binary
cleanup2.077  subtask 4, N = 450, S = 449, E = 450; S: last, E: max, A: big, B: vee
cleanup2.078  subtask 4, N = 450, S = 224, E = 450; S: mid, E: max, A: rand, B: sawup
cleanup2.079  subtask 4, N = 450, S = 404, E = 450; S: near_last, E: n, A: blocks, B: rand
cleanup2.080  subtask 4, N = 450, S = 0, E = 450; S: first, E: max, A: big, B: inc
cleanup2.081  subtask 4, N = 360, S = 155, E = 311; S: rand, E: rand, A: rand, B: rand
cleanup2.082  subtask 4, N = 450, S = 32, E = 313; family teeth, seed 1
cleanup2.083  subtask 4, N = 450, S = 445, E = 450; family teeth, seed 4, reversed
cleanup2.084  subtask 4, N = 450, S = 59, E = 450; family teeth, seed 8
cleanup2.085  subtask 4, N = 296, S = 240, E = 444; family stretch0, seed 1000
cleanup2.086  subtask 4, N = 340, S = 220, E = 442; family stretch1, seed 1001, reversed
cleanup2.087  subtask 4, N = 280, S = 126, E = 448; family stretch2, seed 1002
cleanup2.088  subtask 4, N = 380, S = 371, E = 414; family decay, seed 1, reversed
cleanup2.089  subtask 4, N = 380, S = 3, E = 412; family decay, seed 2
cleanup2.090  subtask 4, N = 380, S = 364, E = 425; family decay, seed 3, reversed
cleanup2.091  subtask 5, N = 1200, S = 599, E = 1200; S: mid, E: max, A: rand, B: rand
cleanup2.092  subtask 5, N = 1200, S = 1088, E = 1200; S: rand, E: max, A: blocks, B: spikes
cleanup2.093  subtask 5, N = 1200, S = 0, E = 1200; S: first, E: max, A: rand, B: sawdown
cleanup2.094  subtask 5, N = 1200, S = 1199, E = 1200; S: last, E: max, A: sparse, B: inc
cleanup2.095  subtask 5, N = 1200, S = 103, E = 600; S: rand, E: half, A: big, B: lambda
cleanup2.096  subtask 5, N = 1200, S = 599, E = 1200; S: mid, E: max, A: small, B: small
cleanup2.097  subtask 5, N = 400, S = 222, E = 1200; S: rand, E: max, A: rand, B: stairs
cleanup2.098  subtask 5, N = 1200, S = 120, E = 1200; S: near_first, E: max, A: zeros, B: binary
cleanup2.099  subtask 5, N = 1200, S = 599, E = 1200; S: mid, E: max, A: big, B: vee
cleanup2.100  subtask 5, N = 1200, S = 1062, E = 1200; S: rand, E: max, A: rand, B: dec
cleanup2.101  subtask 5, N = 600, S = 299, E = 1200; S: mid, E: max, A: blocks, B: sawup
cleanup2.102  subtask 5, N = 1200, S = 1079, E = 322; S: near_last, E: rand, A: rand, B: rand
cleanup2.103  subtask 5, N = 1200, S = 142, E = 634; family teeth, seed 6
cleanup2.104  subtask 5, N = 1200, S = 856, E = 724; family teeth, seed 11, reversed
cleanup2.105  subtask 5, N = 1200, S = 16, E = 1120; family teeth, seed 14
cleanup2.106  subtask 5, N = 800, S = 650, E = 1200; family stretch0, seed 1000
cleanup2.107  subtask 5, N = 750, S = 412, E = 1200; family stretch2, seed 1002, reversed
cleanup2.108  subtask 5, N = 765, S = 127, E = 1190; family stretch3, seed 1003
cleanup2.109  subtask 5, N = 1000, S = 982, E = 1054; family decay, seed 1, reversed
cleanup2.110  subtask 5, N = 1000, S = 7, E = 1051; family decay, seed 2
cleanup2.111  subtask 5, N = 1000, S = 969, E = 1072; family decay, seed 3, reversed
cleanup2.112  subtask 6, N = 3000, S = 1499, E = 3000; S: mid, E: max, A: rand, B: rand
cleanup2.113  subtask 6, N = 3000, S = 1948, E = 3000; S: rand, E: max, A: blocks, B: spikes
cleanup2.114  subtask 6, N = 3000, S = 1499, E = 3000; S: mid, E: max, A: rand, B: sawdown
cleanup2.115  subtask 6, N = 3000, S = 2999, E = 3000; S: last, E: max, A: sparse, B: inc
cleanup2.116  subtask 6, N = 3000, S = 1499, E = 3000; S: mid, E: max, A: big, B: lambda
cleanup2.117  subtask 6, N = 3000, S = 1499, E = 3000; S: mid, E: max, A: small, B: small
cleanup2.118  subtask 6, N = 1500, S = 1186, E = 3000; S: rand, E: max, A: rand, B: stairs
cleanup2.119  subtask 6, N = 3000, S = 300, E = 3000; S: near_first, E: max, A: zeros, B: binary
cleanup2.120  subtask 6, N = 3000, S = 1499, E = 3000; S: mid, E: max, A: big, B: vee
cleanup2.121  subtask 6, N = 3000, S = 1499, E = 3000; S: mid, E: max, A: big, B: dec
cleanup2.122  subtask 6, N = 1000, S = 499, E = 3000; S: mid, E: max, A: blocks, B: sawup
cleanup2.123  subtask 6, N = 3000, S = 2699, E = 3000; S: near_last, E: max, A: rand, B: rand
cleanup2.124  subtask 6, N = 3000, S = 376, E = 1500; S: rand, E: half, A: rand, B: spikes
cleanup2.125  subtask 6, N = 2000, S = 999, E = 3000; S: mid, E: max, A: sparse, B: sawdown
cleanup2.126  subtask 6, N = 3000, S = 0, E = 3000; S: first, E: max, A: blocks, B: spikes
cleanup2.127  subtask 6, N = 3000, S = 0, E = 3000; S: first, E: max, A: big, B: dec
cleanup2.128  subtask 6, N = 3000, S = 777, E = 3000; family teeth, seed 7
cleanup2.129  subtask 6, N = 3000, S = 2719, E = 3000; family teeth, seed 11, reversed
cleanup2.130  subtask 6, N = 3000, S = 750, E = 1410; family teeth, seed 12
cleanup2.131  subtask 6, N = 2000, S = 1625, E = 3000; family stretch0, seed 1000
cleanup2.132  subtask 6, N = 1870, S = 1028, E = 2992; family stretch2, seed 1002, reversed
cleanup2.133  subtask 6, N = 1926, S = 321, E = 2996; family stretch3, seed 1003
cleanup2.134  subtask 6, N = 2500, S = 2465, E = 2598; family decay, seed 1, reversed
cleanup2.135  subtask 6, N = 2500, S = 244, E = 2812; family decay, seed 2
cleanup2.136  subtask 6, N = 2500, S = 2439, E = 2621; family decay, seed 3, reversed
cleanup2.137  subtask 7, N = 8000, S = 4000, E = 8000; family lamteeth, seed 1
cleanup2.138  subtask 7, N = 8000, S = 3999, E = 8000; family lamteeth, seed 2, reversed
cleanup2.139  subtask 7, N = 8000, S = 4000, E = 8000; family lamteeth, seed 3
cleanup2.140  subtask 7, N = 8000, S = 3999, E = 8000; family lamteeth, seed 4, reversed
cleanup2.141  subtask 7, N = 8000, S = 3200, E = 8000; family teethS, seed 1
cleanup2.142  subtask 7, N = 8000, S = 4799, E = 8000; family teethS, seed 2, reversed
cleanup2.143  subtask 7, N = 8000, S = 0, E = 8000; family concave, seed 1
cleanup2.144  subtask 7, N = 8000, S = 0, E = 8000; family concave, seed 2
cleanup2.145  subtask 7, N = 8000, S = 7999, E = 8000; family concave, seed 3, reversed
cleanup2.146  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: rand, B: rand
cleanup2.147  subtask 7, N = 8000, S = 3384, E = 8000; S: rand, E: max, A: blocks, B: spikes
cleanup2.148  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: rand, B: sawdown
cleanup2.149  subtask 7, N = 8000, S = 7999, E = 8000; S: last, E: max, A: sparse, B: inc
cleanup2.150  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: big, B: lambda
cleanup2.151  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: small, B: small
cleanup2.152  subtask 7, N = 4000, S = 1999, E = 8000; S: mid, E: max, A: rand, B: stairs
cleanup2.153  subtask 7, N = 8000, S = 800, E = 8000; S: near_first, E: max, A: zeros, B: binary
cleanup2.154  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: big, B: vee
cleanup2.155  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: big, B: dec
cleanup2.156  subtask 7, N = 2700, S = 1349, E = 8000; S: mid, E: max, A: blocks, B: sawup
cleanup2.157  subtask 7, N = 8000, S = 0, E = 8000; S: first, E: max, A: big, B: dec
cleanup2.158  subtask 7, N = 8000, S = 7199, E = 8000; S: near_last, E: max, A: rand, B: rand
cleanup2.159  subtask 7, N = 8000, S = 0, E = 8000; S: first, E: max, A: rand, B: sawdown
cleanup2.160  subtask 7, N = 8000, S = 3999, E = 8000; S: mid, E: max, A: big, B: inc
cleanup2.161  subtask 7, N = 5400, S = 2699, E = 8000; S: mid, E: max, A: sparse, B: sawdown
cleanup2.162  subtask 7, N = 8000, S = 1877, E = 4745; family teeth, seed 8
cleanup2.163  subtask 7, N = 8000, S = 5809, E = 8000; family teeth, seed 23, reversed
cleanup2.164  subtask 7, N = 8000, S = 2007, E = 8000; family teeth, seed 25
cleanup2.165  subtask 7, N = 5328, S = 4329, E = 7992; family stretch0, seed 1000
cleanup2.166  subtask 7, N = 5000, S = 2749, E = 8000; family stretch2, seed 1002, reversed
cleanup2.167  subtask 7, N = 5139, S = 856, E = 7994; family stretch3, seed 1003
cleanup2.168  subtask 7, N = 6800, S = 6662, E = 7046; family decay, seed 1, reversed
cleanup2.169  subtask 7, N = 6800, S = 57, E = 6962; family decay, seed 2
cleanup2.170  subtask 7, N = 6800, S = 6556, E = 7157; family decay, seed 3, reversed
cleanup2.171  subtask 7, N = 1, S = 0, E = 8000; limit case, S: first, values: rand
cleanup2.172  subtask 7, N = 2, S = 0, E = 8000; limit case, S: first, values: rand
cleanup2.173  subtask 7, N = 10, S = 7, E = 8000; limit case, S: rand, values: rand
cleanup2.174  subtask 7, N = 100, S = 40, E = 8000; limit case, S: rand, values: rand
cleanup2.175  subtask 7, N = 1000, S = 499, E = 8000; limit case, S: mid, values: rand
cleanup2.176  subtask 7, N = 8000, S = 3999, E = 0; limit case, S: mid, values: rand
cleanup2.177  subtask 7, N = 8000, S = 3999, E = 1; limit case, S: mid, values: rand
cleanup2.178  subtask 7, N = 8000, S = 0, E = 2; limit case, S: first, values: rand
