akhauriyash/Code-Regression huggingface dataset:
/*
 
@author
_      _          _                 _      _
\\    // /\    | | \  |     |    /\ \\    //     
 \\  // /__\   | |_/  |_____|   /__\ \\  //
  \\// /    \  | | \  |     |  /    \ \\//
   \/ /      \ | |_/  |     | /      \ \/
@ Indian Institute of Technology Bhilai

With practice comes perfection,
with knowledge comes wisdom.
Incorporate wisdom in you, practice will harvest better results.
Always learn from others, your method is good but someone's even better.
Results take time, run for wisdom, for innovation, for getting better.
Points are mere objects, either you solve first or you solve better.
Seek for betterment, for quality, pace is important but cannot outstand
the quality you persist.
Times are bad just as now but it'll improve, this is my passion and I promise 
I won't let it go. I'll build myself again like a fighter gets back up after 
being thrown to the ground.
I'll learn. I bet that. I promise that.
*/
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
#define rep(i,n) for(ll i=0; i<n; i++)
#define rep1(i,n) for(ll i=1; i<=n; i++)
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define alla(arr,n) arr, arr+n
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define fsync ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll maxx =  1e9+7;

bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b){
    return a.fi>b.fi;
}

ll inline power(ll a, ll b, ll p){
    a %= p;
    ll ans = 1;
    while(b>0){
        if(b & 1)
            ans = (ans*a)%p;
        a = (a*a)%p;
        b >>= 1;
    }
    return ans;
}

ll inv(ll n, ll p){
    return power(n,p-2, p);
}

bool inline isPrime(ll n) { 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; 
}

template<class T>
void printv(T &v, ll n){
    if(n==-1)
        n = v.size();
    rep(i,n)
        cout << v[i] << " ";
    cout << "\n";
}

void solve(){
    ll k,a,b;
    cin>>k>>a>>b;
    if(a%k == 0 || b%k == 0){
        cout << "OK\n";
        return;
    }
    if((a/k)<(b/k)){
        cout << "OK\n";
        return;
    }
    cout <<"NG\n";
}

int main(){
    fsync
    ll test=1;
    // cin >> test;
    while(test--){
        solve();
    }
}

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

int main(){
    int n;
    cin>>n;
    vector<long long int> x(n),y(n);
    long long int ma=0;
    long long int mi=1e9+1;
    long long int mima=0;
    long long int mami=1e9+1;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        ma=max({ma,x[i],y[i]});
        mi=min({mi,x[i],y[i]});
        mima=max(mima,min(x[i],y[i]));
        mami=min(mami,max(x[i],y[i]));
    }
    long long int res=(ma-mami)*(mima-mi);
    
    vector<pair<long long int,int>> p;
    for(int i=0;i<n;i++){
        p.push_back({x[i],i});
        p.push_back({y[i],i});
    }

    sort(p.begin(),p.end());
    vector<int> cnt(n,0);
    int pat=0;
    int tail=0;
    int head=0;
    while(true){
        if(pat==n){
            long long ret=(ma-mi)*(p[head-1].first-p[tail].first);
            res=min(ret,res);
            if(cnt[p[tail].second]==1) pat--;
            cnt[p[tail].second]--;
            tail++;
        }
        else{
            if(head==2*n) break;
            if(cnt[p[head].second]==0) pat++;
            cnt[p[head].second]++;
            head++;
        }
    }
    cout<<res<<endl;

    
    
    return 0;
}

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

vector<int>v[200004];

int main()
{
    int n,x;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        v[x].push_back(i);
    }
    int cnt=0,prev=-1;
    for(int i=1;i<=200000;i++)
    {
        if(v[i].size()==0) break;
        sort(v[i].begin(),v[i].end());
        int X=upper_bound(v[i].begin(),v[i].end(),prev)-v[i].begin();
        //cout<<"X : "<<v[i][X]<<endl;
        if(X>=v[i].size()) break;
        int num=v[i][X];
        //cout<<
        if(num>prev) { prev=num; cnt++; }
        else break;
    }
    if(prev==-1) cout<<-1<<endl;
    else cout<<n-cnt<<endl;
}


Measured memory_bytes: 14576
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

int N, Q;
string s;
int rui[100010];

signed main()
{
	cin >> N >> Q;
	cin >> s;
	s += '?';
	rep(i, N) {
		rui[i] += s[i] == 'A' and s[i + 1] == 'C';
		if (i - 1 >= 0) rui[i] += rui[i - 1];
	}

	rep(_, Q) {
		int l, r; cin >> l >> r;
		l--, r--;
		if (s[r] == 'A') r--;
		if (l - 1 < 0) cout << rui[r];
		else cout << rui[r] - rui[l - 1];
		cout << '\n';
	}
}




Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define pa_ pair<int,int>
#define mp make_pair
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
const int maxn = 2e5+5;
int n,m,S,MAX = 5000;
ll dis[55][5005];
vector<tuple<int,int,int>> g[55];
void dijkstra()
{
    priority_queue<tuple<ll,int,int>,
    vector<tuple<ll,int,int> >,
    greater<tuple<ll,int,int> > > q;
    q.push({0,1,S});
    for(int i=1;i<=n;i++) for(int j=0;j<=MAX;j++) dis[i][j] = INF;
    dis[1][S] = 0;
    while(!q.empty()){
        ll cur_time;
        int cur_pos,cur_coin;
        tie(cur_time,cur_pos,cur_coin) = q.top();q.pop();
        //cout<<cur_time<<cur_pos<<cur_coin<<endl;
        for(auto e:g[cur_pos]){
            ll to_time;
            int to_pos,to_coin;
            tie(to_pos,to_coin,to_time) = e;
            //cout<<to_time<<" "<<to_pos<<" "<<to_coin<<endl;
            ll n_time = dis[cur_pos][cur_coin]+to_time;
            ll n_coin = cur_coin+to_coin;
            if(n_coin<0 || n_coin>MAX) continue;
            if(dis[to_pos][n_coin]>n_time){
                dis[to_pos][n_coin] = n_time;
                q.push({n_time,to_pos,n_coin});
            }
        }
    }
}
int main()
{
    fastio();
    cin>>n>>m>>S;
    S = min(S,MAX);
    while(m--){
        int u,v,a,b;cin>>u>>v>>a>>b;
        g[u].pb({v,-a,b});g[v].pb({u,-a,b});
    }
    for(int i=1;i<=n;i++){
        int a,b;cin>>a>>b;
        g[i].pb({i,a,b});
    }
    dijkstra();
    for(int i=2;i<=n;i++){
        ll ans = INF;
        for(int j=0;j<=MAX;j++) ans=min(ans,dis[i][j]);
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 9324
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string s;
  if (a < b && b < c) {
    s = "Yes";
  } else {
    s = "No";
  }

  // output
  cout << s << endl;
  return 0;
}



Measured memory_bytes: 3212
#include <iostream>
#include <vector>
using namespace std;
typedef int64_t int64;
#define print(x) cout << (x) << '\n'

int main(){
 int n, k; cin >> n >> k;
 int64 a[n];
 for (int i = 0; i < n; ++i) cin >> a[i];
 
 int64 s[n]; s[0] = a[0];
 for (int i = 1; i < n; ++i) s[i] = s[i - 1] + a[i];
 vector<int64> v;
 
 for (int i = 0; i < n; ++i) v.push_back(s[i]);
 for (int i = 0; i < n; ++i){
   for (int j = i + 1; j < n; ++j) v.push_back(s[j] - s[i]);
 }
 
 int64 ans = 0;
 for (int bit = 40; bit >= 0; --bit){
   int64 p = ((int64)1<<bit);
   int cnt = 0;
   
   for (int i = 0; i < (int) v.size(); ++i){
     if (((ans + p) & v[i]) == ans + p) ++cnt;
   }
   if (cnt >= k) ans += p;
 }
 print(ans);
 
 return 0;
}

Measured memory_bytes: 6384
/* basic header */
#include <bits/stdc++.h>
/* define */
#define ll long long
#define dou double
#define pb emplace_back
#define mp make_pair
#define sot(a,b) sort(a+1,a+1+b)
#define rep1(i,a,b) for(int i=a;i<=b;++i)
#define rep0(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-8
#define int_inf 0x3f3f3f3f
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lson (curpos<<1)
#define rson (curpos<<1|1)
/* namespace */
using namespace std;
/* header end */

int n;
vector<pair<ll, ll>> v;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        pair<ll, ll> p; scanf("%lld%lld", &p.first, &p.second);
        if (p.first || p.second) v.pb(p);
    }
    n = (int)v.size();
    sort(v.begin(), v.end(), [&](pair<ll, ll> a, pair<ll, ll> b) {
        return atan2(a.second, a.first) < atan2(b.second, b.first);
    });
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        int j = i; ll x = 0, y = 0;
        for (int k = 0; k < n; k++) {
            x += v[j].first; y += v[j].second;
            ans = max(ans, x * x + y * y);
            if (++j == n) j = 0;
        }
    }
    printf("%.15f\n", sqrt(ans));
    return 0;
}


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

int main() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	vector<int>zero,one;
	if (s.at(0) == '0')one.push_back(0);
	for (int i = 0; i < s.length(); i++) {
		if (i == 0) {
			if (s.at(0) == '0')zero.push_back(1);
			else one.push_back(1);
		}
		else {
			if (s.at(i - 1) == s.at(i)) {
				if (s.at(i) == '0')zero.at(zero.size() - 1)++;
				else one.at(one.size() - 1)++;
			}
			else {
				if (s.at(i) == '0')zero.push_back(1);
				else one.push_back(1);
			}
		}
	}
	if (s.at(s.length() - 1) == '0')one.push_back(0);
	if (zero.size() <= k) {
		cout << n << endl;
		return 0;
	}
	vector<int>zerosig = { 0 };
	vector<int>onesig = { 0 };
	for (int i = 0; i < zero.size(); i++) zerosig.push_back(zerosig.at(i) + zero.at(i));
	for (int i = 0; i < one.size(); i++)onesig.push_back(onesig.at(i) + one.at(i));
	ll ans = 0;
	/*for (int i = 0; i < zerosig.size(); i++)cout << zerosig.at(i) << " ";
	cout << endl;
	for (int i = 0; i < onesig.size(); i++)cout << onesig.at(i) << " ";
	cout << endl;*/
	for (int i = 0; i < zerosig.size() - k; i++) {
		ll res = zerosig.at(i + k) - zerosig.at(i) + onesig.at(i + k + 1) - onesig.at(i);
		ans = max(ans, res);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1404
#include <bits/stdc++.h>
#include"list"
using namespace std;
#define ll long long
#define inf (long long)1e10
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define bug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}



int main(){
    string s1,s2,tst;
    int a1,a2;
    cin>>s1>>s2>>a1>>a2>>tst;

    if(tst==s1){
        cout<<a1-1<<" "<<a2<<endl;
    }
    else cout<<a1<<" "<<a2-1<<endl;

}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if (A >= B && A >= C)
			System.out.println(A * 10 + B + C);
		else if (B >= A && B >= C)
			System.out.println(B * 10 + A + C);
		else if (C >= B && C >= A)
			System.out.println(C * 10 + B + A);
	}

	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


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

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;
 
//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> H >> W;
	int sy, sx, gy, gx;
	cin >> sy >> sx >> gy >> gx;
	sy--, sx--, gy--, gx--;
	vector<string>s(H);
	for (auto &i : s)cin >> i;
	vector<vector<int>>dis(H, vector<int>(W,MOD));

	deque<pair<int, int>>Q;
	Q.push_back({ sy,sx });
	dis[sy][sx] = 0;

	int dir[] = { 1,0,-1,0,1 };
	while (!Q.empty()) {
		int cy, cx;
		tie(cy, cx) = Q.front();
		Q.pop_front();
		for (int i = 0; i < 4; i++) {
			int ny = cy + dir[i];
			int nx = cx + dir[i + 1];
			if (ny < 0 || nx < 0 || ny >= H || nx >= W)continue;
			if (s[ny][nx] == '#')continue;
			if (dis[ny][nx] > dis[cy][cx]) {
				dis[ny][nx] = dis[cy][cx];
				Q.push_front({ ny,nx });
			}
		}
		for (int i = -2; i <= 2; i++) {
			for (int j = -2; j <= 2; j++) {
				int ny = cy + i;
				int nx = cx + j;
				if (ny < 0 || nx < 0 || ny >= H || nx >= W)continue;
				if (s[ny][nx] == '#')continue;
				if (dis[ny][nx] > dis[cy][cx] + 1) {
					dis[ny][nx] = dis[cy][cx] + 1;
					Q.push_back({ ny,nx });
				}
			}
		}
	}
	if (dis[gy][gx] == MOD)dis[gy][gx] = -1;
	cout << dis[gy][gx] << endl;
}

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

typedef long long ll;

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

	string s;
	cin>>s;

	ll a = 0;
	ll b = 0;
	ll c = 0;

	for(ll i=0;i<s.size();i++) {
		if(s[i] == 'a') a++;
		if(s[i] == 'b') b++;
		if(s[i] == 'c') c++;
	}

	ll maxx = max(a, b);
	maxx = max(maxx, c);

	ll minn = min(a, b);
	minn = min(minn, c);

	if(maxx - minn < 2) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#ifdef LOCAL
#define eprintf(args...) fprintf(stderr, args), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define FILE_NAME "a"


int n, k;
vi a;

bool read() {
	if  (scanf("%d%d", &n, &k) < 2) {
		return 0;
	}
	a.resize(n);
	forn(i, n) {
		scanf("%d", &a[i]);
	}
	return 1;
}



bool solve() {
	if  (k > *max_element(all(a))) {
		return 0;
	}
	int g = 0;
	for (int x : a) {
		g = __gcd(g, x);
	}
	if  (k % g == 0) {
		return 1;
	}
	return 0;
}

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

	while (read()) {
		puts(solve() ? "POSSIBLE" : "IMPOSSIBLE");
	}

#ifdef LOCAL
	cerr.precision(5);
	cerr << "Time: " << fixed << (double) clock() / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}


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

#define ll long long

const int MX = 1e5;
const ll MOD = 1e9+7;
int N;
vector<int> adj[MX];
/* 0=white, 1=black */
ll dp[MX][2];

void dfs(int v=0, int p=-1){
    ll sum1=1, sum2=1;
    for(int n : adj[v]){
        if(n==p)
            continue;
        dfs(n,v);
        sum1 *= dp[n][0]+ dp[n][1];
        sum1%=MOD;
        sum2 *= dp[n][0];
        sum2%=MOD;
    }
    dp[v][0] = sum1;
    dp[v][1] = sum2;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    for(int i=0;i<N-1;++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    dfs();
    cout << (dp[0][0] + dp[0][1])%MOD << endl;
    return 0;
}


Measured memory_bytes: 18884
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

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

    READV(N);
    string S;
    cin>>S;
    ll ans=0;
    FORI(i,0,N-2)
    {
        if (S[i]=='A' && S[i+1]=='B' && S[i+2]=='C')
        {
            ans++;
        }
        
    }
    cout<<ans<<endl;

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


    
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)
using namespace std;
using ll = long long;
using ii = pair<int,int>;

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  string s;
  cin >> s;
  for (char& c : s) {
    if (c == '?') c = 'D';
  }
  cout << s << '\n';
  return 0;
}


Measured memory_bytes: 3744
N = int(input())
a = [int(input()) for _ in range(N)]
c = [True] * N
i = 0
ans = 0
while i != 1:
    if not c[i]:
        print(-1)
        exit()
    else:
        c[i] = False
        i = a[i]-1
        ans += 1
print(ans)


Measured memory_bytes: 80716
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, P;
  cin >> N >> P;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  int O = 0, E = 0;
  for (int i = 0; i < N; i++){
    if (A[i] % 2 == 0){
      E++;
    } else {
      O++;
    }
  }
  if (P == 0){
    if (O == 0){
      cout << ((long long) 1 << E) << endl;
    } else {
      cout << ((long long) 1 << (O + E - 1)) << endl;
    }
  } else {
    if (O == 0){
      cout << 0 << endl;
    } else {
      cout << ((long long) 1 << (O + E - 1)) << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;


//const int mod=1000000007;
const int mod=998244353;



int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d,y,l,r;
    cin >> n;
    m=(ll)1e18;
    b=1;
    bool cond=false, zero=false;
    for(int i=0; i<n; i++){
        cin >> a;
        zero=a==0?true:zero;
        if(b!=0&&a>m/b){
            cond=true;
        }
        else{
            b*=a;
        }
    }
    if(zero) cout << 0 <<  el;
    else if(cond){cout << -1 << el;}
    else cout << b << el;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;
int main(){
	string s;
	cin >> s;
	int i=0;
	int j=s.size()-1;
	int a=0;
	int b=0;
	int ans = 0;
	rep(i,s.size()+1){
		if(i == s.size()){
			cout << 0 << endl;
			return 0;
		}
		if(s[i]!='x') break;
	}
	while(1){
		while(s[i]=='x'){
			i++;
			a++;
		}
		while(s[j]=='x'){
			j--;
			b++;
		}
		ans += abs(a-b);
		if(s[i]!=s[j]){
			cout << -1 << endl;
			return 0;
		}
		a=0;b=0;
		i++;
		j--;
		if(i>=j) break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main() {
	int D;
	cin >> D;
	switch (D) {
	case 22:

		cout << "Christmas Eve Eve Eve" << endl;
		break;
	case 23:
		cout << "Christmas Eve Eve" << endl;
		break;

	case 24:
		cout << "Christmas Eve" << endl;
		break;
	case 25:
		cout << "Christmas" << endl;
		break;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    if(A+B>C+D)cout << "Left" << endl;
    else if(A+B<C+D)
    {
        cout << "Right" << endl;
    }
    else cout <<"Balanced"<< endl;
    
}

Measured memory_bytes: 256
n,m = map(int,input().split())
x=list(map(int,input().split()))
x.sort()

if n>=m:
  print(0)
else:
  dises=[]
  for i in range(m-1):
    dises.append(x[i+1]-x[i])
  dises.sort()
  dises.reverse()
  # print(dises)

  dis=0
  for i in range(n-1):
    dis+=dises[i]

  ans=x[m-1]-x[0]-dis
  print(ans)

Measured memory_bytes: 56872
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool ok(char c) {
    if (c == '(') return true;
    if (c == ')') return true;
    if (c == '[') return true;
    if (c == ']') return true;
    return false;
}
string s;
void solve() {
    stack<char> st;
    bool ans = true;
    rep(i, s.size()) {
        if (!ok(s[i])) continue;
        if (s[i] == '(' || s[i] == '[') st.push(s[i]);
        if (s[i] == ')') {
            if (st.size() && st.top() == '(')
                st.pop();
            else
                ans = false;
        }
        if (s[i] == ']') {
            if (st.size() && st.top() == '[')
                st.pop();
            else
                ans = false;
        }
    }
    if (ans && st.empty())
        cout << "yes" << endl;
    else
        cout << "no" << endl;
}
int main() {
    while (getline(cin, s)) {
        if (s == ".") break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 3164
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;


int main() {
    while(true){
        int n,x;
        int ans=0;
        cin>>n>>x;
        if(n==0 && x==0){
            break;
        }
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x){
                        ans++;
                    }
                }
            }
        }
        cout<<ans<<endl;
    }









    return 0;
}



Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <deque>
#include <tuple>
#include <map> 
#include <set>
#include <stack>
#include <functional>
#define ll long long
using namespace std;

int main() {
	int N;

	cin >> N;

	N = N % 1000;
	if (N == 0) cout << 0 << endl;
	else cout << 1000 - N << endl;
}

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

int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  double sum = 0;
  vector<int> num(n);
  for (int i = 0; i < n; i++) {
    cin >> num.at(i);
  }
  for (int i = 0; i < n; i++) {
    sum += (double)1 / num.at(i);
  } 
  cout << (double) 1 / sum;  
}

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

typedef long long LL;

using std::max;

const int N=5010,M=210;

int n,m,B[N][M],q[M][N],t[M],l[N],r[N];
LL A[N],a[N];

void Init() {
	scanf("%d%d",&n,&m);
	for (int i=2;i<=n;++i) scanf("%lld",&A[i]),A[i]+=A[i-1];
	for (int i=1;i<=n;++i)
		for (int j=1;j<=m;++j) scanf("%d",&B[i][j]);
}

void Add(int l,int r,int v) { 
	a[l-1]-=v; a[r]+=v;
}

void Solve() {
	LL ans=0;
	for (int r=1;r<=n;++r) {
		for (int j=1;j<=m;++j) {
			while (t[j] && B[r][j]>=B[q[j][t[j]]][j]) {
				Add(q[j][t[j]-1]+1,q[j][t[j]],-B[q[j][t[j]]][j]);
				t[j]--;
			}
			Add(q[j][t[j]]+1,r,B[r][j]); q[j][++t[j]]=r;
		}
		LL sum=0;
		for (int l=r;l>=1;--l) sum+=a[l],ans=max(ans,sum-(A[r]-A[l]));
	}
	printf("%lld\n",ans);
}

int main() {
	Init();
	Solve();
	return 0;
}

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


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

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
import sys
import numpy as np

ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))

D = ri()
c = np.array(rl())
s = np.array([np.array(rl()) for _ in range(D)])
li = np.zeros(26)
li_one = np.ones(26)
c_sum = sum(c)
for lis in s:
  idx_list = np.argsort(lis/c)[:-15:-1]
  li += li_one
  max_idx = 0
  max_score = -10**10
  for i in idx_list:
    tmp = li
    li[i] = 0
    sum_c_li = np.sum(c*li)
    score = lis[i] - sum_c_li
    if score >= max_score:
      max_idx = i
      max_score = score
    li = tmp
  print(max_idx + 1)


  

Measured memory_bytes: 27408
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
import networkx as nx
def resolve():
    n = int(input())
    A = [tuple(map(int, input().split())) for _ in range(n)]
    B = [tuple(map(int, input().split())) for _ in range(n)]
    G = nx.Graph()
    G.add_nodes_from(range(n))
    G.add_nodes_from(range(n, 2 * n))
    for i in range(n):
        ax, ay = A[i]
        for j in range(n):
            bx, by = B[j]
            if ax < bx and ay < by:
                G.add_edge(i, n + j)

    A = nx.algorithms.bipartite.maximum_matching(G, top_nodes = range(n))
    print(len(A) // 2)
resolve()

Measured memory_bytes: 54344
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
using vi = vector<int>;
using vl = vector<i64>;
using vd = vector<double>;
using pi = pair<int, int>;
using pl = pair<i64, i64>;
using pd = pair<double, double>;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

void can_move(vector<bool> &v, int s, string &str) {
  v[s] = true;
  for (int i = s; i < str.size(); ++i) {
    if (!v[i]) continue;
    if (str[i + 1] == '.') v[i + 1] = true;
    if (str[i + 2] == '.') v[i + 2] = true;
  }
}

bool can_swap(vector<bool> &sv, vector<bool> &fv, int c, int d) {
  FOR(i, 1, sv.size() - 1) {
    if (sv[i - 1] && fv[i] && sv[i + 1] && i + 1 <= c && i <= d) return true;
    if (fv[i - 1] && sv[i] && fv[i + 1] && i <= c && i + 1 <= d) return true;
  }
  return false;
}

bool solve(vector<bool> &sv, vector<bool> &fv, int c, int d) {
  if (!sv[c] || !fv[d]) return false;
  if (c < d) return true;
  return can_swap(sv, fv, c, d);
}

int main() {
  int n, a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d >> s;
  a--;
  b--;
  c--;
  d--;
  vector<bool> sv(n, false), fv(n, false);
  can_move(sv, a, s);
  can_move(fv, b, s);
  cout << (solve(sv, fv, c, d) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int mod=1e9+7;
int main()
{
    int n;
    cin>>n;
    vector<ll> dp(n+1);
    if(n<3)
    {
        cout<<"0";
        return 0;
    }
    dp[0]=1;
    dp[1]=0;
    dp[2]=0;
    dp[3]=1;
    for(int i=4;i<=n;i++)
    {
        for(int j=3;j<=i;j++)
        {
            dp[i]=(dp[i]+dp[i-j])%mod;
        }
    }
    cout<<dp[n];
    
}

Measured memory_bytes: 3620
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.math.*;
import java.io.*;


public class Main {
    static long divCeil(long a, long b){
        return (a+b-1)/b;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int T = sc.nextInt();

        System.out.println(T * divCeil(N, X));
        
    }
}


Measured memory_bytes: 35620
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=1000000007;
const ll INF=1000000000000000001;
int main(){
    ll n,a,b,c,d,e;cin>>n>>a>>b>>c>>d>>e;
    ll f=min(a,b);
    f=min(f,c);
    f=min(f,d);
    f=min(f,e);
    ll cnt=(n+f-1)/f;
    ll ans=cnt+4;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;

 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    int q = sc.nextInt();
    String[] names = new String[n];
    int[] lefttime = new int[n];
    for(int i = 0; i < n; i++){
      names[i] = sc.nextStr();
      lefttime[i] = sc.nextInt();
    }

    LinkedList<Integer> queue = new LinkedList<Integer>();
    for(int i = 0; i < n; i++){
      queue.add(i);
    }
    int nowtime = 0;
    while(!queue.isEmpty()){
      int nownum = queue.poll();
      if(lefttime[nownum] > q){
        lefttime[nownum] -= q;
        nowtime += q;
        queue.add(nownum);
      }else{
        nowtime += lefttime[nownum];
        System.out.print(names[nownum]);
        System.out.print(" ");
        System.out.println(nowtime);
      }
    }
  }
 
  
// LinkedList<Integer>[] setsu = new LinkedList[n];
// for(int i = 0; i < n; i++){
//   setsu[i] = new LinkedList<Integer>();
// } 

 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

#include<random> 

#define int long long 

#define pp pair<int,int> 

#define ss second 

#define ff first 

#define pb push_back 

#define mod 1000000007 

using namespace std; 

void fastio() 

{ 

    #ifndef ONLINE_JUDGE 

        freopen("INPUT.txt","r",stdin); 

            freopen("OUTPUT.txt","w",stdout); 

                #endif 

                    ios_base :: sync_with_stdio(false); 

                        cin.tie(NULL) ; 

                            cout.tie(NULL); 

                            }

signed main() 

{ 

    fastio(); 

        int t=1;

            //cin>>t;

                while(t--)

                    {

                      int a;

                      cin>>a;

                      cout<<a*a*a;    

    }

    }

    

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


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;	 long double sum = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		double num;	cin >> num;
		sum += 1/num;
	}
	cout << 1/sum;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main(){
	int N;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		int a,b,c;
		scanf("%d %d %d",&a,&b,&c);
		if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a){
			puts("YES");
		}
		else puts("NO");
	}
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

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


	ll N = 0, K = 0;
	char c;
	while ((c = getchar_unlocked()) >= '0') N = N * 10 + c - '0';
	while ((c = getchar_unlocked()) >= '0') K = K * 10 + c - '0';

	int A[200001];
	int D2[200001];
	rep1(i, N) A[i] = getint();

	int d = 0;
	int p = 1;
	while (A[p] > 0) {
		D2[d] = p;
		int tugi = A[p];
		A[p] = -d++;
		p = tugi;
	}
	if (K > -A[p]) {
		ll k = K + A[p];
		k %= d + A[p];
		K = -A[p] + k;
	}
	printf("%d", D2[K]);

	Would you please return 0;
}

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

int main() {
	int q;cin>>q;
	map<string,int> mp;
	
	while(q--){
		int query;string key;cin>>query>>key;
		if(query==0){
			int x;cin>>x;
			mp[key]=x;
		}else{
			cout<<mp[key]<<endl;
		}
	}
  return 0;
}



Measured memory_bytes: 27740
fn read<T:std::str::FromStr>() -> T{
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn main(){
  let s: String = read();
  let p: String = read();
  let mut q: Vec<char> = p.chars().collect();
  q.remove(q.len() - 1);
  if s.chars().collect::<Vec<char>>() == q{
    println!("Yes");
  }
  else {
    println!("No");
  }

}

Measured memory_bytes: 2088
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
#define int long long
using namespace std;

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1e16;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
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 << "\t";
    }
    return s;
}
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;
}

//grobal variable
//------------------------------------------
int N;
VI Vec;
int accum;
int med;
//main
//------------------------------------------
signed main(){
    cin >> N;

    REP(i,N){
        int t; cin >> t;
        Vec.pb(t);
        accum += t;
    }
    int x = 0;
    int MIN = INF;    
    for(int i = 0; i < N-1; i++){
        x += Vec[i];
        MIN = min(MIN,abs(accum - 2*x));
    }
    cout << MIN << endl;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
const ll INF = 1e9;
//プロトタイプ宣言
void faster(void);
ll gcd(auto , auto);
ll get_digent(auto);
ll POW(auto , auto);

int main(){
  faster();
  ll n;
  cin >> n;
  for(int i=1;i<=9;i++){
    ll remain = n%i;
    ll quotient = n/i;
    if(remain==0 && quotient <= 9 && quotient != 0){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}








































//以下、ライブラリ

void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

ll gcd(auto a, auto b) {
  return (b ? gcd(b, a%b) : a);
} //ユークリッドの互除法

ll get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} //桁数取得

ll POW(auto x,auto y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} //べき乗計算

Measured memory_bytes: 256
H,W = map(int,input().split())
L = []
blank = ['.' for _ in range(W+2)]
L.append(blank)
def cnt(x):
    if x == '#':
        return 1
    else:
        return 0

for _ in range(H):
    L.append(['.']+list(input())+['.'])
L.append(blank)
for i in range(1,H+1):
    for j in range(1,W+1):
        if L[i][j] == '#':
            print('#',end='')
        else:
            c = cnt(L[i-1][j])+cnt(L[i][j-1])+cnt(L[i+1][j])+cnt(L[i][j+1])+cnt(L[i-1][j-1])+cnt(L[i+1][j-1])+cnt(L[i+1][j+1])+cnt(L[i-1][j+1])
            print(c,end='')
    print()


Measured memory_bytes: 3444
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    print((N - 2) // (K - 1) + 1)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 20516
S = str(input())
L = S
if (len(S)%2) != 0:
    L = S[:-1]
l = len(L)

for i in range(1, int(l/2)):
    j = -int(2*i)
    K = L[:j]
    p = int(len(K)/2)
    if (K[:p] == K[p:]):
        print(len(K))
        break


Measured memory_bytes: 3060
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    d = defaultdict(int)
    for i in s:
        d[i] += 1
    for i in d.keys():
        if d[i] != 2:
            print("No")
            quit()
    print("Yes")
    return

#B
def B():
    n = I()
    p = LI()
    ans = 0
    for i in range(1,n-1):
        k = p[i-1:i+2]
        k.sort()
        if k[1] == p[i]:
            ans += 1
    print(ans)
    return

#C
def C():
    n = I()
    d = LI()
    d.sort()
    print(d[n//2]-d[n//2-1])
    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return


#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 53080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	/** X 座標の上限 */
	private static final int X_LIMIT = 600;

	/**
	 * 入力値の幅の長方形で二次関数の面積の近似値を求める。
	 *
	 * @param args
	 */
	public static void main(String[] args) throws IOException {

		// 入力がある限り処理を行う
		String line = null;
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		while ((line = reader.readLine()) != null) {
			int area = calculateArea(Integer.parseInt(line));
			System.out.println(area);
		}

		if (reader != null) {
			reader.close();
		}
	}

	/**
	 *  指定された幅の長方形で二次関数の面積の近似値を求める。
	 *
	 * @param width 長方形の幅
	 * @return 二次関数の面積の近似値
	 */
	protected static int calculateArea(final int width) {

		int area = 0;
		int parameter = width;

		// 限界値未満の間、面積の計算を繰り返す
		while(parameter < X_LIMIT) {
			area += width * f(parameter);
			parameter += width;
		}

		return area;
	}

	/**
	 * 二次関数 y = x^2
	 *
	 * @param parameter x
	 * @return x^2
	 */
	protected static int f(final int parameter) {
		return parameter * parameter;
	}

}

Measured memory_bytes: 16860