akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)
using ll = std::int64_t;
using ull = std::uint64_t;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return vec<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec


using namespace std;

const size_t SIZE = 2010;
const ll mod = 1e9 + 7;
const ll inf = 5e15;
array<array<ll, SIZE>, SIZE> dp;
array<array<bool, SIZE>, SIZE> calced;
array<array<ll, 26>, SIZE> cntf, cntb;

ll calc(ll l, ll r) {
    if (calced[l][r]) return dp[l][r];
    calced[l][r] = true;
    ll ret = 0;
    for (ll i = 0; i < 26; i++) {
        ll fst = cntf[l][i], snd = cntb[r][i];
        if (l <= fst && fst <= snd && snd <= r) ret += 1;
        if (l <= fst && fst < snd && snd <= r) ret += calc(fst + 1, snd - 1) + 1;
    }
    return dp[l][r] = ret % mod;
}

int main() {
    string s;
    cin >> s;

    for (auto &&e : cntf) fill(ALL(e), inf);
    for (ll i = (ll)s.size() - 1; 0 <= i; i--) {
        for (ll j = 0; j < 26; j++) cntf[i][j] = cntf[i + 1][j];
        cntf[i][s[i] - 'a'] = i;
    }

    for (auto &&e : cntb) fill(ALL(e), -1);
    cntb[0][s[0] - 'a'] = 0;
    for (ll i = 1; i < s.size(); i++) {
        for (ll j = 0; j < 26; j++) cntb[i][j] = cntb[i - 1][j];
        cntb[i][s[i] - 'a'] = i;
    }

    cout << calc(0, s.size() - 1) << endl;
    return 0;
}



Measured memory_bytes: 28560
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: August 19,2019
 * 
 */

#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>
#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define ef else if
#define wh while
#define el else
#define ivv(x) int x; cin>>x
#define lv(x) bint x; cin>>x
#define sv(x) string x; cin>>x
#define cv(x) char x; cin>>x
#define fv(x) float x; cin>>x
#define dv(x) double x; cin>>x
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {
    // your solution goes here 
    ivv(n);
    double sum = 0.0f;
    while(n--){
        dv(x);
        sum+=(1.0f/x);
    }
    cout<<(1.0f/sum)<<endl;
    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def low_link(nodes):
    N = len(nodes)
    visited = [False] * N
    prenum = [0] * N
    parent = [0] * N
    lowest = [0] * N
    bridges = []
    timer = 1

    def rec(cur, prev, timer):
        # curを訪問した直後の処理
        prenum[cur] = lowest[cur] = timer
        timer += 1
        visited[cur] = True
        for nxt in nodes[cur]:
            if not visited[nxt]:
                # curからvへ訪問する直前の処理
                parent[nxt] = cur
                timer = rec(nxt, cur, timer)
                # nxtの探索が終了した直後の処理
                lowest[cur] = min(lowest[cur], lowest[nxt])
                # より近い経路を含まないなら橋とする
                if lowest[nxt] == prenum[nxt]:
                    # 番号の小さい方から入れる
                    bridges.append((min(cur, nxt), max(cur, nxt)))
            elif nxt != prev:
                # cur -> nxt がback-edgeの場合の処理
                lowest[cur] = min(lowest[cur], prenum[nxt])
        return timer
    # 必要な各値の取得(非連結に対応するため全頂点から)
    for i in range(N):
        if not visited[i]:
            timer = rec(i, -1, timer)

    # 間接点
    aps = set()
    # ルートの子ノードの数
    np = 0
    for i in range(1, N):
        p = parent[i]
        if p == 0:
            np += 1
        # 条件2の確認
        elif prenum[p] <= lowest[i]:
            aps.add(p)
    # 条件1の確認
    if np > 1:
        aps.add(0)

    return aps, bridges

N, M = MAP()
nodes = [[] for i in range(N)]
for i in range(M):
    u, v = MAP()
    nodes[u].append(v)
    nodes[v].append(u)

aps, bridges = low_link(nodes)

aps = sorted(aps)
for x in aps:
    print(x)



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

int main(){
	int n,a[1000];
	double ma = -1.0;
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	sort(a,a + n);
	for(int i = 0;i < 3;i++){
		for(int j = 0;j < n - i - 1;j++){
			int b = j,c = j + i + 1,d = -1,e,used[1000] = {};
			used[b] = true;
			used[c] = true;
			for(int k = n - 1;k >= 0;k--){
				if(!used[k]){
					if(d == -1) d = k;
					else{
						e = k;
						break;
					}
				}
			}
			ma = max(ma,(double)(a[d] + a[e]) / (double)(a[c] - a[b]));
		}
	}
	printf("%.9lf\n",ma);
	return 0;
}

Measured memory_bytes: 3256
/*
	問題解決の宝石箱 〜 区間に含まれる区間の数をカウントするクエリにたくさん答えたい
	http://hama-du-competitive.hatenablog.com/entry/2017/04/22/185540

	平面走査による解答例.
*/
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define DATA 0
#define QUERY 1
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

/*
	木に対する一般的なテク達.pdf より発展。

	遅延評価のセグメント木（２）

	注意！）N は今の所 2 のべき乗を想定している。

	[a,b) の範囲に x を加える update(a, b, 0, 0, N, x) (N は配列要素数、セグメント全体の配列ではない。)
	[a,b) の範囲の和を求める  query(a, b, 0, 0, N)	
*/
struct segtree{
	int SIZE;
	vector<int> lazy, sum;

	segtree(int _SIZE):SIZE(_SIZE){
		lazy.clear();
		lazy.resize(SIZE * 2, 0);
		sum.clear();
		sum.resize(SIZE * 2, 0);
	};

	void lazy_evaluate(int l, int r, int k){
		sum[k] += lazy[k] * (r - l);

		if (k < SIZE - 1){ // k isn't leaf of SegmentTree
			lazy[k * 2 + 1] += lazy[k];
			lazy[k * 2 + 2] += lazy[k];
		} // end if
		lazy[k] = 0;
	} // end function

	void update(int a, int b, int k, int l, int r, int x){
		if (r <= a || b <= l) return;

		if (a <= l && r <= b){
			lazy[k] += x;
			lazy_evaluate(l, r, k);
		}else{
			lazy_evaluate(l, r, k);
			update(a, b, k * 2 + 1, l, (l + r) / 2, x);
			update(a, b, k * 2 + 2, (l + r) / 2, r, x);
			sum[k] = sum[k * 2 + 1] + sum[k * 2 + 2];
 
			return;
		} // end if
	} // end function 

	int query(int a, int b, int k, int l, int r){
		lazy_evaluate(l, r, k);
		if (r <= a || b <= l) return 0;
		if (a <= l && r <= b) return sum[k];
		else{
			int lch = query(a, b, k * 2 + 1, l, (l + r) / 2);
			int rch = query(a, b, k * 2 + 2, (l + r) / 2, r);

			return lch + rch;
		} // end if
	} // end function
};

struct RANGE{
	int index;
	int left;
	int right;
	int kind;

	bool operator<(const RANGE& range) const {
		return (right == range.right ? kind < range.kind : right < range.right);
	}
}; 

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, M, Q; cin >> N >> M >> Q;
	vector<RANGE> range(M + Q);
	rep (i, M){
		int L, R; cin >> L >> R;
		range[i] = (RANGE){i, L, R+1, DATA};
	} // end rep

	rep (i, Q){
		int p, q; cin >> p >> q;
		range[i + M] = (RANGE){i, p, q+1, QUERY};
	} // end rep

	sort(ALL(range));

	int n = 1;
	while(n <= N) n *= 2;

	segtree seg(n);
	vector<int> res(Q,-1);
	rep (i, M + Q){
		int index = range[i].index;
		int left = range[i].left;
		int right = range[i].right;
		int kind = range[i].kind;
		if (kind == DATA){
			seg.update(left, left + 1, 0, 0, n, 1);
		}else{ // if (kind == QUERY)
			int ans = seg.query(left, right + 1, 0, 0, n);
			res[index] = ans;
		} // end if
	} // end rep

	rep (i, Q){
		cout << res[i] << endl;
	} // end rep

	return 0;
}

Measured memory_bytes: 6016
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                if (m * i + n * j - 2 * i * j == k) {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 22996
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC105_2 solver = new ABC105_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC105_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int NN = in.nextInt();

            if ((NN % 4) == 0) {
                out.println("Yes");
                return;
            }

            if ((NN % 7) == 0) {
                out.println("Yes");
                return;
            }

            for (int i = 4; i < NN; i += 4) {
                if ((NN - i) % 7 == 0) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
        }

    }
}



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

typedef long long ll;

int main() {
	ll n;
	cin >> n;
	ll m = 100000000000, M = 0, res = -10000000000;
	for (ll i = 0; i < n; i++) {
		ll a;
		cin >> a;
		res = max(res, a - m);
		m = min(m, a);
	}
	cout << res << endl;
}


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

int main() {
  int A,B;
  cin >> A >> B;
  int N = A;
  int count = 0;
  for(int i = A; i <= B; i++){
    int a = N % 10;//一の位
    int b = (N % 100 - a) / 10;//十の位
    int c = (N % 1000 - a - b * 10) / 100;//百の位
    int d = (N % 10000 - a - b * 10 - c * 100) / 1000;//千の位
    int e = (N - a - b * 10 - c * 100 - d * 1000) / 10000;//一万の位
    
    if(N == a * 10000//一万の位
         + b * 1000//千の位
         + c * 100//百の位
         + d * 10//十の位
         + e)//一の位
      count++;
    
    N++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n;
  int stu[100] = {0};
  cin >> n;
  while(n-- ){
    double h;
    cin >> h;
    if(h < 165.0){
      stu[0]++; 
    }else if(h < 170.0){
      stu[1]++;
    }else if(h < 175.0){
      stu[2]++;
    }else if(h < 180.0){
      stu[3]++;
    }else if(h < 185.0){
      stu[4]++;
    }else stu[5]++;
  }

  for(int i = 0 ; i < 6 ; i++){
    for(int j = 0 ; j < stu[i]+1 ; j++){
      if(j == 0 )cout << i+1 << ":";
      else cout << '*';
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<n; i++)

int main(){
    int a, b; cin >> a >> b;
    for(int i=0; i < 10000; i++){
        int eight = i * 8 / 100;
        int ten = i * 10 / 100;
        if(a ==eight && b == ten){
            cout << i;
            return 0;
        }
    }

    cout << -1;
    return 0;
}


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

struct Edge {
	int from, to, flow, rev;
	Edge() {}
	Edge(int from, int to, int flow, int rev) {
		this->from = from;
		this->to = to;
		this->flow = flow;
		this->rev = rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

const int VMAX = 100;

void add_edge(Graph &g, int s, int t, int flow) {
	g[s].push_back(Edge(s, t, flow, g[t].size()));
	g[t].push_back(Edge(t, s, 0, g[s].size() - 1));
}

int dfs(Graph &g, int s, int t, int level[], int seenEdgeCount[], int flow) {
	if (s == t) return flow;
	
	for (int &i = seenEdgeCount[s]; i < g[s].size(); i++) {
		int nv = g[s][i].to;
		if (level[nv] != level[s] + 1 || g[s][i].flow <= 0) continue;	//辺残量も確認する！
		int f = dfs(g, nv, t, level, seenEdgeCount, min(flow, g[s][i].flow));
		if (f <= 0) continue;
		//s --> nv間にfだけ流す
		g[s][i].flow -= f;
		g[nv][g[s][i].rev].flow += f;
		return f;
	}
	return 0;
}

int maxflow(Graph g, int s, int t) {
	int i, level[VMAX], ret = 0;

	while (true) {
		for (i = 0; i < g.size(); i++) level[i] = -1;
		queue<int> que;
		
		level[s] = 0;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (i = 0; i < g[v].size(); i++) {
				if (g[v][i].flow <= 0) continue;
				int nv = g[v][i].to;
				if (level[nv] == -1) {
					level[nv] = level[v] + 1;
					que.push(nv);
				}
			}
		}
		if (level[t] == -1) break;
		
		int seenEdgeCount[VMAX] = {0};
		
		int flowINF = 1e+9;	//辺容量の最大値よりも大きな値にする
		
		while (true) {
			int f = dfs(g, s, t, level, seenEdgeCount, flowINF);
			if (f <= 0) break;
			ret += f;
		}
	}
	return ret;
}

int n, m;
Graph g;

int main() {
	int i;
	
	cin >> n >> m;
	g.resize(n);
	for (i = 0; i < m; i++) {
		int u, v, f;
		cin >> u >> v >> f;
		add_edge(g, u, v, f);
	}
	cout << maxflow(g, 0, n - 1) << endl;
	return 0;
}


Measured memory_bytes: 3192
// RAKSHIT KADAM
 
//  -- Declare array globally...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// find_by_order returns iterator to  element present at that index...
// order_of_key returns no. of elements having value stricktly less than that given in the order_of_key();
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000003
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 200006
    #define pi 3.1415926535897932384626433832795
#define ld long doubles
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 200003;

ll a[maxn][2];
void solve()
{
    ll n;
    cin>>n;
    for(ll i=0;i<n-1;i++)
    {
        cin>>a[i][0]>>a[i][1];
        sort(a[i],a[i]+2);
    }
    ll ans =0;
    for(ll i=1;i<=n;i++)
    {
        ans+=(i)*(n-i+1);
    }
    for(ll i=0;i<n;i++)
    {
        ans-=(a[i][0])*(n-a[i][1]+1);
    }
    cout<<ans<<endl;
}
signed main()
{
   Need_for_speed(activated);
 
//satisfy
//    {
//  solve();
//   }
//
    solve();
    return 0;
}


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


using namespace std;


int main() {
    int n; cin >> n;
    vector<int> a(n+1), b(n);
    for (int i=0; i<=n; i++) cin >> a[i];
    for (int i=0; i<n ; i++) cin >> b[i];

    int cur;
    long long score = 0;
    for (int i=0; i<n; i++) {
        // if a[i] > b[i] => b[i]  (敵の数のほうがおおい)
        // if a[i] < b[i] => a[i]  (倒せる数の方がおおい）
        cur = min(a[i], b[i]);
        score += cur; a[i] -= cur; b[i] -= cur;

        if (b[i] == 0) continue;

        cur = min(a[i+1], b[i]);
        score += cur; a[i+1] -= cur; b[i] -= cur;
    }

    cout << score << endl;
    return 0;
}



Measured memory_bytes: 1024
#include<iostream>

using namespace std;
typedef long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define int ll
signed main(){
    int N,C;int s[214514],t[214514],c[214514];
    int x[214514]={},y[214514]={};
    
    cin>>N>>C;
    REP(i,N){
        cin>>s[i]>>t[i]>>c[i];
        s[i]*=2;t[i]*=2;
        }
    REP(j,C){
        REP(i,214514){
            y[i]=0;
        }
        REP(i,N){
        if(c[i]-1==j){    
            y[s[i]-1]++;
            y[t[i]]--;
        }
        }
    REP(i,214513){
        y[i+1]+=y[i];
        }
    REP(i,214514){
        if(y[i]>0){
                x[i]++;
            }
        }
    }
    int Ans=0;
    REP(i,214514){
        Ans=max(Ans,x[i]);
        }
    cout<<Ans<<endl;
    return 0;
    }

Measured memory_bytes: 8576
N, K = map(int,input().split())
A = list(map(int,input().split()))
start = 0
end = 10**9
while end - start > 1:
   l = (start + end)/2
   l = int(l)
   count = 0
   for i in range(N):
      q = A[i]/l
      if q == int(q):
         q -= 1
      count += int(q)
   if count <= K:
      end = l
   else:
      start = l
print(end)

Measured memory_bytes: 104496
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a - 1) * (b - 1) << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
    unsigned int N, M;
    unsigned int A[10000];
    unsigned int sum = 0;
    unsigned int play = 0;

    scanf("%d %d", &N, &M);
    for (int i = 0; i < M; i++){
        scanf("%d", &A[i]);
        sum += A[i];
    }

    if(sum > N){
        printf("-1");
    }else{
        play = N - sum;
        printf("%d", play);
    }
    }

Measured memory_bytes: 1768
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

typedef pair<int,int> pii;
typedef pair<int,pii> piii;

piii extgcd(int a,int b){
  if(b==0)return a>0?piii(a,pii(1,0)):piii(-a,pii(-1,0));
  piii res=extgcd(b,a%b);
  int x=res.second.first,y=res.second.second;
  return piii(res.first,pii(y,x-a/b*y));
}

int main(void){

  int a,b;

  cin >> a >> b;

  piii res=extgcd(a,b);
  cout << res.second.first << " " << res.second.second << endl;

  return 0;
}

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

int main(){
	int a,b;
	cin >> a;
	cin>>b;
	if (a<b) {
		cout << "a < b" << endl;
	}else if(a>b){
	cout << "a > b" << endl;
	}else{
	cout<<"a == b"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b; cin >> a >> b;
    if(a > b*2) OUT(a - b*2);
    else OUT(0);

    return 0;
}

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

using namespace std;

void solve(long X) {
  for(long A = -1000; A <= 1000; A++)
    for(long B = -1000; B <= 1000; B++)
      if (pow(A, 5) - pow(B, 5) == X) {
	cout << A << " " << B << endl;
	return;
      }
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  long X;
  cin >> X;

  solve(X);

  return 0;
}


Measured memory_bytes: 4028
import collections
n = int(input())
w = list(str(input()) for _ in range(n))
w2 = list(collections.Counter(w).values())
if max(w2) != 1:
    print('No')
else:
    for i in range(n-1):
        if w[i][-1] != w[i+1][0]:
            print('No')
            break
    else:
        print('Yes')

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <string>
// #include <vector>
using namespace std;
int main()
{

  string s, t;
  cin >> s >> t;


  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());

  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;

}

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

using namespace std;

#define ll long long 

int const N = 1e5 + 20;
int const INF = 1e9 + 7;

ll h[N], t, memo[N];

int main(){
	
	memset(memo, INF, sizeof(memo));
	
	cin>>t;
	for(int i = 0; i < t; ++i)
		cin>>h[i];
		
	memo[0] = 0;
	for(int i = 0; i < t; ++i)
		for(int j: {i + 1, i + 2})
			if(j < t)
				memo[j] = min(memo[j], memo[i] + abs(h[i] - h[j]));
				
	cout<<memo[t-1];
	return 0;
}


Measured memory_bytes: 5056
use proconio::input;
use std::cmp::max;

fn main() {
    input!{
        n:usize,
        a:[i64;n]
    };

    let mut dp = vec![0;n+1];

    dp[0] = 1000;

    for i in 0..n {
        for j in 0..i {
            let v = a[j..(i+1)].iter().min().unwrap();
            let rest = dp[j]%v;
            let profit = dp[j]/v*a[i];
            dp[i+1] = max(dp[i+1],rest+profit);
        }
    }
    
    println!("{}",dp[0..(n+1)].iter().max().unwrap());
}



Measured memory_bytes: 2136
#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 sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    vector<string> s(n);
    rep(i, n) {
        cin >> s[i];
        sort(all(s[i]));
    }

    sort(all(s));
    
    ll ans = 0;
    int cnt = 1;
    string tmp;
    rep(i, n-1) {
        if (s[i] == s[i+1]) {
            ans += cnt;
            cnt++;
        } else {
            cnt = 1;
        }
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 7296
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




int n;
int a[210];

int main() {
  while (cin >> n) {
    for (int i = 0; i < n; ++i) cin >> a[i];
    int Min = 1<<29;
    for (int j = -100; j <= 100; ++j) {
      int sum = 0;
      for (int k = 0; k < n; ++k) sum += (a[k] - j) * (a[k] - j);
      chmin(Min, sum);
    }
    cout << Min << endl;
  }
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    string s;
    cin >> s;
    string ans = "";
    REP(i, s.size())
    {
        if(i % 2 == 0){
            ans = ans + s[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  int N, D, cnt=1;
  cin >> N >> D;
  int A=D+1;
  while(A<=N){
    A=A+2*D+1;
    if(A-D<=N) cnt++;
  }
  cout << cnt << endl;
}

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

//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ms(a, b) memset((a), (b), sizeof(a))
#define len(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << '\n';
}
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...);
}

template <class T> bool mini(T& a, T b) { return a > b ? (a = b, 1) : 0; }
template <class T> bool maxi(T& a, T b) { return a < b ? (a = b, 1) : 0; }

typedef long long ll;
typedef double db;
typedef pair<int, int> pi;
typedef pair<int, pi> ti;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ti> vti;
typedef vector<vpi> vvpi;

const int inf = (int)0x3f3f3f3f3f3f3f3f;
const int ninf = (int)0xc0c0c0c0c0c0c0c0;
const ll M = (ll)1e9 + 7;

main() {
    int n, k; cin >> n >> k;
    vi a(n); for (int& x : a) cin >> x;
    sort(all(a));
    ll ans = 0;
    fore(i, 0, n - k) ans += a[i];
    cout << ans << '\n';
}


Measured memory_bytes: 1024
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	const S = parseInt(input[0], 10);
  const W = parseInt(input[1], 10);

  const ret = (S <= W)? 'unsafe' : 'safe';
  console.log(ret);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30340
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  long long n;
  cin >> n;
  long long sq = sqrt(n);
  int mina = 12;
  for(int i = 1; i <= sq; i++){
    if(n % i != 0){
      continue;
    }else{
      long long p = n / i;
      int cur = max(log10(p), log10(i)) + 1;
      if(cur < mina){
        mina = cur;
      }
    }
  }
  cout << mina << endl;
}


Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

show_flg=False
show_flg=True

ans=0

n,k=LI()

for i in range(k,n+1+1):
    #r=(n+n-k+1)*k//2-(k-1)*k//2+1
    r=(n+n-i+1)*i//2-(i-1)*i//2+1
    r%=mo
    ans+=r
    #show(i,r)


print(ans%mo)






Measured memory_bytes: 76636
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int k;

  cin >> k;

  cout << (k / 2) * ((k+1) / 2) << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos

double memo[1001];

double kitai(ll num) {

  if (memo[num] != 0) {
    return memo[num];
  }

  double r = 0.0d;
  for (ll j = 1; j <= num; j++) {
    r += (1.0d / num) * j;
  }

  memo[num] = r;

  return r;
}

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

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

  ll p[N];
  double rui[N];
  for (ll i = 0; i < N; i++) {
    cin >> p[i];
    rui[i] = rui[i - 1] + kitai(p[i]);
  }

  double c = 0.00d;
  for (ll i = 0; i < N - K + 1; i++) {

    double before = i == 0 ? 0.00d : rui[i - 1];
    double after = rui[i + K - 1];

    c = max(c, after - before);
  }

  PS(c);

  return 0;
}


Measured memory_bytes: 3456
N,K = map(int,input().split())
A = [[0]* N for i in range(K)]
d = [0] * K
for i in range(K):
    d[i] = int(input())
    A[i][:] = map(int,input().split())
     
#print("d",d)
#print("A:",A)
ans = 0
count = [0] * (N+1)
for i in range(K):
    for j in range(d[i]):
        #print(A[i][j])
        count[A[i][j]]=1 # お菓子持っていたら1にする

#print(count)
for i in range(1,len(count)):
    if count[i]==0:
        ans +=1

print(ans)


Measured memory_bytes: 9180
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    ll a[100010];
    cin >> n;
    imfor(i, n) {
        cin >> a[i];
    }
    ll ans1 = 0, ans2 = 0;
    // + - + - ...
    ll tmp = 0;
    for (int i = 0; i < n; i++) {
        tmp += a[i];
        if (i % 2 == 0) {
            if (tmp <= 0) {
                ans1 += 1 - tmp;
                tmp = 1;
            }
        }
        else {
            if (tmp >= 0) {
                ans1 += 1 + tmp;
                tmp = -1;
            }
        }
    }
    //- + - + ...
    tmp = 0;
    for (int i = 0; i < n; i++) {
        tmp += a[i];
        if (i % 2 == 1) {
            if (tmp <= 0) {
                ans2 += 1 - tmp;
                tmp = 1;
            }
        }
        else {
            if (tmp >= 0) {
                ans2 += 1 + tmp;
                tmp = -1;
            }
        }
    }
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 1024
/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

#define N 17

int test;

int n,m;

int cou;

int dp[(1<<N)][N];

int kek[(1<<N)][N];

int cost[N][N];

void solve()
{
    cin >> n >> m;

    FOR(i,1,m){
        int a,b,c;
        cin >> a >> b >> c;
        a--;b--;

        cost[a][b] = cost[b][a] = c;
    }   

    for(int mask = 1; mask < (1<<n); mask++){
        for(int i=0; i < n; i++){
            dp[mask][i] = inf;
        }
    }

    for(int mask = 1; mask < (1<<n); mask++){
        for(int i=0; i < n; i++){
            if ( ! ( (1<<i) & mask) ){ // jesli i nie ma
                for(int j=0; j<n; j++){
                    if ( (1<<j) & mask ){ // jesli j jest
                        kek[mask][i] += cost[i][j];
                    }
                }
            }
        }
    }

    dp[1][0] = 0;

    for(int mask = 1; mask < (1<<n) ;mask++){
        for(int i=0; i < n; i++){
            if ( (1<<i) & mask) { // jesli i nie ma
                for(int j=0; j<n; j++){
                    if ( (1<<j) & mask && i!=j && cost[j][i]){ // jesli j jest
                        dp[mask][i] = min(dp[mask][i], dp[mask^(1<<i)][j] + kek[mask^(1<<i)][i] - cost[j][i]);
                    }
                }
            }
        }

        int mask1 = (mask-1)&mask;

        while(mask1){
            int mask2 = mask^mask1;

            int res = 0;

            for(int i=0; i<n; i++){
                if ( (1<<i) & mask1 ){
                    res += kek[mask2][i];
                }
            }

            for(int i=0; i<n; i++){
                if ( (1<<i) & mask1 ){
                    dp[mask][i] = min( dp[mask][i], dp[mask1][i] + res - kek[mask2][i]);
                }
            }

            mask1 = (mask1-1)&mask;
        }
    }

    cout << dp[(1<<n)-1][n-1];

    return;
}

int32_t main()
{
    boost

    test=1;

    while(test--)
    {
        solve();
    }

  return 0;
}


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

int main() {
	std::string a,b,c;
	std::cin >> a >> b >> c;
	std::string k = "   ";
	k.at(0) = a.at(0) ;
	k.at(1) = b.at(0) ;
	k.at(2) = c.at(0);
	std::transform(k.begin(),k.end(),k.begin(),toupper);
    std::cout << k << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  string s;
  cin >> s;
  string k = "keyence";
  int cnt1 = 0;
  rep(i,k.size()){
    if(s[i]==k[i]){
      cnt1++;
    }
    else{
      break;
    }
  }

  int cnt2 = 0;
  rep(i,k.size()){
    if(s[s.size()-1-i]==k[k.size()-1-i]){
      cnt2++;
    }
    else{
      break;
    }
  }  

  if(cnt1+cnt2>=(int)k.size()){
    cout << "YES" << "\n";
  }
  else {
    cout << "NO" << "\n";
  }

  
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val input = readLine()!!
  val count = IntArray(n + 1)
  for (i in 1..n) {
    if (input[i - 1] == '#') {
      count[i] = count[i - 1] + 1
    } else {
      count[i] = count[i - 1]
    }
  }
  val ans = (0..n).map {
    val cost1 = count[it]
    val cost2 = (n - it) - (count[n] - count[it])
    cost1 + cost2 }
      .min()
  println(ans)
}


Measured memory_bytes: 39328
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
class Radix { //n進数に変換
// Radix rと宣言してからr.to(a,b)で変換
private:
  const char* s;
  int a[100000];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;    for(i = 0; s[i]; ++i)

      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "a";
    char t[64000] = { };
    for(i = 62000; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};

int main(){
    int n,k;
    std::cin >> n>>k;
    Radix r;
    std::cout << r.to(n,k).size() << std::endl;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    string s;
    cin>> s;

    for(int i=0; i< s.size(); i++)
    {
        if( ( i%2== 0 && s[i] == 'L') or ( i%2== 1 && s[i] == 'R'))
        {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";

    return 0;
}




Measured memory_bytes: 3620
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author zhangyong
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int num = in.nextInt();
            out.println("ABC" + num);
        }

    }
}



Measured memory_bytes: 22228
main :: IO ()
main = do
    _ <- getLine
    s <- getLine
    putStrLn $ solve s

solve :: String -> String
solve s =
    impl 0 "" "" s
    where
        impl :: Int -> String -> String -> String -> String
        impl p k kk ""
            | p == 0 = kk ++ (reverse k)
            | otherwise = impl (p-1) (')':k) kk ""
        impl p k kk ('(':cs)
            | p == 0 = impl (p+1) "(" (kk ++ (reverse k)) cs
            | otherwise = impl (p+1) ('(':k) kk cs
        impl p k kk (')':cs)
            | p == 0 = impl p (')':k) ('(':kk) cs
            | otherwise = impl (p-1) (')':k) kk cs

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

# f(n)を事前に計算
f = {}

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            f[n] = f.get(n, 0) + 1

for i in range(1, N+1):
    print(f.get(i, 0))


Measured memory_bytes: 11524