Why I keep getting judgement fail???

Правка en2, от Misuki, 2021-10-09 13:47:54

Today I was solving pG in this problem list. When I submit my code it seems alright at the first few test case but turns out to be an judgement fail. Does someone know the reason behind it?

picture

Here is my code:

code

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Misuki 2021-10-10 17:17:09 80
en3 Английский Misuki 2021-10-09 13:48:44 0 (published)
en2 Английский Misuki 2021-10-09 13:47:54 25
en1 Английский Misuki 2021-10-09 13:44:20 5957 Initial revision (saved to drafts)