Broken calculator

all test case passing except testcase1 showing runtime
can someone say why?
#include
#define ll long long
using namespace std;
int main() {
ll int a[505]={1,0};
ll int k=1;
ll int n,x,p,c=0;
ll int l;
cin>>n;
for(ll int i=2;i<=n;i++)
{c=0;x=0;
for(p=0;p<k;p++)
{
l=a[p]*i+c;
a[x++]=l%10;
l/=10;
c=l;

	}while(l>0)
		{
			a[x++]=l%10;
			l/=10;
		}
	if(k<x)k=x;
}
for(p=k-1;p>=0;p--)
cout<<a[p];
return 0;

}

Plz send your code by saving on ide only.