akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  int n, a;
  ll p = 0;
  cin >> n;
  vector<int> v(n);
  rep(i,n)
  {
    cin >> a;
    v[i] = a;
  }
  sort(v.begin(), v.end(), greater<int>());
  for (int i = 0; i < n - 1; i++) {
    if (v[i] == v[i + 1]) {
      if (p == 0) {
        p = v[i];
        i++;
      } else {
        cout << p * v[i];
        return 0;
      }
    }
  }
  cout << 0;
  return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x

signed main() {
    capi(h);
    int ans = 0;
    for (int i = 1; h > 0;) {
        ans += i;
        h /= 2;
        i *= 2;
    }
    
    cout << ans;

    return 0;
}

Measured memory_bytes: 3168
#include<cstdio>
int main(void)
{
    int a,b;
    scanf("%d %d" ,&a,&b);
    for(int i=10*b;i<10*b+10;i++)
    {
        if(100*a<=8*i && 8*i<100*a+100)
        {
            printf("%d" ,i);
            return 0;
        }
    }
    printf("-1");
    return 0;
}


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

int main() {
  string S; cin >> S;
  bool isgood = true;
  if (S.at(0) == S.at(1)) isgood = false;
  if (S.at(1) == S.at(2)) isgood = false;
  if (S.at(2) == S.at(3)) isgood = false;
  if (isgood) cout << "Good" << endl;
  else cout << "Bad" << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++){
        cin >> l[i];
    }
    sort(l.begin(),l.end());
    int sum = 0;
    for (int i = 0; i < n-2; i++){
        for (int j = i+1; j < n-1; j++){
            for (int k = j+1; k < n; k++){
                if (l[k]>=l[j]+l[i]) break;
                else {
                    sum += 1;
                    }
            }
        }
    }
    
    cout << sum;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
const int mod = 1000000007;
//#########################################
signed main(){
	int n;cin >> n;
	vector<int> a(n),b(n);
	rep(i,n)cin >> a[i];
	rep(i,n)cin >> b[i];
	
	vector<int> ua(n),ub(n);
	//check
	int mxa = a[0],mxb = b[n-1];
	{
		for(int i = 1;i < n;i++){
			mxa = max(mxa,a[i]);
			if(a[i] > a[i-1]){
				if(a[i] > b[i]){
					cout << 0 << endl;
					return 0;
				}
			}
			else{
				ua[i] = 1;
			}
		}
		for(int i = n-2;i >= 0;i--){
			mxb = max(mxb,b[i]);
			if(b[i] > b[i+1]){
				if(b[i] > a[i]){
					cout << 0 << endl;
					return 0;
				}
			}
			else{
				ub[i] = 1;
			}
		}
	}
	if(mxa != mxb){
		cout << 0 << endl;
		return 0;
	}
	//ok
	int ret = 1;
	rep(i,n){
		if(ua[i]&& ub[i]){
			ret = (ret*min(a[i],b[i]))%mod;
	    }
	}
	cout << ret << endl;

	return 0;
}

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

int main(){
    string S;
    cin >> S;
    
    if(S[0] == S[1] && S[1] == S[2] || S[1] == S[2] && S[2] == S[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	char buf[7];
	int year,month,day;

	while(true){
		scanf("%s",buf);
		if(buf[0] == '#')break;

		scanf("%d %d %d",&year,&month,&day);

		if((year < 31) || (year == 31 && month <= 3) ||
				(year == 31 && month == 4 && day <= 30)){

			printf("HEISEI %d %d %d\n",year,month,day);

		}else{

			printf("? %d %d %d\n",year+1-31,month,day);
		}
	}

	return 0;
}



Measured memory_bytes: 3148
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 22;
const int MAXM = MAXN * MAXN;

int xm[] = {0, 0, 1, -1}, ym[] = {1, -1, 0, 0};
char str[MAXN];
bool maps[MAXN][MAXN], use[MAXN][MAXN];
int num[MAXN][MAXN], plcx[MAXM], plcy[MAXM];

int bfs(int x, int y, int h, int w)
{
    memset(use, false, sizeof(use));
    memset(num, 0, sizeof(num));
    use[x][y] = true;
    num[x][y] = 0;
    int ens = 0, sta = 1, ans = 0;
    plcx[sta] = x, plcy[sta] = y;
    while (ens < sta)
    {
        ens ++;
        int xx = plcx[ens], yy = plcy[ens];
        for (int i = 0; i < 4; i ++)
        {
            int nx = xx + xm[i], ny = yy + ym[i];
            if ((nx > 0) && (nx <= h) && (ny > 0) && (ny <= w) && (maps[nx][ny]) && (!use[nx][ny]))
            {
                num[nx][ny] = num[xx][yy] + 1;
                use[nx][ny] = true;
                if (num[nx][ny] > ans)
                {
                    ans = num[nx][ny];
                }
                sta ++;
                plcx[sta] = nx;
                plcy[sta] = ny;
            }
        }
    }
    return ans;
}

int main()
{
    int h, w;
    scanf("%d%d", &h, &w);
    memset(maps, true, sizeof(maps));
    for (int i = 1; i <= h; i ++)
    {
        scanf("%s", &str);
        for (int j = 0; j < w; j ++)
        {
            if (str[j] == '#')
            {
                maps[i][j + 1] = false;
            }
        }
    }
    int ans = 0;
    for (int i = 1; i <= h; i ++)
    {
        for (int j = 1; j <= w; j ++)
        {
            if (maps[i][j])
            {
                int tmp = bfs(i, j, h, w);
                if (tmp > ans)
                {
                    ans = tmp;
                }
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

X = getN()
if X == 0:
    print(1)
else:
    print(0)

Measured memory_bytes: 77788
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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 H, W,K;

ll beki(ll a, ll b){
    a %= MOD;
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % MOD;
    if(b % 2 == 1){
        ans = ans * a % MOD;
    }
    return ans;
}
int main(int argc, char const *argv[]) {
  cin >> H  >> W >> K;
  vector<string> s(H);
  rep(i,H) cin >> s[i];

  int ans = 0;
  int bekiH = beki(2, H);
  int bekiW = beki(2, W);
  for (int row = 0; row < bekiH; row++) {
    for (int col = 0; col < bekiW; col++) {
      int cnt = 0;
      
      rep(i,H){
        rep(j,W){
          if (!(row & (1 << i)) && !(col & (1 << j))){
          if (s[i][j] == '#'){
            cnt++;
            }
          }
        }
      }
      if (cnt == K){
        ans++;
        //printf("row:%d col:%d \n", row,col);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>

template<class T> struct UnionFind{
    std::vector<int> par;
    std::vector<T> diff_weight;

    UnionFind(int size = 1, T SUM_UNITY = 0){
        init(size, SUM_UNITY);
    }

    void init(int size = 1, T SUM_UNITY = 0) {
        par.resize(size);
        diff_weight.resize(size);
        fill(par.begin(), par.end(), -1);
        fill(diff_weight.begin(), diff_weight.end(), SUM_UNITY);
    }

    int root(int x) {
        if(par[x] < 0) return x;
        int r = root(par[x]);
        diff_weight[x] += diff_weight[par[x]];
        return par[x] = r;
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    int weight(int x) {
        root(x); // 経路圧縮と重み計算
        return diff_weight[x];
    }

    int diff(int x, int y) {
        return weight(y) - weight(x);
    }

    bool unite(int x, int y, int w) {
        w += weight(x);
        w -= weight(y);
        x = root(x);
        y = root(y);
        if(x == y) return false;

        if(par[y] < par[x]) std::swap(x, y), w = -w; // yの方が気が深いなら交換
        par[x] += par[y];
        par[y] = x;
        diff_weight[y] = w;

        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    UnionFind<int> uf(N);
    for(int i = 0; i < M; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        if(uf.issame(l, r)) {
            if((uf.diff(l, r)) != d) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            uf.unite(l, r, d);
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1024
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	auto N = IN();
	print(N * 800 - (N / 15) * 200);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	string s, prev, next;
	int i, j,renzoku, len, ans;

	cin >> s;
	len = s.length();
	ans = 1;
	prev.push_back(s[0]);
	for (i = 1; i < len ; i = i + j + 1) {
		for (j = 0; i+j < len; j++) {
			next.push_back(s[i + j]);
			if (next != prev)break;
		}
//		cout << "prev = " << prev << " next = " << next <<endl;
		if (next == prev) ans--;
		prev = next;
		next.clear();
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
void trace(int A[], int N){
    int i;
    for(i =0; i < N; i++){
        if(i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

void insertionsort(int A[], int N){
    int i, j, v;
    for( i= 1; i < N; i++){
        v = A[i];
        j = i - 1;
        while( j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main(){
    int N, i, j;
    int A[100];
    
    cin >> N;
    for(i = 0; i < N; i++) cin >> A[i];
    
    trace(A, N);
    insertionsort(A, N);
    
    return 0;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) (int)x.size()
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<ll, ll> point;

const int MAXN = 2e5 + 5;

int n;
point a[MAXN];
ll sol;
multiset <int> l, r;

void probaj(){
  ll minix = *l.begin();
  ll miniy = *r.begin();
  auto it = l.end(); it --;
  ll maxix = *it;
  it = r.end(); it --;
  ll maxiy = *it;

  ll nsol = (maxix - minix) * (maxiy - miniy);
  sol = min(sol, nsol);
}

bool cmp(point A, point B){
  if(A.second != B.second) return A.second > B.second;
  return A.first > B.first;
}

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  sol = 1e18;

  cin >> n;
  REP(i, n){
    cin >> a[i].first >> a[i].second;
    if(a[i].first > a[i].second) swap(a[i].first, a[i].second);
    l.insert(a[i].first); r.insert(a[i].second);
  }
  sort(a, a + n);
  probaj();
  REP(i, n){
    l.erase(l.find(a[i].first));
    r.erase(r.find(a[i].second));
    swap(a[i].first, a[i].second);
    l.insert(a[i].first);
    r.insert(a[i].second);
    probaj();
  }

  cout << sol;
}


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

using namespace std;

typedef long long ll;
const int mod = 998244353;

ll binPow(ll x, ll y, ll md = mod){
    ll res = 1;
    x %= mod;
    while(y){
        if(y & 1){
            res = (res * x) % mod;
        }
        y >>= 1;
        x = (x * x) % mod;
    }
    return res;
}

vector<ll> v;
ll n, a, now;
vector<vector<vector<ll>>> dp[2];

ll rec(ll pos, ll rem, ll till, ll ty){
    if(rem < 0 or till > now){
        return 0;
    }
    if(pos == n){
        if(ty){
            if(till != now - 1 or v[pos] != rem){
                dp[ty][pos][rem][till] = 0;
            }
            else{
                dp[ty][pos][rem][till] = 1;
            }
        }
        else{
            if(rem or (till != now)){
                return dp[ty][pos][rem][till] = 0;
            }
            else{
                return dp[ty][pos][rem][till] = 1;
            }
        }
    }
    if(dp[ty][pos][rem][till] != -1){
        return dp[ty][pos][rem][till];
    }
    ll res = 0;
    if(ty){
        res += rec(pos + 1, rem - v[pos], till + 1, 0);
        res += rec(pos + 1, rem - v[pos], till + 1, 1);
    }
    else{
        res += rec(pos + 1, rem, till, 0);
        res += rec(pos + 1, rem, till, 1);
    }
    return dp[ty][pos][rem][till] = res;
}

void solve(){
    cin >> n >> a;
    v.resize(n + 1, 0);
    ll sum = 0;
    for(ll i = 1; i <= n; i++){
        cin >> v[i];
        sum += v[i];
    }
    ll ways = 0;
    for(ll i = 1; i <= n; i++){
        if(a * i > sum){
            continue;
        }
        now = i;
        dp[0].clear();dp[1].clear();
        dp[0].resize(n + 1, vector<vector<ll>> (a * i + 1, vector<ll>(i + 1, -1)));
        dp[1].resize(n + 1, vector<vector<ll>> (a * i + 1, vector<ll>(i + 1, -1)));
        ways += (rec(1, a * i, 0, 0) + rec(1, a * i, 0, 1));
    }
    cout << ways << "\n";
 }

int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}



Measured memory_bytes: 111996
A = [[0 for i in range(3)]for i2 in range(3)]
c = [[False for i in range(3)]for i2 in range(3)]
A[0] = list(map(int,input().rstrip().split(" ")))
A[1] = list(map(int,input().rstrip().split(" ")))
A[2] = list(map(int,input().rstrip().split(" ")))
int_inp = int(input())
s = 0
for i in range(int_inp):
  s = int(input())
  for i2 in range(9):
    if A[int(i2 / 3)][i2 % 3] == s:
      c[int(i2 / 3)][i2 % 3] = True
ans = False
for i in range(3):
  if c[i][0] and c[i][1] and c[i][2]:ans = True
for i in range(3):
  if c[0][i] and c[1][i] and c[2][i]:ans = True
if c[0][0] and c[1][1] and c[2][2]:ans = True
if c[2][0] and c[1][1] and c[0][2]:ans = True
if ans:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
idx = int(input())-1
print(nums[idx])

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main() {
    long int a,b,c,k;
    char S[11], T[12];
    scanf("%ld%ld%ld%ld", &a,&b ,&c,&k);
    if (k <= a) {
        printf("%d", k);
        return 0;
    }
    else if (k <= b) {
        printf("%d", a);
        return 0;
    }
    else {
        printf("%d", a-(k-a-b));
        return 0;
    }
    return 0;
}

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

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

using namespace std;

int h,w;

int a[1023][1023];
int row[1023],col[1023];

int dfs(int i,int j){
	if(i==h){
		int sum[32][32]={};
		rep(y,h) rep(x,w) sum[y+1][x+1]=sum[y+1][x]+sum[y][x+1]-sum[y][x]+a[y][x];

		int res=0;
		rep(y2,h+1) rep(y1,y2) rep(x2,w+1) rep(x1,x2) {
			res+=(sum[y2][x2]-sum[y2][x1]-sum[y1][x2]+sum[y1][x1])%2;
		}
if(res>=420){
printf("res = %d\n",res);
	rep(y,h){ rep(x,w) printf("%d",a[y][x]); puts(""); } puts("--");
}
		return res;
	}

	if(j==w) return dfs(i+1,0);

	int res=0;
	if(row[i]<=1 && col[j]<=1){
		a[i][j]=1;
		row[i]++;
		col[j]++;
		res=max(res,dfs(i,j+1));
		row[i]--;
		col[j]--;
	}
	a[i][j]=0;
	res=max(res,dfs(i,j+1));
	return res;
}

int main(){
	int m,n; scanf("%d%d",&m,&n);

	h=(1<<m)-1;
	w=(1<<n)-1;

if(0){
//	rep(i,h) rep(j,w) a[i][j]=(i==h/2&&j==w/2?1:0);
	rep(i,3) rep(j,3) a[i  ][j  ]=(i==1&&j==1?0:1);
	rep(i,3) rep(j,3) a[i+4][j  ]=a[i][j];
	rep(i,3) rep(j,3) a[i  ][j+4]=a[i][j];
	rep(i,3) rep(j,3) a[i+4][j+4]=a[i][j];
	rep(i,h) a[i][w/2]=1;
	rep(j,w) a[h/2][j]=1;
	a[h/2][w/2]=0;

	int sum[32][32]={};
	rep(y,h) rep(x,w) sum[y+1][x+1]=sum[y+1][x]+sum[y][x+1]-sum[y][x]+a[y][x];

	int res=0;
	rep(y2,h+1) rep(y1,y2) rep(x2,w+1) rep(x1,x2) {
		res+=(sum[y2][x2]-sum[y2][x1]-sum[y1][x2]+sum[y1][x1])%2;
	}
	printf("res = %d\n",res);
	rep(y,h){ rep(x,w) printf("%d",a[y][x]); puts(""); } puts("--");
	return 0;
}

//	printf("%d\n",dfs(0,0));

	if(m==1 && n==1) return puts("1"),0;

//	rep(i,h) rep(j,w) printf("%d%s",i==h/2&&j==w/2?0:1,j<w-1?"":"\n");

	int k=min(m,n);
	int a[1023][1023];
	rep(i,(1<<k)-1) rep(j,(1<<k)-1) a[i][j]=1;
	for(int t=1;t<k;t++){
		rep(i,(1<<t)-1) rep(j,(1<<t)-1) {
			a[(1<<t)+i][j]=a[i][j];
			a[i][(1<<t)+j]=a[i][j];
			a[(1<<t)+i][(1<<t)+j]=a[i][j];
		}
		a[(1<<t)-1][(1<<t)-1]=0;
	}

	if(m<=n){
		rep(i,(1<<k)-1){
			rep(_,(1<<(n-m))-1) putchar('0');
			rep(j,(1<<k)-1){
				printf("%d",a[i][j]);
				rep(_,(1<<(n-m))-1) putchar('0');
			}
			puts("");
		}
	}
	else{
		rep(i,(1<<k)-1){
			rep(_,(1<<(m-n))-1){
				rep(j,w) putchar('0');
				puts("");
			}
			rep(j,(1<<k)-1){
				printf("%d",a[i][j]);
			}
			puts("");
		}
		rep(_,(1<<(m-n))-1){
			rep(j,w) putchar('0');
			puts("");
		}
	}

	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,a;
    cin >> n >> t >> a;
    int ans,h;
    double min = 1000000.0;
    for(int i = 0;i < n;i++)
    {
        cin >> h;
        if((fabs((t - h * 0.006) - a)) < min)
        {
            min = fabs((t - h * 0.006) - a);
            ans = i + 1;
        }
    }
    cout << ans;
 
    return 0;
}

Measured memory_bytes: 256
import sys
from string import digits

n, k, *d = sys.stdin.read().split()
d = set(digits) - set(d)
l = len(n)

def main(d):
    res = ''
    flag = True
    for i in range(l):
        if flag:
            if n[i] in d:
                res += n[i]
            else:
                flag = False
                for j in range(int(n[i]), 10):
                    if str(j) in d:
                        res += str(j)
                        break
                else:
                    break
        else:
            res += min(d)
    else:
        print(res)
        return
    d = sorted(d)
    res = d[0] * (l + 1) if d[0] != '0' else d[1] + '0' * l
    print(res)

if __name__ ==  '__main__':
    main(d)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define ld long double
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    if (b==0) return (int)1;
    int x = p(a, b>>1);
    if (b & 1) return m(x*m(a*x));
    return m(x*x);
}
signed main(){
    fast();
    int n, k;
    cin >> n >> k;
    vector<ld> a(n);
    for(int i=0; i<n; i++)  cin >> a[i];
    for(int i=0; i<n; i++){
        ld f = a[i];
        a[i] = a[i]*(a[i]+1)/2;
        a[i] /= f;
    }
    for(int i=1; i<n; i++){
        a[i] += a[i-1];
    }
    ld ma = a[k-1];
    for(int i=k; i<n; i++){
        ma = max(ma, a[i]-a[i-k]);
    }
    printf("%0.12LF\n", ma);
    // for(auto i: a)  cerr << i << " ";
    // cerr << endl;
} 

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();


		if(b - a == c - b){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

		sc.close();
	}
}


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



int main()
{
    ll n,K;
    cin>>n>>K;
    vector<ll>v(n);
    vector<ll>dp(n+1,-1);
    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
    }
    dp[0]=0;
    for(ll i=1;i<n;i++)
    {
        ll add=LLONG_MAX;
        for(ll k=1;k<=K;k++){
            if(i-k>=0)
            add=min(add,dp[i-k]+abs(v[i]-v[i-k]));
        }
        dp[i]=add;
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 4864
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! { n: i64 }

    let mut a: Vec<i64> = vec![0; 10000001];
    for i in 1..n + 1 {
        let mut j = 1;
        while i * j <= n {
            a[(i * j) as usize] += 1;
            j += 1;
        }
    }

    let mut ans: i64 = 0;
    for i in 1..n + 1 {
        ans += i * (a[i as usize]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 80120
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val h1 = sc.nextInt()
  val m1 = sc.nextInt()
  val h2 = sc.nextInt()
  val m2 = sc.nextInt()
  val k = sc.nextInt()

  val start = h1 * 60 + m1
  val end = h2 * 60 + m2

  val ans = end - start - k

  println(ans)
}


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

bool sortbydesc(const pair<string, pair<int, int>>& a,
                const pair<string, pair<int, int>>& b)
                {
                    return (a.second.first > b.second.first);
                }
int main()
{
    int n;
    cin >> n;

    string s;
    int p;

    vector<pair<string, pair<int, int>>> sp;

    for (int i = 0; i < n; i++)
    {
        cin >> s >> p;
        sp.push_back(make_pair(s, make_pair(p, i+1)));
    }
    sort(sp.begin(), sp.end());

  
    string iter1 = sp[0].first;
    int i= 0, j = 0;


    while (i < n)
    {
        while (j < n && sp[j].first == iter1)
            j++;
        
        sort(sp.begin()+i, sp.begin()+j, sortbydesc);

        i = j;

        if (j < n)
            iter1 = sp[j].first;

    }
  
    for (pair<string, pair<int, int>> a: sp)
        cout << a.second.second << endl;

}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>
#include <chrono>

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(i, 0, (n))
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)

#define FOREACH(x, arr) for (auto &(x) : (arr))
#define FORITER(x, arr) for (auto(x) = (arr).begin(); (x) != (arr).end(); ++(x))

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//------------------------------------------
//------------------------------------------


int main() {

    int N, M;
    cin >> N >> M;

    vector<LL> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    vector<pair<LL, LL>> CB(M);
    for (int i = 0; i < M; i++) {
        LL b, c;
        cin >> b >> c;
        CB[i] = make_pair(c, b);
    }
    sort(CB.rbegin(), CB.rend());

    priority_queue<LL> Q;
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < CB[i].second; j++) {
            if (Q.size() < N) {
                Q.push(CB[i].first);
            } else {
                break;
            }
        }
    }

    for (int i = 0; i < N; i++) Q.push(A[i]);

    LL ans = 0;
    for (int i = 0; i < N; i++) {
        LL top = Q.top();
        ans += top;
        Q.pop();
    }
    cout << ans << endl;

    return 0;
}































Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
#define ll long long  
#define pb push_back
#define mk make_pair
#define mod 998244353
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
int main()
{
    ios::sync_with_stdio(0) ;
    cin.tie(0); 
    int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y;
    
    return 0;
}
//make all values ll


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int H, W, N;
  cin >> H >> W >> N;
  vector<int> vec(H+5);
  
  int ans = H;
  if (H == 1) {
    cout << 1 << endl;
    return 0;
  }
  rep(i, N) {
    int x, y; cin >> x >> y;
    if (vec.at(x) == 0) {
      vec.at(x) = y;
    } else {
      vec.at(x) = min(vec.at(x), y);
    }
  }

  if (vec.at(2) == 1) {
    cout << 1 << endl;
    return 0;
  }

  int pos = 1;
  for(int i=2; i<=H; i++) {
    if (vec.at(i) >= 1 && vec.at(i) <= pos) {
      cout << i-1 << endl;
      return 0;
    }
    if (vec.at(i) == pos+1) continue;
    pos++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=2e5+5;
const int maxa=1e6+5;
int a[maxn],exist[maxa];
bool check(int val)
{
    for(int i=1;i*i<=val;i++)
        if(val%i==0)
        {
            int l=i,r=val/i;
            if(exist[l]||exist[r])
                return false;
        }
    return true;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        exist[a[i]]++;
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        exist[a[i]]--;
        cnt+=check(a[i]);
        exist[a[i]]++;
    }
    printf("%d\n",cnt);
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

const int MOD=998244353;
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,k;
    cin >> n >> m >> k;
    COMinit();
    ll ans=0;
    ll mexp[n+5];
    mexp[0]=1;
    for(int i = 1; i < n+5; i++) {
        mexp[i]=((mexp[i-1])*(m-1))%MOD;
    }

    for(int i = 0; i <= k; i++) {
        ll add=m%MOD;
        add=(add*COM(n-1,i))%MOD;
        add=(add*mexp[n-i-1])%MOD;
        ans=(ans+add)%MOD;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 17104
K, T = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
summation = sum(A[:-1])
maximum = A[-1]

#print(f'{maximum=} {summation=}')
if summation > maximum-2:
    print(0)
else:
    if summation != 0:
        ans = maximum-summation
        print('{}'.format(ans-1))
    else:
        print('{}'.format(maximum-1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define INF (1ll<<60)
#define mod 1000000007
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
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; }

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(ll N) : par(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x,ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(ll x,ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main(){
    ll n,m;cin>>n>>m;
    vector<ll> p(n);
    rep(i,n){
        cin>>p[i];
        p[i]--;
    }
    UnionFind un(n);

    rep(i,m){
        ll a,b;cin>>a>>b;
        a--;b--;
        un.unite(a,b);
    }

    ll ans=0;
    rep(i,n){
        if(un.same(p[i],i)){
            ans++;
        }
    }

    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, m;
	cin >> n >> m;
	int to = 1;
	for (int j = 0; j < n; ++j)
		to *= 10;

	vector<pair<int, int>> a(m);
	for (auto &i : a) cin >> i.F >> i.S, --i.F;

	for (int i = 0; i < to; ++i)
	{
		string s = to_string(i);
		bool ok = s.length() == n;
		if (ok)
			for (auto j : a)
				ok &= s[j.F]-'0' == j.S;
		if (ok)
		{
			cout << i << "\n";
			return 0;
		}
	}
	cout << "-1\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, z = 0, b = 0;
    cin >> n;
    int a, c = 0;
    for (int i = 0 ; i < n ; i++) {
    	cin >> a;
    	int b = 1;
    	while (b) {
    		if (a % 2 == 0) {
    			c++;
    			a /= 2;
			}
			else break;
		}
	}
	cout << c;
}

Measured memory_bytes: 3584
function Picker(input) {
  var lines = input.split('\n');
  var fields = lines.reduce(function(all, line) { return all.concat(line.split(' ')); }, []);
  var p = 0;

  return {
    int: function() {
      return parseInt(fields[p++], 10);
    },
    float: function() {
      return parseFloat(fields[p++]);
    },
    str: function() {
      return fields[p++];
    }
  };
}

function Main(input) {
  var pick = Picker(input);
  var a = pick.int();
  var b = pick.int();

  if (a === b) {
    console.log(a + b);
  } else {
    console.log(a > b ? 2 * a - 1 : 2 * b - 1);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
bool sortbysecdesc(const pair<string,ll> &a,const pair<string,ll> &b)
{
       return a.second>b.second;
}
int main() {
	int a,b;cin>>a>>b;
	if(b==1)return cout<<0<<endl,0;
	int res=b/a+(b%a!=0?1:0);
	while(res*a-(res-1)<b)res++;
	cout<<res<<endl;
	return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> A(N);
  int sum=0;
  for(int i=0;i<N;++i){
    cin>>A[i];
    sum += A[i];
  }
  sort(A.begin(),A.end(),greater<int>());
  int cnt=0;
  for(int i=0;i<N;++i){
    if(4*M*A[i]>=sum) ++cnt;
    else break;
  }

  if(cnt>=M) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

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 INF = 1LL << 60;

int N;

long long a[100010][3];

long long dp[100010][3];

int main(){
  int N; cin >> N;
  rep(i, N){
    cin >> a[i][0];
    cin >> a[i][1];
    cin >> a[i][2];
  }

  rep(j, 3) dp[0][j] = a[0][j];
  REP(i, 1, N){
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i][0];
    dp[i][1] = max(dp[i-1][2], dp[i-1][0]) + a[i][1];
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + a[i][2];
  }
  
  cout << max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2])) << endl;

  return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int n,x;cin >> n >> x;
  vector<int> child(n);
  rep(i,n) cin >> child.at(i);
  sort(all(child));
  int i;
  for(i=0;i<n-1;i++){
    if(x-child.at(i)<=0) break;
    x-=child.at(i);
  }
  if(child.at(i)-x!=0) i--;
  cout << i+1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
		static List<Integer> list = new ArrayList<>();
		static int min;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		min = Integer.MAX_VALUE / 10;

		for(int num = 6; num <= n; num *= 6) {
			list.add(num);
		}
		for(int num = 9; num <= n; num *= 9) {
			list.add(num);
		}
		Collections.sort(list, Collections.reverseOrder());
		
		dfs(0, n);
		out.println(min);
				
		out.close();
	} 
	static void dfs (int cnt, int deposit) {
		if (deposit < 6) {
			min = Math.min(min, cnt + deposit);
		} else {
			int count = 0;
			for(int i = 0; i < list.size(); i++) {
				int num = list.get(i);
				if (num <= deposit) {
					dfs(cnt + 1, deposit - num);
					count++;
				}
				if (count >= 2)
					break;
			} 
		}
	}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    string S; cin >> S;
    S[3] = '8';
    cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N;
  cin>>N;
  vector<int> P(N);
  rep(i,N) cin>>P[i];
  int ans=0;
  rep(i,N-2){
    if(P[i+1]>P[i]&&P[i+1]<P[i+2]) ans++;
    else if(P[i+1]<P[i]&&P[i+1]>P[i+2]) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 0x20000000;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}

    multimap<int, int> route;
    queue<int> que;;
    int frm[200001]={};
void execute()
{
    int N, M;
    cin >> N >> M;

    for(int i = 0; i < M; i++){
        int A, B;
        cin >> A >> B;
         route.insert(multimap<int, int>::value_type(A, B));
         route.insert(multimap<int, int>::value_type(B, A));
    }


    int find_num = 1;
    frm[1] = 1;
    que.push(1);
    while (!que.empty()) {
        int v = que.front();
        que.pop();

        auto p = route.equal_range(v);
        for (auto it = p.first; it != p.second; ++it) 
        {
            int idx = it->second;
            if(frm[idx] == 0){
                frm[idx] = v;
                que.push(idx);
                if(++find_num == N) {
                    // 結果出力
                    cout << "Yes" << endl;
                    for(int i = 2; i <= N; i++){
                        cout << frm[i] << endl;
                    }
                    return;
                }
            }
        }
    }

    cout << "No" << endl;
}


Measured memory_bytes: 22724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    ll n,k;cin>>n>>k;
    vl a(n);rep(i,n)cin>>a[i];
    ll sum=0;
    rep(i,n) sum+=a[i];
    vl div;
    for(ll i=1;i*i<=sum;i++){
        if(sum%i==0) div.push_back(i);
        if(sum%i==0&&i!=sum/i) div.push_back(sum/i);
    }
    sort(div.rbegin(),div.rend());
    rep(i,(int)div.size()){
        ll mcnt=0,pcnt=0;
        vl num;
        rep(j,n){
            ll cnt=a[j]/div[i];
            ll need=a[j]-div[i]*cnt;
            num.push_back(need);
        }
        sort(num.begin(),num.end());
        ll idx=0;
        while(mcnt+num[idx]<=k&&idx<(int)num.size()){
            mcnt+=num[idx];
            idx++;
        } 
        for(int j=idx;j<(int)num.size();j++) pcnt+=div[i]-num[j];
        if(mcnt>=pcnt){
            cout<<div[i]<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
//#include <algorithm>
#include <vector>

#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))

using namespace std;

int main(int argc, char* argv[])
{
    long n, k;
    scanf("%ld %ld", &n, &k);

    vector<long> a(n);
    vector<long> gp(k+1,0);
 
    long i, j;
    for(i=0; i<n; i++) {
        scanf("%ld", &(a[i]));
    }

    for(i=1; i<=k; i++) {
        for(j=0; j<n; j++) {
            if(i>=a[j] && !gp[i-a[j]])
                break;
        }
        gp[i]=(j<n? 1: 0);
    }
    if(gp[k]) {
        printf("First\n");
    }
    else {
        printf("Second\n");
    } 

    return 0;
}


Measured memory_bytes: 1024