Will it count as plagiarism?

I am able to solve a question in the ongoing challenge with the help of modifying a solution implementation of some other contest held before in codechef. Will it be counted as plaigarism? I am scared if someone else has used that same code as well. It is just one block of code after which I have applied my own logic to solve the problem.

It doesn’t. Afaik any block of code that existed before the contest doesn’t count as plagiarism.