every time i got wrong ans inspite of having correct ans

CodeChef: Practical coding for everyone i wrote this code corrrectly
still getting wrong ans
i dont know why?

You are using int as a data type while the values can be very big upto 10^18 … Switch to long long int or long long unsigned int :)… Green tick if It ACs your solution

i used it too but showing wrong ans

#include
#include
using namespace std;
int main()
{
long long int t,n,c;
scanf("%lld",&t);
while(t–)
{
scanf("%lld",&n);
if(n%2==0)
printf("%lld\n",n);
else{
c=n/2+1;
printf("%lld\n",c);
}
}
return 0;
}

YOu have a wrong approach the solution is directly n/2 + 1 and not n in any case…

Just because if a number is even the answer will be n/2 +1 only…
Reason let the number be 2k…
Now When I divide it into 2 k cup cakes packagees. Chef does not get anything… He can choose the no. as k+1 so that it maximises the no. of cupcakes for chef… (note we cannot go on the negative side of k just because We can make one more package then… The trick is making only one package

it will hardly effect the solution becoz if you have a case and you are having correct ans it is ok i guess

thanks bro i got my mistake