Getting tle in one case
since the input is quite large you need to use fast i/o. So add
ios_base::sync_with_stdio(false);
cin.tie(NULL)
in the begining of your code
Corrected code
since the input is quite large you need to use fast i/o. So add
ios_base::sync_with_stdio(false);
cin.tie(NULL)
in the begining of your code
Corrected code