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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(0);
	string s;

	cin >> s;
	auto ans = s.substr(0, s.length()-8);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; ++i) {
			A[i] = sc.nextInt();
		}
		int res = N - 1;
		int ans = 0;
		while (res > 0) {
			res -= K - 1;
			++ans;
		}
		System.out.println(ans);
		
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 52476
#include<bits/stdc++.h>
using namespace std;
int main(){
  cout << setprecision(10);
  int N;
  cin >> N;
  vector<int> H(N);
  for(auto &hi: H) cin >> hi;
  int ret = 0;
  int c = 0;
  for(int i=N-1; i>0; i--){
    if(H[i-1]>=H[i]){
      c++;
      ret = max(ret, c);
    }else{
      c=0;
    }
  }
  cout << ret << endl;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    ll ans = (N - 1) * N / 2;

    cout << ans << endl;
}


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

int main(){
    int a,b;
    cin>>a>>b;
    int n,m;
    n=a/0.08;
    m=(b+1)/0.08;
    bool flg=false;
    for (int i = n; i <= m; i++)
    {
        int x=0,y=0;
        x=i*0.08;
        y=i*0.1;
        if(x==a&&y==b){cout<<i;flg=true;break;}
    }
    if(flg==false){cout<<-1;}
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] C1 = sc.nextLine().toCharArray();
		char[] C2 = sc.nextLine().toCharArray();
		sc.close();
		boolean isTarget = true;
		for (int i = 0; i < C1.length; i++) {
			if (C1[i] != C2[C2.length - 1 - i]) {
				isTarget = false;
				break;
			}
		}
		if (isTarget) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

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

using namespace std;


#define PI 3.14159265
#define int long long



main(){


	int n; cin >> n;

	vector <int> a(n), b(n);

	vector < pair <int, int> > v(n);

	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		v[i].first = b[i];
		v[i].second = a[i];
	}


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


	int current = 0;
	for(int i = 0; i < n; i++){
		current += v[i].second;
		if(current > v[i].first){
			cout << "No" << endl; return 0;
		}
	}


	cout << "Yes" << endl;



	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    vector<int> vec;
    if(s.size()<t.size()){
        cout<<"UNRESTORABLE"<<endl;
    }else{
        for(int i=0;i<s.size();i++){
            bool h = true;
            for(int j=i;j<i+t.size();j++){
                if(s[j]!='?'&&s[j]!=t[j-i]){
                    h = false;
                }
            }
            if(h){
                vec.push_back(i);
            }
        }
        if(vec.empty()){
            cout<<"UNRESTORABLE"<<endl;
        }else{
        int reg = vec[vec.size()-1];
        for(int i=0;i<s.size();i++){
            if(i==reg){
                for(int j=0;j<t.size();j++){
                    cout<<t[j];
                }
                i += t.size()-1;
            }else{
                if(s[i]=='?'){
                    cout<<'a';
                }else{
                    cout<<s[i];
                }
            }
        }
        cout<<endl;
        }
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
using namespace std;

inline char in() {
	static char buf[1000001],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
template <class Tp> inline void read(register Tp &s) {
	s=0;
	register Tp f=1;
	register char c=in();
	while(!isdigit(c)) {if(c=='-')f=-1;c=in();}
	while(isdigit(c))  s=(s<<1)+(s<<3)+c-48,c=in();
	s*=f;
}
inline void print(int x) {
	if(x<0)  putchar('-'),x=-x;
	if(x>9)  print(x/10);
	putchar(x%10+48);
}

const int N=1e5;
int n,tot,p[100005],f[100005];
bool np[100005];

int main() {
	for(int i=4;i<=N;i+=2)  np[i]=1;
	p[1]=2;  tot=1;  np[0]=np[1]=1;
	for(int i=3;i<=N;i+=2) {
		if(!np[i])  p[++tot]=i;
		for(int j=1;j<=tot&&p[j]*i<=N;++j) {
			np[p[j]*i]=1;
			if(!i%p[j])  break;
		}
	}
	for(int i=3;i<=N;++i) {
		if(!np[i]&&!np[(i+1)>>1])  f[i]=f[i-1]+1;
		else  f[i]=f[i-1];
	}
	int Q;  read(Q);
	while(Q--) {
		int l,r;
		read(l);  read(r);
		print(f[r]-f[l-1]);
		puts("");
	}
	return 0;
}

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

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

using namespace std;

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

set<int> g[100010];
ll mx;
int c[100010];

ll dfs(int cur,int par){
  vll v(2,0);
  for(auto chi:g[cur]){
    if(chi==par)continue;
    v.push_back(dfs(chi,cur));
  }
  sort(v.begin(),v.end(),greater<int>());
  mx = max(mx,c[cur]+v[0]+v[1]);
  return c[cur]+v[0];
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  repeat(i,N-1){
    int x,y;cin>>x>>y;x--;y--;
    g[x].insert(y);
    g[y].insert(x);
  }
  int cnt=0;
  string s;cin>>s;
  repeat(i,N){
    c[i]=s[i]=='B';
    cnt+=!c[i];
  }
  if(cnt<=1){
    cout << cnt << endl;
    return 0;
  }
  queue<int> Q;
  repeat(i,N){
    if(g[i].size()==1&&c[i])Q.push(i);
  }
  while(!Q.empty()){
    int u=Q.front();
    Q.pop();
    int v=*g[u].begin();
    g[v].erase(u);
    c[u]=-1;
    if(g[v].size()==1&&c[v])Q.push(v);
  }
  ll cost=-2;
  int root;
  repeat(i,N){
    if(c[i]<0)continue;
    c[i]=(!c[i]^(g[i].size()&1));
    cost += 2+c[i];
    root = i;
  }
  dfs(root,-1);
  cout << cost-2*mx << endl;
  return 0;
}


Measured memory_bytes: 28108
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
#include<utility>
#include<queue>
#include <map>

using namespace std;



int main(){

	string s;
	cin>>s;
	int k = s.size();
	for(int i=0;i<k;i++)cout<<"x";


	cout<<endl;

	return 0;
}


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


int main(){
    long long n, m;
    cin >> n >> m;

    vector<pair<long long, long long> > v;

    for(long long i = 0; i < n; i++){
        long long a, b;
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }

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

    long long sum = 0;
    long long cost = 0;
    long long i = 0;
    while(1){
        if(sum + v[i].second < m){
            sum += v[i].second;
            cost += v[i].first*v[i].second;
            i++;
        }
        else if(sum + v[i].second >= m){
            cost += (m - sum)*v[i].first;
            sum = m;
            break;
        }
    }

    cout << cost << endl;

    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < S.size() - 1; i++) {
    if (S[i] != S[i + 1]) cnt++;
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i,n)  for(int i = 0; i < (int)(n);    i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

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

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N, M; std::cin >> N >> M;
  std::vector<ll> H(N); rep(i,N) std::cin >> H[i];

  std::vector<bool> G(N, true);
  rep(i,M) {
    int a, b; std::cin >> a >> b; a--, b--;
    if ( H[a] > H[b] ) G[b] = false;
    if ( H[a] < H[b] ) G[a] = false;
    if ( H[a] == H[b] ) G[a] = false, G[b] = false;
  }

  ll ans = 0;
  rep(i,N) if(G[i]) {
    ans++;
  }
  std::cout << ans << std::endl;


  return 0;
}



Measured memory_bytes: 3976
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

int main(){
    ll a,b;
    cin >> a >> b;
    if(a <= 8 && b <= 8){
        cout << "Yay!" << endl;
    }
    else cout << ":(" << endl;
}

Measured memory_bytes: 256
<?php
  fscanf(STDIN, "%d %d", $n, $k);
  $ans = 0.0;

  for ($i=1; $i<=$n; $i++) {
    $sum = $i;
    $tmp = $n;
    
    while ($sum <= $k-1) {
      $sum *= 2.0;
      $tmp *= 2.0;
    }
    $ans += (1.0 / $tmp);
  }

  printf("%.14f\n", $ans);
?>

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

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

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  int A,B;
  cin >> A >> B;
  bool flag = false;
  int ans = 0;
  for(int x = 1;x<=2000;x++){
    if((int)(x*0.08) == A && (int)(x*0.1) == B){
      flag = true;
      ans = x;
      break;
    }
  }
  //cout << (int)(1*0.08) << endl;;
  if(flag) cout << ans << endl;
  else cout << -1 << endl;
 }

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

using namespace std;
using namespace atcoder;

void solve(int N, int M, vector<int> A, vector<int> B) {
    dsu d(N);
    for (int i = 0; i < M; i++) {
        d.merge(A.at(i), B.at(i));
    }
    cout << d.groups().size() - 1 << endl;
}

int main() {
    int N;
    cin >> N;
    int M;
    cin >> M;
    vector<int> A(M);
    vector<int> B(M);
    for (int i = 0; i < M; i++) {
        cin >> A.at(i);
        cin >> B.at(i);
        A.at(i)--;
        B.at(i)--;
    }
    solve(N, M, move(A), move(B));
    return 0;
}


Measured memory_bytes: 9104
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n; cin >> n;
  string s; cin >> s;
  vector<vector<ll>> cnt(9, vector<ll>(9, 0));
  rep(i, n-1) {
    cnt[s[i]-'1'][s[i+1]-'1']++;
  }
  vector<ll> ord(9);
  rep(i, 9) ord[i] = i;
  ll ans = linf;
  vector<ll> ansord;
  do {
    vector<ll> X(9), Y(9);
    ll k = 0;
    rep(y, 3) rep(x, 3) {
      X[ord[k]] = x;
      Y[ord[k]] = y;
      ++k;
    }
    ll cost = 0;
    rep(i, 9) rep(j, 9) {
      cost += cnt[i][j] * (abs(X[i] - X[j]) + abs(Y[i] - Y[j]));
    }
    if (cost < ans || (cost == ans && ord < ansord)) {
      ans = cost;
      ansord = ord;
    }
  } while (next_permutation(all(ord)));
  ll k = 0;
  rep(y, 3) {
    rep(x, 3) {
      cout << ansord[k]+1;
      ++k;
    }
    cout << endl;
  }
}



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

template<class T>
struct SegTree {
    int NN;
    T default_value;
    vector<T> data;

    T func(int a, int b) {
        return max(a, b);
    }

    SegTree(int N, T val) {
        default_value = val;
        NN = 1; while (NN < N) NN <<= 1;
        data = vector<T>(2 * NN, val);
    }

    SegTree(const vector<T> v, T val) {
        default_value = val;
        int N = v.size();
        NN = 1; while (NN < N) NN <<= 1;
        data = vector<T>(2 * NN, val);
        copy(v.begin(), v.end(), data.begin() + (NN - 1));
        build(0, 0, NN);
    }

    void build(int u, int l, int r) {
        if (r - l == 1) return;
        int m = (l + r) / 2;
        build(u * 2 + 1, l, m);
        build(u * 2 + 2, m, r);
        data[u] = func(data[2 * u + 1], data[2 * u + 2]);
    }

    T query(int a, int b, int u, int l, int r) {
        if (l >= b || r <= a)
            return default_value;
        if (l >= a && r <= b)
            return data[u];
        int m = (l + r) / 2;
        T res1 = query(a, b, u * 2 + 1, l, m);
        T res2 = query(a, b, u * 2 + 2, m, r);
        return func(res1, res2);
    }

    void update_value(int idx, T x, int u, int l, int r) {
        if (idx < l || idx >= r)
            return;
        if (idx == l && r - l == 1) {
            data[u] = x;
            return;
        }
        int m = (l + r) / 2;
        update_value(idx, x, u * 2 + 1, l, m);
        update_value(idx, x, u * 2 + 2, m, r);
        data[u] = func(data[2 * u + 1], data[2 * u + 2]);
    }

    void update_delta(int idx, T x, int u, int l, int r) {
        update_value(idx, data[NN - 1 + idx] + x, u, l, r);
    }
};

int solve() {
    int H, W, M;
    cin >> H >> W >> M;

    auto cntR = vector<int>(H, 0);
    auto cntC = vector<int>(W, 0);
    auto t = vector<vector<int>>(H, vector<int>());
    for (int i = 0; i < M; i++) {
        int r, c; 
        cin >> r >> c;
        r--; c--;
        cntR[r]++;
        cntC[c]++;
        t[r].push_back(c);
    }

    auto seg = SegTree<int>(cntC, 0);
    int ans = -1;
    for (int r = 0; r < H; r++) {
        for (auto c : t[r]) {
            seg.update_delta(c, -1, 0, 0, seg.NN);
        }
        int val = cntR[r] + seg.query(0, W, 0, 0, seg.NN);
        ans = max(ans, val);
        for (auto c : t[r]) {
            seg.update_delta(c, +1, 0, 0, seg.NN);
        }
    }
    return ans;
}

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

    cout << solve() << endl;

    return 0;
}

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

int main() {
  long long a, b, x;
  cin >> a >> b >> x;
  
  long long count;
  if(a%x == 0){
    count = b/x - a/x + 1;
  }else{
    count = b/x - a/x;
  }
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())#list(map(int, input()))
l = list(map(int, input().split()))
c = 0 
# print(len(list(filter(lambda x: x % 2 == 0, l))))
# print(N)

while len(list(filter(lambda x: x % 2 == 0, l))) == N:
    l = list(map(lambda x: x / 2 ,l))
    #print(l)
    #print(list(filter(lambda x: x % 2 == 0, l)))
    c += 1

print(c)

Measured memory_bytes: 2940
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

fn main() {
    let n : usize = read();
    println!("{}", n / 2 + n % 2);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
	double n,t,a,h;
	cin>>n>>t>>a;
	vector<double> vec(n);
	for(int i=0;i<n;i++){cin>>h;vec[i]=abs(a-(t-h*0.006));}
	vector<int> index(vec.size());
        iota(index.begin(), index.end(), 0);
    //    for(int i=0;i<n;i++)cout<<a-t-h*0.006<<endl;
	std::sort(
		index.begin(),
		index.end(),
		[&](int x, int y){return vec[x] < vec[y];}
	 );
	cout<<index[0]+1<<endl;
	return 0;}


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

int count( int n )
{
    int ans =0;
    while( n%2==0)
    {
        ans++;
        n = n/2;
    }
    return ans;
}
int main()
{
    int n ;
    cin>>n;
    int ans = INT_MIN;
    int val =0;
    for(int i=1;i<=n;i++)
    {
        int temp =  count(i);
        if( temp > ans )
        {
            val = i;
            ans =  temp;
        }
    }
    cout<<val;
}

Measured memory_bytes: 3644
n,m = gets.split.map &:to_i
a = n.times.map{gets.chomp}
b = m.times.map{gets.chomp}

(n-m+1).times{|i|
  (n-m+1).times{|j|
    f = true
    m.times{|k|
      m.times{|l|
        f = false if a[i+k][j+l]!=b[k][l]
      }
    }
    if f then
      puts 'Yes'
      exit
    end
  }
}

puts 'No'

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

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	ll N;
    cin>>N;
    ll ans = 0;
    rep(i,N){
        ll a = i+1;
        ans += (N-1)/a;
    }
    cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 3620
let cnt = ref 0

let merge a l m r =
  let ni = m - l in
  let ai = Array.make (ni + 1) max_int in
  for i = 0 to ni - 1 do
    ai.(i) <- a.(l + i)
  done;
  let aj = Array.make (r - m + 1) max_int in
  for i = 0 to r - m - 1 do
    aj.(i) <- a.(m + i)
  done;
  let i = ref 0 in
  let j = ref 0 in
  for k = l to r - 1 do
    if ai.(!i) <= aj.(!j) then begin
      a.(k) <- ai.(!i);
      incr i;
    end else begin
      a.(k) <- aj.(!j);
      cnt := !cnt + (ni - !i);
      incr j;
    end
  done

let rec merge_sort a l r =
  if (l + 1) < r then begin
    let m = (l + r) / 2 in
    merge_sort a l m;
    merge_sort a m r;
    merge a l m r
  end

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  merge_sort a 0 n;
  Printf.printf "%d\n" !cnt

Measured memory_bytes: 11584
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n, p;
vector<pair<ll, ll>> prime_factor(ll n) {
    vector<pair<ll, ll>> vp;

    for (ll i = 2; i*i <= n; i++) {
        if (n%i == 0) {
            vp.emplace_back(i, 0);

            do {
                vp[vp.size() - 1].second++;
                n /= i;
            } while (n%i == 0);
        }
    }

    if (n != 1) vp.emplace_back(n, 1);
    return vp;
}
int main(){
    cin>>n>>p;

    if(n==1){
        cout<<p<<endl;
        return 0;
    }
    else if(p==1 || n>50){
        cout<<1<<endl;
        return 0;
    }

    vector<pair<ll, ll>> pf=prime_factor(p);

    ll a[51];
    ll cnt=0;
    REP(i, 0, n){
        a[i]=1;
    }
    RREP(i, 0, pf.size()){
        REP(j, 0, pf[i].second){
            a[cnt]*=pf[i].first;
            cnt=(cnt+1)%n;
        }
    }

    ll gcd=__gcd(a[0], a[1]);
    REP(i, 2, n){
        gcd=__gcd(gcd, a[i]);
    }
    cout<<gcd<<endl;
    return 0;
}

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

 
 
int main() {
   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
     
    int n,k;
    cin>>n>>k;
    int a[n],i;
    for(i=0;i<n;++i)
      cin>>a[i];
      
    sort(a,a+n);
    int sum=0;
    for(i=0;i<k;++i)
      sum+=a[i];
      
    cout<<sum;  
	return 0;
	
} 

Measured memory_bytes: 3660
#include <iostream>
#include <cmath>
using namespace std;
 
  int id;
  double h;
  double w;
 
int main(){
  int n;
  double bmi;
 
  while( cin >> n,n){
  int ans = 0;
  double s = 1000;
    for(int i = 0 ; i < n ; i++){
      cin >> id >> h >> w;
      h /= 100;
      bmi = w/(h * h);
      if(s > fabs(22 - bmi)  ){
    s = fabs(22 - bmi);
    ans = id;
      }
    }
    cout << ans << endl;
}
  return 0;
}

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

  int y[1001];
int main(){
  int n;
  long long ans=1;

  cin >> n;

  
  for(int i=2; i<=n; ++i){
    int work = i;
    for(int k=2; k<=work; ++k){
      if(work%k == 0){
	work/=k;
	++y[k];
	--k;
      }
    }
  }

  for(int i=2; i<1001; ++i){
    if(y[i] > 0){
      ans *= (y[i] + 1);
      ans %= 1000000007;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N, mini = 10e9 + 1, maxi = 0; cin >> N;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        mini = min(mini, a), maxi = max(maxi, a);
    }
    printf("%d\n", maxi - mini);
}


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

int main() {
	int N;
    long double dx,dy,RR,avdist,prt;
    cin >>N;
    int arrive[N];
    vector<vector<long double>> b(N, vector<long double>(2));
    vector<vector<long double>> dist(N, vector<long double>(N,0));
    for(int i=0;i<N;i++){
      arrive[i]=i;
      cin >> b.at(i).at(0) >> b.at(i).at(1);
    }
    for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
        dx=b.at(i).at(0)-b.at(j).at(0);
        dy=b.at(i).at(1)-b.at(j).at(1);
        RR=pow(pow(dx,2)+pow(dy,2),0.5);
        dist.at(i).at(j)= RR;
        //cout << RR << endl;
    	}
    } 
  avdist=0;
  prt=0;
   do{
    for(int k=0;k<N-1;k++){
     avdist+=dist.at(arrive[k]).at(arrive[k+1]);
     }
         prt+=1;
     }while(next_permutation(arrive, arrive + N));
       cout << fixed << setprecision(10) << avdist/prt << endl;
   return 0;
     
    
}

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	int N,r,g,b,count;
  cin >> r >> g >> b >> N;
  froop1(0,N / r + 1){
    for(int j = 0;j < (N - i*r) / g + 1;j++){
        if((N - r*i - g*j) % b  == 0){
          count++;
        }
      }
    }
  cout << count << endl;

return 0;
}

Measured memory_bytes: 256
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();
		int C = sc.nextInt();

		int a = A;
		A = B;
		B = a;

		int c = C;
		C = A;
		A = c;
		System.out.print(A + " ");
		System.out.print(B + " ");
		System.out.print(C);

	}

}


Measured memory_bytes: 38564
#include<iostream>

using namespace std;

int main(void){
	int a[5];
  	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  
  	int max=0,total=0;
  	for(int i=0;i<5;i++){
      	if(a[i]%10 == 0)total+=a[i];
      	else{
          total+=a[i]-a[i]%10+10;
          if(max < 10-a[i]%10)max = 10-a[i]%10;
        }
    }
  	cout<<total-max;
  	return 0;
}

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

#define ll long long
#define vec vector<ll>
#define sortv(a); sort(a.begin(), a.end());
#define rev(a); reverse(a.begin(), a.end());
#define FOR(i,a,b) for (ll i = (ll)(a); i < (b); i++)
#define ROF(i,a,b) for (ll i = (ll)(b)-1; i >= (a); i--)

ll MOD = 1000000007;
ll INF = 1LL << 60;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	string s;cin>>s;
	int N = (int)s.length();

	bool good = true;
	FOR(i,0,N) {
		if (s[i]!=s[N-1-i]) good = false;
	}

	string ss = s.substr(0,(N-1)/2);
	// cout<<ss<<endl;
	int n = (int)ss.length();
	FOR(i,0,n) {
		if (ss[i]!=ss[n-1-i]) good = false;
	}

	ss = s.substr((N+3)/2-1,(N-1)/2);
	// cout<<ss<<endl;
	n = (int)ss.length();
	FOR(i,0,n) {
		if (ss[i]!=ss[n-1-i]) good = false;
	}

	if (good) {
		cout<<"Yes";
	} else {
		cout<<"No";
	}
}

Measured memory_bytes: 256
from numpy import matrix, sort, asscalar
import itertools as it

n, m = [int(i) for i in input().split()]
X = matrix([[int(i) for i in input().split()] for j in range(n)])

ans = []
A = it.product((1, -1), repeat=3)

for a in A:
    s = X * matrix(a).transpose()
    ans.append(matrix([1]*m, dtype='int32') * sort(s, axis=0)[::-1][:m])

print(asscalar(max(ans)))

Measured memory_bytes: 12432
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

typedef long long int ll;

const ll MOD = 1000000007;

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

  int N;
  cin >> N;
  vector<double> v(N);
  for (auto &x: v) cin >> x;

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

  double value = v[0];
  for (int i = 1; i < N; i++) {
    value = (value + v[i]) / 2.0;
  }

  cout << setprecision(16) << value << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll k;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>k;
	vector<ll> a(n),f(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++)
		cin>>f[i];
	sort(a.begin(),a.end());
	sort(f.begin(),f.end(),greater<ll>());
	ll ma=0LL;
	for(int i=0;i<n;i++)
		ma=max(a[i]*f[i],ma);
	ll le=0,ri=ma;
	while(le<ri){
		ll kt=k;
		ll v=(le+ri)/2;
		for(int i=0;i<n;i++){
			if(a[i]*f[i]>v){
				kt-=a[i]-v/f[i];
			}
		}
		if(kt<0)
			le=v+1;
		else
			ri=v; 
	}
	cout<<le<<endl;
	return 0;
}


Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
#define inf 1e9
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (ll i = (ll)(x); i < (ll)(n); i++)
#define repfr(i, n, x) for (ll i = (ll)(n)-1; i >= (ll)(x); i--)
using ll = int64_t;

void Main() {
  int n, a, b;
  std::cin >> n >> a >> b;
  std::cout << min(a * n, b) << '\n';

  return;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;

/*******************************************************/


//solve x, y s.t. mx+ny=gcd(m,n)
class Extended_Euclid {
private:
  ll m, n;
  vvll mx_multiply(vvll mx1, vvll mx2) {
    vvll ret(mx1.size(), vll(mx2[0].size(), 0));
    Loop(i, mx1.size()) {
      Loop(j, mx1[0].size()) {
        Loop(k, mx2[0].size()) {
          ret[i][j] += mx1[i][k] * mx2[k][j];
        }
      }
    }
    return ret;
  }
public:
  ll x, y, gcd;
  Extended_Euclid(ll M, ll N) {
    m = M;
    n = N;
    vll r(100), k(100);
    bool swapflag = false, m_negflag = false, n_negflag = false;
    if (m < n) { swap(m, n); swapflag = true; }
    if (m < 0) { m *= -1; m_negflag = true; }
    if (n < 0) { n *= -1; n_negflag = true; }
    r[0] = m;
    r[1] = n;
    int h = 1;
    while (1) {
      k[h - 1] = r[h - 1] / r[h];
      r[h + 1] = r[h - 1] % r[h];
      if (r[h + 1] == 0) break;
      h++;
    }
    gcd = r[h];
    vvll mx1 = { { 0, 1 },{ 1, (-1) * k[h - 1] } };
    Loopr(i, h - 1) {
      vvll mx2 = { { 0, 1 },{ 1, (-1) * k[i] } };
      mx1 = mx_multiply(mx1, mx2);
    }
    x = mx1[0][0];
    y = mx1[0][1];
    if (n_negflag) { n *= -1; y *= -1; }
    if (m_negflag) { m *= -1; x *= -1; }
    if (swapflag) { swap(m, n); swap(x, y); }
  }
};

int main() {
  ll n, k;
  cin >> n >> k;
  vll a(n);
  Loop(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  ll gcd = a[0];
  Loop1(i, n - 1) {
    Extended_Euclid euc(gcd, a[i]);
    gcd = euc.gcd;
  }
  if (k <= a.back() && (a.back() - k) % gcd == 0) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main()
{
  bool pri[1000001];
  fill(pri,pri+1000001,true);
  pri[0]=pri[1]=false;
  for(int i=2;i<1000001;i++)
    {
      if(pri[i]==0)
	continue;
      for(int j=i+i;j<1000001;j+=i)
	{
	  pri[j]=false;
	}
    }
  
  int a,d,n;
  for(;cin>>a>>d>>n,a||d||n;)
    {     
      if(pri[a])
	n--;
      for(;n>0;)
	{
	  a+=d;
	  if(pri[a])
	    {
	      n--;
	    }
	}
        cout<<a<<endl;
    
    }
 
}

Measured memory_bytes: 2136
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int i=0;
    int n_0=0,n_1=0;
    while(s[i]!=0){
        if(s[i]=='0'){
            n_0++;
        }else{
            n_1++;
        }
        i++;
    }
    cout<<min(n_0,n_1)*2<<"\n";
    return 0;
}


Measured memory_bytes: 512
mod = 10 ** 9 + 7

# permutation
def prm(n,k,mod=10**9+7):
    res = 1
    for i in range(k):
        res = res * (n-i) % mod
    return res

n, a, b = map(int, input().split())

ans = pow(2,n,mod) - 1 #何も選ばない1通りを除く
ans = (ans - prm(n,a)*pow(prm(a,a),mod-2,mod)) % mod
ans = (ans - prm(n,b)*pow(prm(b,b),mod-2,mod)) % mod

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){

	int n, a[100];
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	cout << abs(a[n-1]-a[0]) << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int key = sc.nextInt();
            if(map.containsKey(key)) {
                map.put(key, map.get(key) + 1);
            }else {
                map.put(key, 1);
            }
        }
        int ans = 0;
        int max = Collections.max(map.keySet());
        List<Entry<Integer, Integer>> list = new ArrayList<Entry<Integer, Integer>>(map.entrySet());
        Collections.sort(list, new Comparator<Entry<Integer, Integer>>() {
            public int compare(Entry<Integer, Integer> obj1, Entry<Integer, Integer> obj2) {
                return obj1.getValue().compareTo(obj2.getValue());
            }
        });
        for (int i = 0; i < list.size(); i++) {
            if(list.size() - i <= k) {
                System.out.println(ans);
                break;
            } else {
                ans += list.get(i).getValue();
                //list.get(list.size() - 1).setValue(list.get(list.size() - 1).getValue() + list.get(0).getValue());
                //list.remove(0);
            }
        }

    }
}

Measured memory_bytes: 71360
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

vector<int> idxes[128];
bool check[128];

int stl_binsearch_lower_bound(vector<int>& vec, int val) {
  return lower_bound(vec.begin(), vec.end(), val) - vec.begin();
}

int main(void) {
  string s, t;

  getline (cin, s);
  getline (cin, t);

  for(int i = 0; i < s.length(); i++) {
    check[s[i]] = 1;
    idxes[s[i]].push_back(i);
  }

  long long r = 0, p = 0;
  for(int i = 0; i < t.length(); i++) {
    if(check[t[i]] == 0) {
      cout << -1;

      return 0;
    }

    int next_idx = stl_binsearch_lower_bound(idxes[t[i]], p);

    if(next_idx >= idxes[t[i]].size()) {
      r++;
      p = idxes[t[i]][0];
    } else {
      p = idxes[t[i]][next_idx];
    }

    p++;
    if(p > t.length()) {
      r++;
      p = 0;
    }
  }

  cout << r * s.length() + p;

  return 0;
}

Measured memory_bytes: 1216
#include <iostream>

using namespace std;

int main()
{
	int d, n;
	cin >> d >> n;
	int dp[201][201];
	int a[201], b[201], c[201], t[201];
	for (int i = 0; i < d; i++)
	{
		cin>> t[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
		for (int j = 0; j < d; j++)
		{
			dp[j][i] = 0;
		}
	}
	for (int i = 1; i < d; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (a[j] <= t[i] && t[i] <= b[j])
			{
				int ans = 0;
				for (int k = 0; k < n; k++)
				{
					if (c[j] >= c[k] && a[k] <= t[i - 1] && t[i - 1] <= b[k])
					{
						if (ans <= (dp[i - 1][k] + c[j] - c[k]))
						{
							ans = dp[i - 1][k] + c[j] - c[k];
						}
					}
					else if (c[j] < c[k] && a[k] <= t[i - 1] && t[i - 1] <= b[k])
					{
						if (ans <= (dp[i - 1][k] - c[j] + c[k]))
						{
							ans = dp[i - 1][k] - c[j] + c[k];
						}
					}
				}
				dp[i][j] = ans;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (ans <= dp[d - 1][i])
		{
			ans = dp[d - 1][i];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3264
#include <stdio.h>

int main(){
  char a[10],b;
  int i,j,k,m,n;
  long d,e;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",a);
    for(j=0;a[j]!=0;j++); m=j;
    for(j=0;j<m-1;j++){
      for(k=j+1;k<m;k++){
        if(a[j]>a[k]) {b=a[j];a[j]=a[k];a[k]=b;}
      }
    }
    d=e=0;
    for(j=0;j<m;j++){
      d=d*10+a[j]-'0';
      e=e*10+a[m-j-1]-'0';
    }
    printf("%ld\n",e-d);
  }
  return 0;
}

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    string s;
    map<char, int> hoge;
    for (char i = 'a'; i <= 'z'; i++){
        hoge[i] = 0;
    }
    
    while(getline(cin, s)){
        for (int i = 0; i < s.length(); i++){
            if(s[i] >= 65 && s[i] <= 90){
                s[i] += 32;
                hoge[s[i]]++;
                continue;
            }
            if(s[i] >= 97 && s[i] <= 122){
                hoge[s[i]]++;
                continue;
            }
        }
    }

    for (auto i = hoge.begin(); i != hoge.end(); i++){
        cout << i->first << " : " << i->second << endl;
    }
}


Measured memory_bytes: 3216
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Scanner scanner;

    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        int a = nextInt();
        if (a >= 30) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        
        out.flush();
    }

    public static void println(Object o) {
        System.out.println(o);
    }

    public static void print(Object o) {
        System.out.print(o);
    }

    public static void printf(String format, Object... o) {
        System.out.printf(format, o);
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

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

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

Measured memory_bytes: 29372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		while(true){
			int H = s.nextInt();
			int W = s.nextInt();
			if(H==0 && W==0){
				break;
			}
			
			for(int i=1; i<=H; i++){
				for(int j=1; j<=W; j++){
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
		s.close();
	}

}

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

using namespace std;

int main(){
  string s;
  long long int k;
  cin >> s >> k;
  bool ans=true;
  for(int i=0;i<k;i++){
    if(s[i]!='1'){
      ans=false;
      cout << s[i] << endl;
      break;
    }
  }
  if(ans)cout << '1' << endl;
}

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

using namespace std;

void Solution()
{
    string a;
    
    while(getline(cin,a))
    {
        
        while (1)
        {
            if( a.find("this") != -1 || a.find("the") != -1 || a.find("that") != -1)
            {
                break;
            }
            
            for(int i = 0; i < (int)a.length(); i++)
            {
                if(a[i]==' '|| a[i]=='.')
                {
                    continue;
                }
                else if(a[i] == 'z') //based on ASC||code , after 'z' is '{'
                {
                    a[i] = 'a';
                }
                else
                {
                    a[i]++; // character would be changed based on ASC|| code
                }
            }
            
        }
        cout<<a<<endl;;
    }
}

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

Measured memory_bytes: 1180
N = int(input())
A = list(map(int, input().split()))

stair = []
startDate = 0
lastDate = N - 1
firstFlag = True
for i in range(1, N):
    if (A[i] == A[i - 1]):
        stair.append(0)
        continue
    if (A[i] < A[i - 1]):
        stair.append(-1)
    else:
        if (firstFlag):
            firstFlag = False
            startDate = i - 1
        stair.append(1)
        lastDate = i

upflag = False
base = 1000
ticket = 0
for i in range(startDate, lastDate):
    if (stair[i] == 0):
        continue
    if (upflag):
        if (stair[i] == -1):
            base += ticket * A[i]
            upflag = False
    else:
        if (stair[i] == 1):
            ticket = int(base / A[i])
            base -= ticket * A[i]
            upflag = True

if (ticket != 0):
    base += ticket * A[lastDate]

print(base)

Measured memory_bytes: 9256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

class sumSegTree {
public:
  ll n, height;
  vector<ll> data;
  
  sumSegTree(ll _n) {
    n=1;
    height=1;
    while(n<_n) {
      n*=2;
      height++;
    }
    data=vector<ll>(2*n-1);
  }
  
  void add(ll i, ll x) {
    i+=n-1;
    data[i]+=x;
    while(i>0) {
      i=(i-1)/2;
      data[i]+=x;
    }
  }
  
  //[a, b):要求区間，[l, r):対象区間
  ll _sum(ll a, ll b, ll k, ll l, ll r) {
    if(r<=a || b<=l) return 0;
    if(a<=l && r<=b) return data[k];
    else {
      ll s=_sum(a, b, 2*k+1, l, (l+r)/2);
      ll t=_sum(a, b, 2*k+2, (l+r)/2, r);
      return s+t;
    }
  }
  
  ll sum(ll a, ll b) {
    return _sum(a, b, 0, 0, n);
  }
  
};


int main(void) {
  ll N;
  cin >> N;
  string s;
  cin >> s;
  ll Q;
  cin >> Q;
  ll i;
  
  sumSegTree sst[26]={sumSegTree(N), sumSegTree(N), sumSegTree(N),
  sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N), sumSegTree(N),
    sumSegTree(N), sumSegTree(N)};
  
  
  for(i=0; i<N; i++) {
    sst[s[i]-'a'].add(i, 1);
  }
  
  for(ll _=0; _<Q; _++) {
    ll q;
    cin >> q;
    
    if(q==1) {
      ll id;
      char c;
      cin >> id >> c;
      id--;
      
      sst[s[id]-'a'].add(id, -1);
      sst[c-'a'].add(id, 1);
      s[id]=c;
      
    }else if(q==2) {
      ll l, r;
      cin >> l >> r;
      l--;
      
      ll cnt=0;
      for(i=0; i<26; i++) {
        if(sst[i].sum(l, r)) cnt++;
      }
      
      pt(cnt);
    }
    
    
  }
  
  
  
  
  
  
}




Measured memory_bytes: 214020