akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int pos = 0;
		for(char c : "AKIHABARA".toCharArray()) {
			if(pos < s.length && s[pos] == c) {
				pos++;
			} else if(c != 'A') {
				System.out.println("NO");
				return;
			}
		}
		System.out.println(s.length == pos ? "YES" : "NO");
//		StringBuilder builder = new StringBuilder();
//		builder.append(s);
//		if(builder.charAt(0) != 'A') {
//			builder.insert(0, "A");
//		}
//		if(builder.length() >= 5 && builder.charAt(4) != 'A') {
//			builder.insert(4, "A");
//		}
//		if(builder.length() >= 7 && builder.charAt(6) != 'A') {
//			builder.insert(6, "A");
//		}
//		if(builder.length() >= 9 && builder.charAt(8) != 'A') {
//			builder.insert(8, "A");
//		}
//		System.out.println(builder.toString());
//		if(builder.toString().equals("AKIHABARA")) {
//			System.out.println("YES");
//		} else {
//			System.out.println("NO");
//		}
	}
}


Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin>>n>>s;
  vector<int> x(n+1);
  x.push_back(0);
  int cnt=0;
  for(int i=0;i<n;i++){
    if(s.at(i)=='I'){
      cnt++;
      x.push_back(cnt);
    }
    if(s.at(i)=='D'){
      cnt--;
      x.push_back(cnt);
    }
  }
  sort(x.begin(),x.end());
  reverse(x.begin(),x.end());
  cout<<x.at(0)<<endl;
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素

int n,m;
vector<int> ans;
vector<int> chn;

int main(){
   cin>>n>>m;
   ans.resize(n,0);
   chn.resize(n,0);
   if(n==1) ans[0]=0;
   else ans[0]=1;
   int s,c;
   REP(i,m){
      cin>>s>>c;
      if(s>n ||
         (s==1 && c==0 && n!=1) ||
         (chn[s-1]==1 && ans[s-1]!=c)){
            cout<<"-1"<<endl;
            return 0;
      }
      chn[s-1]=1;
      ans[s-1]=c;
   }
   REP(i,n) cout<<ans[i];
   cout<<endl;
   return 0;
}

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

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int a, b;


//inputします
void input() {
    cin >> a >> b;
}

//ライブラリ置き場

//main
int main() {
    input();
    vector<vector<int>> dat(2);
    ff(i, 0, b) {
        dat[0].push_back(a);
    }
    ff(i, 0, a) {
        dat[1].push_back(b);
    }
    srt(dat);
    ff(i, 0, dat[0].size()) {
        cout << dat[0][i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
 
using namespace std;
using namespace std::chrono; 
 
 
 
//c++ templte for help...........................................................
 
//#define deb(x) cout<<#x<<" "<<x<<endl;/* for debuging  printing variable with name*/
//#define debb(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;										
//#define debbb(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;			
 
typedef long long ll;
typedef unsigned long long ull;
	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
//#define modulo 1000000007
//const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//debb(itr->first,itr->second)
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help........................................................

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JYAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	 
	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		ll a,b,c,k;
		cin>>a>>b>>c>>k;
		
		if(a>k){
			cout<<k<<endl;
		}
		
		else if(k<=a+b){
			cout<<a<<endl;
		}else{
			cout<<a-(k-a-b)<<endl;
		}





	//}
	
	return 0;
}


Measured memory_bytes: 3632
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}
fn gcd(x: u64, y: u64) -> u64 {
    if x == 0 {
        y
    } else {
        gcd(y % x, x)
    }
}

fn main() {
    let n = read::<usize>();

    let v = read_vec::<u64>();

    let mut ans = v[0];
    for i in 1..n {
        ans = gcd(ans, v[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


int main(void){
	int n;
	cin >> n;
 
	vector<int> a(n), b(n), c(n);
 
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
 
	sort(a.begin(), a.end());
	sort(c.begin(), c.end());
 
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		sum += (upper_bound(a.begin(), a.end(), b[i] - 1) - a.begin()) * (n - (lower_bound(c.begin(), c.end(), b[i] + 1) - c.begin()));
	}
	cout << sum << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
#define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++)
#define rep2(CNT, START, GOAL) for (int CNT = (int)(START); CNT < (int)(GOAL); CNT++)
#define rep3(CNT, START, GOAL) for (int CNT = (int)(START); CNT > (int)(GOAL); CNT--)
#define all(CONT) begin(CONT), end(CONT)
template <typename T> void CERR(const T &ELEM) { cerr << ELEM; }
#define dbl(OBJ) cerr << #OBJ << ": "; CERR(OBJ); cerr << "\n"
template <typename T, typename ...Ts> void CERR(const T &FIRST, const Ts &...REST) { CERR(FIRST); cerr << ", "; CERR(REST...); }
#define dbs(...) cerr << "(" << #__VA_ARGS__ << "): ("; CERR(__VA_ARGS__); cerr << ")\n"
#include <atcoder/all>
using namespace atcoder;

// 旗iの座標をFiとする。
// Fi=Xi or Fi=Yi である。
// (Fi=Xi or Fj=Xj) は (Fi=Yi → Fj=Xj) と同値。
// 対偶を取ると，Fj=Yj → Fi=Xi と更に同値。
// i=0,1,...,N-1に対し，
// (1)|Xi-Xj|<D のとき (Fi=Xi → Fj=Yj) i.e. (Fi=Yi or Fj=Yj) というクローズを加え，
// (2)|Xi-Yj|<D のとき (Fi=Xi → Fj=Xj) i.e. (Fi=Yi or Fj=Xj) というクローズを加え，
// (3)|Yi-Yj|<D のとき (Fi=Yi → Fj=Xj) i.e. (Fi=Xi or Fj=Xj) というクローズを加え，
// (4)|Yi-Xj|<D のとき (Fi=Yi → Fj=Yj) i.e. (Fi=Xi or Fj=Yj) というクローズを加える。 ※(2)でカバー済
// Fi=Xiであることをtrueで，Fi=Yiであることをfalseで表す。

int main() {
	int N, D; cin >> N >> D;
	vi X(N), Y(N); rep(i, N) cin >> X[i] >> Y[i];
	two_sat ts(N);
	rep(i, N - 1) rep2(j, i + 1, N) {
		if (abs(X[i] - X[j]) < D) ts.add_clause(i, false, j, false);
		if (abs(Y[i] - Y[j]) < D) ts.add_clause(i, true, j, true);
		if (abs(X[i] - Y[j]) < D) ts.add_clause(i, false, j, true);
		if (abs(Y[i] - X[j]) < D) ts.add_clause(i, true, j, false);
	}

	if (ts.satisfiable()) {
		cout << "Yes" << endl;
		vector<bool> v = ts.answer();
		rep(i, N) cout << (v[i] ? X[i] : Y[i]) << endl;
		// for (auto e : ts.answer()) {
		// 	dbl(e);
		// }
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


// void solve()
// {
//     string s;
//     cin>>s;
//     ll x1=s[0]-'a';
//     ll x2=s[1]-'a';
//     ll x3=s[2]-'a';
//     ll x4=s[3]-'a';
//     ll f1=0,f2=0;

     
    
    
// }


void solve()
{
    ll n,k;
    cin>>n>>k;

    ld res=0;
    ll i;
    for(i=1;i<=n;i++)
    {
        ld tans =i;
        ld ttans = 1.0/n;
        // ll di = floor(log2(n/tans));
        ll no = i;
        ll no2=0;
        while(no<k)
        {
             no*=2;
             no2++;
        }
        res +=1.0*pow(0.5,no2)*ttans;
    }
    cout<<res<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 256
import sys

nk = list(input().split(" "))
n = int(nk[0])
k = int(nk[1])
rsp = list(input().split(" "))
r = int(rsp[0])
s = int(rsp[1])
p = int(rsp[2])
T = str(input())

my_choice = [""] * n
ans = 0

for i in range(0,k):
    if T[i] == "r":
        my_choice[i] = "p"
        ans += p
    elif T[i] == "s":
        my_choice[i] = "r"
        ans += r
    else:
        my_choice[i] = "s"
        ans += s

if k == n:
    print(ans)
    sys.exit()

for i in range(k,n):
    if T[i] == "r" and my_choice[i - k] != "p":
        my_choice[i] = "p"
        ans += p
    elif T[i] == "s" and my_choice[i - k] != "r":
        my_choice[i] = "r"
        ans += r
    elif T[i] == "p" and my_choice[i - k] != "s":
        my_choice[i] = "s"
        ans += s


print(ans)


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

int main(){
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;

	int out = 0;
	for (int i = 0; i < a.size(); ++i){
		if (a.at(i) != b.at(i) && b.at(i) != c.at(i) && c.at(i) != a.at(i)){
			out += 2;
		}
		else{
			if(a.at(i) == b.at(i) && b.at(i) != c.at(i)){
				out++;
			}
			else if(a.at(i) != b.at(i) && b.at(i) == c.at(i)){
				out++;
			}
			else if(a.at(i) != b.at(i) && c.at(i) == a.at(i)){
				out++;
			}
			else{
				continue;
			}
		}
	}

	cout << out << endl;
}

Measured memory_bytes: 256
// type a
//a...いけそう
//b...自信がない
//c...お試し
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#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>
#include <math.h>
#include <cstring>
#include <array>
// ===============================================================
//using系
#pragma region header
using namespace std;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000;
#define mod (int)1000000007
#pragma endregion



int main() {
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	cout << a[n - 1] << ' ';
	int x = lower_bound(a.begin(), a.end(), a[n - 1] / 2) - a.begin();
	if (x == 0) { cout << a[0] << '\n'; return 0; }
	if (n == 2) { cout << a[0] << '\n'; return 0; }
	if (a[x] - (ld)a[n - 1] / 2 >= (ld)a[n - 1] / 2 - a[x - 1]) { cout << a[x - 1] << '\n'; return 0; }
	else { cout << a[x] << '\n'; return 0; }

	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+10; 

ll dp[60][3][3];
int main(){
  fast;
  int n;
  cin>>n;
  fill(dp,0);
  string s1,s2;
  cin>>s1;
  cin>>s2;

  if(s1[0]==s2[0])
  {
  	for(int i=0;i<3;i++)
  		dp[0][i][i]=1;
  }

  else
  {
  	FOR(i,0,2)
  	FOR(j,0,2)
  	{
  		if(i!=j)
  		dp[0][i][j]=1;	
  	}	
  }
  	
  for(int i=1;i<n;i++)
  {
  	if(s1[i]==s2[i])
  	{
  		for(int j1=0;j1<3;j1++)
  		{
 			for(int j2=0;j2<3;j2++)
 			for(int j3=0;j3<3;j3++)
 			{
 				if(j2==j1 or j3==j1)
 					continue;

 				dp[i][j1][j1]=(dp[i][j1][j1]+dp[i-1][j2][j3])%mod;
 				if(dp[i][j1][j1]<0)
 					dp[i][j1][j1]+=mod;
 			}
  		}
  	}

  	else
  	{
  		if(s1[i-1]==s1[i] and s2[i-1]==s2[i])
  		{
  			for(int j1=0;j1<3;j1++)
  			for(int j2=0;j2<3;j2++)
  			{
  				if(j1==j2)
  					continue;
  				dp[i][j1][j2]=dp[i-1][j1][j2];
  			}
  		}
  		else
  		{
  			for(int j1=0;j1<3;j1++)
  			for(int j2=0;j2<3;j2++)
  			{
  				if(j1==j2)
  					continue;
  				
  				for(int j3=0;j3<3;j3++)
  				for(int j4=0;j4<3;j4++)
  				{
  					if(j3==j1 or j2==j4)
  						continue;
  					dp[i][j1][j2]=(dp[i][j1][j2]+dp[i-1][j3][j4])%mod;
  					if(dp[i][j1][j2]<0)
 					dp[i][j1][j2]+=mod;
  				}
  			}
  		}
  	}
  }

  ll ans=0;
  for(int j1=0;j1<3;j1++)
  for(int j2=0;j2<3;j2++)
  {
  	ans=(ans+dp[n-1][j1][j2])%mod;
  	if(ans<0)
  		ans+=mod;
  }
  cout<<ans;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n,i,suma=0,sumb=0;
	cin>>n;
	int a[n+1];
	for(i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+1+n,cmp);
	for(i=1;i<=n;i++)
	{
	 if(i%2!=0)
	 suma+=a[i];
	 else
	 sumb+=a[i];
    }
    cout<<suma-sumb<<endl;
 } 

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
// clang-format on
/* }}} */

void solve()
{
    int n,y;
    cin >> n >> y;
    int a=-1,b=-1,c=-1;
    bool flag;
    REP(i,n+1) REP(j,n+1) 
    {
        int k=n-i-j;
        if((i*10000+j*5000+k*1000==y)&&k>=0)
        {
            a=i,b=j,c=k;
        }
    }
    cout << a << " " <<  b << " " <<  c << endl;
}

signed main() 
{
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define int num
using namespace std;
typedef long long num;
typedef pair<int,int> point;
const int maxn=1e6+10,inf=1e9+10,lg=31;

int n,A[maxn];
map<int,int> mp;
int32_t main(){
	cin>>n;
	rep(i,0,n){
		cin>>A[i];
		mp[A[i]]++;
	}
	int ans=0;
	while(mp.size()){
		point p=(*mp.rbegin());
		mp.erase(--mp.end());
		if(p.Y==0) continue;
		int rem=0;
		for(int i=0;i<lg;i++){
			if((1ll<<i)>p.X){
				rem=(1ll<<i)-p.X;
				break;
			}
		}
		if(rem==p.X){
			ans+=p.Y/2;
		}else{
			ans+=min(mp[rem],p.Y);
			mp[rem]-=min(mp[rem],p.Y);	
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 14336
nv, ne = map(int, input().split())

costs = [[None] * nv for _ in range(nv)]
for i in range(nv):
    costs[i][i] = 0

while ne:
    s, t, d = map(int, input().split())
    costs[s][t] = d
    ne -= 1


def loop():
    for k in range(nv):
        for i in range(nv):
            for j in range(nv):
                if costs[i][k] is None or costs[k][j] is None:
                    continue
                tmp_cost = costs[i][k] + costs[k][j]
                if i == j and tmp_cost < 0:
                    print('NEGATIVE CYCLE')
                    return False
                if costs[i][j] is None or costs[i][j] > tmp_cost:
                    costs[i][j] = tmp_cost
    return True


if loop():
    for vc in costs:
        print(*('INF' if c is None else c for c in vc))

Measured memory_bytes: 8352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, M; cin >> N >> M;
	vector<P> ba(M);
	rep (i, M){
		int a, b; cin >> a >> b;
		ba[i].first = b;
		ba[i].second = a;
	} // end rep
	
	sort(ALL(ba));

	int res = 0;
	int x = 0;
	rep (i, M){
		if (x <= ba[i].second){
			++res;
			x = ba[i].first;
		} // end if
	} // end rep

	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#define rep(i, a) for(int i = 0; i < a; ++i)

int main(void) {
  char w[20], t[1200];
  char s[100] = "END_OF_TEXT";
  int ans = 0;
  scanf("%s", w);
  rep(i, strlen(w)) if(w[i] >= 'A' && w[i] <= 'Z') w[i] += 'a' - 'A';
  while( scanf("%s", t) != EOF ) {
    if(!strcmp(t, s)) break;
    rep(i, strlen(t)) if(t[i] >= 'A' && t[i] <= 'Z') t[i] += 'a' - 'A';
    if(!strcmp(w, t)) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 2744
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		solve(a, b);
	}

	static void solve(int a, int b) {

		String[] arr = new String[16];

		try {
			for (int i = 0; i < a; i++) {
				arr[i * 2] = "e";
			}

			for (int i = 1; i <= b; i++) {
				arr[(i * 2) - 1] = "s";
			}
			System.out.println("Yay!");

		} catch (ArrayIndexOutOfBoundsException e) {
			System.out.println(":(");
		}
	}
}

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

int main(){
  int A,B;
  cin >> A >> B;
  
  if(A==B){
    cout << "Draw" << endl;
  }
  else if(A<B){
    if(A==1){
      cout << "Alice" << endl;
    }
    else{
      cout << "Bob" << endl;
    }
  }
  else {
     if(B==1){
      cout << "Bob" << endl;
    }
    else{
      cout << "Alice" << endl;
    }
  }
}

Measured memory_bytes: 768
n = int(input())
lr = []
for _ in range(n):
    x, l = map(int, input().split())
    lr.append((x-l, x+l))
lr = sorted(lr, key=lambda x:x[0])
prev = lr[0]
ans = 1
for i in range(1, n):
    if prev[1] <= lr[i][0]:
        ans += 1
        prev = lr[i]
    else:
        if prev[1] > lr[i][1]:
            prev = lr[i]

print(ans)




Measured memory_bytes: 58072
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (true) {
      int x = in.nextInt();
      char op = in.next().charAt(0);
      if(op == '?') break;
      int y = in.nextInt();
      switch (op) {
        case '+': System.out.println(x + y); break;
        case '-': System.out.println(x - y); break;
        case '*': System.out.println(x * y); break;
        case '/': System.out.println(x / y); break;
      }
    }
  }
}

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

int N = 0;
int hs[110];
int MAX = 1000;

int min(int start, int end) {
  int m = MAX;
  for (int i = start; i <= end; i++) {
    if (hs[i] < m) {
      m = hs[i];
    }
  }
  return m;
}

int solve(int start, int end) {
  int count = 0;

  if (end - start < 1) {
    count += hs[start];
    hs[start] = 0;
    return count;
  }

  int m = min(start, end);
  if (m == 0) {
    for (int i = start; i <= end; i++) {
      if (hs[i] == 0) {
        count += solve(start, i - 1) + solve(i + 1, end);
        break;
      }
    }
  } else {
    for (int i = start; i <= end; i++) {
      hs[i] = hs[i] - m;
    }
    count += m + solve(start, end);
  }

  return count;
}

int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> hs[i];
  }

  cout << solve(1, N) << endl;
  return 0;
}

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

int main() {
  int n; cin >> n;
  vector<pair<int, int>> red(n);
  for (int i = 0; i < n; i++) {
    int first, second; cin >> first >> second;
    red.at(i) = make_pair(first, second);
  }
  vector<pair<int, int>> blue(n);
  for (int i = 0; i < n; i++) {
    int first, second; cin >> first >> second;
    blue.at(i) = make_pair(first, second);
  }
  sort(red.begin(), red.end());
  sort(blue.begin(), blue.end());
  
  vector<bool> paired(n, false);
  int answer = 0;
  
  for (int i = 0; i < n; i++) {
    int maximum = -1;
    int index = -1;
    for (int j = 0; j < n; j++) {
      if (paired.at(j)) continue;
      if (red.at(j).first > blue.at(i).first) {
        break;
      } else {
        if (red.at(j).second < blue.at(i).second && red.at(j).second > maximum) {
          maximum = red.at(j).second;
          index = j;
        }
      }
    }
    if (index != -1) {
      paired.at(index) = true;
      answer++;
    }
  }
  
  cout << answer << endl;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final Scanner     sc = new Scanner(System.in);
    static final PrintStream so = System.out;

    public static void main(String[] args) {
        int N = nint();
        int[] H = nints(N);
        int curr = H[0]-1;
        
        for (int i = 1; i < N; i++) {
            if (H[i] > curr) {
                H[i] -= 1;
            }
            
            if (H[i] < curr) {
                so.println("No");
                return;
            }
            curr = H[i];
        }
        so.println("Yes");
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static int nint() {
        return sc.nextInt();
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nsToChars() {
        return sc.next().toCharArray();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static String[] nstrs(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = nstr();
        return a;
    }

    private static char[][] nsToChars2D(int h, int w) {
        return nsToChars2D(h, w, 0);
    }

    private static char[][] nsToChars2D(int h, int w, int pad) {
        char[][] a2 = new char[h + pad * 2][w + pad * 2];
        for (int i = 0; i < h; i++)
            System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);
        return a2;
    }
}


Measured memory_bytes: 49664
import sys
a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(input())

yes = "YES"
no = "NO"

if (a == b):
    print(yes)
    sys.exit()

if (w >= v):
    print(no)
    sys.exit()

distance = abs(b - a)
diff_spd = v - w

if ((distance - (diff_spd * t)) > 0):
    print(no)
    sys.exit()

print(yes)


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

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


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

ll next(ll s){
  if(s %2 == 0) return s/2;
  else return 3*s+1;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;
    ll s;
    vl v;
    cin >> s;
    v.pb(s);
    while(true){
      s = next(s);
      bool stop = false;
      for (auto it = v.begin(); it != v.end(); it++) {
        if(s == *it)
          {stop = true;break;}
      }
      if(stop) break;
      v.pb(s);

    }

    cout << v.size()+1 << endl;




    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	//n頂点m枝に対して隣接リストをつくる。
	int n, m;
	cin >> n >> m;
	int u, v;
	//vector< vector <int> > ls(n); //0-origin
	vector< vector <int> > ls(n+1); //1-origin
	REP(i, m){ 
		cin >> u >> v; 
		ls[u].push_back(v); 
		ls[v].push_back(u);
	}
	//
	int gui[n+1] = {};
	gui[1] = 1;
	queue<int > q;
	q.push(1);
	while (!q.empty())
	{
		int now = q.front();
		q.pop();
		REP(i, ls[now].size()){
			if(gui[ls[now][i]] == 0){
				gui[ls[now][i]] = now;
				q.push(ls[now][i]);
			}
		}
	}
	cout << "Yes" << endl;
	for(int i = 2; i<=n; i++) cout << gui[i] << endl;
}

Measured memory_bytes: 10216
my ($n, $k) = split(/\s+/, <>);
my ($s) = split(/\s+/, <>);

for my $i (0..($n-1)) {
    my $c = substr($s, $i, 1);
    if ($i+1 == $k) {
	$c =~ tr/A-Z/a-z/;
    }
    print $c;
}
print "\n";


Measured memory_bytes: 640
using System;

namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int c = 9;
            while(--c >= 0) {
                var data = Console.ReadLine().Split();
                var d = new[] {int.Parse(data[1]), int.Parse(data[2])};
                Console.WriteLine("{0} {1} {2}", data[0], d[0] + d[1], d[0] * 200 + d[1] * 300);
            }
        }
    }
}

Measured memory_bytes: 5620
import java.util.Scanner;

class Main{
 public static void main(String[] args) {
  int a, b, c;
  Scanner scan = new Scanner(System.in);

  a = scan.nextInt();
  b = scan.nextInt();
  c = scan.nextInt();

  if (a < b && b < c) {
   System.out.println("Yes");
  } else {
   System.out.println("No");
  }
 }
}

Measured memory_bytes: 17224
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main() {
    ll N;
  cin>>N;
    cout<<(ll)pow(N,3)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	cin>>n;
	int arr[n];
	for(i=0; i<n; i++)
	{ cin>>arr[i];
	}
	for(i=1; i<n; i++)
	{
		if(arr[i]>arr[i-1])
		arr[i]-=1;
	}
	int flag=1;
	for(i=1; i<n; i++)
	{
		if(arr[i]<arr[i-1])
		{ flag=0;
		break;
		}
	}
	if(flag==1)
	cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int c = sc.nextInt();
    int[][] imos = new int[c][100002];
    for(int i = 0; i < n; i++) {
      int s = sc.nextInt();
      int t = sc.nextInt();
      int u = sc.nextInt();
      imos[u - 1][s]++;
      imos[u - 1][t + 1]--;
    }
    for(int i = 0; i < c; i++) {
      for(int j = 1; j < 100002; j++) {
        imos[i][j] += imos[i][j - 1];
      }
    }
    for(int i = 0; i < c; i++) {
      for(int j = 1; j < 100002; j++) {
        if(imos[i][j] > 0) imos[i][j] = 1; 
      }
    }
    int ans = 0;
    for(int j = 1; j < 100002; j++) {
      int sum = 0;
      for(int i = 0; i < c; i++) {
        sum += imos[i][j];
      }
      ans = Math.max(ans, sum);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 106728
/*

*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define fi first
#define se second
 
using namespace std;

int n, m, a[1000005];

int main () {
	cin >> n;
	int m = n % 500;
	m -= m % 5;
	cout << ((n / 500) * 1000) + m;
	return 0;
}

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

int main(){
    int r, D;
    ll x;
    cin >> r >> D >> x;
    rep(i, 10) {
        x = r * x - D;
        cout << x << endl;
    }
}

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);

vector<int> divisor(const int n){
  vector<int> ret;
  for(int i=1;i*i<=n;i++){
    if(n % i == 0){
      ret.push_back(i);
      if(i*i!= n) ret.push_back(n/i);
    }
  }
  sort(ret.begin(),ret.end());
  return ret;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vec a=divisor(n);
    vec b=divisor(n-1);
    rep(i,b.size()) a.pb(b[i]);
    set<int> st;
    rep(i,a.size()){
        if(a[i]==1) continue;
        int memo=n;
        // cout<<a[i]<<endl;
        while(memo>1){
            if(memo%a[i]==0) memo/=a[i];
            else if((memo%a[i])==1) memo=1;
            else break;
        }
        if(memo==1){
            st.insert(a[i]);
            // debug(a[i]);
        }
    }
    cout<<st.size()<<endl;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i;
  cin >> n >> m;
  if(m<=n){
    cout << 0 << endl;
    return 0;
  }
  vector<int> array(m);
  for(i=0;i<m;i++){
    cin >> array[i];
  }
  vector<int> diff(m-1);
  sort(array.begin(),array.end());
  for(i=0;i<m-1;i++){
    diff[i]=array[i+1]-array[i];
  }
  sort(diff.begin(),diff.end());
  reverse(diff.begin(),diff.end());
  int ans=array[m-1]-array[0];
  for(i=0;i<n-1;++i){
    ans-=diff[i];
  }
  cout << ans << endl;
}

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

int main(){
	int d = 0, n = 0;
    cin >> d >> n;
	if(n == 100)
		n = 101;
    if(d == 0){
      cout << n << "\n";
    }else if(d == 1){
        	n *= 100;
        cout << n << "\n";
    }else{
        n *= 10000;
        cout << n << "\n";
        }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		int[] a = new int[n];
		int[] b = new int[n];
		int k = Integer.MIN_VALUE;
		StringTokenizer st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
			k = Math.max(k, a[i]);
		}
		countingSort(a, b, k);
		StringBuilder sb = new StringBuilder();
		sb.append(b[0]);
		for (int i = 1; i < n; i++) {
			sb.append(' ').append(b[i]);
		}
		System.out.println(sb.toString());
	}

	private static void countingSort(int[] a, int[] b, int k) {
		int[] c = new int[k + 1];
		for (int i = 0; i < a.length; i++) {
			c[a[i]]++;
		}
		for (int i = 1; i <= k; i++) {
			c[i] += c[i - 1];
		}
		for (int i = a.length - 1; i >= 0; i--) {
			c[a[i]]--;
			b[c[a[i]]] = a[i];
		}		
	}
}



Measured memory_bytes: 168068
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();
        long num = x;
        for(int i = 0; i < 10; i++) {
            num = r * num - d;
            System.out.println(num);
        }
    }
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline
import collections

n = int(input().rstrip())
a = [a for a in input().split()]

b = collections.deque(maxlen=n)
for i in range(n):
    if i % 2 == 0: b.append(a[i])
    else: b.appendleft(a[i])
if (n - 1) % 2 == 0: b = list(reversed(b))

for elem in b: print(elem, end=' ')

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

int sumDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

// main
int main(){
    int N; cin >> N;
    int min = 1e6;
    rep(a, N){
        int b = N - a;
        int ab = sumDigits(a) + sumDigits(b);
        if(min > ab) min = ab;
    }
    cout << min << "\n";
    return 0;
}

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

int main(){
    long long int ans = 0;
    long long int a = 0;
    long long int b = 0;
    long long int c = 0;
    cin >> a;
    for(int i = 1; i <= a; i++){
        for(int j = 1; j <= a; j++){
            for(int k = 1; k <= a; k++){
                ans += __gcd(__gcd(i,j), k );
            }
        }
    }
    cout << ans <<endl;
    return 0;
}

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

int main(){
  int N,L;
  cin>>N>>L;
  int mina=300;
  int sum=0;
  for(int i=1;i<N+1;i++){
    mina=min(mina,abs(L+i-1));
    sum=sum+L+i-1;
  }
  //cout<<mina<<" "<<sum<<endl;
  if(sum<0){
    cout<<sum+mina<<endl;
    return 0;
  }
  else cout<<sum-mina<<endl;
  return 0;
}



    


  


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

using namespace std;

int main()
{
	unsigned int i;
	string id,id2;

	cin >> id;
	cin >> id2;
	for (i = 0; i < size(id); i++)
	{
		if (id[i] != id2[i])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>

int main() {
	unsigned long long N;
	std::cin >> N;
	std::vector<int> cumSum(60);
	cumSum.at(0) = 0;
	for (int i = 1; i < 60; ++i) {
		cumSum.at(i) = i + cumSum.at(i - 1);
	}
	int ans = 0;

	if (N == 1) {
		std::cout << 0 << std::endl;
		return 0;
	}

	unsigned long long X = N;
	for (unsigned long long i = 2; i * i < N ; ++i) {
		int cnt = 0;
		int iCum = 0;
		while (X % i == 0) {
			++cnt;
			X /= i;
			if (cnt >= cumSum.at(iCum+1)) {
				++iCum;
			}
		}
		ans += iCum;
		if (X == 1)
			break;
	}

	if (X>1)
		++ans;

	std::cout << ans << std::endl;
}

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

using namespace std;

using ll = long long;

const long long MOD = 1e9+7;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

class Mll
{
    public:
    ll x;

    Mll() : x(0){}
    Mll(ll x=0) : x((x%MOD+MOD)%MOD){}

    Mll operator-() const
    {
        return Mll(-x);
    }

    Mll& operator+=(const Mll& A)
    {
        if((x += A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator-=(const Mll& A)
    {
        if((x += MOD - A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator*=(const Mll& A)
    {
        (x *= A.x) %= MOD;
        return *this;
    }
    
    Mll operator+(const Mll& A)
    {
        Mll res(*this);
        return res+=A;
    }
    Mll operator-(const Mll& A)
    {
        Mll res(*this);
        return res-=A;
    }
    Mll operator*(const Mll& A)
    {
        Mll res(*this);
        return res*=A;
    }
    
    Mll pow(ll t) const // t乗
    {
        if(t==0) return 1;
        Mll A = pow(t>>1);
        A *= A;
        if(t&1) A *= *this;
        return A;
    }

    // for prime mod
    Mll inv() const
    {
        return pow(MOD-2);
    }
    Mll& operator/=(const Mll& A)
    {
        return (*this) *= A.inv();
    }
    Mll operator/(const Mll& A) const
    {
        Mll res(*this);
        return res/=A;
    }

    friend ostream& operator<<(ostream& os, const Mll& M)
    {
        os << M.x;
        return os;
    }
};

vector<Mll> ALLIN_MLL(ll N)
{
    vector<ll> numbers_ll(N);
    ALLIN1_NUMBER(numbers_ll);

    vector<Mll> numbers_Mll;
    for(ll i=0;i<N;i++)
    {
        Mll add(numbers_ll[i]);
        numbers_Mll.push_back(add);
    }

    return numbers_Mll;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

ll ceil(ll dividend, ll divisor)
{
    return (dividend + divisor - 1) / divisor;
}


ll Binary_search_log(ll l, ll r, const vector<ll>& V, const ll& K)
{
    if(r==1)
    {
        return 1;
    }
    auto counter = [l,r,V]()
    {
        ll ret = 0;
        for(auto x : V)
        {
            ret += ceil(x,(l+r)/2)-1;
        }
        return ret;
    };
    ll all = counter();

    if(l+1==r)
    {
        return r;
    }
    else if(all<=K)
    {
        return Binary_search_log(l,(l+r)/2,V,K);
    }
    else
    {
        return Binary_search_log((l+r)/2,r,V,K);
    }
}

int main()
{
    ll N,K;
    cin >> N >> K;

    vector<ll> A(N);
    ALLIN1_NUMBER(A);

    cout << Binary_search_log(0,(ll)2e14,A,K) << endl;

    return 0;
}

Measured memory_bytes: 81240
#include <cstdio>

int main()
{
	int n, a, b;
	
	scanf("%d", &n);
	
	if (n == 1)
	{
		printf("Hello World\n");
	}
	
	else
	{
		scanf("%d%d", &a, &b);
		int c = a + b;
		printf("%d\n", c);
	}
	
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  rep(i, n) {
    cin >> a[i];
    mp[a[i]]++;
  }
  ll total = 0;
  for (auto mpp : mp) {
    int cnt = mpp.second;
    if (cnt >= 2) {
      total += ((ll) cnt * (cnt - 1)) / 2;
    }
  }
  rep(i, n) {
    int k = a[i];
    ll bakValue = ((ll) mp[k] * (mp[k] - 1)) / 2;
    mp[k]--;
    ll newValue = ((ll) mp[k] * (mp[k] - 1)) / 2;

    ll res = total - bakValue + newValue;

    cout << res << endl;

    mp[k]++;
  }

  return 0;
}


Measured memory_bytes: 8320
'use strict'

function main(inp) {
  inp = inp.trim().split('\n')
  const diff = inp[0].length - inp[1].length;
  let ans = inp[1].length
  for (let i = 0; i <= diff; i++) {
    let num = 0;
    for (let j = 0; j < inp[1].length; j++) {
      if (inp[0][i+j] !== inp[1][j]) num++
    }
    ans = Math.min(ans, num)
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 32484
#include<stdio.h>
typedef long long ll;

int main(void){
        ll n;
        scanf("%lld", &n);

        ll x = 1;
        for(ll i=2; i*i<=n; i++){
                if(n%i==0) x = i;
        }
        printf("%lld\n", x+n/x-2);
        return 0;
}

Measured memory_bytes: 128
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
6.long double | 输出浮点数
7.注意特判!(prince and princess)
*/
#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 niv vector<int>
#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
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int a;
	cin>>a;
	cout<<a*a<<endl;
	return 0;
}


Measured memory_bytes: 256
eval"N,M,*A="+`dd`.split*?,;f=->i{d=k=0;A.map{|a|d-=b=(0..99).find{|j|a>>j<=i};k+=a>>b};$x=k--~i/2*d+=M;d>=0};f[(0..10**9).bsearch &f];p$x

Measured memory_bytes: 32792
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <math.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  int n;
  cin>>n;
  int m=n%10;
  if(m==0||m==1||m==6||m==8) cout<<"pon"<<endl;
  if(m==2||m==4||m==5||m==7||m==9) cout<<"hon"<<endl;
  if(m==3) cout<<"bon"<<endl;
}

Measured memory_bytes: 3668