akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int x;
    cin>>x;
    
    vector<int> temp;
    
    for(int i=-1000;i<=1000;i++)
    {
        temp.pb(i*i*i*i*i);
    }
    int i=0;
    int j=1;
    
    int n=temp.size();
    while(i<n && j<n)
    {
        int diff=temp[j]-temp[i];
        if(diff>x)
        {
            i++;
        }
        else if(diff==x)
        {
            //
            cout<<j-1000<<" "<<i-1000;
            return 0;
        }
        else
            j++;
        if(i==j)
            j++;
    }
    
}
            

Measured memory_bytes: 3676
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,i,j;cin>>n;
	vector<vector<int>>ko(n);
	vector<int>oya(n,-1);
	vector<int>deg(n,-1);
	vector<int>sib(n,-1);
	for(i=0;i<n;i++){
		int id;cin>>id;
		int L,R;cin>>L>>R;
		if(L!=-1){
			ko[id].pub(L);
			sib[L]=R;
			oya[L]=id;
		}
		if(R!=-1){
			ko[id].pub(R);
			sib[R]=L;
			oya[R]=id;
		}
	}
	vector<int>fka(n);
	int bas=0;
	vector<pair<int,int>>que;
	for(i=0;i<n;i++){
		if(oya[i]<0){que.pub(mp(i,0));}
	}
	while(que.size()>bas){
		int id,d;
		tie(id,d)=que[bas];bas++;
		fka[id]=d;
		for(auto it:ko[id]){que.pub(mp(it,d+1));}
	}
	vector<int>hai(n,0);
	REV(que);
	for(auto it:que){
		if(oya[it.fir]<0){continue;}
		maxeq(hai[oya[it.fir]],hai[it.fir]+1);
	}
	for(i=0;i<n;i++){
		cout<<"node "<<i<<": parent = "<<oya[i]<<", sibling = "<<sib[i]<<", degree = "<<ko[i].size()<<", depth = "<<fka[i]<<", height = "<<hai[i]<<
		(oya[i]==-1?", root\n":(ko[i].size()?", internal node\n":", leaf\n"));
	}
	return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N, K; cin >> N >> K;
    vector<int> cnt;
    map<int, int> mp;

    for(int i=0; i<N; ++i){
        int a; cin >> a;
        ++mp[a];
    }

    for(auto itr=mp.begin(); itr!=mp.end(); ++itr){
        cnt.push_back(itr->second);
    }

    sort(cnt.begin(), cnt.end(), greater<int>());

    int ans = 0;
    for(int i=0; i<cnt.size(); ++i){
        if(i >= K) ans += cnt[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 10748
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>

using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef complex<int> P;
typedef pair<int,int> pii;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
template <class F, class T> void convert(const F &f, T &t){	stringstream ss; ss << f; ss >> t;}


bool solve(){
	int n, r;
	cin>> n>> r;
	if(n==0 && r==0) return false;
	
	int crr = 0, nex = 1;
	vector<vector<int> > a(2, vector<int>(n));
	for(int i=0;i<n;i++) a[crr][i] = n-i;
	
	for(int i=0;i<r;i++){
		int p, c;
		cin>> p>> c;
		for(int j=0;j<n;j++){
			if(j < c){
				a[nex][j] = a[crr][j+p-1];
			}else if(j < c + p - 1){
				a[nex][j] = a[crr][j-c];
			}else{
				a[nex][j] = a[crr][j];
			}
		}
		swap(crr, nex);
//		for(int k=0;k<n;k++) cout<< a[crr][k]<<" "; cout<< endl;
	}
	
	cout<< a[crr][0]<< endl;
	return true;
}

int main(){
	cout.setf(ios::fixed); cout.precision(10);
	while(solve());
	return 0;
}

 

Measured memory_bytes: 1220
#include<stdio.h>
int main()
{
    int H,W,i,j;
    while(1)
    {
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0)
            break;

        for(j=1; j<=H; j++)
        {
            for(i=1; i<=W; i++)
                printf("#");

            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2016
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,flag=0;
  cin>>n;
  
  for(int i=0;i<n;i++){
    char s;
    cin>>s;
    if(s=='Y')flag=1;
  }
  
  if(flag) cout<<"Four"<<endl;
  else cout<<"Three"<<endl;
}


Measured memory_bytes: 256
# Binary Indexed Tree (Fenwick Tree)
class BIT():
    """区間加算、一点取得クエリをそれぞれO(logN)で答える
    add: 区間[l, r)にvalを加える
    get_val: i番目の値を求める
    i, l, rは0-indexed
    """
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def _add(self, i, val):
        while i > 0:
            self.bit[i] += val
            i -= i & -i

    def get_val(self, i):
        """i番目の値を求める"""
        i = i + 1
        s = 0
        while i <= self.n:
            s += self.bit[i]
            i += i & -i
        return s

    def add(self, l, r, val):
        """区間[l, r)にvalを加える"""
        self._add(r, val)
        self._add(l, -val)



n, m = map(int, input().split())
a = list(map(int, input().split()))

bit = BIT(2 * m + 10)
cnt = 0
for i in range(n - 1):
    l, r = a[i], a[i + 1]
    if l > r:
        r += m
    cnt += r - l
    if l == r or l + 1 == r:
        continue
    if l < r:
        l += 2
        r += 1
        bit.add(l, r, 1)
        bit.add(r, r + 1, -(r - l))
        continue

imos = [0] * (2 * m + 2)
for i in range(2 * m + 2):
    imos[i] += bit.get_val(i)
    if i - 1 >= 0:
        imos[i] += imos[i - 1]

ans = [0] * (m + 1)
for i in range(1, m + 1):
    ans[i] = imos[i] + imos[i + m]
print(cnt - max(ans))

Measured memory_bytes: 56940
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int n; cin >> n;
	if(n <= 9){
		cout << n << "\n";
		return 0;
	}
	vector<vector<Int>> a(10, vector<Int>(10, 0));
	for(Int i=1; i<=9; ++i)
		for(Int j=1; j<=9; ++j){
/*			for(Int k=1; k<10000; ++k){
				Int t = 1;
				while(t <= k) t *= 10;
				if((i*t+k)*10 + j <= n) ++a[i][j];
			}
*/			for(Int k=0; k<5; ++k){
				Int t = 1;
				for(Int l=0; l<k; ++l) t *= 10;
				for(Int l=0; l<t; ++l)
					if((i*t + l)*10 + j <= n) ++a[i][j];
			}
			if(i == j) ++a[i][j];
		}
	Int ans = 0;
	for(Int i=1; i<=9; ++i)
		for(Int j=1; j<=9; ++j)
			ans += a[i][j] * a[j][i];
//	for(Int i=1; i<=9; ++i)
//		for(Int j=1; j<=9; ++j)
//			cout << i << " " << j << " " << a[i][j] << "\n";
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long

ll p_cal_gcd(ll big, ll small)
{
    if(small == 0) return big;
    else return p_cal_gcd(small, big % small);
}

ll cal_gcd(ll a, ll b)
{
    return a > b ? p_cal_gcd(a, b) : p_cal_gcd(b, a);
}

int main()
{
    ll a, b;
    ll gcd, lcm;
    while(cin >> a >> b)
    {
        gcd = cal_gcd(a, b);
        lcm = a * b / gcd;
        cout << gcd << " " << lcm << endl;
    }
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

ll mi(ll x, ll y){
    if(x<y)return x;
    return y;
}
ll x[100000];
int main(void){
    ll n, a, b; cin >> n >> a >> b; for(int i = 0;i < n;i++)cin >> x[i];
    ll ans = 0;
    for(int i = 0;i < n - 1;i++){
        ll d = x[i+1] - x[i];
        ans += mi(a*d, b);
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
n, a, b = map(int, input().split())
s = input()

limit = a + b
cnt_b = 0
for v in s:
    if v == "a":
        if limit > 0:
            print("Yes")
            limit -= 1
            continue
        else:
            print("No")
            continue
    elif v == "b":
        cnt_b += 1
        if limit > 0 and cnt_b <= b:
            print("Yes")
            limit -= 1
            continue
        else:
            print("No")
            continue
    else:
        print("No")
        continue


Measured memory_bytes: 53080
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#define Nmax 200005
#define OFF 100001
using namespace std;

string s;
vector<char> st;

int main()
{
    cin >> s;
    for (auto it : s){
        if (!st.empty() && st.back()=='S' && it == 'T') st.pop_back();
        else st.push_back(it);
    }

    cout << st.size();

    return 0;
}


Measured memory_bytes: 772
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define MINUTES 60
#define HOUR    3600

using namespace std;

int main() {
	int h, m, s;
	while (cin >> h >> m >> s) {
		if (h == -1 && m == -1 && s == -1)
			break;
		int t = 2 * HOUR - (h * HOUR + m * MINUTES + s);
		printf("%02d:%02d:%02d\n", t / HOUR, (t % HOUR) / MINUTES, (t % HOUR) % MINUTES);
		t *= 3;
		printf("%02d:%02d:%02d\n", t / HOUR, (t % HOUR) / MINUTES, (t % HOUR) % MINUTES);
	}
	return 0;
}

Measured memory_bytes: 1160
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL dp[2000+20][2000+20];
vector<mp> ch;
int n;
int main(){
	fastio;
	cin>>n;
	rb(i,1,n){
		mp now;
		cin>>now.FIR;
		now.FIR*=-1;
		now.SEC=i;
		ch.PB(now);
	}
	sort(ALL(ch));
	rb(i,1,n)
		ch[i-1].FIR*=-1;
	rb(i,1,n){
		LL now=ch[i-1].FIR;
		LL pos=ch[i-1].SEC;
//		cout<<now<<" "<<pos<<endl;
		rb(j,0,i){
			//左边
			if(j!=i)
			dp[i][j]=max(dp[i][j],dp[i-1][j]+now*(LL)(abs(n-(i-1-j)-pos)));
			if(j)
			dp[i][j]=max(dp[i][j],dp[i-1][j-1]+now*(LL)(abs(j-pos)));
//			cout<<dp[i][j]<<":"<<j<<endl; 
		}	
	}
	LL res=0;
	rb(i,0,n){
		res=max(res,dp[n][i]);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 26348
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  ll l = a / x;
  if (a % x != 0) l++;
  ll r = b / x;
  cout << r - l + 1 << endl;
}

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

int main() {
	int n , f = 0;
	string s;
	cin >> n;
	cin >> s;
	if(n % 2 != 0 ){
		cout << "No" ;
		exit(0);
	}
	else{
		int j = n / 2;
		for(int i = 0 ; i < n / 2 ; i++){
			if(s[i] != s[j]){
				break;
			}
			else if(s[i] == s[j] && j == (n-1)){
				f = 1;
				break;
			}
			else{
				j++;
			}
		}
		
		if(f == 0){
			cout << "No" ;
		}
		else{
			cout << "Yes";
		}
	}
	return 0;
}

Measured memory_bytes: 256
import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,Q = LI()
ab = [LI() for _ in [None]*(N-1)]
px = [LI() for _ in [None]*(Q)]
ans = [0]*(N+1) #1_index
graph = [collections.deque() for _ in [None]*(N+1)] #1_index
for a,b in ab:
        graph[a].append(b)
        graph[b].append(a)
for p,x in px:
    ans[p] += x
seen = [0]*(N+1) #1_index
stack = []
def dfs():
    seen[1] = 1
    stack.append(1)
    while stack:
        s = stack.pop()
        if not graph[s]:
            continue
        for j in range(len(graph[s])):
            g_NO = graph[s].popleft()
            if seen[g_NO]:
                continue
            seen[g_NO] = 1
            stack.append(g_NO)
            ans[g_NO] += ans[s]
dfs()
print(*ans[1:])


Measured memory_bytes: 244144
// 1_agc031_a
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#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 SZ(x) ((int)(x).size())
#define INF (1e16)
#define MOD (1000000007)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> alpha(26);
    rep(i, 26){
        alpha[i] = 0;
    }

    rep(i, n){
        alpha[s[i] - 'a']++;
    }

    ll ans = 1;
    rep(i, 26){
        ans = ans * (alpha[i] + 1) % MOD;
    }
    if(ans == 0){
        cout << MOD - 1 << endl;
    }else{
        cout << ans - 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#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)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int n,d;
	cin>>n>>d;
	vector<vector<int>> a(n,vector<int>(d));
	rep(i,n){
		rep(j,d)cin>>a[i][j];
	}

	int ans=0;
	rep(i,n)rep(j,i){
		int res = 0;
		rep(k,d)res+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
	
		bool ok=false;
		rep(k,1000){
			if(res==k*k)ok=true;
		}
		if(ok)++ans;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr lint MOD = 1000000007;

int N;

int main()
{
    cin >> N;
    vector<int> prime;
    vector<int> furui(1001, 1);
    for (int i = 2; i <= 1000; i++)
    {
        if (!furui[i]) continue;
        prime.push_back(i);
        for (int j = i; j <= 1000; j+=i) furui[j] = false;
    }
    map<int, int> w;
    for (int i = 1; i <= N; i++)
    {
        int tmp = i;
        for (auto p : prime)
        {
            while (tmp % p == 0)
            {
                w[p]++;
                tmp /= p;
            }
        }
    }
    lint ans = 1;
    for (auto v : w) ans = (ans * (v.second + 1)) % MOD;
    cout << ans << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
lamp_list = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0

#すべてのonoffの組み合わせについてbit全探索
for i in range(2**n):
    on_lamp = 0 #転倒したランプの個数をカウント
    #すべてのランプについて
    for j in range(m):
        on_sw = 0 #スイッチがonの個数をカウント
        for k in range(n):
            #スイッチがonかつランプにつながっていたらインクリメント
            if (i >> k) & 1 and k in lamp_list[j]:
                on_sw += 1
        if on_sw%2 == p[j]:
            on_lamp += 1
    if on_lamp == m:
        ans += 1
print(ans)

Measured memory_bytes: 73708
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n, m;
    cin >> n >> m;
    ll ans = (1900*m+100*(n-m))*pow(2,m);
    cout << ans << endl; 
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(a - x) > abs(b - x)) cout << "B" << endl;
	else cout << "A" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	
	int h, w, x, y;
	
	while ((h != 0)||(w != 0)){
		
		scanf("%d %d", &h, &w);
		
		if ((h != 0)||(w != 0)){
			
			for (x = 0; x < h; ++x){
				
				for (y = 0; y < w; ++y){
					
					if ((x == 0) || (x == h - 1)){
						printf("#");
					}
					
					else if ((y == 0) || (y == w - 1)){
						printf("#");
						
					}
					
					else {
						printf(".");
					}
				
					
				}
				
				printf("\n");
				
			}
			
			printf("\n");
			
		}
		
	
	}
	
	return 0;
}

Measured memory_bytes: 1816
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    char c;
    cin >> c;
    if(c == 'a' || c== 'i' || c == 'u' || c == 'e' || c == 'o')
        cout << "vowel" << endl;
    else
    {
        cout << "consonant" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
    char a[20];
    scanf("%s",a);
    int i;
    for(i=0;a[i]!='\0';i++)
        if(a[i]==',')printf(" ");
        else printf("%c",a[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

  string s;
  
  cin >> s;
  
  if(s == name[0]){
    n[0]--;
  } else {
    n[1]--;
  }
  
  cout << n[0] << " " << n[1] << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
int S, h, m, s;

  scanf("%d", &S);

  h = S / 3600;
  m = (S % 3600)/60;
  s = (S % 3600)%60;

  printf("%d:%d:%d\n", h, m, s);
  return 0;

}

Measured memory_bytes: 1852
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		char[][] m = new char[5][6];
		int t = 97;
		for(int i = 0;i < 6;i++){
			for(int j = 0;j < 5;j++){
				m[j][i] = (char)t;
				t++;
			}
		}
		m[1][5] = '.';
		m[2][5] = '?';
		m[3][5] = '!';
		m[4][5] = ' ';
		while(scan.hasNext()){
			String str = scan.nextLine();
			if(str.length() % 2 != 0 || str.indexOf("7") >= 0 ||
					str.indexOf("8") >= 0 || str.indexOf("9") >= 0 || str.indexOf("0") >= 0){
				System.out.println("NA");
				continue;
			}
			int a;
			int b;
			char[] ch = str.toCharArray();
			String ts = "";
			for(int i = 0;i < ch.length;i+=2){
				a = ch[i+1] - '0' -1;
				b = ch[i] - '0' -1;
				if(a > 4 || b > 5 || a < 0 || b < 0){
					ts = "NA";
					break;
				}
				ts += m[a][b];
			}
			System.out.println(ts);
		}
	}
}

Measured memory_bytes: 17432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=5600;
int p[maxn];
int vis[maxn];
int c[maxn];
vector<ll> q;
ll sum=0;
void dfs(int rt)
{
	vis[rt]=1;
	sum+=1ll*c[p[rt]];
	q.push_back(sum);
	if(!vis[p[rt]]) dfs(p[rt]);
}
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&p[i]);
	for(int i=1;i<=n;i++) scanf("%d",&c[i]);
	ll ans=-1e18;
	for(int i=1;i<=n;i++)
	{
		    memset(vis,0,sizeof(vis));
			ll add=0;
			sum=0;
			q.clear();
			dfs(i);
		    int len=q.size();
		    if(q[len-1]>0) add=q[len-1];
		    for(int i=0;i<len;i++)
		    {
		    	if(i+1>k) break;
		    	if(i<=(k-1)%len) ans=max(ans,q[i]+add*((k-1)/len));
		    	else ans=max(ans,q[i]+add*((k-1)/len-1));
			}
	 } 
	 printf("%lld",ans);
 } 

Measured memory_bytes: 3880
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> list = new ArrayList<String>();
		for (int i = 0; i < s.length(); i++) {
			String t = String.valueOf(s.charAt(i));
			if ("0".equals(t)) {
				list.add(t);
			} else if ("1".equals(t)) {
				list.add(t);
			} else {
				if (list.size() != 0) {
					list.remove(list.size() - 1);
				}
			}
		}
		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));
		}
	}

}

Measured memory_bytes: 21844
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

set<string> st{"dream","dreamer","erase","eraser"};

string s;

int main(){
	cin>>s;
	int S=s.size();
	vi dp(S+1);
	dp[0]=1;
	for(int i=1;i<=S;i++) for(int j=5;j<8;j++){
		if(i-j>=0&&dp[i-j]&&st.find(s.substr(i-j,j))!=st.end()){
			dp[i]=1;
		}
	}
	if(dp[S]) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 896
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }

const int MAXN = 100;

int n;
int a[2][MAXN];

int lsum[MAXN];
int rsum[MAXN];

void run() {
	scanf("%d", &n);
	REP(i, 2) REP(j, n) scanf("%d", &a[i][j]);

	lsum[0] = a[0][0]; FOR(i, 1, n) lsum[i] = lsum[i - 1] + a[0][i];
	rsum[n - 1] = a[1][n - 1]; for (int i = n - 2; i >= 0; --i) rsum[i] = rsum[i + 1] + a[1][i];
	int ret = 0;
	REP(i, n) ret = max(ret, lsum[i] + rsum[i]);
	printf("%d\n", ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll k;
ll a[200100];
ll s[200100];

template<typename T, int max_n>
class BIT {
private:
    T bit[max_n + 1];
    int n;
public:
    BIT(int _n = max_n) {
        n = _n;
        memset(bit, 0, sizeof(bit));
    }
    // [1, i]
    T sum(int i) {
        T s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    // [a, b]
    T sum(int a, int b) {
        return sum(b) - sum(a-1);
    }

    void add(int i, T x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }

    int lower_bound(T x) {
        int lb = 0, ub = n;
        while (ub - lb > 1) {
            int mid = (ub + lb) / 2;
            T v = sum(mid);
            if (v < x) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return ub;
    }

    int upper_bound(T x) {
        int lb = 1, ub = n+1;
        while (ub - lb > 1) {
            int mid = (ub + lb) / 2;
            T v = sum(mid);
            if (v <= x) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return ub;
    }
};

ll solve() {
    for (int i = 0; i < n; i++) a[i] -= k;
    map<ll, int> m;
    m[0] = 0;
    for (int i = 1; i <= n; i++) {
        s[i] = a[i-1] + s[i-1];
        m[s[i]] = 0;
    }
    int r = 1;
    for (auto& v: m) {
        m[v.first] = r++;
    }

    BIT<int, 200100> bit;
    ll res = 0;
    for (int i = 0; i <= n; i++) {
        res += bit.sum(m[s[i]]);
        bit.add(m[s[i]], 1);
    }

    return res;
}

void input() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
}

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

    input();
    cout << solve() << endl;
}


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

int main(){
    int n;
    int result;
    int tmp;

    while(cin >> n, n!=0){
        result = 0;
        n /= 4;
        for(int i=1; i<=n; i++){
            cin >> tmp;
            result += tmp;
        }
        cout << result << endl;
    }

    return 0;
}

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

int main() {
  int r, g, b, n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n - i; j++) {
      int tmp = n - (i * r + j * g);
      if (tmp % b == 0 && tmp >= 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		int count = 0;
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (set.contains(x)) {
				count++;
			} else {
				set.add(x);
			}
		}
		int total = set.size();
		if (count % 2 == 1) {
			total--;
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 63412
def bubble(A,N):
	flag=1
	cnt=0
	while flag==1:
		flag=0
		for j in range(1,N):
			if A[j]<A[j-1]:
				k=A[j-1]
				A[j-1]=A[j]
				A[j]=k
				flag=1
				cnt+=1
	return A,cnt
n=int(raw_input())			
list=map(int,raw_input().split())
list,cnt=bubble(list,n)
for x in list:
	print x,
print
print cnt,

Measured memory_bytes: 4228
n = gets.to_i
x = gets.split.map(&:to_f)
y = gets.split.map(&:to_f)
p1, p2, p3 = 0, 0, 0;
max_array = []
n.times do |i|
  q = x[i] - y[i]
  q = q * -1 if q < 0
  max_array << q
  p1 += q
  p2 += q ** 2
  p3 += q ** 3
end
puts p1
puts Math.sqrt(p2)
puts p3 ** Rational(1, 3)
puts max_array.max

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

int main() {
  char c;
  cin >> c ;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ) {
  cout << "vowel" << endl;
  } else {
  cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;

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


Measured memory_bytes: 3624
import java.util.Scanner;



public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ac = 0;
		int wa = 0;
		int tle = 0;
		int re = 0;
		
		for(int i = 0; i < n; i++) {
			String judge = sc.next();
			if(judge.equals("AC")) {
				ac++;
			}else if(judge.equals("WA")) {
				wa++;
			}else if(judge.equals("TLE")) {
				tle++;
			}else if(judge.equals("RE")) {
				re++;
			}
		}

		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + re);
		sc.close();
	}
 
}

Measured memory_bytes: 58684
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 10000

int min(int,int);
void kan(void);

int n,m[N+1][N+1],a[N+1];

int main(){
  int i;
  
  scanf("%d",&n);
  
  for(i = 1; i <= n; i++){
    scanf("%d %d",&a[i-1],&a[i]);
  }
  
  kan();
  
  printf("%d\n", m[1][n]);

  return 0;
}

void kan(){
  int i,j,l,k;
  
  for(i = 1; i <= n; i++){
    m[i][i] = 0;
  }
  
  for(l = 2; l <= n; l++){
    for(i = 1; i <= n; i++){
      j = i + l -1;
      m[i][j]=99999999;
      for(k = i; k <= j; k++){
	m[i][j] = min(m[i][j],m[i][k]+m[k+1][j] + a[i-1]*a[k]*a[j]);
      }
    }
  }
}

int min(int x, int y){
  if(x >= y){
    return y;
  }
  else{
    return x;
  }
}



Measured memory_bytes: 2160
def main():
    N = int(input())
    lst_a = list(map(int, input().split()))
    ans = set()

    for i in range(N - 1, -1, -1):
        a = lst_a[i]
        for j in range(i + 1, N + 1, i + 1):
            if j in ans:
                a += 1
        if a % 2:
            ans.add(i + 1)
    
    print(len(ans))
    print(*ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 15764
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
ll n,m,i,j,k,l,t,arr[sz],brr[sz],crr[sz],ans,hi,lo,mi;
char c[sz];
int main()
{
    scanf("%lld %lld",&n,&k);
    for(i=1;i<=n;i++)
        scanf("%lld",&arr[i]),hi=max(hi,arr[i]);
        ans=hi;
        lo=1;
        while(hi>=lo)
        {
            mi=(hi+lo)/2;
            j=0;
            for(i=1;i<=n;i++)
            {
                j+=arr[i]/mi;
                if(arr[i]%mi)
                    j++;
                j--;
            }
            if(j<=k)
            {
                ans=min(ans,mi);
                hi=mi-1;
            }
            else
                lo=mi+1;
        }
        printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 5296
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> order_set;

int main() {
    int X, Y, A, B, C;
    scanf("%d %d %d %d %d", &X, &Y, &A, &B, &C);
    priority_queue<pii> pq;
    for (int i = 0; i < A; i++) {
        int tmp;
        scanf("%d", &tmp);
        pq.push(make_pair(tmp, 0));
    }

    for (int i = 0; i < B; i++) {
        int tmp;
        scanf("%d", &tmp);
        pq.push(make_pair(tmp, 1));
    }

    for (int i = 0; i < C; i++) {
        int tmp;
        scanf("%d", &tmp);
        pq.push(make_pair(tmp, 2));
    }
    LL ans = 0;
    int sum1 = 0, sum2 = 0, sum3 = 0;
    while (!pq.empty() && (sum1 + sum2 + sum3 < X + Y)) {
        auto tp = pq.top();
        pq.pop();
        if (tp.second == 2) {
            sum3++;
        } else if (tp.second == 1) {
            if (sum2 == Y) continue;
            sum2++;
        } else {
            if (sum1 == X) continue;
            sum1++;
        }
        ans += tp.first;
    }
    printf("%lld\n", ans);
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/


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

int main(){
    string S,T;
    cin >> S >> T;
    int count = 0;
    for(int i=0;i<S.size();i++){
        if(!(S.at(i) == T.at(i))){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3892
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    string S;
    cin >> S;
    cout << (S != "AAA" && S != "BBB" ? "Yes\n" : "No\n");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(NULL);
    int h,n;
    cin>>h>>n;
    if(h%n==0)
    cout<<(h/n);
    else
    cout<<((h/n)+1);
}


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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  sort(v.begin(),v.end());
  cout<<v[n/2]-v[(n/2)-1]<<endl;
}
///////////////////////////

Measured memory_bytes: 768
a = input()
b = input()
c = input()

play = 'a'
for i in range(len(a)+len(b)+len(c)):
    if (play == 'a'):
        if (len(a) == 0):
            print('A')
            break
        else:
            play = a[0]
            a = a[1:]
    elif (play == 'b'):
        if (len(b) == 0):
            print('B')
            break
        else:
            play = b[0]
            b = b[1:]
    elif (play == 'c'):
        if (len(c) == 0):
            print('C')
            break
        else:
            play = c[0]
            c = c[1:]

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n;
	cin>>n;
	vector<int> a(n), b(n);
	rep(i,n)cin>>a[i]>>b[i];
	sort(all(a));
	sort(all(b));
	int med_a, med_b;
	if(n%2==0){
		n--;
		med_a=(a[n/2]+a[n/2+1]);
		med_b=(b[n/2]+b[n/2+1]);
	}else{
		n--;
		med_a=a[n/2];
		med_b=b[n/2];
	}


	cout<<med_b-med_a+1<<endl;

	return 0;
}

Measured memory_bytes: 4820
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ll N, K;
    cin >> N >> K;
    vl A(N);
    for (auto &x : A) cin >> x;
    ll ans = 0;
    FOR(i, 0, N) {
        FOR(j, i + 1, N) {
            if (A[i] > A[j]) {
                ans += K;
                ans %= INF;
            }
        }
        ll tmp = 0;
        FOR(j, 0, N) {
            if (A[i] > A[j]) {
                tmp++;
            }
        }
        ll tmp2 = K * (K - 1) / 2;
        tmp2 %= INF;
        ans += tmp * tmp2 % INF;
        ans %= INF;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
nums = [int(e) for e in input().split()]
if nums[0] == nums[1]:
    if nums[1]  == nums[2]:
        print("No")
    else:
        print("Yes")
else:
    if nums [1] == nums[2]:
        print("Yes")
    else:
        if nums[2] == nums[0]:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b == 0)return a;
    return gcd(b,a % b);
}
long long get(long long a,long long b)
{
    long long g = gcd(a,b);
    return a / g * b;
}
int main()
{
    long long a,b,flag = -1;
    cin>>a>>b;
    for(long long i = a;i <= get(a,b);i += a)
    {
        if(flag > 0)break;
        if(i % b)flag = i;
    }
    cout<<flag;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N;
  int a[110];
  int res=INF;
  cin >> N;

  int aMin=100;
  int aMax=-100;
  rep(i,N) {
    cin >> a[i];
    aMin = min(a[i],aMin);
    aMax = max(a[i],aMax);
  }

  FOR(i,aMin,aMax){
    int c = 0;
    rep(j,N){
      c += (a[j]-i)*(a[j]-i);
    }
    res = min(res, c);
  }

  cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main()

{
	unsigned int a,b;
	while(~scanf("%u%u",&a,&b)){
	    
		unsigned int c=a,d=b;
		while(a>0&&b>0){
			if(a>b)a=a%b;
			else b=b%a;
		}
		printf("%u %u\n",a+b,c/(a+b)*d);
		
	}
	
	return 0;
}


Measured memory_bytes: 2564
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 traveling(n: i32, v: Vec<Vec<i32>>) -> String {
    let mut ts: Vec<i32> = vec![0];
    let mut xs: Vec<i32> = vec![0];
    let mut ys: Vec<i32> = vec![0];
    for txy in v {
        ts.push(txy[0]);
        xs.push(txy[1]);
        ys.push(txy[2]);
    }
    let mut can = true;
    for i in 0..n {
        let i = i as usize;
        let dt = ts[i+1] - ts[i];
        let dist = (xs[i+1] - xs[i]).abs() + (ys[i+1] - ys[i]).abs();
        if dt < dist {
            can = false;
        }
        if dist % 2 != dt % 2 {
            can = false;
        }
    }
    if can {
        return "Yes".to_string();
    } else {
        return "No".to_string();
    }
}

fn main() {
    input!{
        n: i32,
        v: [[i32; 3]; n],
    }
    //let n: i32 = 1;
    //let v: Vec<Vec<i32>> = vec![vec![2, 100, 100]];
    println!("{}", traveling(n, v));
}

Measured memory_bytes: 12540
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
int pre1[N], pre2[N];
int find(int x, int* pre)
{
    return pre[x] == x ? pre[x] : pre[x] = find(pre[x], pre);
}
int join(int x, int y, int* pre)
{
    int px = find(x, pre);
    int py = find(y, pre);
    if (px != py) {
        pre[px] = py;
    }
}
int main()
{
    int n, k, l;
    cin >> n >> k >> l;
    for (int i = 1; i <= n; i++)
        pre1[i] = i, pre2[i] = i;
    for (int i = 1; i <= k; i++) {
        int x, y;
        cin >> x >> y;
        join(x, y, pre1);
    }
    for (int i = 1; i <= l; i++) {
        int x, y;
        cin >> x >> y;
        join(x, y, pre2);
    }
    for (int i = 1; i <= n; i++) {
        find(i, pre1);
        find(i, pre2);
    }
    map<pair<int ,int>,int> mp;
    for(int i=1;i<=n;i++){
        mp[make_pair(pre1[i],pre2[i])]++;
    }
    for(int i=1;i<=n;i++){
        cout<<mp[make_pair(pre1[i],pre2[i])]<<" ";
    }
    cout<<endl;
    system("pause");
}

Measured memory_bytes: 13816
#include<bits/stdc++.h>
using namespace std;
typedef long long L;
#define mx 1000001
L n,dp1[mx],dp2[mx],data[205];
void init(){
    for(L i=0;i<=200;i++){
        data[i]=(i*(i+1)*(i+2))/6;
    }
    dp1[0]=dp2[0]=0;
    for(L i=1;i<mx;i++){
        dp1[i]=dp2[i]=i;
        for(L j=0;i-data[j]>=0;j++){
            dp1[i]=min(dp1[i],dp1[i-data[j]]+1);
            if(data[j]%2==1){
                dp2[i]=min(dp2[i],dp2[i-data[j]]+1);
            }
        }
    }
}
int main()
{
    init();
    while(scanf("%lld",&n)&&n){
        printf("%lld %lld\n",dp1[n],dp2[n]);
    }
    return 0;
}



Measured memory_bytes: 18768
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();

       if ((x - a) * (x - a) > (x - b) * (x - b)) {
           System.out.println("B");
       } else {
           System.out.println("A");
       }

    }
}


Measured memory_bytes: 21972