TLE on Life, Universe and Everything

I have below code, for which I am getting error as Time Limit Exceeded.
But when I am submitting the solution, it gets accepted.

Also, Memory size for the code that I submitted is quite large, and I have checked some other codes with less memory utilization, their code looks almost the same as mine.

I am sharing my code below, please let me know what should be done in order to avoid both in the future.

using System;

public class Test
public static void Main()
// your code goes here
string a;
a = Console.ReadLine();
if (a == “42”){


1 Like

This may resolve your TLE and submission doubt New to Codechef. Can't understand the platform


@jashan_bansal - Thanks for the post. It really helped me understand this platform better.

I have one more doubt related to Memory size, can you suggest something for that?