Language: C++




#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)

std::string STR;;
int sum[20];
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> STR;
	std::reverse(all(STR));

	sum[0] = (STR[0] - '0');
	for (size_t i = 1; i < STR.size(); i++)
	{
		sum[i] = sum[i - 1] + (STR[i] - '0');
	}

	std::reverse(all(STR));
	int64_t max = sum[STR.size()-1];
	int64_t sum2 = 0;
	for (int i = 0; i < STR.size(); i++)
	{
		sum2+= (STR[i] - '0');
		max = std::max(
			max,
			sum2 - 1 + (STR.size() - 1 - i) * 9
		);
	}

	out << max << endl;

	return 0;
}
#endif

#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)

int32_t H,W;
int32_t h, w;

char map[1000][1010];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> H>>W>>w>>h;

	if (H % 2) {
		for (int32_t i = 0;w>0 && i <= W-2; i+=2)
		{
			map[H - 1][i] = '<';
			map[H - 1][i+1] = '>';
			--w;
		}
	}
	if (W % 2) {
		for (int32_t i = 0; h>0 && i <= H - 2; i += 2)
		{
			map[i][W - 1] = '^';
			map[i + 1][W - 1] = 'v';
			--h;
		}
	}

	for (int hh = 0; hh <= H - 2; hh += 2)
		for (int ww = 0; ww <= W - 2; ww += 2)
		{
			if (h > 0) {
				map[hh][ww] = '^';
				map[hh + 1][ww] = 'v';
				--h;
				if (h == 0) {
					map[hh][ww + 1] = '.';
					map[hh + 1][ww + 1] = '.';
				}
				else {
					map[hh][ww + 1] = '^';
					map[hh + 1][ww + 1] = 'v';
					--h;
				}
			}
			else if (w > 0) {
				map[hh][ww] = '<';
				map[hh][ww + 1] = '>';
				--w;
				if (w == 0) {
					map[hh + 1][ww] = '.';
					map[hh + 1][ww + 1] = '.';
				}
				else {
					map[hh + 1][ww] = '<';
					map[hh + 1][ww + 1] = '>';
					--w;
				}
			}
			else {
				map[hh][ww] = '.';
				map[hh + 1][ww] = '.';
				map[hh][ww + 1] = '.';
				map[hh + 1][ww + 1] = '.';
			}
		}


	if (h<=0&&w<=0) {
		int32_t squ_count = (H / 2)*(W / 2);
		assert(squ_count > (h + 1) / 2 + (w + 1) / 2);
		out << "YES\n";
		for (int32_t i = 0; i < H; i++)
		{
			out << map[i]<<'\n';
		}
	}
	else {
		out << "NO\n";
	}

	return 0;
}
#endif


Compiler output:
a.cc: In function 'int main()':
a.cc:56:31: error: no matching function for call to 'max(int64_t&, long unsigned int)'
   56 |                 max = std::max(
      |                       ~~~~~~~~^
   57 |                         max,
      |                         ~~~~   
   58 |                         sum2 - 1 + (STR.size() - 1 - i) * 9
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   59 |                 );
      |                 ~              
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/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:56:31: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long unsigned int')
   56 |                 max = std::max(
      |                       ~~~~~~~~^
   57 |                         max,
      |                         ~~~~   
   58 |                         sum2 - 1 + (STR.size() - 1 - i) * 9
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   59 |                 );
      |                 ~              
/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,
                 from a.cc:17:
/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:56:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   56 |                 max = std::max(
      |                       ~~~~~~~~^
   57 |                         max,
      |                         ~~~~   
   58 |                         sum2 - 1 + (STR.size() - 1 - i) * 9
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   59 |                 );
      |                 ~