TSORT: getting abnormal behaviour in ideone

when i run the following code on ideone it gave me time exceeded error and on codechef it runs fine!!
Since both codechef and ideone use s same sphere online judge i don’t understand the difference in such a behaviour

#include<stdio.h>

int arr[1000001];


void init()
{
    for(int i=0; i<1000001; i++)
        arr[i] = 0;
}

// testing new implementation
int main()
{
    int t, no_char, j, num = 0;
    char buffer[10000];
    scanf("%d\n", &t);
    while(t)
    {
        no_char = fread(buffer, sizeof(char), 10000, stdin);
        for(j=0; j<no_char; j++)
        {
            if(buffer[j] == '\n')
            {
                arr[num]++;
                t--;
                num = 0;
            }
            else
            {
                num = num * 10 + buffer[j] - '0';
            }
        }
    }
    for(int i=0; i<1000001; i++)
    {
        while(arr[i]--)
            printf("%d\n", i);
    }
    return 0;
}

is it because of ‘\n’ use in scanf. Because when i remove it, it runs on ideone but gives me wrong answer

Hello @vijay40,

Actually, IDEone has some restrictions that can be a bit “tighter” than one can expect, i.e., what runs fine here might give some troubles on IDEone…

I recommend you read the IDEone FAQ, in order to have an idea of what is, or is not allowed:

Ideone FAQ

I hope this can help you,

Bruno