Language: C++

#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;

const int inf=0x3fffffff;
const int maxn=int(1e5)+10;

int mod;
int f[110][maxn];
int exp10[110];

void solve()
{
	for (int i=0; i<=51; ++i)
		for (int j=0; j<mod; ++j)
			f[i][j]=inf;

	exp10[0]=1;
	for (int i=1; i<=50; ++i)
		exp10[i]=(exp10[i-1]*10)%mod;

	for (int i=50; i; --i)
	{
		for (int j=1; j<=9; ++j)
			f[i][exp10[i-1]*j%mod]=min(f[i][exp10[i-1]*j%mod], j);

		for (int j=0; j<mod; ++j)
		{
			for (int k=0; k<=9; ++k)
			{
				f[i][(j+exp10[i-1]*k)%mod]=min(f[i][(j+exp10[i-1]*k)%mod], f[i+1][j]+k);
			}
		}
	}

	printf("%d\n", f[1][0]);
}
int main()
{
	scanf("%d", &mod);
	solve();
	return 0;
}


Compiler output:
a.cc:11:14: error: 'int exp10 [110]' redeclared as different kind of entity
   11 | int exp10[110];
      |              ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cstdio:41,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:132:1: note: previous declaration 'double exp10(double)'
  132 | __MATHCALL_VEC (exp10,, (_Mdouble_ __x));
      | ^~~~~~~~~~~~~~
a.cc: In function 'void solve()':
a.cc:19:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |         exp10[0]=1;
      |                ^
a.cc:19:17: error: assignment of read-only location '* exp10'
   19 |         exp10[0]=1;
      |         ~~~~~~~~^~
a.cc:21:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |                 exp10[i]=(exp10[i-1]*10)%mod;
      |                        ^
a.cc:21:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |                 exp10[i]=(exp10[i-1]*10)%mod;
      |                                    ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:21:37: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
   21 |                 exp10[i]=(exp10[i-1]*10)%mod;
      |                           ~~~~~~~~~~^~~
      |                                    | |
      |                                    | int
      |                                    double(double) noexcept
a.cc:26:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |                         f[i][exp10[i-1]*j%mod]=min(f[i][exp10[i-1]*j%mod], j);
      |                                       ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:40: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
   26 |                         f[i][exp10[i-1]*j%mod]=min(f[i][exp10[i-1]*j%mod], j);
      |                              ~~~~~~~~~~^~
      |                                       | |
      |                                       | int
      |                                       double(double) noexcept
a.cc:26:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |                         f[i][exp10[i-1]*j%mod]=min(f[i][exp10[i-1]*j%mod], j);
      |                                                                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:67: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
   26 |                         f[i][exp10[i-1]*j%mod]=min(f[i][exp10[i-1]*j%mod], j);
      |                                                         ~~~~~~~~~~^~
      |                                                                  | |
      |                                                                  | int
      |                                                                  double(double) noexcept
a.cc:32:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                                 f[i][(j+exp10[i-1]*k)%mod]=min(f[i][(j+exp10[i-1]*k)%mod], f[i+1][j]+k);
      |                                                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:32:51: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
   32 |                                 f[i][(j+exp10[i-1]*k)%mod]=min(f[i][(j+exp10[i-1]*k)%mod], f[i+1][j]+k);
      |                                         ~~~~~~~~~~^~
      |                                                  | |
      |                                                  | int
      |                                                  double(double) noexcept
a.cc:32:81: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                                 f[i][(j+exp10[i-1]*k)%mod]=min(f[i][(j+exp10[i-1]*k)%mod], f[i+1][j]+k);
      |                                                                                 ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:32:82: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
   32 |                                 f[i][(j+exp10[i-1]*k)%mod]=min(f[i][(j+exp10[i-1]*k)%mod], f[i+1][j]+k);
      |                                                                        ~~~~~~~~~~^~
      |                                                                                 | |
      |                                                                                 | int
      |                                                                                 double(double) noexcept