It’s my first test and it fails due to TLE. Here’s the code
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
int main(){
long current_num = 0, flag = 0;
char input[13];
while(1){
// Reading, then checking for newline
fgets(input, 12, stdin);
if(input[0] == '\n') break;
// Conversion and test for success
current_num = strtol(input, NULL, 0);
if(errno) return -1;
// The actual task
if((current_num != 42) && (flag != 1))
printf("%ld\n", current_num);
else
flag = 1;
}
return 0;
}
It works just fine on the sample input/output test. I know there’s some extra stuff here, but otherwise it appears to be without any serious quirks. Am I forgetting something really important? I ran tests in console, should I try debugging with a file?