akhauriyash/Code-Regression huggingface dataset:
l = input()
p = 10 ** 9 + 7
dp = [0, 1]
for i in l:
    dp2 = [j % p for j in dp]
    if i == "0":
        dp[0] = dp2[0] * 3
        dp[1] = dp2[1]
    else:
        dp[0] = dp2[0] * 3 + dp2[1]
        dp[1] = dp2[1] * 2
print(sum(dp) % p)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    REP(i, 0, n + 1) {
        cin >> a[i];
    }
    vector<int> b(n);
    REP(i, 0, n) {
        cin >> b[i];
    }
    ll ans = 0;
    REP(i, 0, n) {
        ll t = min(a[i], b[i]);
        b[i] -= t;
        ans += t;
        t =  min(a[i + 1], b[i]);
        a[i + 1] -= t;
        ans += t;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;cin>>S;
  ll ans = INF;
  repeat(i,S.length()-2){
    ll  X = 0;
    repeat(j,3){
      X*=10;
      X+=S[i+j]-'0';
    }
    ans = min(ans,abs(X-753));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
edge=[list(map(int,input().split())) for i in range(N-1)]
inf=10**15
c=[[] for i in range(N)]
for i,j,w in edge:
    c[i-1].append((j-1,w))
    c[j-1].append((i-1,w))
Q,K=map(int, input().split())
d=[inf]*N
d[K-1]=0
v=[0]*N
import sys
sys.setrecursionlimit(10**5+9)
def dfs(p,v,d):
    for n,w in c[p]:
        if v[n]==0:
            d[n]=min(d[n],d[p]+w)
            v[n]=1
            dfs(n,v,d)
dfs(K-1,v,d)
xy=[list(map(int,input().split())) for i in range(Q)]
for x,y in xy:
    print(d[x-1]+d[y-1])

Measured memory_bytes: 163948
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007


void solve()
{
	int n,x,t;
	cin>>n>>x>>t;
	int ans=0,c=0;
	while(ans<n)
	{
		ans+=x;
		c+=t;
	}
	cout<<c;
	return;
}

int main()
{
	fast;
	ll q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> data(N+1);
  data.at(0)=2;
  data.at(1)=1;
  for(int i=2;i<data.size();i++){
    data.at(i)=data.at(i-1)+data.at(i-2);
  }
  cout << data.at(N) << endl;
}


Measured memory_bytes: 3636
def MinorChange():

    str1 = str(input())
    str2 = str(input())

    data = []

    for num in range(len(str1)):
        if str1[num] != str2[num]:
            data.append(str2[num])

    print(len(data))

if __name__ == '__main__':
    MinorChange()

Measured memory_bytes: 10896
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int H, W;
    cin >> H >> W;
    vector<int> cnt(26);
    rep(i, H) {
        string s;
        cin >> s;
        rep(j, s.size()) cnt[s[j] - 'a']++;
    }

    int c4 = 0, c2 = 0, c1 = 0;
    rep(i, 26) {
        c4 += cnt[i] / 4 * 4;
        c2 += cnt[i] % 4 / 2 * 2;
        c1 += cnt[i] % 2;
    }

    bool ans = true;
    if (H % 2 && W % 2) {
        if (c1 > 1) ans = false;
        if (c4 < H * W - H - W + 1) ans = false;
    }
    else if (H % 2) {
        if (c1 > 0) ans = false;
        if (c4 < (H - 1) * W) ans = false;
    }
    else if (W % 2) {
        if (c1 > 0) ans = false;
        if (c4 < H * (W - 1)) ans = false;
    }
    else {
        if (c1 > 0) ans = false;
        if (c2 > 0) ans = false;
    }

    write(ans ? "Yes" : "No");
}

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

using namespace std;

const int MAXV = 1010, MAXE = 1000010;

struct edge { int u, v, next; } g[MAXE];

int n, m;
int head[MAXV], idx;

int main(int argc, char *argv[])
{

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    idx = 0;
    memset(head, -1, sizeof(head));
    
    cin >> n >> m;
    
    for (int i = 0, u, v; i < m; i++) {
        cin >> u >> v;
        u--, v--;
        
        g[idx] = edge{u, v, head[u]};
        head[u] = idx++;
        
        g[idx] = edge{v, u, head[v]};
        head[v] = idx++;
        
    }
    
    int permutation[8], cases = 0;
    iota(permutation, permutation + n, 0);
    
    do {
        int cnt = 1;
        for (int i = 0; i < n - 1; i++) {
            int ii = permutation[i];
            bool match = false;
            for (int j = head[ii]; ~j; j = g[j].next){
                if (g[j].v == permutation[i + 1]) {
                    match = true;
                    break;
                }
            }
            if (!match) {
                break;
            }
            cnt++;
        }
        if (cnt == n) {
            cases++;
        }
    } while (next_permutation(permutation + 1, permutation + n));
    
    cout << cases << endl;
    
}


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

int main() {
  rep(i, 5) {
    int x;
    cin >> x;
    if (x == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3604
# coding: utf-8
# Your code here!
def main():
    S = input()
    min_num = 1000000
    for i in range(0,len(S)-2):
        num = int(S[i:i+3:1])
        if min_num >= abs(num-753):
            min_num = abs(num-753)
    print(min_num)
    
main()

Measured memory_bytes: 2940
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int n = s.Length;
            int max = 0;
            int cnt = 0;
            for(int i = 0; i < n; i++)
            {
                while (i < n)
                {
                    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
                    {
                        cnt++;
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                max = (int)Math.Max(max, cnt);
                cnt = 0;
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 25872
#include<cstdio>
#include<iostream>
#include<string>
#include<queue>
#define RI register int
#define CI const int&
const int N=64;
struct data
{
	int c,lst; std::string s;
	friend inline bool operator < (const data& A,const data& B)
	{
		return A.c>B.c;
	}
}a[N];
int n; std::string s; bool flag; std::priority_queue <data> q;
inline char dgt_ch(CI x)
{
	if (x<=26) return 'a'+x-1; else if (x<=52) return 'A'+x-27; else return '0'+x-53;
}
inline int query(std::string s)
{
	std::cout<<"? "<<s<<'\n'; fflush(stdout);
	int res; std::cin>>res; return res;
}
int main()
{
	RI i,j; for (i=1;i<=62;++i)
	{
		s=dgt_ch(i); int res=query(s); if (!n) n=res;
		else if (n!=res) n=std::max(n,res),flag=1;
	}
	if (!flag) ++n; for (i=1;i<=62;++i)
	{
		for (s="",j=1;j<=n;++j) s+=dgt_ch(i); a[i].c=n-query(s);
		for (j=1;j<=a[i].c;++j) a[i].s+=dgt_ch(i); a[i].lst=n-a[i].c; if (a[i].c) q.push(a[i]);
	}
	while (q.size()>1)
	{
		data A=q.top(); q.pop(); data B=q.top(); q.pop();
		//cout<<A.s<<' '<<B.s<<'\n'; fflush(stdout);
		for (i=j=0;i<=A.s.length();++i) if (j<B.c)
		{
			A.s.insert(i,1,B.s[j]); int res=query(A.s);
			if (res<A.lst) A.lst=res,++A.c,++j; else A.s.erase(i,1);
		}
		q.push(A);
	}
	std::cout<<"! "<<q.top().s<<'\n'; return 0;
}

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main()
{
  int N;
  vector<int> A(3*3);
  vector<int> AT(3*3);
  REP(i,3*3){
   cin >> A[i]; 
  }
  cin >> N;
  vector<int>  B(N);
  REP(i,N) cin >> B[i];
  REP(i,N){
    REP(j,9){
      if(B[i] ==  A[j] ){
		AT[j] = 1;
      }
    }
  }
  int out = 0;
  REP(i,2){
   if(AT[0] == 1 && AT[1] == 1 && AT[2] == 1){
      out = 1;
      break;
   }
   if(AT[3] == 1 && AT[4] == 1 && AT[5] == 1){
      out = 1;
      break;
   }
   if(AT[6] == 1 && AT[7] == 1 && AT[8] == 1){
      out = 1;
      break;
   }
   if(AT[0] == 1 && AT[3] == 1 && AT[6] == 1){
      out = 1;
      break;
   }
   if(AT[1] == 1 && AT[4] == 1 && AT[7] == 1){
      out = 1;
      break;
   }
   if(AT[2] == 1 && AT[5] == 1 && AT[8] == 1){
      out = 1;
      break;
   }
   if(AT[0] == 1 && AT[4] == 1 && AT[8] == 1){
      out = 1;
      break;
   }
   if(AT[2] == 1 && AT[4] == 1 && AT[6] == 1){
      out = 1;
      break;
   }
  }
  if(out) cout << "Yes";
  else cout << "No";
  return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i = 0; i < n; i++)

string s[10010];

int main(void)
{
    int n;
    cin >> n;
    REP(i, n) cin >> s[i];
    int cnt = 0, ca = 0, cb = 0, cab = 0,a,b;
    REP(i, n) {
        REP(j, s[i].length()-1) {
            if(s[i][j] == 'A' && s[i][j+1] == 'B') cnt++;
        }
        a = (s[i][s[i].length()-1] == 'A')?1:0;
        b = (s[i][0] == 'B')?1:0;
        if(a+b==2) {
            cab ++;
        } else {
            ca += a;
            cb += b;
        }
    }
    if(cab==0) {
        cnt += min(ca,cb);
    } else {
        if(ca+cb>0) {
            cnt += cab+min(ca,cb);
        } else {
            cnt += cab-1;
        }
    }
    cout << cnt << endl;

}


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


int main(){

  string s;
  cin >> s;

  int first = -1;
  int last = -1;

  for(int i = 0; i < s.size(); ++i){
    if(s[i] == 'A'){
        first = i;
        break;
    }
  }

  for(int i = (s.size() - 1); i >= 0; --i){
    if(s[i] == 'Z'){
        last = i;
        break;
    }
  }

  int ans = last - first + 1;

  cout << ans << endl;


  return 0; 
}

Measured memory_bytes: 640
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//https://atcoder.jp/contests/abc169/tasks/abc169_d
//package pkg21.days.of.code;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
/**
 *
 * @author Pravash Ranjan
 */
 class Main {
    static class FastReader{BufferedReader br;StringTokenizer st;public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}String next(){ while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}
        catch (IOException  e){e.printStackTrace();}}return st.nextToken();}int nextInt(){return Integer.parseInt(next());}long nextLong(){return Long.parseLong(next());} 
        double nextDouble(){return Double.parseDouble(next());}String nextLine(){String str = ""; try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;}}
    public static void main(String args[])
    {
        FastReader ob=new FastReader();
        ArrayList<Integer> prm=new ArrayList<>();
        int size=(int)1e6+2;
        boolean prime[]=new boolean[(int)1e6+2];
        for(int i=2;i*i<size;i++)
        {
            for(int j=i*i;j<size;j+=i)
                prime[j]=true;
        }
        for(int i=2;i<size;i++)
            if(!prime[i])
                prm.add(i);
        long n=ob.nextLong();
        long m=n;
        HashMap<Long,Integer> map=new HashMap<>();
        int c=0;long x;int cnt=0;int sz=prm.size();
        //System.out.println((long)prm.get(sz-1)*999983L);
        while(n!=1)
        {
            if(c>=sz)
                break;
           x=prm.get(c);
           if(x*x>n)
               break;
           c++;cnt=0;
           while(n%x==0)
           {
               n/=x;cnt++;
           }
           if(cnt!=0)
               map.put((long)x,cnt);
           
        }
        if(n!=1)
            map.put(n,1);
        long ans=0;int sum=0;long j;
        for(long i:map.keySet())
        {
            for(j=1;(j*(j+1))/2<=map.get(i);j++);
            ans+=(j-1);            
        }
        if(m==1)
            System.out.println(0);
        else
            System.out.println(ans);
    }
}


Measured memory_bytes: 37104
import sys

dic = {
        'a': input(),
        'b': input(),
        'c': input()
    }

s = 'a'
while True:
    if not dic[s]:
        print(s.upper())
        sys.exit()

    t = dic[s][0]
    dic[s] = dic[s][1:len(dic[s])]
    s = t

Measured memory_bytes: 3060
# AOJ 0012 A Point in a Triangle
# Python3 2018.6.17 bal4u

EPS = 0.0001

# a, b, はラインの同一側にあるか
def is_atSameSide(a, b, line):
	sa = (line[1].real-line[0].real)*(a.imag-line[0].imag) \
		 + (line[1].imag-line[0].imag)*(line[0].real-a.real);
	sb = (line[1].real-line[0].real)*(b.imag-line[0].imag) \
		 + (line[1].imag-line[0].imag)*(line[0].real-b.real);
	if -EPS <= sa and sa <= EPS: return False 		 # a in line
	if -EPS <= sb and sb <= EPS: return False 		 # b in line
	if sa*sb >= 0: return True           # a,b at same side
	return False  # -1;
	
while True:
	try: p = list(map(float, input().split()))
	except: break
	
	p1 = complex(p[0], p[1])
	p2 = complex(p[2], p[3])
	p3 = complex(p[4], p[5])
	pp = complex(p[6], p[7])
	if is_atSameSide(p3, pp, [p1,p2]) and \
	   is_atSameSide(p1, pp, [p2,p3]) and \
	   is_atSameSide(p2, pp, [p3,p1]): print('YES')
	else: print('NO')


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

#define ankit_2305 cerr<<"\nTime taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<" sec\n";
#define START clock_t
#define TIMER time_p=clock();
#define ll long long

#define MOD 1000000007

using namespace std;

int x, y;

int main(){
    START TIMER
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int n;
	cin>>n>>x>>y;
	int k[n] = {}, dist;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			dist = min(j-i, abs(x-i)+abs(y-j)+1);
			k[dist]++;
		}
	}
	for(int i=1;i<n;i++)
		cout<<k[i]<<"\n";
    ankit_2305
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define PI (3.141592653589793)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N,W;
int w[110],v[110];
int dp[110][100100];

signed main(){
    cin>>N>>W;
    rep(i,N)cin>>w[i]>>v[i];
    rep(i,N){
        rep(sum_w,W+1){
            if(sum_w-w[i]>=0){
                chmax(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i]);
            }
            chmax(dp[i+1][sum_w], dp[i][sum_w]);
        }
    }
    cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 79360
H,W,D = map(int,input().split())
MAX = H*W
#M = MAX//D+1
dic = {}

for i in range(H):
  temp = list(map(int,input().split()))
  for j in range(W):
    now = temp[j]
    dic[now] = (i,j)
#print(dic)
L = [[0] for _ in range(D)]
for i in range(D): #MODで0からD-1をひたすら見ていく。
  if i == 0:
    now = D
  else:
    now = i
  while now+D <= MAX:
    tsugi = now+D
    np = dic[now] #今の場所
    tp = dic[tsugi]
    dis = abs(np[0]-tp[0])+abs(np[1]-tp[1])
    L[i].append(L[i][-1]+dis)
    now = tsugi
#print(L)
Q = int(input())
for i in range(Q):
  left,right = map(int,input().split())
  MOD = left%D
  #print(L[MOD])
  start = (left-1)//D
  end = (right-1)//D
  ans = L[MOD][end]-L[MOD][start]
  print(ans)
    
  

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

using namespace std;

#define INF 1000000000
#define pb(a) push_back(a)
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
#define ll long long;
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x;
#define bit(n) (1<<(n))

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < sz(v);i++)


int main(){
	map<int,int> ma;
	int n,buf,ans=0;
	cin>>n;
	REP(i,n){
		cin>>buf;
		ma[buf]++;
	}
	for(auto a:ma){
		if(a.first>a.second){
			ans+=a.second;
		}
		if(a.first<a.second)ans+=a.second-a.first;
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    ll x,f=0,k=0;
    for(ll i=0;i<n;i++){
        cin >> x;
        if(x%4==0)  f++;
        else if(x%2!=0) k++;
    }
    if(f>=k||(f==k-1&&f+k==n))    cout << "Yes";
    else    cout << "No";
    return 0;
}

Measured memory_bytes: 256
try:
  N, x = map(int, input().split())
  a = list(map(int, input().split()))
  a_ = sorted(a)
  cnt = 0
  for i in range(len(a_)-1):
      if a_[i]<=x:
          cnt += 1
          x = x-a_[i]
  if a_[len(a_)-1]-x==0:
      cnt += 1
  print(cnt)
except EOFError:
  pass

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int b[200010];

int main(){
    int n;
    cin >> n;
    rep(i, n-1){
        int a;
        cin >> a;
        b[a]++;
    }
    for(int i = 1; i<=n; i++){
        cout << b[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);

    if(a > b){
        d = b;
        b = a;
        a = d;
    }
    if(b > c){
        d = c;
        c = b;
        b = d;
    }
    if(a > b){
        d = b;
        b = a;
        a = d;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2056
import bisect
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
k = 0
for i in range(n):
    for j in range(i + 1, n):
        ind = bisect.bisect_left(l, l[i] + l[j])
        k += max(ind-j-1, 0)
print(k)


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 100010;
const LL INF = 1234567890123456;
int X,Y,Z;
int n;
int A[MC],B[MC],C[MC];
int s[MC];
priority_queue<int , vector<int> , greater<int> > QA,QB;
LL mA[MC] , mB[MC];
LL ans , mx = -INF;


int main(){
	scanf("%d%d%d" , &X , &Y , &Z);
	n = X+Y+Z;
	repp(i,0,n){
		scanf("%d%d%d" , A + i , B + i , C + i);
		A[i] -= C[i];
		B[i] -= C[i];
		ans += C[i];
		s[i] = i;
	}
	sort(s,s+n,[&](const int p , const int q){return A[p]-B[p]>A[q]-B[q];});
	repp(i,0,X){
		QA.push(A[s[i]]);
		mA[X-1] += A[s[i]];
	}
	repp(i,X,n-Y){
		QA.push(A[s[i]]);
		mA[i] = mA[i-1] + A[s[i]] - QA.top();
		QA.pop();
	}
	repm(i,n-1,n-Y-1){
		QB.push(B[s[i]]);
		mB[n-Y] += B[s[i]];
	}
	repm(i,n-Y-1,X-1){
		QB.push(B[s[i]]);
		mB[i] = mB[i+1] + B[s[i]] - QB.top();
		QB.pop();
	}
	repp(i,X-1,n-Y){
		mx = max(mx , mA[i]+mB[i+1]);
	}
	printf("%lld\n" , ans + mx);
	return 0;
}


Measured memory_bytes: 3072
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList();
		for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(list);

		int n1 = Integer.MAX_VALUE;
		int n2 = Integer.MAX_VALUE;
		for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		}
		for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		}
		System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
	}
}


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

int main(){
  string S;
  cin >> S;
  string sun = "Sunny";
  string clo = "Cloudy";
  string rai = "Rainy";
    
  if(S == sun){ cout << clo;}
  else if(S == clo){cout << rai;}
  else{cout << sun;}
 
  return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long  ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;

#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define ins insert
#define pi  3.14159265359
#define mod 1000000007
#define si(x) int(x.size())
#define FOOR(i, a, b)  for (int i=a; i<=(b); i++)
#define FOR(i, a)  for (int i=0; i<(a); i++)
#define FOORd(i,a,b)  for (int i = (b)-1; i >= a; i--)
#define FORd(i,a)  for (int i = (a)-1; i >= 0; i--)




int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int n,ans=0;
    cin>>n;
    vector<int>a(n);
    map<int,int>x;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        x[a[i]]++;
    }
    sort(a.begin(),a.end());
    a.resize(unique(a.begin(),a.end())-a.begin());
    for(int i=0;i<a.size();i++)
    {
        for(int j=i+1;j<a.size();j++)
        {
            for(int k=j+1;k<a.size();k++)
            {

                    if(a[i]+a[j]>a[k]){
                        ans+=(x[a[i]]*x[a[j]]*x[a[k]]);
                     }

            }
        }

    }
    cout<<ans<<endl;




}


Measured memory_bytes: 3604
n, m = map(int,input().split())
a = [int(input()) for i in range(m)]
a = set(a)
dp = [0] * (n+1)
dp[0] = 1

for i in range( 1, n+1):
    if i in a:
        dp[i]= 0
    else:
        dp[i]= (dp[i-1] + dp[i-2])

print(dp[n] % 1000000007)

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

char *reverse(char *s){
    int i,tmp;
    for(i=0; i<strlen(s)/2; i++){
        tmp = s[i];
        s[i] = s[strlen(s)-1-i];
        s[strlen(s)-1-i] = tmp;
    }
    return s;
}

int main(){

    char str[21];

    scanf("%s",str);
    printf("%s\n",reverse(str));

    return 0;
}

Measured memory_bytes: 948
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int hills[10];
    for (size_t i = 0; i < 10; i++)
    {
        cin>>hills[i];
        /* code */
    }
    sort(hills,hills+10,greater<int>());
    for (size_t i = 0; i < 3; i++)
    {
        cout<<hills[i]<<endl;
        /* code */
    }
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main()
{
	int N, Q;
	string S;
	cin >> N >> Q;
	cin >> S;
	vector<int> l(Q), r(Q);
	for (int i = 0; i < Q; i++) {
		cin >> l[i] >> r[i];
	}
	vector<int> sum(N + 1, 0);
	for (int i = 1; i < N; i++) {
		if (S[i - 1] == 'A' && S[i] == 'C') {
			sum[i + 1] = sum[i] + 1;
		}
		else {
			sum[i + 1] = sum[i];
		}
	}
	for (int i = 0; i < Q; i++) {
		cout << sum[r[i]] - sum[l[i]] << endl;
	}
	return 0;
}



Measured memory_bytes: 2176
using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace AtcoderProblem
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            int N = int.Parse(Console.ReadLine());
            int zorori = 0;
            while(i < N)
            {
                string L = Console.ReadLine();
                var stArrayData = L.Split(' ');
                int A1 = int.Parse(stArrayData[0]);
                int A2 = int.Parse(stArrayData[1]);
                if (A1 == A2 || zorori >= 3)
                {
                    zorori++;
                }
                else zorori = 0;
                i++;
            }

            if (zorori >= 3) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }         
    }
}


Measured memory_bytes: 27376
import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline
N = int(input())
par = [-1 for _ in range(N)]
son = [[] for _ in range(N)]
for i in range(1, N):
    a = int(input())
    par[i] = a - 1
    son[a-1].append(i)

def dfs(i):
    if son[i] == []: return 0
    depth = []
    for j in son[i]:
        depth.append(dfs(j))
    depth.sort(reverse = True)
    maxDepth = 0
    for i, d in enumerate(depth): maxDepth = max(maxDepth, i + d)
    return maxDepth + 1

def solve():
    print(dfs(0))
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 122928
N,M = map(int,input().split(" "))
MER = list(map(int,input().split(" ")))
mer_sum = sum(MER)

threshold = mer_sum / (4 * M)
mer_over = [1 if i >= threshold else 0 for i in MER]
mer_threshold = sum(mer_over)

if M <= mer_threshold:
  print("Yes")
else:
  print("No")

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

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

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
using namespace std;
signed main() {
	int N;
	cin >> N;
	bool A = false;

	vector<char>S(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < N; i++) {
		if (S[i] == 'Y') {
			A = true;
		}
	}
	if (A == true) {
		cout << "Four" << endl;
	}
	else {
		cout << "Three" << endl;
	}


}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>

using namespace std;

int main()
{
    int N, K;
    vector<int> h;// List of height
    vector<int> DP;// Hold DP value for each node

    cin >> N >> K;

    h.resize(N);
    DP.resize(N);
    
    for(int i=0; i<N; i++)
    {
        cin >> h.at(i);
        //DP.at(i) = 10000;// Initialize all nodes with expected maximum cost + 1
        DP.at(i) = -1;
    }

    /////////////////////////
    // Initialize DP table //
    /////////////////////////
    DP.at(0) = 0;

    ////////////////////////////////////
    // Fill DP table to the last node //
    ////////////////////////////////////
    for(int inode=0; inode<N; inode++)
    {
        for (int jnode = inode + 1; jnode - inode <= K && jnode < N; jnode++)
        {
            int dp = abs(h.at(inode) - h.at(jnode)) + DP.at(inode);
            if(DP.at(jnode) == -1)
            {
                DP.at(jnode) = dp;
            }
            else if (dp < DP.at(jnode))
            {
                DP.at(jnode) = dp;
            }
        }
    }

    cout << DP.at(N - 1) << endl;
    return 0;
}

Measured memory_bytes: 1024
# your code goes here
a,b,k = map(int,input().split())

if 2*k < b-a + 2:
	for i in range (a,a+k):
		print(i)
	for i in range(b-k+1,b+1):
		print(i)
else:
	for i in range(a,b+1):
		print(i)
		

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

int main(){
  int c = 0, i, j, len;
  while(1){
    char str[105] = {}, reverse[105] = {};
    if(scanf("%s", str) == EOF) break;
    len = strlen(str);
    for(i = len;i >= 0;i--)
      sprintf(reverse, "%s%c", reverse, str[i]);
    if(strcmp(str, reverse)==0) c++;
  }
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 564
#include<iostream>

using namespace std;

int main(void)
{
	char c;
	cin >> c;
	char x[5]={'a','e','i','o','u'};
	for(int i=1;i<=5;i++)
	{
		if(c==x[i-1])
		{
			cout << "vowel" << endl;
			return 0;
		}
	}
	cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<queue>
using namespace std;
int main() {
	long long n, m;
	cin >> n >> m;
	if (n * 2 >= m)cout << m / 2 << endl;
	else cout << (n * 2 + m) / 4 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,l,r) for(ll i=l; i<(ll)(r); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}
const ll MOD = 1000000007;

/////Union Find(for C)/////
int par[201010];   //par:-1*(size of set), chi:par
void UF(int n) {
    for (int i = 0; i < n; i++){
        par[i] = -1;
    }
}
int root(int x) {
    if(par[x] < 0) return x;
    return par[x] = root(par[x]);
}
void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    if(par[rx] > par[ry]) swap(rx,ry);
    par[rx] += par[ry];
    par[ry] = rx;
}
int same(int x, int y) {
    return (root(x) == root(y)?1:0);
}
int size(int x) {
    return (-par[root(x)]);
}
/////----------/////

int main() {
    int n, m, flag = 0;
    scanf("%d%d", &n, &m);
    UF(n);
    rep(i,m){
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--;
        if(same(a,b) == 0) unite(a,b);
    }
    int ans = 1;
    rep(i,n){
        ans = max(size(i),ans);
    }

    printf("%d\n",ans);
}

Measured memory_bytes: 2492
k = int(input())
A = list(map(int, input().split()))
if A[-1] != 2:
    print(-1)
    exit()
L = 1
R = 2
for a in reversed(A):
    c = R//a-L//a
    if c == 0:
        print(-1)
        exit()
    L = (L//a+1)*a-1
    R = (R//a+1)*a-1
print(L+1, R)


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

using ll = long long;
#define REP(i, n) for(int (i)=0; (i)< (n); ++i)
#define REPR(i, n) for(int (i)=(n); (i)>=0; --i)
#define FOR(i, n, m) for(int (i)=(n); (i)<(m); ++i)
//#define INF 1e9
constexpr ll INF = 1LL << 62;
constexpr int mod = 1e9+7;

int main(){
  int N;
  cin >> N;
  vector<vector<int>> g(N);
  REP(i, N-1){
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> board(N, -1);
  queue<int> que;
  que.push(0);
  que.push(N-1);
  board[0] = 0;
  board[N-1] = 1;
  int b = 1, w = 1;
  while(!que.empty()){
    int v = que.front(); que.pop();
    for(auto nv : g[v]){
      if(board[nv] != -1) continue;
      board[nv] = board[v];
      if(board[v] == 0){
        b++;
      }
      else{
        w++;
      }
      que.push(nv);
    }
  }
  if(b>w){
    cout << "Fennec" << endl;
  }
  else{
    cout << "Snuke" << endl;
  }

  return 0;
}


Measured memory_bytes: 6144
import sys
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
a=[1]*(n+1)
for i in range(m):
    a[int(input())]=0
memo={}
def count(p):
    if p in memo:
        return memo[p]
    if p==0:
        return 1
    if p==1:
        return a[p]
    if a[p]==1:
        x=count(p-1)+count(p-2)
        memo[p]=x
        return x
    else:
        memo[p]=0
        return 0
print(count(n)%1000000007)


Measured memory_bytes: 550632
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}





int main(){
  int K,N;
  cin >> K >> N;
  int a[N];
  rep(i,N)cin >> a[i];
  int dist = a[0] + K - a[N-1];
  rep(i,N-1) dist = max(dist,a[i+1]- a[i]);
  cout << K - dist << endl;
  return 0;
}



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

typedef  long long ll;




int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N,P;
    cin>>N>>P;
    if(N==1){
        cout<<P<<endl;
        return 0;
    }
    

    ll p = P;
    ll divisor = 2;
    ll ans = 1;
    while(p&&pow(divisor,N)<=p){
        while (p%divisor != 0) {
            divisor ++;
        }
        int cnt = 0;
        while (p%divisor == 0) {
            p= p/divisor;
            ++cnt;
        }
        ans *= pow(divisor, cnt/N);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
N,K,Q = map(int,input().split(' '))
A_i = list()
for k in range(Q):
    k = int(input())
    A_i.append(k)

First = [K-Q] * N

for i in A_i:
    First[i-1] += 1
for j in First:
    if j <= 0:
        print('No')
    else:
        print('Yes') 

Measured memory_bytes: 10472
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
class union_find{
  int n;
  vector<int> par,rk,size;
  public:
  union_find(int max_n){
    n = max_n+1;
    for(int i=0;i<=n;i++){
      par.emplace_back(i);
      rk.emplace_back(0);
      size.emplace_back(1);
    }
  }
  int root(int x){
    vector<int> nodes;
    while(x!=par[x]){
      nodes.emplace_back(x);
      x = par[x];
    }
    for(auto v:nodes){
      par[v] = x;
    }
    return x;
  }
  void unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x==y) return;
    if(rk[x]<rk[y]){
      par[x] = y;
      size[y] += size[x];
    }else{
      par[y] = x;
      if(rk[x]==rk[y]) rk[x]++;
      size[x] += size[y];
    }
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int treesize(int x){
    return size[root(x)];
  }
};
signed main(){
  init_io();
  ll n,m,ans=0;
  cin >> n >> m;
  union_find uf(n);
  vector<ll> p(n),x(m),y(m);
  for(int i=0;i<n;i++){
    cin >> p[i];
    p[i]--;
  }
  for(int i=0;i<m;i++){
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    uf.unite(x[i],y[i]);
  }
  for(int i=0;i<n;i++){
    if(uf.same(p[i],i)){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4076
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>    // std::copy
#include <iterator>     // std::back_inserter
#include <set>
using namespace std;
 
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    if(N * A <  B){
        cout << N * A << endl;
    }
    else {
        cout <<  B << endl;
    }
}

Measured memory_bytes: 256
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power(ll a, ll b, ll m)
{
	ll sol = power(a, b / 2, m);
	sol = (sol * sol) % m;
	if (b % 2 == 1)
		sol = (sol * a) % m;
	return(sol);
}
ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	else
	{
		return gcd(b, a % b);
	}
}

void solve()
{
	ll a, b, c, d, sol = 0;
	cin >> a >> b >> c >> d;
	sol = 0;
	ll l, r;
	l = a / c + 1;
	if (b % c == 0)
	{
		r = b / c - 1;
	}
	else
		r = b / c;
	sol = sol + (r - l + 1);
	l = a / d + 1;
	if (b % d == 0)
	{
		r = b / d - 1;
	}
	else
		r = b / d;
	sol = sol + (r - l + 1);

	ll lcm = c * d / gcd(c, d);

	l = a / lcm + 1;
	if (b % lcm == 0)
	{
		r = b / lcm - 1;
	}
	else
		r = b / lcm;
	sol = sol - (r - l + 1);
	if (a % c == 0 || a % d == 0)
		sol++;
	if (b % c == 0 || b % d == 0)
		sol++;
	cout <<b-a+1- sol;
}
int main()
{
	int t = 1;
	//cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  vi32 x(n);
  cin >> x;
  auto sx = x;
  sort(all(sx));
  rep(i, n) {
    if (x[i] <= sx[n / 2 - 1]) {
      cout << sx[n / 2] << '\n';
    } else {
      cout << sx[n / 2 - 1] << '\n';
    }
  }
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int a, b;
    cin >> a >> b;

    string s;
    if (a < b) {
        rep(i, b) s.push_back(a + '0');
    } else {
        rep(i, a) s.push_back(b + '0');
    }

    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
long long n,m,a,k,i,j,num[500005];
string st;
int main()
{
	ios_base::sync_with_stdio(0);
	cin>>n>>m>>a>>k;
	if (k&1) cout<<m-n; else cout<<n-m;
	return 0;
}

Measured memory_bytes: 256
X,N = map(int,input().split())
if N == 0:
    print(X)
else:
    array = list(map(int, input().split()))
    answer = -114514
    for i in range(-200,200):
        ok = True
        for v in array:
            if v == i:
                ok = False
                break
        if ok is False:
            continue
        if abs(answer-X) > abs(i-X):
            answer = i
    print(answer)


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

int N, sum, Max;

int main(){
    int p;
    scanf("%d", &N);
    for (int i=1; i<=N; i++){
        scanf("%d", &p);
        Max = max(Max, p);
        sum += p;
    }
    printf("%d", sum - (Max/2));
    return 0;
}


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

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

    int ans = 0;
    for (int i = 1; i <= T; i++)
    {
        if (i % A == 0)
        {
            ans += B;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = input()
a = input().split()
n= int(n)
a= [int(i) for i in a]
f=0
#print(a)

for h in a:	
	if h%2 ==0:
  		if h%3 ==0 or h%5 ==0: f=f+1
	else: f = f+1


#print(f)
if f == len(a): print("APPROVED")
else: print("DENIED")

Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc135/tasks/abc135_a

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#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))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if ((a - b) % 2 != 0) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << min(a, b) + abs(a - b) / 2 << endl;
    }

    return 0;
}


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

using namespace std;

typedef struct{
  int x;
  int y;
}BILL;
typedef pair<int,int> P;
const int INF = (1<<20);
const int MAX = 1001;
BILL bill[MAX];
int pre[MAX],node[MAX];
int n,m;
vector<int> IN;

void init(){
  fill(pre,pre+MAX, -1);
  fill(node,node+MAX, INF);
}


double Getd(BILL a, BILL b){
  return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

void solve(int from, int to){
  init();
  node[from] = 0;
  priority_queue<P,vector<P>, greater<P> > Q;
  Q.push(P(node[from],from));
  //Q(distance,name)
  while(!Q.empty()){
    P now = Q.top(); Q.pop();
    //   if(now.first > node[now.second]) continue;
    for(int i = 0; i < IN.size(); i++){
      int next = IN[i];
      if(Getd(bill[now.second],bill[next]) <= 50 && Getd(bill[now.second],bill[next]) > 0)
	if(node[next] > now.first+Getd(bill[now.second],bill[next])){
	  node[next] = now.first+Getd(bill[now.second],bill[next]);
	  Q.push(P(node[next],next));
	  pre[next] = now.second;
	}
    }
  }

  vector<int> V;
  int prec = to;
  if(node[to] == INF) cout << "NA";
  else {
    V.push_back(to);
    while(pre[prec] != -1){
      V.push_back(pre[prec]);
      prec = pre[prec];
    }
  }
  reverse(V.begin(),V.end());
  for(int i = 0; i < V.size(); i++){
    if(i) cout << " ";
    cout << V[i];
  }
  cout << endl;
}

int main(){
  while(cin >> n && n){
    IN.clear();
    for(int i = 0; i < n; i++){
      int num;
      cin >> num;
      cin >> bill[num].x >> bill[num].y;
      IN.push_back(num);
    }
    cin >> m;
    for(int i = 0; i < m; i++){
      int f,t;
      cin >> f >> t;
      solve(f,t);
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>

    
int main(void){
    int i;  
int A[100];
for(i = 0;i<3;i++){
scanf("%d",&A[i]);
}
int min = A[0];
int max = A[0];
for(i = 0;i<3;i++){
if(min > A[i]){
min = A[i];
}
if(max < A[i])
max = A[i];
}
printf("%d",max-min);
return 0;
}

Measured memory_bytes: 128
# include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N] , b[N] , n;
int main(){
	int res = 0;
	string a , b;
	cin >> a >> b;
	for(int i = 0; i < 3; i ++){
		if(a[i] == b[i]) res ++;
	}
	cout << res << "\n";
}

Measured memory_bytes: 256