CONSTRAINT FAILURE IN LUCKY FOUR PROBLEM

#include<iostream>

using namespace std;

int main()

{
	
  long long	int x;  // input for T (denoting the number of integers in Kostya's list)
long long	int i; //  iterating input loop for T times
long long 	int m; // variable for splitting input into digits
long long	int d;  // for checking if digit is 4 or not
	int c=0;    //  counter for digit 4
	cin>>x;
long long	int g[x];  array for storing final number of occurrences of 4 for each input line
	
	for(i=1;i<=x;i++)
	{
		cin>>m;
		while(m!=0)
		{ 
		   d = m%10;
		   if(d==4)
		   c++;
		   g[i-1]=c;
		   
		   m=m/10;
			
		}
		c=0;
		
		
		}	
	// loop for printing T lines
	int f;
	for(f=0;f<x;f++)
	{
		cout<<g[f]<<endl;
	}
	
}

Here is my code submission for Problem Code: LUCKFOUR
I am failing constraint subtask 1 , how to proceed further I have tried changing my data types to long.

This is what I get with your solution for the test input shown:

[simon@simon-laptop][17:18:34]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling werckmeister_1-LUCKFOUR.cpp
Executing command:
  g++ -std=c++17 werckmeister_1-LUCKFOUR.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG    -fsanitize=undefined -ftrapv
Successful
[simon@simon-laptop][17:18:37]
[~/devel/hackerrank/otherpeoples]>echo "10
0
0
0
0
0
0
0
0
0
0" | ./a.out
140722622579824
140722622579528
0
140277476739007
140722622579444
140722622579528
22301152
2317650357738660608
94835065023488
0

Your results may differ :slight_smile: