Array-Max value in array

#include
using namespace std;
int main() {
long long int n,temp=0;
cin>>n;
const int size=n;
int arr[size];
int max=arr[0];
for(int i=0;i<n;i++){

cin>>arr[i];}
for(int i=0;i<n;i++)
{

     if(max<arr[i])
       {
           temp=arr[i];
           max=arr[i];
           max=temp;
       } 
    
}
cout<<max<<endl;

return 0;

}
why this code not passing any test case in this problem and still it is successfully passing on other idide

Read the constraints given in the ques carefully. The range of numbers is -1000000000 to 1000000000 while in the given code data type is taken as int.