akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

using namespace std;

#define MAX 10000
#define NIL -1

struct Node { int parent, left, right;};

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u,int d) {
	if(u == NIL) return;
	D[u] = d;
	setDepth(T[u].left, d+1);
	setDepth(T[u].right,d+1);
}

int setHeight(int u) {
	int h1 = 0, h2 = 0;
	if(T[u].left != NIL)
		h1 = setHeight(T[u].left)  + 1;
	if(T[u].right != NIL)
		h2 = setHeight(T[u].right) + 1;
	return H[u] = (h1 > h2 ? h1 : h2);
}

// 接点 u の兄弟を返す
int getSibling(int u) {
	if( T[u].parent == NIL ) return NIL;
	if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
		return T[T[u].parent].left;
	if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
		return T[T[u].parent].right;
	return NIL;
}

void print(int u) {
	printf("node %d: ",u);
	printf("parent = %d, ",T[u].parent);
	printf("sibling = %d, ",getSibling(u));
	int deg = 0;
	if(T[u].left  != NIL) deg++;
	if(T[u].right != NIL) deg++;
	printf("degree = %d, ",deg);
	printf("depth = %d, ",D[u]);
	printf("height = %d, ",H[u]);
	
	if(T[u].parent == NIL) {
		printf("root\n");
	} else if(T[u].left == NIL && T[u].right == NIL) {
		printf("leaf\n");
	} else {
		printf("internal node\n");
	}
}

int main(void) {
	int v, l, r, root = 0;
	scanf("%d",&n);
	for(int i=0;i<n;i++) T[i].parent = NIL;
	for(int i=0;i<n;i++) {
		scanf("%d %d %d",&v,&l,&r);
		T[v].left  = l;
		T[v].right = r;
		if(l != NIL) T[l].parent = v;
		if(r != NIL) T[r].parent = v;
	}
	
	for(int i=0; i<n; i++)
	if(T[i].parent == NIL) root = i;
	
	setDepth(root,0);
	setHeight(root);
	
	for(int i=0;i<n;i++) print(i);
	
	return 0;
}


Measured memory_bytes: 2768
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s, t = input().split()
a, b = na()
u = input()
if u == s:
    print(a-1, b)
else:
    print(a, b-1)

Measured memory_bytes: 38384
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>
#include <string.h>
#include <cctype>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

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

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

bool comp(int i, int j) {
	return i > j;
}

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

	for (int i = 1; i < 4; i++)
	{
		if (s[i - 1] == s[i])
		{
			cout << "Bad";
			return 0;
		}
	}
	cout << "Good";
}



Measured memory_bytes: 31488
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

# input = sys.stdin.readline


def main():
    n = int(input())

    stu = defaultdict(int)

    count = 1
    for o in input().split():
        stu[count] = int(o)
        count += 1

    stu = sorted(stu.items(), key=lambda x: x[1])

    ans = []
    for s in stu:
        ans.append(s[0])

    print(*ans, sep=' ')


if __name__ == '__main__':
    main()

Measured memory_bytes: 25520
#include<stdio.h>
int main()
{
	long long n,m,a[200009],b[200009],c[300000],i;
	scanf("%lld%lld",&n,&m);
	    for(i=1;i<=m;i++)
	    {
	      scanf("%lld%lld",&a[i],&b[i]);
	        if(a[i]==1&&b[i]!=n)
			c[b[i]]=1;
	    }	
				    for(i=1;i<=m;i++)
					
	     	         {
				        if(b[i]==n&&c[a[i]]==1)
				          {
						  printf("POSSIBLE\n");
	     	              return 0;
						   }
				     }
				 
	printf("IMPOSSIBLE\n");
	return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll n;
vector<ll> a(400);
vector<vector<ll>> dp(410,vector<ll>(410,-1));
vector<ll> ruiseki(401,0);

ll solve(ll l, ll r)
{
    if(dp.at(l).at(r) != -1) return dp.at(l).at(r);
    if(l == r) return dp.at(l).at(r) =  0;
    if(r == l+1) return dp.at(l).at(r) = a.at(l) + a.at(r);
    ll i;
    ll res = 1e18;
    for(i = l;i < r;++i){
        res = min(res, solve(l,i) + solve(i+1,r) + ruiseki.at(r+1) - ruiseki.at(l));
    }
    return dp.at(l).at(r) = res;
}

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    for(i = 1;i <= n;++i){
        ruiseki.at(i) = ruiseki.at(i-1) + a.at(i-1);
    }
    ll ans = solve(0, n-1);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

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

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    Vec a(n);
    cin>>a;

    map<ll,ll> mp;
    rep(i,n){
        mp[a[i]]++;
    }
    ll x = mp.size();
    ll cnt = 0;
    Each(p, mp){
        cnt += p.se-1;
    }
    ll ans= x;
    if(cnt%2==1){
        ans--;
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 7296
require 'prime'
n = gets.to_i

def factorial(n)
  return 1 if n == 0
  n * factorial(n-1)
end

num = factorial(n)
primes = num.prime_division.select{|a| a[1] >= 2}.map{|a| a[1]}

ans = 0

primes.size.times do |i|
  if primes[i] >= 74
    ans += 1
  else
    break
  end
end

primes.size.times do |i|
  if primes[i] >= 24 
    primes.size.times do |j|
      if i == j
        next
      end
      if primes[j] >= 2
        ans += 1
      end
    end
  else
    break
  end
end

primes.size.times do |i|
  if primes[i] >= 14 
    primes.size.times do |j|
      if i == j
        next
      end
      if primes[j] >= 4
        ans += 1
      end
    end
  else
    break
  end
end

primes.size.times do |i|
  if primes[i] >= 4
    primes.size.times do |j|
      if i >= j
        next
      end
      if primes[j] >= 4
        primes.size.times do |k|
          if i == k || j == k
            next
          end
          if primes[k] >= 2
            ans += 1
          end
        end
      end
    end
  else
    break
  end
end

puts ans


Measured memory_bytes: 2044
import sys
input = sys.stdin.readline

N = int(input())
ans = 0
if N >= 10 ** 5:
    N = 10 ** 5 - 1
if N >= 10 ** 4:
    ans += N - 10 ** 4 + 1
if N >= 10 ** 3:
    N = 10 ** 3 - 1
if N >= 10 ** 2:
    ans += N - 10 ** 2 + 1
if N >= 10 ** 1:
    N = 10 ** 1 - 1
if N >= 10 ** 0:
    ans += N
print(ans)


Measured memory_bytes: 38256
N,M,Q=map(int,input().split())
S=[]
for i in range(Q):
    S.append(list(map(int,input().split())))
try_lis=[]
def dfs(A):
    if len(A)==N:
        try_lis.append(A[::1])
        return   
    for v in range(1,M+1):
        if v>=A[-1]:
            A.append(v)
            dfs(A)
            A.pop()
dfs([1])
total=0
for one_case in try_lis:
    tmp=0
    for j in S:
        if one_case[j[1]-1]-one_case[j[0]-1]==j[2]:
            tmp+=j[3]

    total=max(total,tmp)

print(total)

Measured memory_bytes: 16236
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;
i64 giant = 4000000000000000000;

using namespace std;

int main() {
	string s;
	cin >> s;
	i64 dp[100010][13];
	dp[0][0] = 1;
	ff(i, 1, 13) {
		dp[0][i] = 0;
	}
	ff(i, 0, s.size()) {
		int b;
		if (s[i] != '?')b = s[i] - '0';
		else b = -1;
		ff(j, 0, 13)dp[i + 1][j] = 0;
		if (b >= 0) {
			ff(j, 0, 13) {
				dp[i + 1][(j * 10 + b) % 13] += dp[i][j];
			}
		}
		else {
			ff(j, 0, 13) {
				ff(k, 0, 10) {
					dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
				}
			}
			ff(j,0,13)dp[i + 1][j] %= inf;
		}
	}
	cout << dp[s.size()][5] << endl;
	return 0;
}

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

using namespace std;
using namespace __gnu_cxx;

typedef double db;
typedef long long ll;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef unsigned long long ull;

#define F          first
#define S          second
#define pnl        printf("\n")
#define sz(x)      (int)x.size()
#define sf(x)      scanf("%d",&x)
#define pf(x)      printf("%d\n",x)
#define all(x)     x.begin(),x.end()
#define rall(x)    x.rbegin(),x.rend()
#define rep(i, n)  for(int i = 0; i < n; ++i)

const db eps = 1e-9;
const db pi = acos(-1);
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000 * 1000 * 1000 + 7;

int n, m;
int a[10];
int c[] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int dp[10005];

int solve(int rem) {
    if (rem <= 0) return (rem == 0 ? 0 : -INF);
    int &ret = dp[rem];
    if (~ret) return ret;
    ret = -INF;
    for (int i = 0; i < m; ++i) {
        ret = max(ret, solve(rem - c[a[i]]) + 1);
    }
    return ret;
}

void trace(int rem) {
    if (rem == 0) return;
    int &ret = dp[rem];
    for (int i = 0; i < m; ++i) {
        if (ret == solve(rem - c[a[i]]) + 1) {
            cout << a[i];
            trace(rem - c[a[i]]);
            return;
        }
    }
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
        cin >> a[i];
    sort(a, a + m, greater<int>());
    memset(dp, -1, sizeof dp);
    solve(n);
    trace(n);
    cout << endl;
    return 0;
}


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

int main() {
    int h, w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }

    int dp[h][w];
    for (int i = 0; i < h; i++) {
        fill(dp[i], dp[i] + w, 0);
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (i == 0 && j == 0) continue;
            if (i == 0) {
                dp[i][j] = dp[i][j - 1] + s[i][j] - '0';
            } else if (j == 0) {
                dp[i][j] = dp[i - 1][j] + s[i][j] - '0';
            } else {
                dp[i][j] = min(dp[i][j - 1], dp[i - 1][j]) + s[i][j] - '0';
            }
        }
    }
    cout << dp[h - 1][w - 1] << endl;
    return 0;
}

Measured memory_bytes: 3216
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define FST first
#define SND second

#define MAX_N   (100000)                  // 10^5
// #define MAX_N   (1000000000)              // 10^9
// #define MAX_N   (1000000000000000000)     // 10^18
#define BASE    (1000000000 + 7)          // 10^9 + 7
#define INFI    (1000000000 + 7)          // 10^9 + 7
#define INFL    (1000000000000000000 + 7) // 10^18 + 7

int N;
ll A[3 * MAX_N], SUM[2][MAX_N + 1];

void solve() {
  priority_queue<ll, vector<ll>, greater<ll> > former;
  priority_queue<ll> latter;

  SUM[0][0] = SUM[1][N] = 0;
  for (int i = 0; i < N; i++) {
    SUM[0][0] += A[i];
    former.push(A[i]);
    SUM[1][N] += A[2 * N + i];
    latter.push(A[2 * N + i]);
  }

  for (int i = 0; i < N; i++) {
    ll a = A[N + i];
    former.push(a);
    SUM[0][i + 1] = SUM[0][i] - former.top() + a;
    former.pop();
    ll b = A[2 * N - 1 - i];
    latter.push(b);
    SUM[1][N - 1 - i] = SUM[1][N - i] - latter.top() + b;
    latter.pop();
  }

  ll ans = -INFL;
  for (int i = 0; i <= N; i++) {
    ans = max(ans, SUM[0][i] - SUM[1][i]);
  }

  cout << ans << endl;
}

int main() {
  cin >> N;
  for (int i = 0; i < 3 * N; i++) cin >> A[i];

  solve();

  return 0;
}


Measured memory_bytes: 5996
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define TT pair<long long, long long>
#define ordered_set tree<TT, null_type, less<TT>, rb_tree_tag, tree_order_statistics_node_update>
#define fo(i,n)   for(i=0;i<n;i++)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define mp make_pair
#define For(m) for(auto it = m.begin();it!=m.end();it++)
#define fi first
#define se second
typedef long long ll;
typedef long double mytype;
vector<ll> v[30];
ll n,dp[21][1<<21],mod=1e9 + 7;
ll solve(ll curr,ll mask){
    if(curr==n && mask==((1<<n) - 1))
    return 1;
    ll i,ans=0;
    if(dp[curr][mask]!=-1)
    return dp[curr][mask];
    fo(i,v[curr].size()){
        if((mask&(1<<v[curr][i]))==0){
            ans+=solve(curr+1,(mask|(1<<v[curr][i])));
            ans%=mod;
        }
    }
    return dp[curr][mask]=ans;
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //priority_queue <int, vector<int>, greater<int> > pq;
    //cout << fixed << setprecision(9) <<ans<<endl;
    //ordered_set os;//os.order_of_key();//os.find_by_order();
    ll l,r,count,m,sum=0,ans=0,i,j,k,tt,t,x,y,z,c,a[200005]={},b[200005]={};
    string ss;
    set<ll> s;
    map<ll,ll> ma;
    memset(dp,-1,sizeof(dp));
    cin>>n;
    fo(i,n){
        fo(j,n){
            cin>>x;
            if(x==1)
            v[i].pb(j);
        }
    }
    cout<<solve(0,0)<<endl;
}

Measured memory_bytes: 344320
def solve():
    N = int(input())
    H = [int(i) for i in input().split()]
    if N == 1:
        print('Yes')
    elif N == 2:
        print('Yes' if abs(H[0] - H[1]) <= 1 else 'No')
    else:
        for i in range(1, N)[::-1]:
            l = H[i - 1]
            r = H[i]
            if l <= r:
                continue
            elif l - 1 <= r:
                H[i - 1] -= 1
            else:
                print('No')
                exit()
        print('Yes')

if __name__ == "__main__":
    solve()

Measured memory_bytes: 85432
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    N = int(input())
    h=int(input())
    w=int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    print((N-h+1)*(N-w+1))




if __name__ == "__main__":
    main()

Measured memory_bytes: 77492
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int a, b, m;
  cin >> a >> b >> m;
  int ans = 1e9;
  vector<int> aa(a);
  vector<int> bb(b);
  int mina = 1e9;
  int minb = 1e9;
  for(int i = 0; i < a; i++) cin >> aa[i], mina = min(mina, aa[i]);
  for(int i = 0; i < b; i++) cin >> bb[i], minb = min(minb, bb[i]);
  ans = mina + minb;

  for(int i = 0; i < m; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    x--, y--;
    ans = min(ans, aa[x] + bb[y] - c);
  }

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


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

int sum_of_digits(int n) {
  if (n == 0) return 0;

  return n % 10 + sum_of_digits(n / 10);
}

int Main(int N, int A, int B) {
  int result = 0;

  for (int i = 1; i <= N; i++) {
    int sum = sum_of_digits(i);
    if (sum >= A && sum <= B) {
      result += i;
    }
  }

  return result;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  cout << Main(N, A, B) << endl;
}

Measured memory_bytes: 256
/*input
2
3 2
2 1 2
4 7
2 5 6 3
*/

#include <bits/stdc++.h>


using namespace std;

#define ll long long


vector<ll> prime(10001);
void SieveOfEratosthenes(ll n) 
{ 
    
    
    for(ll i=2;i<10001 && n>0;i++){
        while(n%i==0){
            prime[i]++;
            n = n/i;
        }
    }
    
} 


int main() {
    string s;cin>>s;
    if(s.size()<6)cout<<"No"<<endl;
    else if(s[2]==s[3] && s[4]==s[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int k,n,l;
long long res,MOD=1000000007,p25[2000100],comb;
long long inv[2000100];
void init_math(int N){
	inv[1]=1LL;
	for(int i=2;i<=N;i++) inv[i]=(MOD-((MOD/i)*inv[MOD%i])%MOD);
}
string s;
int main(){
	cin>>k>>s;
	n=s.size()+k;
	l=s.size();
	init_math(n);
	p25[0]=1;
	for(int x=1;x<=n;x++) p25[x]=(p25[x-1]*25LL)%MOD;
	comb=1;
	for(int x=1;x<=n;x++){
		comb=(comb*(long long)(n-x+1))%MOD;
		comb=(comb*inv[x])%MOD;
		if(x>=l) res=(res+comb*p25[n-x]%MOD)%MOD;
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 35532
#include <bits/stdc++.h>
using namespace std;
#define long long long
#define read cin >>
#define echo cout <<
#define fin << endl
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)

// for debug macro
bool global_debug_flag = false;
#define DEBUG(val) \
  if (global_debug_flag) cout << #val << " = " << val << endl
long gcd(long a, long b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  return b ? gcd(b, a % b) : a;
}

long lcm(long a, long b) { return a * b / gcd(a, b); }
int main() {
  long x, y;
  read x >> y;
  echo lcm(x, y) fin;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long LL;


LL gcd(LL x, LL y){
  if(y == 0) return x;
  return gcd(y, x%y);
}

int main(){
  LL N;
  while(cin>>N,N){
	const int NB = N * (N+1) /2;
	vector<LL> bs(NB);
	for(int i=0;i<NB;++i) cin >> bs[i];
	LL even = 0;
	for(int i=0;i<N;++i){
	  even = gcd(bs[i], even);
	}
	vector<LL> as(N);
	for(int i=0;i<N;++i)
	  as[i] = bs[i] / even;

	int idx = N;
	for(int i=0;i<N;++i){
	  for(int j=i+1;j<N;++j){
		if(as[i] * as[j] != bs[idx]){
		  LL lf = bs[idx] / as[i] / as[j];
		  //		  cout<<"!"<<i<<","<<j<<"->"<<lf<<endl;
		  lf = sqrt(lf);
		  even /= lf;
		  for(int k=0;k<N;++k)
			as[k] = bs[k] / even;
		}
		++idx;
	  }
	}
	
	cout << even << endl;
	sort(as.begin(), as.end());
	cout << as[0];
	for(int i=1;i<N;++i) cout << " " << as[i];
	cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<ll> a(n),b(n),c(n),d(n),e(n);
	rep(i,n) cin >> a.at(i);
	rep(i,n) cin >> b.at(i);
	rep(i,n) cin >> c.at(i);
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	ll j=0;
	rep(i,n){
		if(j==n){
			d.at(i)=j;
			continue;
		}
		while(b.at(i)>a.at(j)){
			j++;
			if(j==n) break;
		}
		d.at(i)=j;
	}
	j=0;
	rep(i,n-1) d.at(i+1)+=d.at(i);
	rep(i,n){
		if(j==n){
			e.at(i)=d.at(j-1);
			continue;
		}
		while(c.at(i)>b.at(j)){
			j++;
			if(j==n) break;
		}
		if(j>0) e.at(i)=d.at(j-1);
	}
	ll ans=0;
	rep(i,n) ans+=e.at(i);
	cout << ans << endl;
}

Measured memory_bytes: 4224
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
int n;
int dis[510][510];
int c[510][510];
queue<pair<int,int> >q;
bool vis[510][510];
const int dx[]={1,-1,0,0};
const int dy[]={0,0,1,-1};
void work(int x,int y)
{
	dis[x][y]--;c[x][y]=0;
	q.push(make_pair(x,y));
	vis[x][y]=true;
	while(!q.empty())
	{
		x=q.front().first;
		y=q.front().second;
		q.pop();vis[x][y]=false;
		for(int i=0;i<4;i++)
		{
			int tx=x+dx[i];
			int ty=y+dy[i];
			if(tx<=0||tx>n)continue;
			if(ty<=0||ty>n)continue;
			if(dis[x][y]+c[tx][ty]<dis[tx][ty])
			{
				dis[tx][ty]=dis[x][y]+c[tx][ty];
				if(!vis[tx][ty]){
					vis[tx][ty]=true;
					q.push(make_pair(tx,ty));
				}
			}
		}
	}
	return ;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			dis[i][j]=min(min(i,n-i+1),min(j,n-j+1));
			c[i][j]=1;
		}
	int ans=0;
	for(int i=1;i<=n*n;i++)
	{
		int p;scanf("%d",&p);p--;
		int x=p/n+1;
		int y=p%n+1;
		work(x,y);
		ans+=dis[x][y];
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5944
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << a+b+c - max(a, max(b, c)) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var figs = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        Array.Sort(figs);
        var alice = 0;
        var bob = 0;
        for(var i = 0; i < num; i++)
        {
            if (i % 2 == 0) alice += figs[num-i-1];
            else bob += figs[num-i-1];
        }
        WriteLine(alice - bob);
    }
}



Measured memory_bytes: 11220
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <climits>
using namespace std;

int main()
{
  string S;
  cin >> S;
  char t = S[0];
  for(int i=1; i < 4; ++i){
    if(t == S[i]){
      cout << "Bad" << endl;
      return 0;
    }
    t = S[i];
  }
  cout << "Good" << endl; 
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int num[5], sum=0;
	for (int i = 0; i < 5; i++) {
		cin >> num[i];
		if (num[i] < 40) num[i] = 40;
		sum = sum + num[i];
	}
	cout << sum / 5 << endl;
	return 0;
}

Measured memory_bytes: 3080
PROGRAM-ID.                      ABC_046_A.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP     PIC X(11).
    01 a       PIC 9(3).
    01 b       PIC 9(3).
    01 c       PIC 9(3).
    01 cnt1.
        03 cnt PIC 9(3) OCCURS 100 VALUE ZERO.
    01 i       PIC 9(3).
    01 sm      PIC 9(1).
    01 ans     PIC X(1).

    01 ZS      PIC Z(2).
    01 DUMMY   PIC X(1).

PROCEDURE                        DIVISION.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO a b c.

    ADD 1 TO cnt(a).
    ADD 1 TO cnt(b).
    ADD 1 TO cnt(c).

    PERFORM VARYING i FROM 1 BY 1 UNTIL 100 < i
        IF ZERO < cnt(i) THEN
            ADD 1 TO sm
        END-IF
    END-PERFORM.

    MOVE sm TO ZS
    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fint register int
#define h 5001
#define p 475893
using namespace std;
char s[p],t[p];
int main()
{
	scanf("%s",s+1);
	int ls=strlen(s+1);
	scanf("%s",t+1);
	int lt=strlen(t+1);
	int ans=984092353;
	for(fint i=1;i<=ls-lt+1;i++)
	{
		int now=0,cnt=i;
		for(fint j=1,k=i;j<=lt,k<=lt+i-1;j++,k++)
		if(t[j]!=s[k])
		now++;
		ans=min(ans,now);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3760
def main():
    last = input()[-1]
    if(last == '2' or last == '4' or last == '5' or last == '7' or last == '9'):
        print('hon')
    elif(last == '0' or last == '1' or last == '6' or last == '8'):
        print('pon')
    else:
        print('bon')
    

main()

Measured memory_bytes: 8724
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

class modfact(object):
    def __init__(self, n):
        fact, invfact = [1] * (n + 1), [1] * (n + 1)
        for i in range(1, n + 1): fact[i] = i * fact[i - 1] % MOD
        invfact[n] = pow(fact[n], MOD - 2, MOD)
        for i in range(n - 1, -1, -1): invfact[i] = invfact[i + 1] * (i + 1) % MOD
        self._fact, self._invfact = fact, invfact

    def fact(self, n):
        return self._fact[n]

    def invfact(self, n):
        return self._invfact[n]

    def comb(self, n, k):
        return self._fact[n] * self._invfact[k] % MOD * self._invfact[n - k] % MOD if 0 <= k <= n else 0

    def perm(self, n, k):
        return self._fact[n] * self._invfact[n - k] % MOD if 0 <= k <= n else 0

def resolve():
    k = int(input())
    n = len(input())
    mf = modfact(n + k)
    ans = 0
    for i in range(n, n + k + 1):
        ans += mf.comb(n + k, i) * pow(25, n + k - i, MOD)
        ans %= MOD
    print(ans)
resolve()

Measured memory_bytes: 103576
#include<cstdio>
#include<cstring>
using namespace std;
#define key 1000000007ll
int n,dp[60][4][4];
char ma[60][2];
int main(){
	scanf("%d",&n);
	for(int i=0;i<2;++i){
		getchar();
		for(int j=1;j<=n;++j)ma[j][i]=getchar();
	}
	dp[0][0][0]=1;
	for(int i=1;i<=n;++i){
		if(ma[i][0]==ma[i][1]){
			if(i!=1)for(int j=1;j<=3;++j){
				for(int k=1;k<=3;++k)if(k!=j){
					for(int l=1;l<=3;++l)
					if(l!=j)dp[i][j][j]+=dp[i-1][k][l],dp[i][j][j]%=key;
				}
			}
			else for(int j=1;j<=3;++j)dp[i][j][j]=1;
		}
		else{
			if(i!=1)for(int j=1;j<=3;++j){
				for(int k=1;k<=3;++k)
					for(int l=1;l<=3;++l)if(!((ma[i][0]==ma[i-1][0])^(l==j)))
						for(int m=1;m<=3;++m)
						if(!((ma[i][1]==ma[i-1][1])^(m==k))&&(j!=k))
							dp[i][j][k]+=dp[i-1][l][m],dp[i][j][k]%=key;
			}
			else for(int j=1;j<=3;++j)
				for(int k=1;k<=3;++k)if(j!=k)dp[i][j][k]=1;
		}
	}
	long long ans=0;
	for(int i=1;i<=3;++i)
		for(int j=1;j<=3;++j)ans+=dp[n][i][j],ans%=key;
	printf("%lld\n",ans);
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  string s;
  cin>>s;
  REP(_,8)s.pop_back();
  cout<<s<<endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
    scanf("%lld", &n);
    string s = "";
    n--;
    while (n >= 0) {
        ll temp = n % 26;
        s += temp + 'a';
        n /= 26;
        n--;
    }
    reverse(s.begin(), s.end());
    printf("%s", s.c_str());
	return 0;
}


Measured memory_bytes: 3736
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min = min(a) + min(b)

for i in range(M):
  x, y, c = list(map(int, input().split()))
  tmp = a[x - 1] + b[y - 1] - c
  if min > tmp:
    min = tmp

print(min)

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

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N){
  double x = (double)N/1.08;
  ll ans = ceil(x);
  // std::cout << x << std::endl;
  if((double)N == floor((double)ans*1.08)) {
    std::cout << ans << std::endl;
  } else {
    std::cout << ":(" << std::endl;
  }

}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define ALL(x)          (x).begin(), (x).end()
#define rALL(x)         (x).rbegin(), (x).rend()
#define REP(i, n)       for(int i = 0; (i) < (int)(n); (i)++)
#define rREP(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define FOR(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/

bool judge(ll &x){
    if(x < 2) return false;
    else return true; 
}

/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/
    bool rev = false;
    string s; cin >> s;
    int q; cin >> q;

    string front = "", back = "";
    REP(i, q){
        int t; cin >> t;
        if(t == 1){
            rev ^= 1;
        }
        else if(t == 2){
            int f; cin >> f;
            if(f == 1 && !rev){
                char c; cin >> c;
                front += c;
            }
            if(f == 1 && rev){
                char c; cin >> c;
                back += c;
            }
            if(f == 2 && !rev){
                char c; cin >> c;
                back += c;
            }
            if(f == 2 && rev){
                char c; cin >> c;
                front += c;
            }
        }
    }

    if(rev){
        s += back;
        reverse(ALL(s));
        s += front;
        cout << s << endl;
        return 0;
    }
    else{
        s += back;
        reverse(ALL(s));
        s += front;
        reverse(ALL(s));
        cout << s << endl;
        return 0;
    }

return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
long long n, a[200010];
int main(){
	scanf("%lld", &n);
	for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	for(int i = 1; i <= n; i++) a[i] -= i;
	sort(a + 1, a + n + 1);
	long long ans = 0;
	for(int i = 1; i <= n; i++) ans += abs(a[i] - a[(n + 1) / 2]);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int memo[100005];

int main()
{
    ciosup;
    int n;
    cin >> n;
    vector<pint> a(n);
    vint b(n);
    REP(i, n)
    {
        cin >> a[i].FI;
        b[i] = a[i].FI;
        a[i].SE = i;
    }
    REP(i,n){
        memo[i] = -1;
    }
    multiset<int> s;
    s.insert(b[0]);
    FOR(i, 1, n)
    {
        if (b[i] <= *s.begin()){
            s.insert(b[i]);
        }else{
            auto ite = s.lower_bound(b[i]);
            --ite;
            auto hit(s.find(*ite));
            if (hit != s.end())s.erase(hit);
            //s.erase(*ite);
            s.insert(b[i]);
        }
    }
    cout << s.size() << endl;
}

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

int main() {
    int r, d, x2000;
    cin >> r >> d >> x2000;

    int x[10];
    x[0] = r * x2000 - d;
    cout << x[0] << endl;
    for (int i = 1; i < 10; i++) {
        x[i] = r * x[i-1] - d;
        cout << x[i] << endl;
    }
}

Measured memory_bytes: 3568
#include<stdio.h>

int main(void){

	int i,num,sum = 0,highest = 0;
	int price[10];
	scanf("%d",&num);
	
	for(i = 0;i < num;i++){
		scanf("%d",&price[i]);
	}
	for(i = 0;i < num;i++){
		if(highest < price[i]){
			highest = price[i];
		}
		sum += price[i];
	}
	sum = (sum - highest) + highest / 2;
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 128
unittest
{
	assert( [ "100 17" ].parse.expand.solve == 83 );
	assert( [ "48 58" ].parse.expand.solve == 0 );
	assert( [ "1000000000 1000000000" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xt = input.front.split.to!( long[] );
	return tuple( xt[ 0 ], xt[ 1 ] );
}

auto solve( long x, long t )
{
	auto r = x - t;
	return ( 0 <= r ) ? r : 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
	int H, W;
	int i, j;

	while (1)
	{
		scanf("%d%d", &H, &W);
		if (H == 0 && W == 0)
			break;
	
		for (i = 0; i < H; i++)
		{	
			for (j = 0; j < W; j++)
				putchar('#');
			putchar('\n');
                }
                putchar('\n');
	}	
	return 0;
}

Measured memory_bytes: 572
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		
		long temp = 100;
		int count = 0;
		while(true) {
			
			if(temp >= x) break;
			
			temp += temp / 100;
			count++;
		}
		
		System.out.println(count);
		
	}

}


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

// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n, m);
	VEC(int, x, m);

	if (n >= m) {
		cout << 0 << endl;
		return 0;
	}
	
	sort(ALL(x));
	vector<int>diff;
	REP(i, m-1){
		diff.push_back(abs(x[i+1]-x[i]));
		// debug(diff[i]);
	}
	sort(ALL(diff));
	int ans = 0;
	REP(i, diff.size() - (n) + 1){
		//debug(diff[i]);
		ans += diff[i];
	}
	OUT(ans)BR;
	
  return 0;
}


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

int main(){
    std::vector<int> letter;
    letter.resize(26);
    
    std::string str;
    while(std::getline(std::cin, str)){
        if(str == "")
            return 0;
        for(int i=0; i<str.length(); i++){
            int l = std::tolower(str[i]) - 'a';
            letter[l]++;
        }
    }
  	for(int i=0; i<26; i++){
      std::cout << char('a'+i) << " : " << letter[i] << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
int tmp[1005];
int D;
int OK(int x)
{
    return x<=D;
}
int main()
{
    int N,X;
    cin>>N>>D>>X;
    for(int i=1;i<=N;i++) cin>>tmp[i];
    X+=N;
    for(int i=1;i<=N;i++)
    {
        int a=1;
        while(OK(a++*tmp[i]+1)) X++;
    }
    cout<<X;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

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

    int tmp = a[0];
    ll res = 0;
    for (int i = 1; i < n; ++i) {
        if (a[i] < tmp) res += (tmp - a[i]);
        else tmp = a[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 4048
#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;

char to_lower(char c)
{
    if ('A' <= c && c <= 'Z')
    {
        return char(c - ('A' - 'a'));
    }
    else
    {
        return c;
    }
}

bool is_alphabet(char c)
{
    if ('a' <= to_lower(c) && to_lower(c) <= 'z')
    {
        return true;
    }
    else
    {
        return false;
    }
}

int main()
{
    unordered_map<char, int> result_hash;
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    string input_str;
    for (char c : alphabet)
    {
        result_hash[c] = 0;
    }

    while (getline(cin, input_str))
    {
        for (char c : input_str)
        {

            if (is_alphabet(c))
            {
                result_hash[to_lower(c)] += 1;
            }
        }
    }

    for (char c : alphabet)
    {
        cout << c << " : " << result_hash[c] << endl;
    }
}


Measured memory_bytes: 3112
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n,a;
    cin>>n>>a;
    if(n%500<=a){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No" <<endl;
    }
}

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

int main(int argc, char *argv[]) {
    int n;
    cin >> n;

    int amount = 0;

    vector<int> a(n);
    for(int i = 0; i < n; ++i) {
        int x; cin >> x;
        if(x % 2 != 0) continue;

        int c = 0;
        while(x % 2 == 0) { c++; x /= 2; }
        amount += c;
    }

    cout << amount << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  ll n;
  cin >> n;
  if(n&1){
  	ll x = n/2;
    x++;
    cout << fixed << setprecision(12) << (double)(x)/n;
  }
  else{
  	cout << fixed << setprecision(12) << (double)(1)/2;
  }
  return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;

  string str[h];

  rep(i, h)
  {
    cin >> str[i];
    str[i] = '#' + str[i] + '#';
  }

  rep(i, w+2)
  {
    cout << '#';
  }
  cout << endl;

  rep(i, h)
  {
    cout << str[i] << endl;
  }

  rep(i, w+2)
  {
    cout << '#';
  }
  cout << endl;

}


Measured memory_bytes: 3600
import java.util.Arrays;
import java.util.Scanner;
 
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
 
		long[] array = new long[] { A, B, C };
		Arrays.sort(array);
 
		if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
			System.out.println(0);
		} else {
			System.out.println(array[0] * array[1]);
		}
	}
}

Measured memory_bytes: 9684
#include <vector>
#include <iostream>
 
using namespace std;
 
int main() {
    int n;
    cin >> n;
    int d;
    vector<int> S;
    for (int i = 0; i < n; ++i) {
        cin >> d;
        S.push_back(d);
    }
    int q;
    cin >> q;
    vector<int> T;
    for (int i = 0; i < q; ++i) {
        cin >> d;
        T.push_back(d);
    }
 
    int count = 0;
    for (int j = 0; j < q; ++j) {
        for (int i = 0; i < n; ++i) {
            if (T[j] == S[i]) {
                ++count;
                break;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1320
mod = 10 ** 9 + 7

N = int(input())
T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

HT = [False] * N
for i in range(1, N):
    if T[i - 1] < T[i]:
        HT[i] = True
HT[0] = True

HA = [False] * N
for i in range(N - 1):
    if A[i] > A[i + 1]:
        HA[i] = True
HA[-1] = True

ans = 1
for ht, ha, t, a in zip(HT, HA, T, A):
    if ht and ha:
        ans *= 1 if t == a else 0
    elif ht:
        ans *= 1 if t <= a else 0
    elif ha:
        ans *= 1 if t >= a else 0
    else:
        ans = (ans * min(t, a)) % mod
print(ans)


Measured memory_bytes: 19648
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pb push_back

const int N = 100 * 1000 + 1000;
int a[N];

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

	int n, k;
	cin >> n >> k;

	int gc = 0,
		Max = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		gc = __gcd(gc, a[i]);
		Max = max(Max, a[i]);
	}
	
	if(k <= Max && (Max - k) % gc == 0)
		cout << "POSSIBLE\n";
	else
		cout << "IMPOSSIBLE\n";


	return 0;
}

Measured memory_bytes: 1024