On my machine, your program gives the answer Yes for the testcase:
1
5
1 2 3 5 5
4
1 3 4 5
although there’s an element of unpredictability here as you are mixing C-style input with iostream-based input while deliberately putting them out of sync.
Edit:
To be explicit, either:
i) Use scanf exclusively, and not cin;
ii ) use cin exclusively, and not scanf; or
iii) Remove the call to FAST_IO.
Ugh - it’s an unbelievably sloppily-written question, but looking at some of the AC submissions, it appears that the elements of F need not be consecutive in N i.e. we need to check whether F is a subsequence of N, in spite of the question asking to check whether it is a substring. (sigh).
For example, a randomly-chosen AC solution gives Yes for the testcase: