akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={0,31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int d[200010][70];
ll n,k;
int a[200010];
bool w[100],b[100];
int t=1;
void run(int x){
	int a=x-1;
	for(int i=1;i<=n;i++)
		d[i][x]=d[d[i][a]][a];
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)d[i][0]=a[i];
	for(int i=1;i<=62;i++)
		run(i);
//	int pos=0;
//	while(k){
//		w[pos++]=k&1;
//		k/=2;
//	} 
//	for(int i=pos-1;i>=0;i--)cout<<w[i];
//	for(int i=0;i<pos;i++)
//		b[pos-i-1]=w[i];
//	for(int i=0;i<pos;i++)
//		if(b[i])t=d[t][i];
	for(int i=62;i>=0;i--){
		ll l=1ll<<i;
		if(l<=k){
			t=d[t][i];
			k-=l;
		}
	} 
	cout<<t;
	return 0;
}



Measured memory_bytes: 59092
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__;
const ll MOD = 1000000007;
const int MAX = 200000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    string S; cin >> S;
    bool f=true;
    if(S.size()%2!=0){
        cout << "No" << endl;
        return 0;
    }
    for(int i=0;i<S.size();i+=2){
        if(S[i]=='h' && S[i+1]=='i'){

        }else{
            f=false;
        }

        
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main() {

    string s;
    cin>>s;

    string ou{};
    for (auto& c : s) {
        if (c != 'B') {
            ou.push_back(c);
        }
        else {
            if (!ou.empty()) ou.pop_back();
        }
    }
    cout<<ou<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	vector<int>inp;
	for(int i=0;i<3;i++)
	{
		cin>>a;
		inp.push_back(a);
	}
	int n;
	cin>>n;
	sort(inp.begin(),inp.end());
	for(int i=0;i<n;i++)inp[2]*=2;
	cout<<inp[0]+inp[1]+inp[2];
	return 0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int, int>
#define mod (ll)1e9+7
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define repf(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define N 100005 
int main()
{
	FAST
    int t=1;
    // cin>>t;
    while(t--)
    {
		int n;cin>>n;
		vector<pii> vp(n);
		int i;repf(i,0,n) cin>>vp[i].ff>>vp[i].ss;
		repf(i,0,n-2)
		{
			if(vp[i].ff==vp[i].ss && vp[i+1].ff==vp[i+1].ss &&
			vp[i+2].ff==vp[i+2].ss)
			{
				cout<<"Yes";return 0;
			}
		}
		cout<<"No";
    }
    return 0;
} 


Measured memory_bytes: 3644
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h, cur = 1, sum = 0;
    cin>>h;
    vector<ll> v;
    while(1) {
    	v.pb(h);
    	if(h == 1)
    		break;
    	h /= 2;
    }
    for(auto u: v) {
    	sum += cur;
    	cur = cur * 2;
    }
    cout<<sum<<"\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

const int MAX = 510000;
const int MOD = 1e9+7;

int main(){
  ll x;
  cin >> x;
  for(int i=0;i<=1000;i++){
    ll temp=x-i*100;
    if(0<=temp && temp<=5*i){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
return 0;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i=0;i<N;i++){
    cin >> a[i];
  }
  cout << (N+K-3)/(K-1) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
#define debug(x) (cout << "#x = " << (x) << endl)
#define lowbit(x) (x & -x)
#define Set(x, i) memset(x, i, sizeof x)
#define R register
#define For( i, j, k ) for(R int i = (j); i <= (k); ++i)
#define Rep( i, j, k ) for(R int i = (j); i >= (k); --i)
#define Cross( i, j, k ) for(R int i = (j); i; i = (k))
typedef long long ll;
using namespace std;
const ll N = 100011;
const ll INF = 5e16;

namespace IO {

	#define dd ch = getchar()
	inline ll read() {
		ll x = 0; bool f = 0; char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write ( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar (x % 10 | 48);
	}

	inline void wrn ( ll x ) { write(x); putchar (' '); }

	inline void wln ( ll x ) { write(x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn(x); wln (y); }

}

using namespace IO;

namespace Cesare {
	
	ll n, b[N], a[N];
	
	int main() {
		n = read();
		For ( i, 1, n - 1 ) b[i] = read();
		a[1] = b[1], a[n] = b[n - 1];
		For ( i, 2, n - 1 ) a[i] = min(b[i], b[i - 1]);
		ll Ans = 0; For ( i, 1, n ) Ans+= a[i];
		return wln(Ans), 0;
	}
	
}

int main()
{
	return Cesare :: main();
}

/*

*/



Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////



int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c) wrln(1);
	else if (a == b || b == c || c == a) wrln(2);
	else wrln(3);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 	int a,b,k,i;
  	cin>>k>>a>>b;
  	for(i=a;i<=b;++i){
      if(i%k==0){
        cout<<"OK\n";
        return 0;
      }
	}
  	cout<<"NG\n";
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void){
  ll n,ans=0;
  
  cin >> n;
  
  if (n%2==1){
    cout << 0 << endl;
    return 0;
  }
  
  n/=10;
  while (n>0){
    ans+=n;
    n/=5;
  }
  
  cout << ans << endl;
  
  return 0;
}

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

typedef long long ll;
const int maxn = 2e6 + 3;
const ll mo = 1e9 + 7;

ll mpow(ll a, ll k) {
	ll ans = 1;
	while(k > 0) {
		if(k & 1)
			ans = ans * a % mo;
		a = a * a % mo;
		k >>= 1;
	}
	return ans;
}

ll frac[maxn], rfrac[maxn];

ll C(int u, int v) {
	if(v < 0 || v > u)
		return 0;
	return frac[u] * rfrac[v] % mo * rfrac[u - v] % mo;
}

inline ll unbounded(int s, int n) {
	// sum_{a_i} = s, and 0 \le a_i
	return C(s + n - 1, n - 1);
}

ll bounded(int s, int n, int u) {
	// sum_{a_i} = s for 0 \le i < n
	// and 0 \le a_i < u for 0 \le i < n
	ll ans = unbounded(s, n);
	for(int k = 1; k <= n && k * u <= s; ++k) {
		ans = (ans + ((k & 1) ? -1 : 1) * C(n, k) * unbounded(s - k * u, n)) % mo;
	}
	return ans;
}

ll boundedPrevM(int s, int n, int u, int m) {
	// sum_{a_i} = s for 0 \le i < n
	// and 0 \le a_i < u for 0 \le i < m, 0 \le a_i for m \le i
	if(s < 0 || u <= 0 || m > n)
		return 0;
	ll ans = unbounded(s, n);
	for(int k = 1; k <= m && k * u <= s; ++k) {
		ans = (ans + ((k & 1) ? -1 : 1) * C(m, k) * unbounded(s - k * u, n)) % mo;
	}
	// fprintf(stderr, "boundedPrevM: %d %d %d %d: %d\n", s, n, u, m, ans);
	return ans;
}

ll solve(int n, int m, int s) {
	ll ans = unbounded(s, n + 1);
	for(int i = 0; i <= s + 1 && i * (ll)(n - m) <= s; ++i) {
		ans = (ans - (
				boundedPrevM(s - i * (n - m), n + 1, i, m) -
				((i + 1) * (ll)(n - m) <= s ? boundedPrevM(s - (i + 1) * (n - m), n + 1, i, m) : 0)
			) * C(n, m)) % mo;
	}
	return ans;
}

int main() {
	frac[0] = 1;
	for(int i = 1; i < maxn; ++i)
		frac[i] = frac[i - 1] * (ll)i % mo;
	rfrac[maxn - 1] = mpow(frac[maxn - 1], mo - 2);
	for(int i = maxn - 2; i >= 0; --i)
		rfrac[i] = rfrac[i + 1] * (ll)(i + 1) % mo;

	int n, m, l, r;
	scanf("%d%d%d%d", &n, &m, &l, &r);
	printf("%lld\n", ((solve(n, n - m, r) - solve(n, n - m, l - 1)) % mo + mo) % mo);
	return 0;
}


Measured memory_bytes: 31488
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		// 入力フェーズ
				string[] input = Console.ReadLine().Split(' ');
        int AB = int.Parse(input[0]);
        int BC = int.Parse(input[1]);
        int CA = int.Parse(input[2]);

        int ret = AB * BC /2;
        Console.WriteLine(ret);
    }
}

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

#define int int_fast64_t

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

  int h, w; cin >> h >> w;
  vector<vector<int>> col(h, vector<int>(w, true));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      char c; cin >> c;
      assert(c == '#' || c == '.');
      if (c == '#')
        col[i][j] = 1;
      else
        col[i][j] = 0;
    }
  }
  // dp[i][j] = number of flips to reach from 0
  vector<vector<int>> dp(h+2, vector<int>(w+2));
  
  for (int i=0; i<h; ++i) {
    for (int j=0; j<w; ++j) {
      if (i==0 && j==0)
        dp[0][0] = col[0][0];
      else if (i==0)
        dp[0][j] = dp[0][j-1] + (col[0][j-1] != col[0][j]);
      else if (j==0)
        dp[i][0] = dp[i-1][0] + (col[i-1][0] != col[i][0]);
      else
        dp[i][j] = min(dp[i][j-1] + (col[i][j-1] != col[i][j]),
                       dp[i-1][j] + (col[i-1][j] != col[i][j]));
    }
  }
  cout << (dp[h-1][w-1] + col[h-1][w-1])/2 << '\n';
}



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

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


// import here

int main(){
    LL n;
    cin >> n;
    vector<LL> h(n);
    for(LL i = 0; i < n; ++i){
        cin >> h[i];
    }
    LL cur = 0;
    LL ans = 0;
    for(LL i = 1; i < n; ++i){
        if(h[i-1] >= h[i]){
            cur += 1;
        }else{
            cur = 0;
        }
        ans = max(ans, cur);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
signed main(){
  string c;
  bool C=false,ans=false;
  cin>>c;
  for(int i=0;i<100;i++){
    if(c[i]=='C')
      C=true;
    if(C && c[i] == 'F')
      ans=true;
  }

  if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return(0);
}
  


Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <cstring>
const int MAXN = 2005;
struct { int v, next; } e[MAXN * 2];
int cnt_edge, head[MAXN];
inline void add_edge(int u, int v) {
	e[cnt_edge] = { v, head[u] };
	head[u] = cnt_edge++;
}
int n, k, dis[MAXN];
int solve(std::queue<int> &que) {
	int cur = 0;
	while(!que.empty()) {
		int u = que.front(); que.pop();
		if(dis[u] > k / 2) cur++;
		for(int j = head[u]; j != -1; j = e[j].next) {
			if(dis[e[j].v] > dis[u] + 1) {
				dis[e[j].v] = dis[u] + 1;
				que.push(e[j].v);
			}
		}
	}
	return cur;
}
int main() {
	scanf("%d%d", &n, &k);
	memset(head, 0xff, sizeof(head));
	for(int i = 1; i < n; i++) {
		int a, b; scanf("%d%d", &a, &b);
		add_edge(--a, --b);
		add_edge(b, a);
	}
	int ans = 1e9;
	if(k % 2 == 0) {
		for(int i = 0; i < n; i++) {
			memset(dis, 0x3f, sizeof(dis));
			std::queue<int> que;
			dis[i] = 0;
			que.push(i);
			int cur = solve(que);
			if(ans > cur) ans = cur;
		}
	}
	else {
		for(int i = 0; i < cnt_edge; i += 2) {
			memset(dis, 0x3f, sizeof(dis));
			std::queue<int> que;
			dis[e[i].v] = dis[e[i + 1].v] = 0;
			que.push(e[i].v); que.push(e[i + 1].v);
			int cur = solve(que);
			if(ans > cur) ans = cur;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;
template<typename T>
T fastPow(T a, T b, T mod = 0) {
	if (a == 0 and b == 0) {
		return -1;
	}
	if (a == 0) {
		return 0;
	}
	if (b == 0) {
		return 1;
	}
	long long tmp = fastPow(a, b / 2, mod);
	if (mod != 0) {
		if (b % 2 == 0) {
			return (tmp * tmp) % mod;
		}
		else {
			return ((tmp*tmp) % mod * (a % mod)) % mod;
		}
	}
	else {
		if (b % 2 == 0) {
			return (tmp*tmp);
		}
		else {
			return tmp * tmp * a;
		}
	}
}

int main() {
	string s;
	cin >> s;
	ll slen = s.length();
	vector<bool> plus;
	plus.resize(slen);
	plus[slen - 1] = true;
	ll ans = 0;

	for (ll q = 0; q < fastPow(2LL, slen - 1); q++) {
		ll nowQ = q;
		ll p = 0;
		while (nowQ > 0) {
			plus[p] = nowQ % 2;
			p++;
			nowQ /= 2;
		}


		string tmp;
		for (ll i = 0; i < slen; i++) {
			tmp += s[i];
			if (plus[i] == true) {
				ans += stoll(tmp);
				tmp.clear();
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
#define IOS ios::sync_with_stdio(false)
const int maxn = 2e5 + 5;
char str[maxn];
void solve(){
	cin >> str;
	int len = strlen(str), sum = 0;
	for (int i = 0; i < len; ++i){
		sum += str[i] - '0';
	}
	if (sum % 9)	cout << "No" << endl;
	else 	cout << "Yes" << endl;
}
int main(){
	solve();
	return 0;
}


Measured memory_bytes: 3736
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  ll dp[c][d];
  rep(i,c){
    rep(j,d){
      dp[i][j]=0;
    }
  }
  dp[a-1][b-1]=1;
  FOR(i,a-1,c){
    FOR(j,b-1,d){
      if(i!=a-1&&j!=b-1){
        dp[i][j]=(MOD2+(i+1)*dp[i][j-1]%MOD2+(j+1)*dp[i-1][j]%MOD2-(i*j%MOD2)*dp[i-1][j-1]%MOD2)%MOD2;
      }
      else if(j!=b-1){
        dp[i][j]=(i+1)*dp[i][j-1]%MOD2;
      }
      else if(i!=a-1){
        dp[i][j]=(j+1)*dp[i-1][j]%MOD2;
      }
    }
  }
  cout << dp[c-1][d-1]%MOD2 << endl;
}

Measured memory_bytes: 73936
using System;
namespace kozaiyApp
{
    public class AFlog1
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] H = Array.ConvertAll(input, int.Parse);

            int[] DP = new int[N];
            for (int i = 0; i < N; i++)
            {
                if (i == 0)
                {
                    DP[i] = 0;
                }
                else if (i == 1)
                {
                    DP[i] = Math.Abs(H[0] - H[i]);
                }
                else
                {
                    // 一つ前からジャンプ vs 二つ前からジャンプ
                    DP[i] = Math.Min(DP[i - 1] + Math.Abs(H[i - 1] - H[i]), DP[i - 2] + Math.Abs(H[i - 2] - H[i]));
                }
            }

            Console.WriteLine(DP[N - 1]);
        }
    }
}


Measured memory_bytes: 18912
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(Check(Console.ReadLine()) ? "Yes" : "No");
    }

    public static bool Check(string dance)
    {
        for (int i = 0; i < dance.Length; i++)
        {
            if ((dance[i].ToString() == "R") && (i % 2 == 1))
            {
                return false;
            }
            if ((dance[i].ToString() == "L") && (i % 2 == 0))
            {
                return false;
            }

        }
        return true;
    }
}


Measured memory_bytes: 11092
import math

def permutations_count(n, r):
    if (n < 2):
        return 0
    else:
        return math.factorial(n) // math.factorial(n - r)

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

bar = {}

for i in range(N):
    if (A[i] in bar):
        bar[A[i]] = bar[A[i]] + 1
    else:
        bar[A[i]] = 1

partOfNum = {}
lackPartOfNum = {}

for j in bar.keys():
    tmp = permutations_count(bar[j], 2)
    partOfNum[j] = int(tmp / 2)
#   tmp = permutations_count(bar[j] - 1, 2)
    lackPartOfNum[j] = partOfNum[j] - (bar[j] - 1)

allSum = 0
for l in partOfNum.keys():
    allSum += partOfNum[l]

for i in range(N):
    print(allSum - partOfNum[A[i]] + lackPartOfNum[A[i]])


Measured memory_bytes: 38716
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int main(){
    ll N, K; cin >> N >> K;
    ll cnt = 0;
    if(K == 0){
        cnt = N * N;
        cout << cnt << endl;
        return 0;
    }
    rep(b, K+1, N+1){
        ll r = N / b;
        ll amari = N % b;
        cnt += (r * (b - K));
        if(amari >= K) cnt += (amari - K + 1);
    }
    cout << cnt << endl;
    return 0;
}




Measured memory_bytes: 256
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
#pragma endregion

int main()
{
  init_main();

  int n, k;
  cin >> n >> k;
  if (k == n)
  {
    cout << 0 << endl;
    return 0;
  }
  vector<ll> h(n);
  rep(i, n) cin >> h[i];
  ll dp[310][310];
  Fill(dp, LINF);
  rep(i, n) dp[i][1] = h[i];
  rep(i, n)
  {
    REP(j, 1, n + 1)
    {
      rep(k, i)
      {
        chmin(dp[i][j], dp[k][j - 1] + max(0LL, h[i] - h[k]));
      }
    }
  }
  ll Min = LINF;
  rep(i, n) REP(j, n - k, n + 1) chmin(Min, dp[i][j]);
  cout << Min << "\n";
  return 0;
}


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

int check(int x, int y, int b, int p)
{
	if (b < 5){
		b = 5;
	}
	if (p < 2){
		p = 2;
	}

	return ((x * b + y * p) * 8 / 10);
}

int main()
{
	int n;
	int x, y, b, p;
	int sum;

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%d%d%d%d", &x, &y, &b, &p);
		sum = min(check(x, y, b, p), x * b + y * p);
		cout << sum << endl;
	}

	return (0);
}

Measured memory_bytes: 1208
N, K = $stdin.gets.split.map {|i| i.to_i }
S = [false] * N
0.upto(K - 1) do |i|
  di = $stdin.gets.strip.to_i
  ai = $stdin.gets.split.map {|i| i.to_i - 1 }
  ai.each do |aij|
    S[aij] = true
  end
end
puts S.inject(0) {|result, item| result + (item ? 0 : 1) }


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

struct d{char M[101];int p;int r;int rk[101];};
d t[101];
int v[101];

int func(int n){
int c=t[n].rk[0];
int a=0;
v[n]=1;
if(t[n].rk[0]==0){
return t[n].p;
}
for(int i=1;i<=c;i++){
if(v[t[n].rk[i]]==1){
a+=t[t[n].rk[i]].p;
}
else if(t[t[n].rk[i]].r==0){
a+=t[t[n].rk[i]].p;
}
else {
a+=func(t[n].rk[i]);
}
}
if(a<t[n].p)
t[n].p=a;

return t[n].p;
}
int main(void){
int n,i,j,l;
while(scanf("%d",&n),n){

int m,k,V;
char T[101];
for(i=0;i<n;i++){
scanf("%s %d",t[i].M,&t[i].p);
}
scanf("%d",&m);
for(i=0;i<m;i++){

scanf("%s",T);
for(j=0;j<n;j++){
if(!(strcmp(t[j].M,T))){
t[j].r=1;
break;
}
}
V=j;
scanf("%d",&k);
t[V].rk[0]=k;
for(j=0;j<k;j++){
scanf("%s",T);
for(l=0;l<n;l++){
if(!(strcmp(t[l].M,T))){
t[V].rk[j+1]=l;
break;
}
}
}
}
scanf("%s",T);
for(i=0;i<n;i++){
if(!(strcmp(t[i].M,T))){
break;
}
}
printf("%d\n",func(i));

for(i=0;i<101;i++){
v[i]=0;
t[i].r=0;
t[i].p=0;
}
}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int d , n ;
    cin >> d >> n  ;

    int g ;
    g = (int)pow(100 , d) ;
    if(n  !=100){
    cout << g * n << endl;
    }else{
        cout << g * (n +1)<< endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

const ll MAX = 1e7;
ll fac[MAX], finv[MAX], inv[MAX];

//前処理
void COMinit (){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < MAX; i++){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = mod-inv[mod%i]*(mod/i)%mod;
        finv[i] = finv[i-1]*inv[i]%mod;
    }
}
//二項係数
ll COM(ll n, ll k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return (fac[n]*(finv[k]*finv[n-k]%mod))%mod;
}

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    COMinit();
    for(ll i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(),a.end());
    ll ans = 0;
    if(k == 1){
        cout << 0 << endl;
        return 0;
    }
    for(ll i = 0; i <= n-k; i++){
        ans += COM(n-i-1,k-1)*((a[n-i-1]-a[i])%mod);
        ans %= mod;
    }
    cout << (ans+mod)%mod << endl;
    return 0;
}

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


int main()
{
	char s[50];
	char s1[]="AKIHABARA";
	cin>>s;
	if(strlen(s)>strlen(s1))
	{
		puts("NO");
		return 0;
	}
	int p1=0;
	int p2=0;
	for(int i=0;i<strlen(s1);i++)
	{
		if(s1[p1]==s[p2])
		{
			p1++;
			p2++;
		}
		else if(s1[p1]!=s[p2])
		{
			if(s1[p1]=='A')
			{
				p1++;
			}
			else
			{
				puts("NO");
				return 0;
			}
		}
	}
	puts("YES");


}


Measured memory_bytes: 256
#!python3.8
# -*- coding: utf-8 -*-
# abc172/abc172_d
import sys
from numba import njit

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

@njit('i8(i8)', cache=True)
def f(N):
    r = 0
    for i in range(1, N+1):
        n = N // i
        r += i * n * (1 + n) // 2
    return r

def main():
    N = i2n()
    print(f(N))
    return

main()


Measured memory_bytes: 106272
#include <iostream>
using namespace std;
int main(){
    string s; cin >> s;
    int ans = 1e9, ocnt = 0, ecnt = 0;
    for(int i = 0; i < s.size(); i++){
        if(i%2 == 0){
            if(s[i] == '1') ocnt++;
            else ecnt++;
        }
        else{
            if(s[i] == '1') ecnt++;
            else ocnt++;
        }
        ans = min(ocnt,ecnt);
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
int T;
scanf("%d",&T);
for(int t=0;t<T;t++){
int edge[3];
scanf("%d %d %d",edge,edge+1,edge+2);
sort(edge,edge+3,greater<int>());
if(edge[0]*edge[0]==edge[1]*edge[1]+edge[2]*edge[2]){
printf("%s\n","YES");
}else{
printf("%s\n","NO");
}
}

return 0;
}

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

using namespace std;
typedef long long LL;

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

const int MAXN = 1000005;
int a[MAXN];
int p[MAXN] = {};
set<int> fac;


bool notprime[MAXN];
bool gg = false;
void init() {
    memset(notprime, false, sizeof(notprime));
    notprime[0] = notprime[1] = true;
    for (int i = 2; i < MAXN; i++) {
        if (!notprime[i]) {
            int cnt = 0;
            if(p[i])cnt++;
            //if (i > MAXN / i)continue;
            for (int j = i * 2; j < MAXN; j += i) {
                notprime[j] = true;
                if(p[j]) cnt++;
                if(cnt >= 2) {
                    gg = true;
                    return;
                }
            }
        }
    }
}


int main() {
    int n;
    cin >> n;
    int gcda = 0;
    init();
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
        if (gcda == 0)gcda = a[i];
        else gcda = gcd(gcda, a[i]);
        if(p[a[i]] && a[i] != 1){
            gg = true;
        }
        p[a[i]] = true;
    }
    if(!gg)init();

    if(!gg){
        cout<<"pairwise coprime";
    }
    else if(gcda == 1){
        cout<<"setwise coprime";
    }else cout<<"not coprime";

}

Measured memory_bytes: 12412
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Arrays;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            boolean[] numbers = new boolean[10];

            int n = sc.nextInt();
            int k = sc.nextInt();

            for (int i = 0; i < k; i++) {
              int d = sc.nextInt();
              numbers[d] = true;
            }

            while (true) {

              boolean isValid = true;
              String number = String.valueOf(n);
              
              for (int j = 0; j < number.length(); j++) {
              int index = Integer.parseInt(String.valueOf(number.charAt(j)));
                if (numbers[index]) {
                  isValid = false;
                  break;
                }
              }
              if (isValid) {
                break;
              }
              n++;  
            }

            System.out.println(n);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 17620
MOD = 1000000007

def conv(a,b)
  if b > a/2
    b = a - b
  end
  ans = 1
  div = 1
  b.times do |i|
    ans *= a - i
    ans %= MOD
    div *= (i+1)
    div %= MOD
  end
  ans = ans * pow(div, MOD-2)
  ans % MOD
end

def pow(x,n)
  if n == 0
    1
  elsif n % 2 == 0
    pow(x*x%MOD, n/2) % MOD
  else
    x * pow(x, n-1) % MOD
  end
end

x,y=gets.chomp.split(" ").map(&:to_i)

if (x + y) % 3 != 0
  puts "0"
  exit
end

n = (x + y) / 3
x = x - n
y = y - n
if x < 0 || y < 0
  puts "0"
  exit
end

puts conv(x + y, x)

Measured memory_bytes: 1788
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

h, w = Is()
s = LSR(h)
y = [1, 0]
x = [0, 1]

@lru_cache(None)
def dfs(sy, sx, gy, gx, ans, flag):
    if sy == gy and sx == gx:
        return 0
    for i in range(2):
        ny = sy + y[i]
        nx = sx + x[i]
        if 0 <= ny < h and 0 <= nx < w:
            if s[ny][nx] == '#':
                if flag:
                    ans = min(ans, dfs(ny, nx, gy, gx, ans, True))
                else:
                    ans = min(ans, dfs(ny, nx, gy, gx, ans, True)+1)
            else:  # s[ny][nx] == '.'
                ans = min(ans, dfs(ny, nx, gy, gx, ans, False))
    return ans

if s[0][0] == '.':
    print(dfs(0, 0, h-1, w-1, INF, False))
else:
    print(dfs(0, 0, h-1, w-1, INF, True)+1)


Measured memory_bytes: 138196
n = int(input())
s = [0] * n
for i in range(0,n):
    s[i] = int(input())

#print(s)

l0 = []
l1 = []
for i in range(0,n):
    if s[i] % 10 == 0:
        l1.append(s[i])
    else:
        l0.append(s[i])

#print(l)

w = sum(s)

if w % 10 != 0:
    ans = w

elif l0 == []:
    ans = 0

else:

    l0.sort()
    
    #print(l)
    
    ans = w - l0[0]

print(ans)
    

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

int main(void){
int a,b,c,x;
cin >> a >>b >>c>>x;
int count = 0;

for(int i = 0;i < a+1;i++){
  for(int j = 0;j < b+1;j++){
    for(int k = 0;k < c+1;k++){
      if(500*i+100*j+50*k==x){
        count++;
      }
    }
  }
}

cout << count <<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if (i < n - 1) {
				if (a[i] == a[i + 1]) {
					while (i < n - 1 && a[i] == a[i + 1]) {
						i++;
					}
				}

				if (a[i] > a[i + 1]) {
					while (i < n - 1 && a[i] >= a[i + 1]) {
						i++;
					}
				} else if (a[i] < a[i + 1]) {
					while (i < n - 1 && a[i] <= a[i + 1]) {
						i++;
					}
				}
			}

			cnt++;

		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 51724
/*https://atcoder.jp/contests/abc122/tasks/abc122_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	string s;
	int count = 0, max_count = 0;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T')
			count++, max_count = max(max_count, count);
		else
			count = 0;
	}
	cout << max_count;
}

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

int main(){
  int A, B, M, ans = 200000;
  cin >>A>>B>>M;
  vector<int>a(A);
  vector<int>b(B);
  vector<int>c(M);
  vector<int>x(M);
  vector<int>y(M);
  rep(i, A) {
    cin >> a.at(i);
  }
  rep(i, B) {
    cin >> b.at(i);
  }
  rep(i, M) {
    cin >> x.at(i) >> y.at(i) >> c.at(i);
  }
  rep(i, M) {
    if (ans > a.at(x.at(i)-1) + b.at(y.at(i)-1) - c.at(i)) {
      ans = a.at(x.at(i)-1) + b.at(y.at(i)-1) - c.at(i);
    }
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if (ans > a.at(0) + b.at(0)) {
    ans = a.at(0) + b.at(0);
  }
  cout << ans;
}


Measured memory_bytes: 2176
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: i32,
        r: i32,
    }

    let ans = if n > 10 { r } else { r + ( 10 - n ) * 100 };

    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Main ss = new Main();
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		ss.select(array);
	}
	public void select(int[] a) {
		int count = 0;
		for (int i = 0; i < a.length; i++) {
			int min = a[i];
			int k = 0;
			for (int j = i + 1; j < a.length; j++) {
				//minを探す
				if (a[j] < min) {
					min = a[j];
					k = j;
				}
			}
			if (a[i] > min) {
				int past = a[i];
				a[i] = min;
				a[k] = past;
				count++;
			}
		}
		for (int l = 0; l < a.length; l++) {
			System.out.print(a[l]);
			if (l != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println("");
		System.out.println(count);
	}

}


Measured memory_bytes: 26244
#include <bits/stdc++.h>
 
 
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;
const double PI = 3.141592653589793238;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double a,b,x;cin>>a>>b>>x;
    if(x<a*a*b/2){
        cout<< setprecision(8)<<atan(a*b*b/2/x)/PI*180;
    }
    else{
        x=a*a*b-x;
        cout<< setprecision(8)<<atan(2*x/a/a/a)/PI*180;
    }
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn trial(A: &Vec<i64>, b: bool) -> i64 {
    let mut A = A.to_owned();
    A.sort();

    let mut li = 0;
    let mut ri = A.len();
    let mut s;

    let (mut front, mut back, mut t) = if b {
        s = -2 * A[li];
        li += 1;
        (-A[li - 1], -A[li - 1], 0)
    } else {
        ri -= 1;
        s = 2 * A[ri];
        (A[ri], A[ri], 2)
    };

    debug!(A);
    while li < ri {
        debug!((t, li, ri, front, back, s));
        if t <= 1 {
            ri -= 1;

            s += 2 * A[ri];
            back = front;
            front = A[ri];
        } else {
            s -= 2 * A[li];
            back = front;
            front = -A[li];

            li += 1;
        }
        t = (t + 1) % 4;
    }

    s - front - back
}

fn main() {
    let N = read![usize];
    let A = read![i64; N];
    println!("{}", max(trial(&A, true), trial(&A, false)));
}


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

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
  int h,w;cin>>h>>w;
  int H = h + 2, W = w + 2;
  vector<string> A(h);
  for(auto& a : A) {
    cin >> a;
  }

  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(i >= 1 && i <= h && j >= 1 && j <= w) {
        cout << A[i-1][j-1];
      } else {
        cout << '#';
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n){
  cin>>p[i];
  }
  
  sort(all(p));
  reverse(all(p));
  
  int a,b;
  a=0;
  b=0;
  rep(i,n){
    if(i%2==0) a+=p[i];
    else b+=p[i];
  }
  
  cout << a-b << endl;
  
}

Measured memory_bytes: 256
/*
g++ --std=c++17 A.cpp
*/

#include <iostream>
#include <iomanip> //! for setprecision(20)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < int(n); ++i)
template<class T> inline bool chmax(T& a, T b) { bool ret = (a < b); if (ret) { a = b; } return ret; }
template<class T> inline bool chmin(T& a, T b) { bool ret = (b < a); if (ret) { a = b; } return ret; }
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int INF = 1000000000;
const int MOD = 1000000007;


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

  string s;
  cin >> s;
  if (s[s.length()-1] == 's') {
    s += "es";
  } else {
    s += 's';
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 3644
import java.util.*;

/**
 * A
 */
public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int[] A = new int[H];

        for(int i=0; i<H; i++) {
            A[i] = sc.nextInt();
        }

        sc.close();

        for (int i = 1; i <= H; i++) {

            StringBuilder sb = new StringBuilder();
            sb.append("node ").append(i).append(": key = ").append(A[i-1]).append(", ");

            if(i != 1) {
                sb.append("parent key = ").append(A[i/2-1]).append(", ");
            }

            if(i*2 <= H) {
                sb.append("left key = ").append(A[i*2-1]).append(", ");
            }

            if(i*2+1 <= H) {
                sb.append("right key = ").append(A[i*2]).append(", ");
            }

            System.out.println(sb);

        }

    }
}


Measured memory_bytes: 27320