In the DSA learning series, while doing problems, it successfully gives correct output for all public test cases, but it gives the Wrong answer while submitting the code. could someone help with this problem? This problem is about sum is everywhere (sum of the first n even and odd numbers)

#include<bits/stdc++.h>
using namespace std;
int evensum(int n){
int cur=2,sum=0;
for(int i=1;i<=n;i++){
sum+=cur;
cur +=2;
}
return sum;
}
int oddsum(int n){
int cur=1,sum=0;
for(int i=1;i<=n;i++){
sum+=cur;
cur +=2;
}
return sum;
}
int main(){
int n;
cin>>n;
if(n>0)cout<<oddsum(n)<<" "<<evensum(n)<<endl;
return 0;
}

i did with n*2 only in the beginning then it didn’t accept my code then this 2 loops method still not after using long long it accepted. Why we need to use this why int is not sufficient it has a wide range right