Language: C++

#include <bits/stdc++.h>

int main() {
  int n; std::cin >> n;
  std::vector<string> a(n);
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  
  /* ピリオドをすべての文字列に加える */
  for (int i = 0; i < n; i++)
    if (a[i].find('.') == std::string::npos) // ピリオドの有無
      a[i].push_back('.');                   // ピリオドを末尾に加える
  
  /* key:val = (c2, c5):cnt */
  std::map<std::pair<int, int>, int> p;

  /* aの素因数2と5の数を数える */
  for (int i = 0; i < n; i++) {
    // a[i].length() => 文字列の長さ
    // a[i].find('.') => .(ピリオド)が存在すればその位置, なければstd::string::npos

    // std::cout << a[i] << " " <<  a[i].length() - a[i].find('.') - 1 << std::endl;
    /* 小数点以下の数 */
    int d_cnt = a[i].length() - a[i].find('.') - 1;
    int c2 = -d_cnt; // 2の数を-d_cntで初期化
    int c5 = -d_cnt; // 5の数を-d_cntで初期化
    
    /* 文字を数字に変換 */
    a[i].replace(a[i].find('.'), 1, ""); // .(ピリオド)を削除 str.replace(開始位置, 長さ, 置き換え後の新たな文字列)
    long long a_ll = std::stoll(a[i].c_str()); // long longに変換
    
    /* 2の数を取得 */
    while (a_ll%2 == 0) {
      ++c2;
      a_ll /= 2;
    }
    /* 5の数を取得 */
    while (a_ll%5 == 0) {
      ++c5;
      a_ll /= 5;
    }

    /* mapに key:val = (c2, c5):数 保持 */
    p[std::pair<int, int>(c2, c5)]++; // keyが存在しない場合は0が追加される
  }

  long long cnt = 0;
  for (auto itr = p.begin(); itr != p.end(); ++itr) {
    if (itr->first.first >= 0 && itr->first.second >= 0)
      cnt += itr->second*(itr->second-1)/2;

    for (auto itr_2 = std::next(itr, 1); itr_2 != p.end(); ++itr_2) {
      if (itr->first.first + itr_2->first.first >= 0 && itr->first.second + itr_2->first.second >= 0)
        cnt += itr->second * itr_2->second;
    }

  }
  std::cout << cnt << std::endl;


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'string' was not declared in this scope
    5 |   std::vector<string> a(n);
      |               ^~~~~~
a.cc:5:15: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:21: error: template argument 1 is invalid
    5 |   std::vector<string> a(n);
      |                     ^
a.cc:5:21: error: template argument 2 is invalid
a.cc:6:44: error: invalid types 'int[int]' for array subscript
    6 |   for (int i = 0; i < n; ++i) std::cin >> a[i];
      |                                            ^
a.cc:10:10: error: invalid types 'int[int]' for array subscript
   10 |     if (a[i].find('.') == std::string::npos) // ピリオドの有無
      |          ^
a.cc:11:8: error: invalid types 'int[int]' for array subscript
   11 |       a[i].push_back('.');                   // ピリオドを末尾に加える
      |        ^
a.cc:23:18: error: invalid types 'int[int]' for array subscript
   23 |     int d_cnt = a[i].length() - a[i].find('.') - 1;
      |                  ^
a.cc:23:34: error: invalid types 'int[int]' for array subscript
   23 |     int d_cnt = a[i].length() - a[i].find('.') - 1;
      |                                  ^
a.cc:28:6: error: invalid types 'int[int]' for array subscript
   28 |     a[i].replace(a[i].find('.'), 1, ""); // .(ピリオド)を削除 str.replace(開始位置, 長さ, 置き換え後の新たな文字列)
      |      ^
a.cc:28:19: error: invalid types 'int[int]' for array subscript
   28 |     a[i].replace(a[i].find('.'), 1, ""); // .(ピリオド)を削除 str.replace(開始位置, 長さ, 置き換え後の新たな文字列)
      |                   ^
a.cc:29:34: error: invalid types 'int[int]' for array subscript
   29 |     long long a_ll = std::stoll(a[i].c_str()); // long longに変換
      |                                  ^