func_code_string: #include <bits/stdc++.h>      using namespace std;      typedef long long ll;   typedef long double ld;   typedef pair<int, int> pii;   typedef pair<ll, ll> pll;   typedef vector<int> vi;   typedef vector<ll> vl;   typedef vector<pii> vii;   typedef vector<vi> vvi;   typedef vector<pll> vll;   typedef vector<vl> vvl;      #define fori(i, n) for (int i = 0; i < n; i++)   #define ford(i, n) for (int i = n - 1; i >= 0; i--)   #define rep(i, a, b) for (int i = a; i <= b; i++)   #define repd(i, a, b) for (int i = a; i >= b; i--)   #define trav(x, a) for (auto &x : a)   #define all(x) (x).begin(), (x).end()   #define pb push_back   #define eb emplace_back   #define endl   n    #define sz(a) (int)(a).size()   #define fi first   #define se second      clock_t time_p = clock();   void time_taken()   {       time_p = clock() - time_p;       cerr <<  Time Taken :   << (float)(time_p) / CLOCKS_PER_SEC <<   n ;   }      const ll mod = 1e9 + 7;   const ll INF = 1e18;      int main()   {       ios_base::sync_with_stdio(false), cin.tie(nullptr);          int n, d;       cin >> n >> d;          vi a(n);       fori(i, n) cin >> a[i];          vector<vector<ld>> dp(n + 1, vector<ld>(10, -1));       vvi prv(n + 1, vi(10));       vvi taken(n + 1, vi(10));       dp[0][1] = 0;          for (int i = 0; i < n; i++)       {           for (int j = 0; j < 10; j++)           {               if (dp[i][j] == -1)                   continue;               int to = (j * a[i]) % 10;               ld maybe = dp[i][j] + log2l(a[i]);               if (maybe > dp[i + 1][to])               {                   dp[i + 1][to] = maybe;                   taken[i + 1][to] = 1;                   prv[i + 1][to] = j;               }                  to = j;               maybe = dp[i][j];               if (maybe > dp[i + 1][to])               {                   dp[i + 1][to] = maybe;                   taken[i + 1][to] = 0;                   prv[i + 1][to] = j;               }           }       }          if (dp[n][d] == -1)       {           cout <<  -1  << endl;           return 0;       }          int i = n, j = d;          vi ans;       while (i)       {           if (taken[i][j])           {               ans.pb(a[i - 1]);           }           j = prv[i][j];           i--;       }          if(sz(ans) == 0){           cout << -1 << endl;           return 0;       }          cout << sz(ans) << endl;       for (int x : ans)       {           cout << x <<    ;       }       cout << endl;          time_taken();       return 0;   }