Help me in solving FCTRL2 problem

My issue

My code

#include<iostream>
using namespace std;

int main(){
    
    int t,n;
    cin>>t;
    for(int i=1;i<=t;i++){
        cin>>n;
        int fact=1;
        for(int j=1;j<=n;j++){
            fact=fact*j;
        }
        cout<<fact<<endl;
    }
    
    
    return 0;
}

Problem Link: FCTRL2 Problem - CodeChef

Codechef shows it being a pre-solved problem. Maybe in your code, the int data type posses a problem as factorial values can be very large.

// We have populated the solutions for the 10 easiest problems for your support.
// Click on the SUBMIT button to make a submission to this problem.

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
using namespace std;
using namespace boost::multiprecision;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    cpp_int fact=1;
	    for(int i=n;i>0;i--)
	     fact=fact*i;
	    cout<<fact<<endl; 
	}
	
	return 0;
}

Tried to submit the code and it worked for me.