akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <limits>
#include <queue>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

class Solution {
public:
	template<typename T>
	class segment_tree{
		int n;
		T fval;
		function<T(T,T)> operation;
		vector<T> dat;
		
		T _query(int a, int b, int k, int l, int r){
			if(r <= a || b <= l){
				return fval;
			}
			
			if(a <= l && r <= b){
				return dat[k];
			}else {
				T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2 );
				T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);
				return operation(vl, vr);
			}
		}
		
	public:
		
		segment_tree(){
			
		}
		
		segment_tree(int n_, T val, function<T(T,T)> fun){
			init(n_, val, fun);
		}
		
		~segment_tree(){
			
		}
		
		void init(int n_, T val, function<T(T,T)> fun){
			fval = val;
			
			operation = fun;
			
			n = 1;
			
			while(n < n_) n *= 2;
			
			dat.resize(2 * n - 1);
		
			for(int i = 0; i < 2 * n - 1; i++) dat[i] = fval;
		}

		void update(int k, T a){
			k += n - 1;
			dat[k] = a;
			while(k > 0){
				k = (k - 1) / 2;
				dat[k] = operation(dat[k*2 + 1],dat[k*2 + 2]);
			}
		}
		
		T query(int a, int b){
			return _query(a, b, 0, 0, n);
		}
		
	};

    string minInteger(string num, int k) {
		const int kn = 26;
        int n = num.size();
		string res;
		vector<deque<int>> ind(kn);
		segment_tree<int> seg;
		
		seg.init(n+2, 0, [](int first, int second){ return (first+second);});
		
		res.resize(n, '1');
		
		for(int i = 0; i < num.size(); i++){
			ind[num[i] - 'a'].push_back(i);
		}
		
		for(int i = 0; i < num.size(); i++){
			for(int j = 0; j < kn; j++){
				if(ind[j].size() == 0) continue;
				
				int p = ind[j].front();
				
				p += seg.query(p, n);
				
				if(p - i <= k) {
					k -= p - i;
					seg.update(ind[j].front(), 1);
					ind[j].pop_front();
					
					res[i] = 'a' + j;
					
					break;
				}
			}
		}
		
		return res;
	}
};

signed main(){
	cout<<fixed<<setprecision(10);
	
	string s;
	int k;
	Solution S;
	
	cin>>s;
	cin>>k;
	
	cout<<S.minInteger(s, k)<<endl;
	
	return 0;
}


Measured memory_bytes: 9400
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


ll askx(ll a, ll b){
    ll ans = 0;
    for (int i = 0; i < 30; i++) {
        if( b & (1<<i) ){
            if(a & (1<<i)){
            }else{
                ans |= (1<<i);
            }
        }else{
            if(a & (1<<i)){
                ans |= (1<<i);
            }else{
                
            }
        }
    }
    return ans;
}
ll n;
bool saiki(ll now,ll a,ll b, map<ll,ll> c){
    if(now == n){
        return true;
    }
    bool ok = false;
    
    ll x = askx(a,b);
    if( c[x]>0 ){
        c[x]--;
        if( saiki(now+1,b,x,c) ){
            ok = true;
        }else{
            c[x]++;
        }
    }
    return ok;
}

int main() {
    ll a[100010];
    std::cin >> n;
    
    std::map<ll, ll> cou;
    
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        cou[a[i]]++;
    }
    
    for (int i = 0; i < 30; i++) {
        ll c1,c0;
        c1 = 0;
        c0 = 0;
        for (int j = 0; j < n; j++) {
            if( a[j] & (1<<i) ){
                c1++;
            }else{
                c0++;
            }
        }
        if(c1 == 2*c0 || c0 == n){
            continue;
        }else{
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    
    for (int i = 1; i < n; i++) {
        if( cou[askx(a[0],a[i])]>0 && cou[askx(a[i],a[0])]>0 ){
            cou[a[0]]--;
            cou[a[i]]--;
            if( saiki(2,a[0],a[i],cou) ){
                std::cout << "Yes" << std::endl;
                return 0;
            }
            cou[a[0]]++;
            cou[a[i]]++;
        }
    }
    std::cout << "No" << std::endl;
}

Measured memory_bytes: 33792
// #include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <map>
#include <math.h>
#include <algorithm> // std::sort, std::min, std::next_permutation, std::lower_bound
#include <iomanip> // std::setprecision
#include <cmath> // std::ceil
#include <numeric> // std::gcd, std::lcm
#include <limits> // std::numeric_limits<long int>::max()
#include <unordered_map>
#include <map>
#include <cmath> // std::atan2

using namespace std;
typedef long long ll;
#define INF 1999999999
#define MODA 1000000007 
#define rep(i,n) for (long long i = 0; i < (n); ++i)

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N), B(N);
  rep(i, N) cin >> A[i] >> B[i];

  vector<pair<ll, ll> > works;
  rep(i, N) works.push_back(make_pair(B[i], A[i]));

  sort(works.begin(), works.end());

  map<ll, bool> days;
  rep(i, M+1) days.insert(make_pair(i, true));

  ll reward = 0;
  for(int i = N-1; i >= 0; --i) {
    // cerr << works[i].first <<" "<< works[i].second << endl;
    ll daylimit = M - works.at(i).second;
    auto iter = days.upper_bound(daylimit);
    if (iter != days.begin()) {
      iter--;
      reward += works.at(i).first;
      days.erase(iter);
    }
  }
  
  cout << reward << endl;
  return 0;
}


Measured memory_bytes: 9584
#include<cstdio>
using namespace std;
int main(){
	int a,b,x;
	while(~scanf("%d%d",&a,&b)){
	x=a+b;
	if(x/2.0>=x/2+0.5)
	printf("%d\n",x/2+1);
	else
	printf("%d\n",x/2);
}
}

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

ll dp[3000][3000];

int main(void){
    int s;
    cin >> s;
    
    ll mod = 1e9+7,ans = 0;
    dp[0][0] = 1;
    for(int i = 0;i < s/3;i++){
        for(int j = 0;j <= s;j++){
            for(int k = 3;k <= s-j;k++){
                dp[i+1][j+k] += dp[i][j];
                dp[i+1][j+k] %= mod;
            }
        }
    }
    
    for(int i = 0;i <= s;i++){
        ans += dp[i+1][s];
        ans %= mod;
    }
    cout << ans << endl;
}

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

int main() {
    int n, t; cin >> n >> t;
    vector<int> imos(t + 1);
    while (n--) {
        int l, r; cin >> l >> r;
        imos[l]++, imos[r]--;
    }
    for (int i = 0; i < t; i++) imos[i + 1] += imos[i];
    int ma = 0;
    for (int i = 0; i < t; i++) ma = max(ma, imos[i]);
    cout << ma << endl;
    return 0;
}


Measured memory_bytes: 3100
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        a: i64,
        b: i64,
        h: i64,
        w: i64,
    }

    println!("{}", a * b - h * b - a * w + h * w);
}


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

ll a,b,c,n,m;
ll ans=100000000000;
double PI=3.14159265358979323846;

string s;

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

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;

int main(void) {
	int x, a, b;
	cin >> x >> a >> b;
	if (a>=b) {
		cout << "delicious";
		return 0;
	}
	else if (b - a <= x) {
		cout << "safe";
		return 0;
	}
	else {
		cout << "dangerous";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> v1, v2;
	for (int i = 0; i < n; i++) {
		cin >> a;

		if (a >= 0) {
			v1.emplace_back(a);
		} else {
			v2.emplace_back(a);
		}
	}

	// 絶対値の小さい順
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end(), greater<int>());

	vector<int> x, y;
	int tmp = 0;
	int m;
	if (v1.empty()) {
		tmp = v2[0];
		for (int i = 1; i < v2.size(); i++) {
			x.emplace_back(tmp);
			y.emplace_back(v2[i]);
			tmp = x.back() - y.back();
		}
		m = x.back() - y.back();

	} else if (v2.empty() ){
		tmp = v1[0];
		for (int i = 1; i < v1.size() - 1; i++) {
			x.emplace_back(tmp);
			y.emplace_back(v1[i]);
			tmp = x.back() - y.back();

		}

		x.emplace_back(v1.back());
		y.emplace_back(tmp);
		m = x.back() - y.back();
	} else {

		// 負 - 正
		tmp = v2[0];
		for (int i = 1; i < v1.size(); i++) {
			x.emplace_back(tmp);
			y.emplace_back(v1[i]);
			tmp = x.back() - y.back();
		}
		v2[0] = tmp;

		// 正 - 負
		tmp = v1[0];
		for (int i = 0; i < v2.size(); i++) {
			x.emplace_back(tmp);
			y.emplace_back(v2[i]);
			tmp = x.back() - y.back();
		}
		m = x.back() - y.back();

	}


	cout << m << endl;
	for (int i = 0; i < x.size(); i++) {
		cout << x[i] << " " << y[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}


// std::vector Declaration
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// std::vector Initialization
template<typename T>
void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U>
void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

// std::vector Debug
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
   os << "[";
   bool a = 1;
   for (auto e : v ) {
      os << (a ? "" : " "); 
      os << e;
      a = 0;
   }
   os << "]";
   return os;
}

// std::pair Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
   os << "(" << p.first << " " << p.second << ")";
   return os;
}

// std::set Debug
template<typename T>
ostream& operator<<(ostream& os, const set<T>& st) {
   os << "{";
   bool a = 1;
   for (auto e : st) {
      os << (a ? "" : " ");
      os << e;
      a = 0;
   }
   os << "}";
   return os;
}

// std::map Debug
template<typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& mp) {
   os << "{";
   bool a = 1;
   for (auto e : mp) {
      os << (a ? "" : " ");
      os << e.first << ":" << e.second;
      a = 0;
   }
   os << "}";
   return os;
}

// std::tuple Debug
template<int N,class Tuple>
void out(ostream &os,const Tuple &t){}
template<int N,class Tuple,class H,class ...Ts>
void out(ostream &os,const Tuple &t){
   if(N)os<<" ";
   os<<get<N>(t);
   out<N+1,Tuple,Ts...>(os,t);
}
template<class ...Ts>
ostream& operator<<(ostream &os, const tuple<Ts...> &t){
   os<<"(";
   out<0,tuple<Ts...>,Ts...>(os,t);
   os<<")";
   return os;
}

// Debug
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

int main()
{
   int M, K; cin >> M >> K;

   if (M == 0) {
      if (K == 0) {
         cout << "0 0" << endl;
      } else {
         cout << -1 << endl;
      }
      return 0;
   }

   if (M == 1) {
      if (K == 0) {
         cout << "0 0 1 1" << endl;
      } else {
         cout << -1 << endl;
      }
      return 0;
   }

   if ((1LL<<M) <= K) {
      cout << -1 << endl;
      return 0;
   }

   for (int i = 0; i < (1LL<<M); ++i) {
      if (i == K) continue;
      printf("%d ", i);
   }
   printf("%d ", K);
   for (int i = (1LL<<M)-1; i >= 0; --i) {
      if (i == K) continue;
      printf("%d ", i);
   }
   printf("%d\n", K);

   return 0;
}


Measured memory_bytes: 1792
s = input()

L = len(s)
fl = True
for i in range(L):
    if i%2 == 0 and s[i] == "L":
        fl = False
        break
    if i%2 == 1 and s[i] == "R":
        fl = False
        break
if fl:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 2e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


#define N 100010
vii M(N, vi()); //グラフの隣接リスト表現
vi color(N, -1);

//二部グラフかどうかを判断
bool bipartite(int s) {
	stack<int> st;
	color[s] = 0;
	st.push(s);
	int i, j;
	bool flag = true;
	while (!st.empty()) {
		i = st.top();
		st.pop();
		for (j = 0; j < M[i].size(); j++) {
			if (color[M[i][j]] == color[i]) {
				//cout << "NO" << endl;
				flag = false;
			}
			else {
				if (color[M[i][j]] == -1) {
					color[M[i][j]] = 1 - color[i];
					st.push(M[i][j]);
				}
			}
		}
	}
	//cout << "YES" << endl;
	return flag;
}

int main() {
	int n, m, i, j;
	cin >> n >> m;
	vector<bool> used(n, false);
	for (i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		M[u].push_back(v);
		M[v].push_back(u);
		used[u] = used[v] = true;
	}

	ll single = 0, nibu = 0, ki = 0;
	for (i = 0; i < n; i++) {
		if (!used[i]) {
			single++;
		}
		else {
			if (color[i] == -1) {
				if (bipartite(i)) {
					nibu++;
				}
				else {
					ki++;
				}
			}
		}
	}
	ll ans = 0;
	for (i = 0; i < single; i++) {
		ans += 2 * (n - i) - 1;
	}
	ans += 2 * nibu + ki;
	ans += 2 * nibu*(nibu - 1) + 2 * nibu * ki + ki * (ki - 1);
	cout << ans << endl;

}

Measured memory_bytes: 7296
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
using namespace std;
int main(){
	int N,a,b;
	cin>>N;
	if(N==1){
		cout<<"Hello World"<<endl;
	}else if(N==2){
		cin>>a>>b;
		cout<<a+b<<endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    String pix[] = new String[H];
    for(int i = 0;i < H;i++){
      pix[i] = sc.next();
    }

    for(int k = 0;k < H;k++){
      System.out.println(pix[k]);
      System.out.println(pix[k]);
    }


  }
}


Measured memory_bytes: 24340
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

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

using namespace std;

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

    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> X(N);
    Rep (i, N) {
        cin >> X.at(i);
    }

    ll ans = 0;
    Rep (i, N - 1) {
        ll dist = X[i+1] - X[i];
        ans += min (dist * A, B);
    }

    cout << ans << "\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main() {
	long long h, n;
	cin >> h >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];
	long long ans = 0;
	for (int _a : a) {
		ans += _a;
	}
	if (ans >= h)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
using namespace std;
int dp[101][10001];
int main(void){
	int n;
	int box[100];
	int i,j;
	int MAX,sum;
	scanf("%d",&n);
	sum=0;
	for(i=0;i<n;i++){
		scanf("%d",&box[i]);
		sum+=box[i];
	}
	for(i=0;i<=n;i++){
		for(j=0;j<=10000;j++){
			dp[i][j]=0;
		}
	}
	dp[0][0]=1;
	for(i=0;i<n;i++){
		for(j=0;j<=sum;j++){
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			if(dp[i][j]==1){
				dp[i+1][j+box[i]]=1;
			}
		}
	}
	// for(i=0;i<=n;i++){
		// for(j=0;j<=sum;j++){
			// printf("%d ",dp[i][j]);
		// }
		// printf("\n");
	// }
	MAX=0;
	for(i=0;i<=sum;i++){
		if(dp[n][i]==1){
			if(i%10!=0){
				MAX=max(MAX,i);
			}
		}
	}
	printf("%d\n",MAX);
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

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

    if(a <= 0 && 0 <= b){
        cout << "Zero" << endl;
    }else if(a > 0 && b > 0){
        cout << "Positive" << endl;
    }else{
        if(abs((long)b-a) % 2 == 1){
            cout << "Positive" << endl;
        }else{
            cout << "Negative" << endl;
        }
    }

    return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int main() {
  int n;

  while(cin >> n, n) {
    VI a(n);
    REP(i, n) cin >> a[i];

    int ans = -1000000;
    REP(i, n) {
      int sum = 0;
      FOR(j, i, n) {
	sum += a[j];
	ans = max(sum, ans);
      }
    }

    cout << ans << endl;
  }
}

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

int main(void){
    int n;
    cin >> n;
    int t[100100],x[100100],y[100100];
    t[0] = x[0] = y[0] = 0;
    for(int i = 0;i < n;i++)cin >> t[i+1] >> x[i+1] >> y[i+1];
    
    bool check = true;
    
    for(int i = 0;i < n;i++){
        int dt,dist;
        dt = t[i+1] - t[i];
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if(dt < dist || dist % 2 != dt % 2)check = false;
    }
    if(check)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)   make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

int gcd(int a,int b){return b ? gcd(b,a%b) : a;} 
int lcm(int a,int b){return a/gcd(a,b)*b;}

signed main(){
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s << '\n';
    else cout << "red\n";
    return 0;
}


Measured memory_bytes: 256
#B - Bingo
A =[list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for j in range(N)]
A_n = [[0 for a in range(3)] for c in range(3)]

for k in range(3):
    for l in range(3):
        for m in range(N):
            if A[k][l] == b[m]:
                A_n[k][l] = 1
            else:
                pass

if A_n[0][0]+A_n[0][1]+A_n[0][2]==3 or A_n[1][0]+A_n[1][1]+A_n[1][2] == 3 or A_n[2][0]+A_n[2][1]+A_n[2][2] == 3:
    print("Yes")
elif A_n[0][0]+A_n[1][0]+A_n[2][0]==3 or A_n[0][1]+A_n[1][1]+A_n[2][1] == 3 or A_n[0][2]+A_n[1][2]+A_n[2][2] == 3:
    print("Yes")
elif A_n[0][0]+A_n[1][1]+A_n[2][2]==3 or A_n[0][2]+A_n[1][1]+A_n[2][0]==3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
n = [int(e) for e in input().split(" ")]
d = []
c = 0
for e in input().split(" "):
    d.append([(int(e)), []])
for _ in range(n[1]):
    x = [int(e) - 1 for e in input().split(" ")]
    d[x[0]][1].append(d[x[1]][0])
    d[x[1]][1].append(d[x[0]][0])
for e_d in d:
    try:
        m = max(e_d[1])
    except:
        m = -1
    if(m < e_d[0]):
        c += 1
print(c)

Measured memory_bytes: 34380
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int A,B; cin>>A>>B;
    string s; cin>>s;

    bool ok=true;
    REP(i,s.size()){
        if(i==A){
            if(s[i]!='-') ok=false;
        }
        else{
            if(!isdigit(s[i])) ok=false;
        }
    }
    cout<<(ok? "Yes":"No")<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

typedef long long ll;

int main(){
  int n; cin >> n;

  ll a[n], b[n];
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<n; i++) cin >> b[i];

  ll ans=0;

  //各ビットについて調査
  for(ll bit=0; bit<30; bit++){
    ll cnt=0;
    ll t = 1ll << bit;

    //tmpa, tmpbを用意
    int tmpa[n], tmpb[n];
    for(int i=0; i<n; i++){
      tmpa[i] = a[i] % (2*t);
      tmpb[i] = b[i] % (2*t);
    }

    sort(tmpb, tmpb+n);

    //a_jを固定して考える
    for(int j=0; j<n; j++){
      cnt += lower_bound(tmpb, tmpb+n, 4*t-tmpa[j])-lower_bound(tmpb, tmpb+n, 3*t-tmpa[j]);
      cnt += lower_bound(tmpb, tmpb+n, 2*t-tmpa[j])-lower_bound(tmpb, tmpb+n, t-tmpa[j]);
    }
    ans += (cnt%2)*t;
  }

  cout << ans << endl;

  return 0;
}


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

int main()
{
    int c[3][3];
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            cin >> c[i][j];
        }
    }
    string ans = "No";
    if (c[0][0] - c[0][1] == c[1][0] - c[1][1] && c[0][0] - c[0][2] == c[1][0] - c[1][2] && c[0][0] - c[0][1] == c[2][0] - c[2][1] && c[0][0] - c[0][2] == c[2][0] - c[2][2])
    {
        if (c[0][0] - c[1][0] == c[0][1] - c[1][1] && c[0][0] - c[2][0] == c[0][1] - c[2][1] && c[0][0] - c[1][0] == c[0][2] - c[1][2] && c[0][0] - c[2][0] == c[0][2] - c[2][2])
        {
            ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
// C++ implementation of the approach 
#include <bits/stdc++.h> 
using namespace std; 

#define V_SUM_MAX 100005
#define N_MAX 105
#define W_MAX 1000000005
#define MAXN 105

// To store the states of DP 
int dp[V_SUM_MAX + 1][N_MAX]; 
bool v[V_SUM_MAX + 1][N_MAX]; 

// Function to solve the recurrence relation 
int solveDp(int r, int i, int* w, int* val, int n) 
{ 
	// Base cases 
	if (r <= 0) 
		return 0; 
	if (i == n) 
		return W_MAX; 
	if (v[r][i]) 
		return dp[r][i]; 

	// Marking state as solved 
	v[r][i] = 1; 

	// Recurrence relation 
	dp[r][i] 
		= min(solveDp(r, i + 1, w, val, n), 
			w[i] + solveDp(r - val[i], 
							i + 1, w, val, n)); 
	return dp[r][i]; 
} 

// Function to return the maximum weight 
int maxWeight(int* w, int* val, int n, int c) 
{ 

	// Iterating through all possible values 
	// to find the the largest value that can 
	// be represented by the given weights 
	for (int i = V_SUM_MAX; i >= 0; i--) { 
		if (solveDp(i, 0, w, val, n) <= c) { 
			return i; 
		} 
	} 
	return 0; 
} 

// Driver code 
int main() 
{ 
    int n,C;
    cin >> n >> C;
    int w[MAXN];
    int val[MAXN];

    for(int i=0; i<n; i++)
        cin >> w[i] >> val[i];
	cout << maxWeight(w, val, n, C); 

	return 0;
} 


Measured memory_bytes: 51584
#include <vector>
#include <string>
#include <iostream>
#include <stdlib.h> // @atoi
#include <algorithm>
using namespace std;


int main(void)
{
	struct rideInfo
	{
	public:
		long int humanNum;

		long int rideMax;
		rideInfo()
		{
			humanNum = 0;
			rideMax = 0;
		}
	};

	long int totalHuman = 0;
	std::vector<rideInfo> v_ride;


	cin >> totalHuman;
	for (int i = 0; i < 5; ++i)
	{
		rideInfo tmp;
		cin >> tmp.rideMax;
		v_ride.push_back(tmp);
	}

	rideInfo tmp;
	tmp.humanNum = 0;
	tmp.rideMax = 999;
	v_ride.push_back(tmp);

	v_ride.at(0).humanNum = totalHuman;

	long int waitTime = 0;

	long int minTime = min({ v_ride.at(0).rideMax, v_ride.at(1).rideMax,v_ride.at(2).rideMax,v_ride.at(3).rideMax,v_ride.at(4).rideMax });
	waitTime = ((totalHuman + minTime-1) / minTime) + 4;
	cout << waitTime << endl;
	return 0;
}

Measured memory_bytes: 256
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.ST                 as ST
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.Foldable                  ( toList )
import           Data.Int
import qualified Data.IntMap                   as IM
import           Data.List
import qualified Data.Map                      as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                      as S
import qualified Data.Sequence                 as SQ
import           Data.Time
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
readInts n = replicateM n readInt
readString = map BS.unpack . BS.words <$> BS.getLine
readStrings n = replicateM n readString
toPair [x, y] = (x, y)

main = do
  [a, b, m] <- readInt
  as        <- readInt
  bs        <- readInt
  ms        <- readInts m
  print $ solve as bs ms

solve as bs ms = min minMs (minimum as + minimum bs)
 where
  asv   = VU.fromList as
  bsv   = VU.fromList bs
  minMs = minimum $ map (\m -> f m asv bsv) ms
  f [x, y, c] asv bsv = asv VU.! (x - 1) + bsv VU.! (y - 1) - c


Measured memory_bytes: 49276
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll len = S.size();
    ll white = 0;
    REP(i, 0, len) {
        if (S[i] == '.') {
            white++;
        }
    }
    ll black = len - white;
    ll tmp = 0;
    ll ans = white;
    REP(i, 0, len) {
        if (S[i] == '.') {
            tmp++;
        }
        ans = min(ans, (i + 1) - tmp + (white - tmp));
    }
    cout << ans << endl;
}


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

int prime(int x);

int main() {
    int n; //how many numbers
    int x;
    int cou = 0;
    
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> x; //stop endl
        cou += prime(x);
    } 
    cout << cou << endl;
    
    return 0;
}

int prime(int x) {
  int c = 0;
  
  if (x <= 1) return c;
  else if (x == 2) return ++c; //c++ だとreturnして++
  else {
      for ( int i = 2; i <= sqrt(x); i++ ) {
          if (x % i == 0) return c;
      }
      return ++c;
  }
}


Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
 
int main(){
 
    int n,a,b,cnt=0;
    cin >> n;
  	cin >> a;
    cin >> b;
 
    for(int i=1;i<=n;++i){
        int wa = i/10000 + (i/1000)%10 + (i/100)%10 + (i/10)%10 + i%10;
        if(a <= wa && wa <= b) cnt+=i ;
    }
 
    cout << cnt;
    return 0;
}

Measured memory_bytes: 256
x_y = input()
x_y_list = x_y.split()
x = int(x_y_list[0])
y = int(x_y_list[1])
max_y = x * 4
min_y = x * 2
if y % 2 != 0:
  print("No")
elif y > max_y:
  print("No")
elif y < min_y:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 9184
///who is the king ??? *** << t.mohammad >> *** ///
/*
                  00                                                                                                            00
                 00                               00                                                                           00
            0000000000                           00                                                                           00
           0000000000   000       000           00                        000       000  000       000                       00
              00       0000     0000           00         000000         0000     0000  0000     0000   000000              00
             00       00 00   00 00    000    00        00000000        00 00   00 00  00 00   00 00  00000000       00000000
            00       00  00 00  00   00000   000000    00    000       00  00 00  00  00  00 00  00  00    000     0000000000
           00       00   000   00  00   00  00000000  00    0000      00   000   00  00   000   00  00    0000    00     0000
          00       00         00  00   00  00    00  00    00 00     00         00  00         00  00    00 00   00     00 00
         00  00   00         00   00000   00    00  00000000  00    00         00  00         00  00000000  00  000000000  00
        00  00   00         00    000    00    00   000000    00   00         00  00         00   000000    00  0000000    00
*/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std ;
#define int long long int
typedef long double ld ;
#define ff first
#define ss second
#define setp(t) cout << setprecision(t) << fixed ;
const int N = 3e3 + 100 ;
int dp[N][N] ;
int32_t main() {
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;
	string a , b ;
	cin >> a >> b ;
	int n = a.size() , m = b.size() ;
	for (int i = 1 ; i <= a.size() ; i++) {
		for (int j = 1 ; j <= b.size() ; j++) {
			if (a[i - 1] == b[j - 1])
				dp[i][j] = dp[i - 1][j - 1] + 1 ;
			else
				dp[i][j] = max(dp[i - 1][j] , dp[i][j - 1]) ;
		}
	}
	string fin = "" ;
	int k = dp[a.size()][b.size()] , i =  a.size() , j = b.size() ;
	while (k) {
		if (a[i - 1] == b[j - 1]) {
			fin += a[i - 1] ;
			i-- , j-- ;
			k = dp[i][j] ;
		}
		else {
			if (dp[i - 1][j] > dp[i][j - 1])
				i-- , k = dp[i][j] ;
			else if (dp[i - 1][j] < dp[i][j - 1])
				j-- , k = dp[i][j] ;
			else
				i-- , k = dp[i][j] ;
		}
	}
	reverse (fin.begin() , fin.end()) ;
	cout<< fin ;
}


Measured memory_bytes: 73984
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int dp[110][10110];

int main () {
  int n;
  cin >> n;
  vi s(n);
  rep(i,n) cin >> s[i];
  
  dp[0][0] = 1;
  rep(i,n) {
    rep(j,10001) {
      if (dp[i][j] != 1) continue;
      dp[i+1][j] = dp[i][j];
      dp[i+1][j+s[i]] = dp[i][j];
    }
  }

  int ans = 0;
  rep(i,10001) {
    if (dp[n][i] && i%10 != 0) {
      chmax(ans,i);
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    if(s[s.size()-1]=='s'){
        s.push_back('e');
        s.push_back('s');
    }
    else
        s.push_back('s');
    cout<<s;
    return 0;
}


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

string Str;
std::string ans = "Yes";

int main() {
  cin >> Str;
  if ((int)Str.length() % 2 == 0) {
    for (size_t i = 0; i < (int)Str.length() / 2; i++) {
      if (Str.at(2 * i) != 'h' || Str.at(2 * i + 1) != 'i') {
        ans = "No";
        break;
      }
    }
  }else{
    ans = "No";
  }
  cout << ans;
  return 0;
}


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

using namespace std;

int main()
{
	int N, G, A, B;

	while (true)
	{
		cin >> N;

		if (N == 0) { break; }

		vector<vector<int> > dp(N + 1, vector<int>(1001, 0));

		dp[0][0] = 1;

		for (int i = 1; i <= N; i++)
		{
			cin >> A >> B;

			for (int j = 0; j <= 1000; j++)
			{
				for (int k = 0; k <= A * B; k += A)
				{
					if (j - k >= 0)
					{
 						dp[i][j] += dp[i - 1][j - k];
					}
				}
			}
		}

		cin >> G;

		for (int i = 0; i < G; i++)
		{
			cin >> A;

			cout << dp[N][A] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3080
import java.util.*;
public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    if(s.charAt(2)==s.charAt(3)&&s.charAt(4)==s.charAt(5))
    {
      System.out.println("Yes");
    }
    else
    {
            System.out.println("No");

    }
  }
}


Measured memory_bytes: 23764
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
inline int in(){ int x; scanf("%d",&x); return x;}

//---------- union find ----------- begin
namespace UF {
#define MAX_N  10000
  int par[MAX_N], rank[MAX_N];

  void init(int n){
    int i;
    rep(i,n){ par[i] = i; rank[i] = 0;}
  }

  int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rank[x] < rank[y]) par[x] = y;
    else {
      par[y] = x;
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(int x, int y){ return (find(x) == find(y));}
}
//---------- union find ---------- end

struct Edge {
  int from, to, cost;
/*
  Edge(int from_, int to_, int cost_){
    from = from_;
    to = to_;
    cost = cost_;
  }
*/
  bool operator < (const Edge& a) const {
    return cost < a.cost;
  }
};

int n,m;
vector<Edge> edges;

int main(){
  int i,j,k;

  while(scanf("%d",&n)){
    if(n == 0) break;

    m = in();
    edges.resize(m);
    rep(i,m) scanf("%d,%d,%d",&edges[i].from,&edges[i].to,&edges[i].cost);

    //---------- kuruskal ---------- begin
    int ans = 0;
    sort(edges.begin(),edges.end());
    UF::init(n);
    rep(i,m){
      if(UF::same(edges[i].from, edges[i].to)) continue;
      ans += (edges[i].cost / 100) - 1;
      UF::unite(edges[i].from, edges[i].to);
    }

    printf("%d\n",ans);
    //---------- kurusukal ---------- end
  }

  return 0;
}

Measured memory_bytes: 0
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 0), 1000000001*3)
	sc.Split(bufio.ScanWords)
	a, b, x := nextInt(), nextInt(), nextInt()
	v0 := a * a * b
	v1 := v0 - x
	switch {
	case v1 <= x:
		fmt.Println(math.Atan((float64(v1)*2.0)/float64(a*a*a)) * (180.0 / math.Pi))
	case v1 > x:
		fmt.Println(90.0 - (math.Atan((float64(x)*2.0)/float64(a*b*b)) * (180.0 / math.Pi)))
	}
}


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

int main(void) {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = h1 * 60 + m1;
    int t2 = h2 * 60 + m2;
    int ans = t2 - k - t1;
    if (ans < 0) {
        cout << 0 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


int main() {
	int n;
	int a[100];
	int cnt = 0;
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	int last = n;
	for(int i=0; i<last; i++) {
		for(int j=n-1; j>i; j--) {
			if(a[j] < a[j-1]) {
				int tmp = a[j];
				a[j] = a[j-1];
				a[j-1] = tmp;
				cnt++;
			}
		}
	}
	cout << a[0];
	for(int i=1; i<n; i++) {
		cout << " " << a[i];
	}
	cout << endl;
	cout << cnt << endl;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail
{
  template <typename T, std::size_t NDIMS>
  struct vector_builder
  {
    using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

    static type make(std::vector<std::size_t> dims, const T &v = {})
    {
      const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
      if (!dims.empty())
        dims.pop_back();
      return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
    }
  };

  template <typename T>
  struct vector_builder<T, 1>
  {
    using type = std::vector<T>;

    static type make(std::vector<std::size_t> dims, const T &v = {})
    {
      return type(dims.empty() ? 0 : dims.back(), v);
    }
  };
} // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T &v, SIZE_T... dims)
{
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

bool is_kaibun(string s)
{
  int n = s.size();
  for (int i = 0; i < n / 2; i++)
  {
    if (s[i] != s[n - 1 - i])
      return false;
  }
  return true;
}

void solve(std::string S)
{
  int N = S.size();
  if (is_kaibun(S) && is_kaibun(S.substr(0, (N - 1) / 2)) &&
      is_kaibun(S.substr((N + 1) / 2, (N - 1) / 2)))
  {
    cout << YES << endl;
  }
  else
    cout << NO << endl;
}

int main()
{
  cout << setprecision(10);
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  int res = 0;
  for (int i = 0; i < N; ++i) cin >> H[i];
  int max_H = H[0];
  for (int i = 0; i < N; ++i) {
    if (max_H <= H[i]) {
      res++;
      max_H = H[i];
    }
  }
  cout << res << endl;
}

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

template<class T> struct FenwickTree {
    using F = function<T(T, T)>;
private :
    T id;
    const F &f;
    vector<T> node;
public : 
    FenwickTree (int n, const F &f, const T &id) : 
        node(n+1, id), id(id), f(f) { }

    void resize (int n) {
        node.assign(n+1, id);
    }

    T fold (int i) {
        T ret = id;
        for (++i; i > 0; i -= (i & -i)) {
            ret = f(ret, node[i]);
        }
        return ret;
    }

    void add (int i, const T &x) {
        for (++i; i < node.size(); i += (i & -i)) {
            node[i] = f(node[i], x);
        }
    }

};

int main() {
    int n, q, query;
    cin >> n >> q;
    auto f = [](int a, int b) -> int { return a + b; };
    FenwickTree<int> node(n, f, 0);
    
    while (q--) {
        cin >> query;
        if (query == 0) {
            int i, x;
            cin >> i >> x;
            node.add(--i, x);
        }
        if (query == 1) {
            int l, r;
            cin >> l >> r;
            --l; --r;
            int ans = node.fold(r) - node.fold(l-1);
            cout << ans << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 3136
#include<stdio.h>
int main(void){
        int a,b,c;
	scanf("%d %d %d\n",&a,&b,&c);
	if(a<b && a<c){
         if(b<c){
        	 printf("%d %d %d\n",a,b,c);
         }
         else{
          printf("%d %d %d\n",a,c,b);
         }
        }
	else if(b<a && b<c){
         if(a<c){
        	 printf("%d %d %d\n",b,a,c);
         }
         else{
          printf("%d %d %d\n",b,c,a);
         }
        }
	else{
         if(a<b){
        	 printf("%d %d %d\n",c,a,b);
         }
         else{
          printf("%d %d %d\n",c,b,a);
         }
        }
	
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
  Scanner scan = new Scanner(System.in);
  String str = scan.nextLine();
  String[] strs = str.split(" ");
  int D = Integer.parseInt(strs[1]);
  int count = 0;
    while (scan.hasNext()){
      str = scan.nextLine();
      strs = str.split(" ");
      int x = Integer.parseInt(strs[0]);
      int y = Integer.parseInt(strs[1]);
      double distance = Math.sqrt(Math.pow(x, 2)+Math.pow(y, 2));
      if(distance<=D) count++;
    }

    System.out.println(count);
}
}


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

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

using namespace std;
using lint=long long;

int main(){
	lint a,b1,b2; scanf("%lld%lld.%lld",&a,&b1,&b2);
	lint b=100*b1+b2;
	printf("%lld\n",a*b/100);
	return 0;
}


Measured memory_bytes: 3868
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) { os << p.first << " " << p.second; return os; }

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; }return false; }
template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>v(N); rep(i, 0, N) { cin >> v[i]; }
	int ans = 0;
	int h = 0;
	rep(i, 0, N) {
		if (h <= v[i])ans++;
		chmax(h, v[i]);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin>>n;
    int p[n];
    rep(i,0,n-1) cin>>p[i];
    int cnt=0;
    rep(i,0,n-1){
        if(p[i]!=i+1) cnt++;
    }
    if(cnt<=2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 888