Tags: algorithms python programming 

Rating:

```
from pwn import *
nc = remote('challs.xmas.htsp.ro', 6051)
for i in range(7):
chall = nc.recvline().decode().strip()
i = 0
while True:
test = nc.recvline().decode().strip()
print(test)
exec(nc.recvline().decode().strip())
exec(nc.recvline().decode().strip())
exec(nc.recvline().decode().strip())
array = sorted(array)
answer = str(array[:k1]) + '; ' + str(array[-k2:][::-1])
answer = answer.replace('[', '')
answer = answer.replace(']', '')
nc.sendline(answer)
i += 1
if i == 50:
check = nc.recv().decode().strip()
print(check)
break
else:
check = nc.recvline().decode().strip()
print(check)
```
```
[x] Opening connection to challs.xmas.htsp.ro on port 6051
[x] Opening connection to challs.xmas.htsp.ro on port 6051: Trying 149.28.40.196
[+] Opening connection to challs.xmas.htsp.ro on port 6051: Done
Test number: 1/50
Good, that's right!
Test number: 2/50
Good, that's right!
Test number: 3/50
Good, that's right!
...
...
...
Test number: 46/50
Good, that's right!
Test number: 47/50
Good, that's right!
Test number: 48/50
Good, that's right!
Test number: 49/50
Good, that's right!
Test number: 50/50
Good, that's right!
Those are some was lightning quick reflexes you've got there!
Here's your flag: X-MAS{th15_i5_4_h34p_pr0bl3m_bu7_17'5_n0t_4_pwn_ch41l}
```
```
X-MAS{th15_i5_4_h34p_pr0bl3m_bu7_17'5_n0t_4_pwn_ch41l}
```