Unable to run the code in Time limit

Problem: Spam Classification Using Neural Net
Problem Link: https://www.codechef.com/problems/SPAMCLAS

Can somebody explain me the issue with my code.
It passes the test case but is exceeding the time limit.
How can I improve this code to run in Time limit ?

Code Link- https://www.codechef.com/submit/SPAMCLAS