how to take input

How should i take input
1.from a file or
1.using scanf

It is the same as in your TEST submission - from stdinā€¦

I recommend to read FAQ