I hate every cheater ever but I specifically hate the ones from India WITH PASSION like they're not even trying to hide it, it's so blatant
10 minutes into the contest:

| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3657 |
| 3 | jiangly | 3638 |
| 4 | turmax | 3442 |
| 5 | tourist | 3380 |
| 6 | Um_nik | 3353 |
| 7 | strapple | 3350 |
| 8 | squareOf105 | 3346 |
| 9 | heuristica | 3322 |
| 10 | maroonrk | 3310 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 144 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | Proof_by_QED | 131 |

I hope Dominater069 looks to it.

Honestly, I think this is pretty good so I felt like sharing it.
You are given a permutation $$$p_1,p_2,\ldots,p_n$$$.
An array $$$a_1,a_2,\ldots,a_m$$$ is called good if its indices can be partitioned into groups such that every group consists of indices $$$i_1 \lt i_2 \lt \ldots \lt i_k$$$, where $$$k\geq 2$$$, and $$$a_{i_1} \lt a_{i_2} \lt \ldots \lt a_{i_k}$$$.
Every index must belong to exactly one group. The indices in a group do not have to be consecutive. The empty array is considered good.
Find the minimum number of elements you must delete from $$$p$$$ so that the remaining array is not good. Deleting elements does not change the relative order of the remaining elements.
If $$$p$$$ is already not good, the answer is $$$0$$$.
The first line contains a single integer $$$t$$$ ($$$1\leq t\leq 100$$$) — the number of test cases.
For each test case, the first line contains a single integer $$$n$$$ ($$$1\leq n\leq 5000$$$).
The second line contains $$$n$$$ integers $$$p_1,p_2,\ldots,p_n$$$ — a permutation of $$$1,2,\ldots,n$$$.
For each test case, print a single integer — the minimum number of elements you have to delete so that the remaining array is not good.
2
6
2 1 4 3 6 5
5
1 2 3 4 5
3
4
TC 1: Delete the elements at positions 4, 5, and 6. The remaining array is [2, 1, 4]. Its three elements would have to form a single group, but they are not increasing.
Fewer deletions do not suffice. Think of the original positions as three pairs: (1, 2), (3, 4), and (5, 6). Elements chosen from different pairs are increasing in their original order. Any four remaining elements can be split into two groups of two, each using different pairs. Any five remaining elements can be split into a group of three and a group of two. All six elements can be split into [2, 4, 6] and [1, 3, 5].
TC 2: Delete any four elements, leaving a single element, which cannot belong to an allowed group. With fewer deletions, the remaining array is increasing and has length 2, 3, 4, or 5; these lengths can be grouped as 2, 3, 2 + 2, or 2 + 3, respectively.
3
1
1
4
3 2 1 4
4
1 2 4 3
0
0
1
TC 1: The array contains only one element, so it is already not good.
TC 2: The elements 3, 2, and 1 cannot share a group with one another. Each would need the element 4 in its group, which is impossible because every element belongs to exactly one group. No deletions are needed.
TC 3: Initially, the array can be partitioned into the increasing subsequences [1, 4] and [2, 3]. Delete the element at position 1 to obtain [2, 4, 3]. These three elements are not increasing, so the remaining array is not good.
78 minutes in and well... 
| Name |
|---|


