Language: C++

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll lon, squ, tri, lle, lri, zri, zle;
	cin >> lon >> squ >> tri >> lle >> lri >> zri >> zle;
	ll tot1 = squ * 2;
	tot1 += 4 * (lle / 2);
	tot1 += 4 * (lri / 2);
	if(lon && (lle & 1) && (lri & 1)) tot1 += 6, lon--;
	tot1 += (lon / 2) * 4;
	ll tot = squ * 2;
	ll mn = min({lon, lle, lri});
	tot += mn * 6;
	lon -= mn;
	lri -= mn;
	lle -= mn;
	tot += (lon / 2) * 4;
	tot += (lle / 2) * 4;
	tot += (lri / 2) * 4;
	cout << max({tot1 / 2, tot / 2, tot2 / 2}) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:45:41: error: 'tot2' was not declared in this scope; did you mean 'tot'?
   45 |         cout << max({tot1 / 2, tot / 2, tot2 / 2}) << endl;
      |                                         ^~~~
      |                                         tot
a.cc:45:20: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   45 |         cout << max({tot1 / 2, tot / 2, tot2 / 2}) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:3:
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
/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:   candidate expects 2 arguments, 1 provided