Why is it showing time limit exceeded

#include
#include
using namespace std;

void rotate(int a[][1000],int n){
for(int i=0;i<n;i++){
reverse(a[i],a[i]+n);
}

for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i<j){
swap(a[i][j],a[j][i]);
}
}
}
}
int main() {
int n;
cin>>n;
int a[1000][1000];
for(int i=0;i<n;i++){
for(int j=0;j<n;i++){
cin>>a[i][j];
}
}
rotate(a,n);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<a[i][j];
}
cout<<endl;
}
return 0;
}

Hello @apoorvsin please be in a habbit of sharing your code by saving it on ide.coding,blocks.com .
i have corrected your code and commented the mistake.
https://ide.codingblocks.com/s/402838
if you have any doubt you can ask here;
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.