Help needed in problem FFC219B

Question link → FFC219B Problem - CodeChef
This is the question from yesterdays contest. My code is giving correct output for all test cases but showing WA pls help…
Heres my code CodeChef: Practical coding for everyone

Do vec[i]=(vec[i-1]+k)%mod;
And try

i tried that too still WA:(

It’s giving “SIGSEGV”

I just edited your code and it got submitted
The link of the edited code is-
https://www.codechef.com/viewsolution/26918577

The only changes are with the lines -
ios_base::sync_with_stdio(0);
cin.tie(0);

I don’t know the reason as I don’t code in C++.
Maybe someone else will be able to tell the same.
Hope this helps!!

yeah it did lol…thanks but those lines are only for fast io strange -_-

@noob_coder1212
since you are using fast IO all the inputs and outputs should be taken or given after including fast IO lines.
Since you have used (cin>>t) above the fast io this will lead to ambiguity.
try submitting your code where cin>>t; is placed after fast IO