akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
int n, a[2010], w;
int main() {
    scanf("%d%*d%d", &n, &w);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    if (n == 1)
        printf("%d\n", std::abs(w - a[n]));
    else
        printf("%d\n", std::max(std::abs(w - a[n]), std::abs(a[n - 1] - a[n])));
    return 0;
}

Measured memory_bytes: 128
function gcd(a,b:int64):int64;
var t:int64;
begin
  while b <> 0 do
    begin
       t := b;
       b := a mod b;
       a := t;
    end;
    result := a;
end;

var
  n,k,t,i,x,now,mx:int64;
begin
  read(n);
  read(k);
  read(now);
  mx := now;
  for i := 2 to n do
  begin
    read(x);
    now := gcd(now,x);
    if (mx<x) then mx := x;
  end;
  if (mx>=k) and (k mod now=0) then writeln('POSSIBLE')
  else writeln('IMPOSSIBLE');
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x, a;
    cin >> x >> a;

    if(x < a){
        cout << 0 << endl;
    }else{
        cout << 10 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
int n, q, v[1 << 18], w[1 << 18];
ll f[1024][100010];

int main() {
    scanf("%d", &n);
    int K = 10;
    for (int i = 1; i <= n; i++) {
        scanf("%d %d", &v[i], &w[i]);
        if (log2(i) >= K) continue;
        memcpy(f[i], f[i >> 1], sizeof(f[i]));
        for (int j = 100000; j >= w[i]; j--) {
            f[i][j] = max(f[i][j], f[i][j - w[i]] + v[i]);
        }
    }
    scanf("%d", &q);
    for (int i = 1, u, L; i <= q; i++) {
        scanf("%d %d", &u, &L);
        vector<int> V;
        while (log2(u) >= K) {
            V.push_back(u), u >>= 1;
        }
        ll ans = 0;
        for (int j = 0; j < 1 << V.size(); j++) {
            ll s1 = 0, s2 = 0;
            for (int k = 0; k < V.size(); k++) {
                if (j >> k & 1) s1 += w[V[k]], s2 += v[V[k]];
            }
            if (s1 <= L) ans = max(ans, s2 + f[u][L - s1]);
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Measured memory_bytes: 805332
#include "bits/stdc++.h"

typedef long long ll;
typedef long long int lli;
const int MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
	cin.tie(0); ios::sync_with_stdio(false);

	int N,res=0; cin >> N;
	vector<int>ver(N);
	rep(i, N) { cin >> ver[i]; }
	
	for (int i = 1; i < N - 1;i++) {
		if (ver[i-1]>ver[i]&&ver[i]>ver[i+1]) {
			res++;
		}
		else if (ver[i - 1] < ver[i] && ver[i] < ver[i + 1]) {
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N = list(sorted(list(map(int, input().split()))))
    if N[0] == 1 and N[1] == 4 and N[2] == 7 and N[3] == 9:
        print(YES)
    else:
        print(NO)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4068
#include<stdio.h>
int main()
{
  int a,b,i,j;
  while(1)
       {
  scanf("%d%d",&a,&b);
  if(a==0&&b==0){break;}
 
  for(i=1;i<=a;i++)
    {
      for(j=1;j<=b;j++)
    {
      if(j%2==1)
        {
          if(i%2==1)printf("#");
          else printf(".");
        }
      else
        {
              if(i%2==1)printf(".");
          else printf("#");
        }
    }
      printf("\n");
    }
  printf("\n");
     
       }
  return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<tuple>
#include<stack>
#include<iomanip>
#include<map>
using namespace std;

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << h * (a + b) / 2;

	return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())
l = list(map(int, input().split()))

def solve():
    if 0 in l:
        return (0)
        sys.exit()

    x = 1
    for i in range(N):
        x = x * l[i]
        if x > (1000000000000000000):
            x = -1
            break

    return str(x)

print(solve())

Measured memory_bytes: 21584
#include <iostream>
#include <vector>
using namespace std;

bool search(const vector<int>& A, int n, int m) {
    if (m == 0) return true;
    if (n >= A.size()) return false;

    int ret = search(A, n+1, m) || search(A, n+1, m-A[n]);
    return ret;
}

int main(void) {
    int n;
    cin >> n;
    vector<int> ary(n);
    for (int i = 0; i < n; i++) {
        cin >> ary[i];
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int m;
        cin >> m;
        if (search(ary, 0, m)) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1184
// iketyun08 

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdlib>
#include<cstdio>
#include<utility>
using namespace std;
int dfs(int, int, int, int, int);
char field[50][50 + 1];
int main() {
	int H, W, cnt = 0;
	cin >> H >> W;

	/*for(int i=0;i<H;i++){
	for(int j=0;j<W;j++)field[i][j]=" ";
	}*///初期化
	for (int i = 0; i<H; i++) {
		for (int j = 0; j<W; j++)cin >> field[i][j];
	}
	for (int i = 0; i<H; i++) {
		for (int j = 0; j<W; j++) {
			if (field[i][j] == '#') {
				int size = dfs(i, j, 1, H, W);
				// cout << size << endl;
				if (size < 2) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;

	return 0;
}
int dfs(int y, int x, int size, int H, int W) {
	field[y][x] = '.';
	int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };//移動4方向のベクトル
	for (int i = 0; i < 4; i++) {
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= ny && ny < H && 0 <= nx && nx < W) {
			// cout << ny << " " << nx << " " << field[ny][nx] << " " << size << endl;
			if (field[ny][nx] == '#') size = dfs(ny, nx, ++size, H, W);
		}
	}
	return size;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"

void solve() {
  ll a, b, c, ans = 0;
  cin >> a >> b >> c;
  cout << min((1ll * b / a), c) << endl;
}

int main() {
  ll t;
  // cin >> t;
  t = 1;
  while (t--)
    solve();
  return 0;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100;
const int MAX_P = 10;
const int MAX_LEN = 200;

const int MAX_E = MAX_P * MAX_LEN;

const int INF = 1 << 30;

/* typedef */

/* global variables */

int n, ulen, pis[MAX_N], wlens[MAX_N];
string wis[MAX_N], usp;
bool mtx[MAX_N][MAX_LEN];
int dp0[MAX_LEN + 1], dp1[MAX_E + 1];

/* subroutines */

bool strmatch(string& s0, string& sub, int i) {
  for (int j = 0; j < sub.size(); j++)
    if (s0[i + j] != sub[j]) return false;
  return true;
}

/* main */

int main() {
  for (int cn = 1;; cn++) {
    cin >> n;
    if (n == 0) break;

    for (int i = 0; i < n; i++) {
      cin >> wis[i] >> pis[i];
      wlens[i] = wis[i].size();
    }

    cin >> usp;
    ulen = usp.size();
    
    for (int i = 0; i < n; i++)
      for (int j = 0; j < ulen; j++)
	mtx[i][j] = strmatch(usp, wis[i], j);

    for (int i = 1; i <= ulen; i++) dp0[i] = -1;
    dp0[0] = 0;

    for (int k = 0; k <= ulen; k++)
      if (dp0[k] >= 0)
	for (int i = 0; i < n; i++)
	  if (mtx[i][k]) {
	    int ki = k + wlens[i];
	    if (ki <= ulen)
	      dp0[ki] = max(dp0[ki], dp0[k] + pis[i]);
	  }

    int max_exp = dp0[ulen];
    //cout << max_exp << endl;
    
    for (int i = 1; i <= max_exp; i++) dp1[i] = INF;
    dp1[0] = 0;

    for (int e = 0; e <= max_exp; e++)
      if (dp1[e] < INF)
	for (int i = 0; i < n; i++) {
	  int ei = e + pis[i];
	  if (ei <= max_exp)
	    dp1[ei] = min(dp1[ei], dp1[e] + wlens[i]);
	}

    printf("Case %d: %d\n", cn, dp1[max_exp]);
  }

  return 0;
}

Measured memory_bytes: 1252
#include<cstdio>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,k; scanf("%d%d",&n,&k);
	static int card[500][500];
	rep(i,k) rep(j,n/2) scanf("%d",card[i]+j), card[i][j]--;

	int seq[1000];
	rep(i,n) seq[i]=(i<n/2?0:1);
	while(1){
		bool ok=true;
		rep(i,k){
			int cnt=0;
			rep(j,n/2) if(seq[card[i][j]]==1) cnt++;
			if(cnt<n/8 || 3*n/8<cnt){ ok=false; break; }
		}
		if(ok) break;

		random_shuffle(seq,seq+n);
	}

	rep(i,n) printf("%d",seq[i]); putchar('\n');

	return 0;
}

Measured memory_bytes: 0
// 最長増加部分列
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cassert>

#include<vector>
#include<queue>
#include<set>

using namespace std;

const int INF = -1;
const int MAX_N = 100000;

int longestIncrementSubsequence(int Seq[], int n);

int main(void)
{

	int n, maxLen;
	// 数列を格納する配列
	int ary_S[MAX_N];

	cin >> n;

	for(int i = 0; i < n; i++)
	{
		cin >> ary_S[i];
	}

	maxLen = longestIncrementSubsequence(&ary_S[0], n);

	printf("%d\n", maxLen);

	return 0;
}

// 最長増加部分列問題を解く関数
// S[] : 最長増加部分列を求める数列
// n   : 最長増加部分列を求める数列の長さ
int longestIncrementSubsequence(int A[], int n)
{
	// 最長増加部分列の長さ
	int length;
	// 最長増加部分列を格納する配列
	int L[n];

	// 初期値の設定
	length = 0;
	L[0] = A[0];

	for(int i = 0; i < n; i++)
	{
		if( L[length] < A[i] )
		{
			// L[]の最後の要素より大きければ, 一番最後に追加する
			length++;
			L[length] = A[i];
		}
		else if( L[length] > A[i] )
		{
			// L[]内の途中の要素に追加する

			int *pos;
			int idx;

			// L[]の中で, A[i]以上の値が現れる所を検索する
			pos = lower_bound(L, L + length + 1, A[i]);
			idx = distance(L, pos);
			// 要素の値を置き換える
			L[idx] = A[i];
		}
	}

	return length + 1;
}



Measured memory_bytes: 3952
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int sum=0;
  if(a+b<2*c){
    sum=a*x+b*y;
  }else{
    sum+=2*c*min(x,y);
    if(x>y){
      sum+=(x-y)*min(a,c*2);
    }else{
      sum+=(y-x)*min(b,c*2);
    }
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC084C()
{
	int N;
	cin >> N;
	vector<int> C(N-1), S(N-1), F(N-1);
	for (int i = 0; i < N - 1; ++i)
	{
		cin >> C[i] >> S[i] >> F[i];
	}


	for (int j = 0; j < N - 1; ++j)
	{
		int t = 0;
		for (int i = j; i < N - 1; ++i)
		{
			if (t < S[i])
				t = S[i];
			else
			{
				int u = t % F[i];
				t += (F[i] - u) % F[i];
			}
			t += C[i];
		}
		cout << t << endl;
	}
	cout << 0 << endl;
}

int main()
{
	ABC084C();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> d(k);
    for(int i = 0; i < k; i++){
        cin >> d[i];
    }

    int ans = 0;
    for(int i = n; i < 10 * n; i++){
        int x = i;
        bool f = false;
        vector<int> tmp;
        while(x > 0){
            tmp.push_back(x%10);
            x /= 10;
        }
        for(int y : tmp){
            for(int z : d){
                if(z == y){
                    f = true;
                    break;
                }
            }
            if(f) break;
        }

        if(!f){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    int p[M];
    string S[M];

    for (int i = 0; i < M; i++) {
        cin >> p[i] >> S[i];
    }

    int WA[N];
    bool AC[N];
    for (int i = 0; i < N; i++) {
        WA[i] = 0;
        AC[i] = false;
    }

    for (int i = 0; i < M; i++) {
        if (S[i] == "WA" && !(AC[p[i]-1])) WA[p[i]-1] ++;
        if (S[i] == "AC") AC[p[i]-1] = true;
    }

    int correct = 0;
    int wrong = 0;

    for (int i = 0; i < N; i++) {
        if (AC[i]) {
            correct ++;
            wrong += WA[i];
        } 
    }

    cout << correct << " " << wrong << endl;
    return 0;
}

Measured memory_bytes: 6528
List = [input() for _ in range(5)]

import math

unitsPlace = [int(List[i][-1]) for i in range(5) if int(List[i][-1])!=0]

if unitsPlace==[]:
    res = sum([int(List[i]) for i in range(5)])
    print(res)
else:
    minUnitsPlace = min(unitsPlace)
    
    ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]
    res = sum(ceilList) + minUnitsPlace - 10
    print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 1000000001

vector<ll> enum_divisors(ll N) {
    vector<ll> res;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}//vector<ll>で受け取ること！

int main() {
    ll n;cin >> n;
    vector<ll> a=enum_divisors(n);
    ll x=a[a.size()/2];
    ll y=n/x;
    ll p=1,q=1;
    while(x>=10){
        x /= 10;
        p++;
    }
    while(y>=10){
        y /= 10;
        q++;
    }

    cout << max(p,q) << endl;

    return 0;
}

Measured memory_bytes: 3548
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

const int MAX_N = 1000006;
int a,d,n;
bool is_prime[MAX_N];
void init() {
    fill(is_prime,is_prime+MAX_N,true);
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i < MAX_N; i++) {
        if(is_prime[i]) for(int j=i+i; j<MAX_N;j+=i) is_prime[j] = false;
    }
}
int main() {
    init();
    while(cin>>a>>d>>n) {
        int ans;
        if(a==0&&d==0&&n==0) break;
        while(n) {
            if(is_prime[a]) n--;
            if(n==0) ans = a;
            a+=d;
        }

        cout<<ans<<endl;

    }
    return 0;
}

Measured memory_bytes: 2136
#include <iostream>



using namespace std;

int main() {
	long long int n, a, b, c, d;
	cin >> n >> a >> b;
	c = n % (a + b);
	d = n / (a + b);
	if (c == 0) {
		cout << d * a << endl;
	}
	else {
		if (c >= a) {
			cout << d * a + a << endl;
		}
		else {
			cout << d * a + c << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n, m;
	cin >> n >> m;
	vector<vector<int>>G(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	vector<int>dist(n,-1);
	queue<int>que;
	dist[0] = 0;
	que.push(0);

	while (!que.empty()) {
		int v = que.front();
		que.pop();
		for (int nv : G[v]) {
			if (dist[nv] != -1) continue;
			dist[nv] = dist[v] + 1;
			que.push(nv);
		}
	}
	vector<int>ans;
	rep1(i, n) {
		bool find = false;
		for (int ni : G[i]) {
			if (find) break;
			else if (dist[i] == dist[ni] + 1) {
				ans.pb(ni+1);
				find = true;
			}
		}
	}
	if (ans.empty())print("No");
	else {
		println("Yes");
		for (auto a : ans)println(a);
	}
}

Measured memory_bytes: 14188
#include<bits/stdc++.h>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int L = 1;

    for(int i =0;i<N;i++){
        if(L <= K){
            L = L*2;
        }
        else{
            L = L+K;
        }
    }
    cout << L << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int main() {
    ll A;
    string B;
    cin >> A >> B;
    int n = B.size();
    ll C = stoi(B.substr(0, n - 3)) * 100 + stoi(B.substr(n - 2, 2));
    cout << A * C / 100 << "\n";
}


Measured memory_bytes: 3632
from collections import deque
from copy import deepcopy

N, K = map(int, input().split())
V = list(map(int, input().split()))
q = deque()
for v in V:
    q.append(v)
ans = 0
jotai = []
for l in range(K + 1):
    for r in range(K + 1 - l):
        if l + r <= N:
            jotai.append([l, r, K - l - r])

for i in range(len(jotai)):
    d = deepcopy(q)
    tmp = []
    for l in range(jotai[i][0]):
        tmp.append(d.popleft())
    # print(tmp)
    for r in range(jotai[i][1]):
        tmp.append(d.pop())
    # print(tmp)
    for k in range(jotai[i][2]):
        if tmp and min(tmp) < 0:
            tmp.remove(min(tmp))
    # print(tmp)
    ans = max(sum(tmp), ans)
print(ans)

Measured memory_bytes: 3572
// AOJ Volume 0 Problem 0026

#include <stdio.h>

char *week_str[] = {"Monday", "Tuesday", "Wednesday", "Thursday",
				  "Friday", "Saturday", "Sunday"};

int days_month[] = {31, 29, 31, 30, 31, 30,
					31, 31, 30, 31, 30, 31};

int main(void)
{
    int month, day;
	int days;
	int i;
	
    while (1){
		scanf("%d%d", &month, &day);
		if (month == 0){
			break;
		}
		
		days = 2 + day;
		for (i = 1; i < month; i++){
			days += days_month[i - 1];
		}
		
		printf("%s\n", week_str[days % 7]);
    }

    return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
#define MOD 1000000007 //998244353

//制約 k,n<10^7  and  p is primenumber  and p>n
const ll MAX=2100;
vl fac(MAX), finv(MAX), inv(MAX);
// テーブルを作る前処理 O(n)
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
ll COM(ll n, ll k){
    if (n<k or n<0 or k<0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    // solution comes here

    ll N, K;
    cin >> N >> K;

    COMinit();
    for(ll i=1; i<=K; i++) {
        cout << ( COM(N-K+1, i)*COM(K-1, i-1) )%MOD << nl;
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int N;
    cin >> N;
    map<int, int> A;
    for(int i = 0; i < N; ++i){
        int tmp;
        cin >> tmp;
        A[tmp] += 1;
    }

    int tmp = 0;
    if(N % 2 == 0){
        for(auto itr = A.begin(); itr != A.end(); ++itr){
            if(itr->second != 2){
                cout << 0 << endl;
                return 0;
            }
        }
        tmp = A.size();
    }else{
        if(A[0] != 1){
            cout << 0 << endl;
            return 0;
        }
        for(auto itr = next(A.begin()); itr != A.end(); ++itr){
            if(itr->second != 2){
                cout << 0 << endl;
                return 0;
            }
        }
        tmp = A.size() - 1;
    }

    ll ans = 1;
    for(int i = 1; i <= tmp; ++i){
        ans = (ans * 2) % 1000000007;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3200
use std::io::stdin;

fn main(){
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let n:Vec<i32> = st.trim().split(" ").map(|x| x.parse().unwrap()).collect();
    println!("{}", (n[0]+n[1])*(n[0]+n[1]-1)/2-(n[0]*n[1]));
}

Measured memory_bytes: 4352
n = int(input())
a = list(map(int,input().split()))

s = sum(a)
s1 = 0
for i in range(1,n,2):
    s1 += a[i]

ans = [s-s1*2]
for i in range(1,n):
    ans.append((a[i-1]-ans[i-1]//2)*2)

print(*ans)


Measured memory_bytes: 20600
N = int(input())

dishes = []
for _ in range(N):
  a, b = map(int, input().split())
  dishes.append([a,b,a+b])
  
start = 0
end = N // 2
  
dishesA = sorted(dishes, key = lambda x:x[2])[::-1]

pointA = 0
pointB = 0

      
for i in range(N):
  if i % 2 == 0:
    pointA += dishesA[i][0]
  else:
    pointB += dishesA[i][1]
    
print(pointA - pointB)

Measured memory_bytes: 25252
#include<bits/stdc++.h>
using namespace std;

int main(){
  int A,B,C;
  cin >>A>>B>>C;
  
  int ans;
  if(A==B) ans=C;
  if(B==C) ans=A;
  if(C==A) ans=B;
  
  cout <<ans<< endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll ;
const int MAX=1e3+10;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
int dir[21][2]={{2,0},{0,2},{-2,0},{0,-2},{2,2},{-2,2},{2,-2},{-2,-2},
                {1,2},{1,-2},{-1,2},{-1,-2},{2,1},{2,-1},{-2,1},{-2,-1},
                {1,1},{1,-1},{-1,1},{-1,-1}};
int dir1[4][2]={{1,0},{-1,0},{0,1},{0,-1}};

struct Node{
    int a,b;
    int ci;

    Node(int aa,int bb,int cc){
        a=aa;
        b=bb;
        ci=cc;
    }
    bool operator<(const Node &no)const {
        return ci>no.ci;
    }
};

char a[MAX][MAX];
bool biao[MAX][MAX];
int h,w;
bool check(int x,int y){
    if(x>=1&&x<=h&&y>=1&&y<=w){
        return true;
    }
    return false;
}
queue<Node>q;
queue<Node>q2;
void solve(){
    cin>>h>>w;
    int ch,cw,dh,dw;
    cin>>ch>>cw>>dh>>dw;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>a[i][j];
        }
    }

    q.push(Node(ch,cw,0));
    biao[ch][cw]=1;
    bool is=true;
    ll ans=-1;
    while(is&&(!q.empty()||!q2.empty())) {
        while (!q.empty()) {
            Node begin = q.front();
            q.pop();
            if (begin.a == dh && begin.b == dw) {
                ans = begin.ci;
                is = false;
                break;
            }
            for (int i = 0; i < 4; i++) {
                Node next = Node(begin.a + dir1[i][0], begin.b + dir1[i][1], begin.ci);
                if (a[next.a][next.b] == '#') {
                    q2.push(begin);
                }
                if (check(next.a, next.b) && biao[next.a][next.b] == 0 && a[next.a][next.b] == '.') {
                    biao[next.a][next.b] = 1;
                    q.push(next);
                }
            }
        }
        while (!q2.empty()) {
            Node begin = q2.front();
            q2.pop();
            if (begin.a == dh && begin.b == dw) {
                ans = begin.ci;
                is = false;
                break;
            }
            for (int i =0; i <20; i++) {
                    Node next2 = Node(begin.a + dir[i][0], begin.b + dir[i][1], begin.ci + 1);
                    if (check(next2.a, next2.b) && biao[next2.a][next2.b] == 0 && a[next2.a][next2.b] == '.') {
                        biao[next2.a][next2.b] = 1;
                        q.push(next2);
                    }
            }
        }
    }
    if(is){
        cout<<-1;
    }else{
        cout<<ans;
    }

}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int _=1;
    //cin>>_;
    while(_--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 6124
#include <stdio.h>

int main(void)
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int d, e, f;
    d = a + b;
    e = b + c;
    f = a + c;
    int min;
    if (d < e) {
        if (d < f)
            min = d;
        else 
            min = f;
    }
    if (d > e) {
        if (e > f)
            min = f;
        else
            min = e;
    }
    printf("%d\n", min);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll h, w;
    cin>>h>>w;
    char a[h][w];
    ll done[h][w];
    queue<pairs> n;
    for(ll i=0;i<h;++i){
        for(ll j=0;j<w;++j){
            cin>>a[i][j];
            if(a[i][j] == '#'){
                n.push(make_pair(i, j));
                done[i][j] = 0;
            }else{
                done[i][j] = INF;
            }
        }
    }
    ll dx[4] = {1, 0, -1, 0};
    ll dy[4] = {0, 1, 0, -1};
    while(n.size()){
        pairs x = n.front();
        n.pop();
        for(ll i=0;i<4;++i){
            pairs m = make_pair(x.first+dx[i], x.second+dy[i]);
            if(m.first < 0 or m.first >= h or m.second < 0 or m.second >= w){
                continue;
            }
            if(done[m.first][m.second] == INF and a[m.first][m.second] == '.'){
                a[m.first][m.second] = '#';
                done[m.first][m.second] = done[x.first][x.second]+1;
                n.push(make_pair(m.first, m.second));
            }
        }
    }
    ll ans = 0;
    for(ll i=0;i<h;++i){
        for(ll j=0;j<w;++j){
            ans = max(done[i][j], ans);
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 25396
#include<bits/stdc++.h>
namespace imzzy{
	#define endl '\n'
	#define rgi register int
	#define rgl register long long
	#define ll long long
	class fastin{private:int _ch,_f;
	public:inline fastin&operator>>(char&c){c=getchar();return*this;}
	template<typename _Tp>inline fastin&operator>>(_Tp&_x){
	_x=0;while(!isdigit(_ch))_f|=(_ch==45),_ch=getchar();
	while(isdigit(_ch))_x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
	_f&&(_x=-_x,_f=0);return*this;}fastin(){_ch=_f=0;}
	}fin;class fastout{private:int _num[32],_head;
	public:inline fastout&operator<<(char c){putchar(c);return*this;}
	template<typename _Tp> inline fastout&operator<<(_Tp _x){
	_Tp _k;if(_x==0){putchar('0');return *this;}if(_x<0)putchar('-'),_x=-_x;
	while(_x>0)_k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
	while(_head>0)putchar(_num[_head]),--_head;return*this;}fastout(){_head=0;}
	}fout;inline void P_INIT(){
	#ifdef D_STDOUT_UNBUFFERED
	setbuf(stdout,NULL);
	#endif
}}using namespace imzzy;
// ----------------------------
// #define int ll
// using namespace std;
const int maxn=200004;
const int /*mod=1000000007,*/inf=1201201201;

std::string s;
signed main()
{P_INIT();
	// freopen("tt.in","r",stdin);
	// freopen("tt.out","w",stdout);
	int n,cnt=0,ans=0; fin>>n;
	std::cin>>s;
	for(rgi i=0;i<n;++i) if(s[i]=='R') ++cnt;
	for(rgi i=0;i<cnt;++i) ans+=(s[i]=='W');
	fout<<ans;
	return 0;
}
// ----------------------------
// by imzzy

Measured memory_bytes: 3760
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
const int MOD = 1000000007;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}


 
int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
 
    int H,W,M;cin >> H >> W >> M;
    vector<pair<int,int>> destroyH(H);
    vector<pair<int,int>> destroyW(W);
    for(int i = 0;i<H;i++) destroyH.at(i).second = i;
    for(int i = 0;i<W;i++) destroyW.at(i).second = i;
    set<pair<int,int>> target;
    for(int i = 0;i<M;i++){
        int h,w;cin >> h >> w;h--;w--;
        target.insert(make_pair(h,w));
        destroyH.at(h).first++;
        destroyW.at(w).first++;
    }
    sort(destroyH.begin(),destroyH.end(),greater<pair<int,int>>());
    sort(destroyW.begin(),destroyW.end(),greater<pair<int,int>>());
    int ans = destroyH.front().first+destroyW.front().first;
    int maxiH = destroyH.front().first,maxiW = destroyW.front().first;
    int maxiCountH = 0;
    int maxiCountW = 0;
    for(int i = 0;i<H;i++) if(destroyH.at(i).first == maxiH) maxiCountH++;
    for(int i = 0;i<W;i++) if(destroyW.at(i).first == maxiW) maxiCountW++;

    //爆破できるやつがmaxの状態から減らないように列と行を見ていく
    //途中でダブりないやつがあったらそれが明らかに答え
    for(int i = 0;i<maxiCountH;i++){
        for(int j = 0;j<maxiCountW;j++){
            if(target.count(make_pair(destroyH.at(i).second,destroyW.at(j).second)) == 0){
                cout << ans << endl;
                return 0;
            }
        }
    }
    cout << ans-1 << endl;
}

Measured memory_bytes: 21944
n,k = map(int,input().split())
sun = []
for i in range(n):
  sun.append(0)
for i in range(k):
  d = int(input())
  a = list(map(int,input().split()))
  for i in range(d):
    sun[a[i]-1]+=1
ans = 0
for i in range(n):
  if(sun[i]==0):
    ans+=1
print(ans)



Measured memory_bytes: 9208
#include<iostream>

using namespace std;

int main()
{
	int num, cnt;

	while(cin >> num)
	{
		if(!num) break;
		num = 1000 - num;
		cnt = 0;
		
		while(num)
		{
			if(num >= 500) num -= 500;
			else if(num >= 100) num -= 100;
			else if(num >= 50) num -= 50;
			else if(num >= 10) num -= 10;
			else if(num >= 5) num -= 5;
			else if(num >= 1) num -= 1;
			cnt++;
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 1160
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int S = scanner.nextInt();
    int h = S/3600;
    int m = (S%3600)/60;
    int s = (S%3600)%60;
    System.out.println(h+":"+m+":"+s);
  }
}


Measured memory_bytes: 26264
#include<bits/stdc++.h>
using namespace std;
string s;
int l;
int main()
{
    cin>>s;
    for(int i=0;i<s.size();i++)
        if(s[i]=='C')
            for(int j=i+1;j<s.size();j++)
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
    cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main(){
  string x;
  cin>>x;
  for(int i=0;i<(x.size()-1)/2;i++){
  if(x.at(i)!=x.at(x.size()-i-1)){
  cout<<"No"<<endl;
  return 0;
  }
  }
  for(int j=0;j<(x.size()-1)/2/2;j++){
  if(x.at(j)!=x.at((x.size()-1)/2-j-1)){
  cout<<"No"<<endl;
   return 0;
  }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define DD long double

#define M 1000000007
#define INF 1e18

void setIO(string s = "") { 
  cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if (s.size()) s += ".in", freopen(s.c_str(), "r", stdin);
}

int tt = 1;
void solve() {
  string s;
  cin >> s;
  set<char> c1, c2;
  string s1 = s.substr(0, 3);
  string s2 = s.substr(1, 3);
  for (auto c : s1) c1.insert(c);
  for (auto c : s2) c2.insert(c);
  cout << ((c1.size() == 1 || c2.size() == 1) ? "Yes" : "No")  << endl;
}

int main() {
  setIO();
  while (tt--) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i], a[i]--;
  vll idx(n);
  rep(i,n) idx[a[i]]=i;
  
  set<ll> s;
  ll ans=0;
  rrep(x,n){
    ll i=idx[x];
    s.insert(i);
    vll l(2,-1), r(2,n);
    {
      auto itr=s.find(i);
      rep(j,2){
        if(itr==s.begin()) break;
        --itr;
        l[j]=*itr;
      }
    }
    {
      auto itr=s.find(i);
      rep(j,2){
        ++itr;
        if(itr==s.end()) break;
        r[j]=*itr;
      }
    }
    vll ls(2), rs(2);
    ls[0]=i-l[0], ls[1]=l[0]-l[1];
    rs[0]=r[0]-i, rs[1]=r[1]-r[0];
    ans+=(ls[0]*rs[1]+ls[1]*rs[0])*(x+1);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,a,b;
	cin >>n >>a >>b;
	VI p(n), usd(n);
	rep(i,n) cin >>p[i];
	

	int ct[3]={};
	rep(i,n){
		if(p[i] <=a) ct[0]++;
		if(p[i]>=a+1 && p[i]<=b) ct[1]++;
		if(p[i]>=b+1) ct[2]++;
	}
	
	
	
	cout << *min_element(ct, ct+3) <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
using namespace std;

const ll mod = 1000000007;

ll N,T;
ll A[100010],a[100010],b[100010];

int main(){
  cin>>N>>T;
  if(N==1){
    cout<<1<<endl;
    return 0;
  }
  for(ll i=0;i<N;i++)cin>>A[i];


  a[0]=A[0];
  for(ll i=1;i<N;i++){
    if(A[i]<a[i-1])a[i]=A[i];
    else a[i]=a[i-1];
  }

  //rep(i,N)cout<<a[i]<<" ";
  //cout<<endl;

  ll memo=-1;
  for(ll i=1;i<N;i++){
    b[i]=(A[i]-a[i]);
    memo=max(b[i],memo);
  }
  //rep(i,N)cout<<b[i]<<" ";

  ll cnt=0;
  for(ll i=0;i<N;i++){
    if(b[i]==memo)cnt++;
  }

  cout<<cnt<<endl;

}


Measured memory_bytes: 2560
L = list(map(int, input().split()))
L.sort()
m2 = L[2] - L[1]
m1 = L[1] - L[0]
if m1 % 2 == 0:
  k = m1 // 2
else:
  k = m1 // 2 + 2
ans = m2 + k
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
        x=x*10+ch-'0',ch=getchar();
    return x*f;
}
ll ans=0,a,b,c;
int main()
{
    a=read();
    ans=read();
    read();
    b=read();
    c=read();
    read();
    read();
    if(!a||!b||!c)
    {
        printf("%lld\n",ans+a/2*a+b/2*2+c/2*2);
        return 0;
    }
    
    if(a%2==b%2&&b%2==c%2)
    {
        printf("%lld\n",ans+a+b+c);
        return 0;
    }
    printf("%lld\n",ans+a+b+c-1);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll n;
    cin >> n;
    ll lim = ll(sqrt(n));
    ll k=0;
    ll i;
    for(i=lim; i>0; i--) {
        if (n%i==0){
            k = n/i;
            break;
        }
    }
    cout << (k-1) + (i-1) << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
namespace LibraryOfComputationalGeometry {
	typedef long double ld;
	const ld eps = 1e-9;
	struct point {ld x, y; };
	struct line {point a, b; }; //Be sure that a and b are distinct.
	void ReadPointInt(point &a) {read(a.x), read(a.y); }
	void PrintPoint(point a) {printf("%.10Lf %.10Lf\n", a.x, a.y); }
	void ReadLineInt(line &a) {ReadPointInt(a.a), ReadPointInt(a.b); }
	void CerrPoint(point a) {cerr << a.x << ' ' << a.y << endl; }
	void CerrLine(line a) {cerr << a.a.x << ' ' << a.a.y << ' ' << a.b.x << ' ' << a.b.y << endl; }
	point operator + (point a, point b) {return (point) {a.x + b.x, a.y + b.y}; }
	point operator - (point a, point b) {return (point) {a.x - b.x, a.y - b.y}; }
	point operator * (point a, ld b) {return (point) {a.x * b, a.y * b}; }
	ld dot(point a, point b) {return a.x * b.x + a.y * b.y; }
	ld operator * (point a, point b) {return a.x * b.y - a.y * b.x; }
	ld moo(point a) {return sqrtl(a.x * a.x + a.y * a.y); }
	ld dist(point a, point b) {return moo(a - b); }
	point unit(point a) {
		ld tmp = moo(a);
		assert(tmp > eps);
		return a * (1.0 / tmp);
	}
	point Projection(point x, line a) {
		ld d = dot(x - a.a, a.b - a.a) / dist(a.a, a.b);
		return a.a + unit(a.b - a.a) * d;
	}
	point Reflection(point x, line a) {
		return Projection(x, a) * 2 - x;
	}
	bool OnLine(point x, line a) {
		return fabsl((a.b - a.a) * (x - a.a)) <= eps;
	}
	bool OnSegment(point x, line a) {
		return dist(x, a.a) + dist(x, a.b) - dist(a.a, a.b) <= eps;
	}
	bool Parallel(line a, line b) {
		return fabsl((a.b - a.a) * (b.b - b.a)) <= eps;
	}
	bool Orthogonal(line a, line b) {
		return fabsl(dot(a.b - a.a, b.b - b.a)) <= eps;
	}
	bool SegmentIntersect(line a, line b) {
		if (Parallel(a, b)) return OnSegment(b.a, a) || OnSegment(b.b, a) || OnSegment(a.a, b) || OnSegment(a.b, b);
		ld tmp = ((a.b - a.a) * (b.a - a.a)) * ((a.b - a.a) * (b.b - a.a));
		ld tnp = ((b.b - b.a) * (a.a - b.a)) * ((b.b - b.a) * (a.b - b.a));
		return tmp <= eps && tnp <= eps;
	}
	point LineIntersection(line a, line b) {
		assert(!Parallel(a, b));
		ld tmp = (b.a - a.a) * (b.b - a.a);
		ld tnp = (b.b - a.b) * (b.a - a.b);
		return (a.a * tnp + a.b * tmp) * (1 / (tmp + tnp));
	}
}
int main() {
	using namespace LibraryOfComputationalGeometry;
	int q; read(q);
	while (q--) {
		line a, b;
		ReadLineInt(a);
		ReadLineInt(b);
		PrintPoint(LineIntersection(a, b));
	}
	return 0;
}


Measured memory_bytes: 3220
#include<stdio.h>
#include<algorithm>
using namespace std;

const int maxn=1000+10;
int a[maxn];

int main()
{
    long long n,k,res=0;
    scanf("%lld%lld",&n,&k);
    res=n%k;
    res=min(res,k-n%k);
    printf("%lld\n",res);
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long MOD = 1000000007;
const long long INF = (1LL << 29);
using namespace std;
typedef long long ll;
map<int, int> mp;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, l, t;
	cin >> n >> l >> t;
	vector<int>x(n), w(n);
	rep(i, n)cin >> x[i] >> w[i];
	vector<int>tmp(n);
	rep(i, n) {
		if (w[i] == 1)tmp[i] = (x[i] + t) % l;
		else tmp[i] = ((x[i] - t) % l + l) % l;
	}
	sort(tmp.begin(), tmp.end());
	int cnt = 0;
	rep(i,n) {
		if (w[i] == 1)cnt -= (t - (l - x[i]) + l) / l;
		else cnt += (t - (x[i] + 1) + l) / l;
	}
	cnt = (cnt%n + n) % n;
	vector<int>ans(n);
	rep(i, n) {
		ans[(i + cnt) % n] = tmp[i];
	}
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  int tmp1 = (A/K)*K;
  int tmp2 = tmp1 + K;
  if (A == tmp1 || tmp2 <= B) cout << "OK" << endl;
  else cout << "NG" << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>

using namespace std;
using int64 = long long;

int main() {
    int64 n,c;
    cin >> n >> c;
    const int64 LIM = 1e6;
    vector<vector<int64>> imos(c+1, vector<int64>(LIM + 10, 0));
    for (int64 i=0; i<n; i++) {
        int64 s,t,ci;
        cin >> s >> t >> ci;
        imos[ci][s-1]++;
        imos[ci][t]--;
    }

    int64 ans = 0;
    for (int64 i=0; i<LIM; i++) {
        int64 cnt = 0;
        for (int j=1; j<=c; j++) {
            imos[j][i + 1] += imos[j][i];
            if (imos[j][i] >= 1) cnt++;
        }
        ans = max(ans, cnt);
    }


    cout << ans << endl;
}

Measured memory_bytes: 250368
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(ll x=j;x<n;x++)
#define repr(x,j,n)for(ll x=j;x>n;x--)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
const int N=2e6+7;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
    if(b&1)
    r=(r*a)%m;
    b=b/2;
    a=(a*a)%m;
    }
    return r%m;
}
int main()
{

    ll n;
    cin>>n;
    ll x;
    vi f(n+1,0);
    rep(i,0,n-1)cin>>x,f[x]++;
    rep(i,1,n+1)cout<<f[i]<<endl;;







}


Measured memory_bytes: 4792