Language: C++

/*
PROG: arc085e
LANG: C++
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
 */
#include <bits/stdc++.h>

using namespace std;

long long readi()
{
	long long input = 0;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	bool negative = false;
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
void prints(string output)
{
	for (int i = 0; i < output.length(); i++)
	{		
		putchar(output[i]);
	}
	return;
}
int sgn(long long x)
{
	if (x < 0) 
	{
		return -1;
	}
	if (x > 0) 
	{
		return 1;
	}
	return 0;
}

#define MP make_pair
#define PB push_back
#define PF push_front
#define MT make_tuple
#define LB lower_bound
#define UB upper_bound

#define SINF 10007
#define MOD 1000000007
#define INF 1000000861
#define LLINF 1000000000000000861ll
#define CO 1000861
#define EPS 0.000000000000001
#define PI 3.141592653589793
#define MAXN 110
#define MAXM 10010
#define next next_

typedef int64_t ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int N, M, S, T, E = 2;
int level[MAXN];
ll from[2 * MAXM], to[2 * MAXM], cap[2 * MAXM], next[2 * MAXM], head[2 * MAXM];
ll res;
ll arr[MAXN];
ll ans;

void addedge(int u, int v, ll sz)
{
	from[E] = u;
	to[E] = v;
	cap[E] = sz;
	next[E] = head[u];
	head[u] = E;
	E++;
	from[E] = v;
	to[E] = u;
	cap[E] = 0;
	next[E] = head[v];
	head[v] = E;
	E++;
}
bool bfs()
{
	for (int i = 0; i <= N + 1; i++)
	{
		level[i] = -1;
	}
	queue<int> q;
	q.push(S);
	level[S] = 0;
	while(!q.empty())
	{
		int u = q.front();
		q.pop();
		for (int i = head[u]; i > 0; i = next[i])
		{
			int v = to[i];
			if (cap[i] > 0 && level[v] == -1)
			{
				level[v] = level[u] + 1;
				q.push(v);
				if (v == T)
				{
					return true;
				}
			}
		}
	}
	return false;
}
ll aug(int u, ll flo)
{
	if (u == T)
	{
		res += flo;
		return flo;
	}
	ll rem = flo, gain = 0;
	for (int i = head[u]; i > 0 && rem > 0; i = next[i])
	{
		int v = to[i];
		if (cap[i] > 0 && level[v] == level[u] + 1)
		{
			gain = aug(v, min(rem, cap[i]));
			cap[i] -= gain;
			cap[i ^ 1] += gain;
			rem -= gain;
		}
	}
	return flo - rem;
}
ll dinic()
{
	res = 0ll;
	while(bfs())
	{
		aug(S, LLINF);
	}
	return res;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	srand(time(NULL));
	//	cout << fixed << setprecision(10);	
	//	cerr << fixed << setprecision(10);
	//	if (fopen("arc085e.in", "r"))
	//	{	
	//		freopen ("arc085e.in", "r", stdin);
	//		freopen ("arc085e.out", "w", stdout);
	//	}
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		cin >> arr[i];
	}
	S = 0; T = N + 1;
	for (int i = 1; i <= N; i++)
	{
		for (int j = i; j <= N; j += i)
		{
			addedge(i, j, LLINF);
		}
		addedge(0, i, -arr[i]);
		addedge(i, N + 1, arr[i]);
	}
	for (int i = 1; i <= N; i++)
	{
		ans += max(arr[i], 0ll);
	}
	ans -= dinic();
	cout << ans << '\n';
	return 0;
	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:236:27: error: no matching function for call to 'max(ll&, long long int)'
  236 |                 ans += max(arr[i], 0ll);
      |                        ~~~^~~~~~~~~~~~~
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:12:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:236:27: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
  236 |                 ans += max(arr[i], 0ll);
      |                        ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:236:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
  236 |                 ans += max(arr[i], 0ll);
      |                        ~~~^~~~~~~~~~~~~