wait genuinely it says it fails test 4 but when I run it on test 4 manually it passes
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
| Name |
|---|



i changed it to python instead of pypy and it works now (fails test 120) but im not sure why it failed with pypy.
first of all you are trying to allocate an array of length k
which in worst case can be 1e9 so there it will cause runtime error as this allocation memory is not possible
now coming to wrong answer:
because you are storing l as set itself, the order can be random
for example:
case:
1
3 6
2 4 6
here if the set generates the order 6 4 2
then the code will print
3
6 4 2
which is not minimal because it should be 2 4 6 and then then
1
2
should be the output
so that is why on some inputs the set's order is not giving the minimum so that is why it is failing
and anyways it will not pass the worst case because of memory error as I explained above
and also it should not pass in python or pypy both, it will fail in both the environments.
oh good eye to notice i had to sort it