Help me in solving TRIO problem

My issue

include <bits/stdc++.h>
using namespace std;
int main()
{
int ti, n;
cin >> ti;
while (ti–)
{
unordered_map<long, long> m; // val req,rev val
int c = 0;
cin >> n;
while (n–)
{
long long t;
cin >> t;
long long f = t / (t - 3);
m[f] = 1;
if (m.find(t) != m.end())
{
c++;
}
}
cout<<c<<endl;
}
return 0;
}
why this code is giving runtime error

My code

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int ti, n;
    cin >> ti;
    while (ti--)
    {
        unordered_map<long, long> m; // val req,rev val
        int c = 0;
        cin >> n;
        while (n--)
        {
            long long t;
            cin >> t;
            long long f = t / (t - 3);
            m[f] = 1;
            if (m.find(t) != m.end())
            {
                c++;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}

Problem Link: Freedom Practice Coding Problem - CodeChef

@sh_clevercoder
plzz refer my c++ code for better understanding

#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n;
	    cin>>n;
	    long long int a[n];
	    map<long long int,long long int> mp;
	    long long int ans=0;
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	        
	        if(a[i]!=1)
	        {
	            long long int ch=a[i]*3LL;
	            if(ch%(a[i]-1)==0)
	            {
	                ans+=mp[ch/(a[i]-1)];
	            }
	        }
	        mp[a[i]]++;
	    }
	    cout<<ans<<endl;
	}
	return 0;
}