Language: C++

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

long long N; string arr[200010],dot=".";
vector<long long> zer,five[20],two[20];

void Input(){
	cin>>N;
	for(long long i=0; i<N; i++){
		cin>>arr[i];
	}
}

long long stringToText(string a){
	long long total=0,len=a.length();
	for(long long i=0; i<len; i++){
		total*=10;
		total+=a[i]-'0';
	}
	return total;
}

void Change(){
	for(long long i=0; i<N; i++){
		long long pos=-1;
		for(long long j=0; j<min(5,arr[i].length()); j++){
			if(arr[i][j]=='.')pos=j;
		}
		long long dec=0,len=arr[i].length();
		if(pos!=-1)dec=len-pos-1;
		if(pos!=-1)arr[i].erase(pos,1);
		long long curr=stringToText(arr[i]);
		while(curr%10==0){
			dec--; curr/=10;
		}
		long long type=-1,sum=0;
		while(curr%2==0){
			type=0; sum++;
			curr/=2;
		}
		while(curr%5==0){
			type=1; sum++;
			curr/=5;
		}
		//cout<<i<<" "<<dec<<" "<<sum<<" ";
		if(type==0){
			two[sum].push_back(dec);
			//cout<<"two"<<'\n';
		}else if(type==1){
			five[sum].push_back(dec);
			//cout<<"five"<<'\n';
		}else{
			zer.push_back(dec);
			//cout<<"zer"<<'\n';
		}
	}
}

void Sorting(){
	for(long long i=0; i<15; i++){
		sort(two[i].begin(),two[i].end());
		sort(five[i].begin(),five[i].end());
	}
	sort(zer.begin(),zer.end());
}

long long SolveZer(){
	long long sum=0,zerosize=zer.size();
	for(long long i=0; i<zerosize; i++){
		long long l=i+1,r=zerosize-1,total=i;
		while(l<=r){
			long long mid=(l+r)/2;
			if(zer[i]+zer[mid]<=0){
				total=mid; l=mid+1;
			}else{
				r=mid-1;
			}
		}
		sum+=total-i;
	}
	for(long long i=0; i<zerosize; i++){
		for(long long j=0; j<15; j++){
			if(two[j].empty())continue;
			long long l=0,r=two[j].size()-1,total=-1;
			while(l<=r){
				long long mid=(l+r)/2;
				if(zer[i]+two[j][mid]<=0){
					total=mid; l=mid+1;
				}else{
					r=mid-1;
				}
			}
			//cout<<i<<" "<<j<<" "<<total<<'\n';
			sum+=total+1;
		}
	}
	for(long long i=0; i<zerosize; i++){
		for(long long j=0; j<15; j++){
			if(five[j].empty())continue;
			long long l=0,r=five[j].size()-1,total=-1;
			while(l<=r){
				long long mid=(l+r)/2;
				if(zer[i]+five[j][mid]<=0){
					total=mid; l=mid+1;
				}else{
					r=mid-1;
				}
			}
			//cout<<i<<" "<<j<<" "<<total<<'\n';
			sum+=total+1;
		}
	}
	return sum;
}

long long SolveRest(){
	long long sum=0;
	for(long long i=0; i<15; i++){
		if(two[i].empty())continue;
		long long twosize=two[i].size();
		for(long long j=0; j<twosize; j++){
			for(long long k=0; k<15; k++){
				if(five[k].empty())continue;
				long long l=0,r=five[k].size(),total=-1;
				while(l<=r){
					long long mid=(l+r)/2;
					if(two[i][j]+five[k][mid]<=min(i,k)){
						total=mid; l=mid+1;
					}else{
						r=mid-1;
					}
				}
				//cout<<i<<" "<<j<<" "<<k<<" "<<total<<'\n';
				sum+=total+1;
			}
		}
	}
	return sum;
}

void Solve(){
	Change();
	Sorting();
	cout<<SolveZer()+SolveRest()<<'\n';
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	Input();
	Solve();
}

Compiler output:
a.cc: In function 'void Change()':
a.cc:26:41: error: no matching function for call to 'min(int, std::__cxx11::basic_string<char>::size_type)'
   26 |                 for(long long j=0; j<min(5,arr[i].length()); j++){
      |                                      ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:26:41: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   26 |                 for(long long j=0; j<min(5,arr[i].length()); j++){
      |                                      ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:26:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |                 for(long long j=0; j<min(5,arr[i].length()); j++){
      |                                      ~~~^~~~~~~~~~~~~~~~~~~