Help me in solving ANTITRI problem

My issue

include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
long long int n,l;
cin>>n>>l;
long long int arr[n];
long long int a=1;
arr[0]=l-1;
for(int i=1;i<n;i++){
arr[i]=arr[i-1]+l;
}
for(int i=0;i<n;i++){
cout<<arr[i]<<" ";
}
cout<<endl;
}
return 0;
}

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
int t;
cin>>t;
while(t--){
    long long int n,l;
    cin>>n>>l;
    long long int arr[n];
    long long int a=1;
    arr[0]=l-1;
    for(int i=1;i<n;i++){
    arr[i]=arr[i-1]+l;
    }
    for(int i=0;i<n;i++){
        cout<<arr[i]<<" ";
    }
    cout<<endl;
}
return 0;
}

Problem Link: Anti-Triangle Practice Coding Problem - CodeChef

@mukesh_8702
for higher value of l your code will not follow the rule to keep all elements within 10^9.
plzz refer my code for better understanding

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,l;
	    cin>>n>>l;
	    if(l>=1000000)
	    {
	        for(int i=1;i<=n;i++)
	        {
	            cout<<i<<" ";
	        }
	    }
	    else
	    {
	        cout<<1<<" ";
	        int pre=1;
	        for(int i=1;i<n;i++)
	        {
	            cout<<pre+l<<" ";
	            pre+=l;
	        }
	    }
	    cout<<endl;
	}
	return 0;
}