akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> d(N);
    rep(i, N) cin >> d[i];

    // sort
    sort(d.begin(), d.end());
    int diff = d[N/2] - d[N/2-1];
    cout << diff << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int len=s.size(),ans=s.size();
	for(int i=0;s[i+1];i++)
		if(s[i]!=s[i+1])
			ans=min(ans,max(i+1,len-i-1));
	cout<<ans;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n;
D x[10],y[10],ans;
int main(void){
	cin>>n;
	for(int i=0;i<n;i++)cin>>x[i]>>y[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)continue;
			ans+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
		}
	}
	ans/=D(n);
	printf("%0.7lf\n",ans);
}


Measured memory_bytes: 384
PROGRAM Knapsack1
      IMPLICIT NONE
      integer(16) :: n,w
      integer(16),allocatable :: ww(:),vv(:),dp(:,:)
      integer(16) :: i,num,weight
      
      read*,n,w
      allocate( ww(n),vv(n),dp(0:n,0:w) )
      do i = 1,n
        read*,ww(i),vv(i)
      end do
      
      dp = 0
      do num = 1,n
        do weight = 1,w
          
          if( weight-ww(num)>=0 )then
            dp(num,weight) = max( dp(num-1,weight), &
              & dp(num-1,weight-ww(num))+vv(num) )
          else
            dp(num,weight) = dp(num-1,weight)
          end if
          
        end do
      end do
      
      print*,dp(n,w)
      
      
      
      
      END PROGRAM

Measured memory_bytes: 158080
//============================================================================
// Name        : abc141_d.cpp D - Powerful Discount Tickets
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : https://atcoder.jp/contests/abc141/tasks/abc141_d
//============================================================================

#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

// 数値の読み取り, 低速な cin の使用を回避する
inline int read() {
	int f = 1, x = 0; // 負数フラグ、絶対値
	char ch = getchar();
	while (ch < '0' || ch > '9') { // 数値以外を飛ばす
		if (ch == '-') { // ただし '-' のとき負数フラグを立てる
			f = -1;
		}
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') { // 数値の読み取り
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return x * f;
}

// 数値の書き出し, 低速な cout の使用を回避する
template<typename T>inline void write(T n) {
	int i = 0;
	char b[30];
	if (!n) {
		putchar('0');
	} else {
		if (n < 0) { // 負数のとき負号出力
			putchar('-');
			n *= -1;
		}
		i = 0;
		while (n) { // 下の桁から順番に文字にして b に格納
			b[i++] = '0' + (n % 10);
			n /= 10;
		}
		while (i--) { // 上の桁から順番に出力
			putchar(b[i]);
		}
	}
	putchar('\n');
}

int N, M;
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//N = read(); // 品物数
	//M = read(); // 割引券枚数
	cin >> N >> M;

	// 品物値段 A_1(=A[0]) ~ A_N(=A[N-1]) の読み取り
	priority_queue<long long> A;
	long long tmp;
	for (int i = 0; i < N; ++i) {
		//A.push(read());
		cin >> tmp;
		A.push(tmp);
	}
	// 割引適用 M 枚
	long long max;
	for (int j = 0; j < M; ++j) {
		max = A.top();
		A.pop();
		A.push(max >> 1);
	}
	long long sum = 0;
	for (int i = 0; i < N; ++i) {
		sum += A.top();
		A.pop();
	}
	// write(sum);
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1400
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
int main() {
	int v[3][3], xdif[2] = { 2000,2000 }, ydif[2] = { 2000,2000 };
	bool b = 1;
	rep(x, 3)rep(y, 3) {
		cin >> v[x][y];
		if (x > 0) {
			if (xdif[x - 1] == 2000)xdif[x - 1] = v[x][y] - v[x - 1][y];
			else if (xdif[x - 1] != v[x][y] - v[x - 1][y]) { b = 0;}
		}
		if (y > 0) {
			if (ydif[y - 1] == 2000)ydif[y - 1] = v[x][y] - v[x][y-1];
			else if (ydif[y - 1] != v[x][y] - v[x][y-1]) { b = 0;}
		}
	}
	//cout << ydif[0] << "," << ydif[1] << endl;
	cout << yn(b) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

using i64 = long long;
i64 dp[123456];
i64 mt[123456];
i64 a[123456];
i64 n,t;
vector<i64>sock;

int main(void)
{
	scanf("%lld %lld", &n, &t);
	for (int i = 0; i < n; ++i)
	{
		scanf("%lld", a + i);
	}
	i64 bignum = a[n - 1];
	int bigitr = n - 1;
	i64 biggest = 0;
	for (int i = n - 2; i >= 0; --i)
	{
		dp[i] = bigitr;
		mt[i] = a[bigitr] - a[i];
		biggest = max(mt[i], biggest);
		if (bignum < a[i])
		{
			bignum = a[i];
			bigitr = i;
		}
	}
	for (int i = 0; i < n - 1; ++i)
	{
		if (biggest == mt[i])
		{
			sock.push_back(i);
		}
	}
	printf("%d\n", (int)sock.size());
	return 0;
}


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

int main(){
  int s;
  cin >> s;
  vi v(1000000);
  v[0] = s;
  rep(i,1000000){
    if(v[i]%2 == 0) v[i+1] = v[i]/2;
    else v[i+1] = 3*v[i] + 1;
  }
  rep(i,1000000)rep(j,1000000){
    if(i==j) continue;
    if(v[i] == v[j]){
      cout << j+1 << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 7132
program line_plus_plus
  implicit none
  integer :: n, x, y, i, j, c(2000) = 0, m
  read(*,*) n, x, y
  do i = 1, n-1
    do j = i+1, n
      m = min(j-i,abs(x-i)+1+abs(j-y))
      c(m) = c(m)+1
    end do
  end do
  do i = 1, n-1
    write(*,'(i0)') c(i)
  end do
end program line_plus_plus

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pa pair<int,int>
#define ld long double
#define BOOST ios_base::sync_with_stdio(false)
#define pb push_back
using namespace std;
const int MAX=1e5+5;
int dp[MAX];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int tab[n];
    dp[1]=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d",&tab[i]);
    }
    for (int i=2;i<=n;i++)
    {
        int l=1000000000;
       for (int j=i-1;j>=max(1,i-k);j--)
       {
           l=min(l,dp[j]+abs(tab[j]-tab[i]));
       }
       dp[i]=l;
      // cout<<i<<" "<<dp[i]<<"\n";
    }

    printf("%d",dp[n]);

    return 0;
}



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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        mut an:[i64;n],
    }
    an.sort();
    let mut an:Vec<f64> = an.into_iter().map(|x| x as f64).collect();
    for i in 0..n-1 {
        an[i+1] = (an[i] + an[i + 1]) / 2.;
    }
    println!("{}",an[n-1]);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
N, M = map(int, input().split())
m = 0
for i in range(M):
    m += 2**i
for n in range(N):
    k = list(map(int, input().split()))
    k_n = k[0]
    _m = 0
    for i in range(k_n):
        _m ^= 2**(k[i+1]-1)
    m &= _m
ret = bin(m).count("1")
print(ret)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll k; cin >> k;
    ll s = 0;
    REP(i, k*2){
        if ((i != 0) && (s == 0)){
            cout << i << endl;
            return 0;
        }
        s *= 10;
        s += 7;
        s %= k;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;

signed main() {
  vector<vector<int>> Bingo(3, vector<int>(3));
  for( int i = 0; i < 3; i++ ){
    for( int j = 0; j < 3; j++ ) cin >> Bingo.at(i).at(j);
  }
  
  int N;
  cin >> N;
  vector<vector<bool>> fg(3, vector<bool>(3));
  for( int i = 0; i < N; i++ ){
    int A;
    cin >> A;
    for( int i = 0; i < 3; i++ ){
      for( int j = 0; j < 3; j++ ){
        if( Bingo.at(i).at(j) == A ) fg.at(i).at(j) = true;
      }
    }
  }
  
  bool ok = false;
  
  //横
  for( int i = 0; i < 3; i++ ){
    bool atari = true;
    for( int j = 0; j < 3; j++ ){
      if( fg.at(i).at(j) == false ) atari = false;
    }
    if( atari == true ) ok = true;
  }
  
  //縦
  for( int i = 0; i < 3; i++ ){
    bool atari = true;
    for( int j = 0; j < 3; j++ ){
      if( fg.at(j).at(i) == false ) atari = false;
    }
    if( atari == true ) ok = true;
  }
  
  //斜め
  bool ikeru = true;
  for( int i = 0; i < 3; i++ ){
    if( fg.at(i).at(i) == false ) ikeru = false;
  }
  if( ikeru ) ok = true;
  
  if( fg.at(2).at(0) && fg.at(1).at(1) && fg.at(0).at(2) ) ok = true;
  
  if( ok ) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int m,a,p;
    scanf("%d%d%d", &m, &a, &p);
    if(m>=p){
        printf("0\n");
    }
    else if(m+a>=p){
        printf("%d\n", p-m);
    }
    else{
        printf("NA\n");
    }
    return 0;
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int A, B;
    cin >> A >> B;
    
    if (A == 1) A = 14;
    if (B == 1) B = 14;
    
    if (A > B) cout << "Alice" << endl;
    else if (A < B) cout << "Bob" << endl;
    else cout << "Draw" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
 
        if(a < b){
            System.out.println("a < b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }
 
    }
}

Measured memory_bytes: 26092
#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
	char a[3][3];
	for(int i=0;i<3;i++)	{
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	cout<<a[0][0]<<a[1][1]<<a[2][2];
	return 0;
}

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

vector<ll> c;

void dfs(ll x) {

    c.push_back(x);
    if (12 < to_string(x).size()) {
        return;
    }
    ll xu, xm, xl;
    xu = x % 10 + 1;
    xm = x % 10;
    xl = x % 10 - 1;
    for (ll i = 0; i < 3; i++) {
        if (i == 0) {
            if (9 < xu) continue;
            x *= 10;
            x += xu;
            dfs(x);
            x -= xu;
            x /= 10;
        }
        else if (i == 1) {
            x *= 10;
            x += xm;
            dfs(x);
            x -= xm;
            x /= 10;
        }
        else if (i == 2) {
            if (xl < 0) continue;
            x *= 10;
            x += xl;
            dfs(x);
            x -= xl;
            x /= 10;
        }
    }
    return;
}

int main() {

    ll k; cin >> k;
    for (ll i = 1; i <= 9 ; i++) {
        dfs(i);
    }
    sort(c.begin(), c.end());
    cout << c[k - 1] << endl;
    return 0;
}

Measured memory_bytes: 69124
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	printf("%d\n",max(a*10+b+c,max(b*10+a+c,c*10+a+b)));
	return 0;
} 

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

int main(void){
    ll N, T, t[200001], nowT=0,sumT=0;
    cin >> N >> T;
    for(int i=0;i<N;i++){
        cin >> t[i];
    }
    for(int i=1;i<N;i++){
        if(t[i]<=nowT+T){
            sumT += (t[i] - nowT);
        }else if (t[i] > nowT+T){
            sumT += T;
        }
        nowT = t[i];
    }
    cout << sumT+T << endl;

    return 0;
}

Measured memory_bytes: 1792
import math
A,B = list(map(int,input().split()))
before_min_A = math.ceil(A * 12.5)
before_min_B = B * 10
if before_min_B <= before_min_A < before_min_B + 10:
    print(before_min_A)
elif before_min_A <= before_min_B < before_min_A + 12:
    print(before_min_B)
else:
    print("-1")

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

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const int mod = 998244353;


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b, n;
    //cin >> n;
    while(cin >> a >> b >> n)
    cout << (n - 1)/max(a,b) + 1 << '\n';
}

Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;


int main(){
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  int a[n];
  int b[n];
  string memo = s.substr(0,1);
  int acnt = 0;
  int bcnt = 0;
  if(memo == "1"){
    a[0] = 0;
    acnt++;
  }else{
    b[0] = 0;
    bcnt++;
  }
  rep(i,n){
    // printf("%s\n",s.substr(1,i).c_str() );
    if(s.substr(i,1) != memo){
      if(memo == "1"){
        b[bcnt] = i;
        bcnt++;
      }else{
        a[acnt] = i;
        acnt++;
      }
      memo = s.substr(i,1);
    }
  }


  int ans = 0;
  if(bcnt <= k){
    printf("%d\n", n);
    return 0;
  }else{
    if(s[0] == '1'){
      rep(i,bcnt-k){
        ans = max(ans,b[i+k]-a[i]);
      }
      if(s[s.size()-1] == '1'){
        ans = max(ans,n-a[bcnt-k]);
      }else{
        ans = max(ans,n-a[bcnt-k]);
      }
    }else{
      rep(i,bcnt-k-1){
        ans = max(ans,b[i+k+1]-a[i]);
      }
      ans = max(ans,a[k-1]+1);
      if(s[s.size()-1] == '1'){
        ans = max(ans,n-a[bcnt-k-1]);
      }else{
        ans = max(ans,n-a[bcnt-k-1]);
      }
    }
  }

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


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  sort(A.rbegin(),A.rend());
  long long ans=0;
  for(int i=1;i<N;i++){
    ans+=A.at(i/2);
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 4020
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    int s[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin>>K;
    cout<<s[K-1]<<endl;
}


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

int main(void){
  int n;cin>>n;
  vector<int> t(n);
  for(int i=0;i<n;i++){
    cin >> t.at(i);
  }
  int m;cin>>m;
  vector<pair<int, int>> drink(m);
  for(int i=0;i<m;i++){
    int p, x;cin>>p>>x;p--;
    drink.at(i)=make_pair(p, x);
  }
  int preans=0;
  for(int i=0;i<n;i++){
    preans += t.at(i);
  }
  for(int i=0;i<m;i++){
    cout << preans - t.at(drink.at(i).first) + drink.at(i).second << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#define mp make_pair
using namespace std;

long long n;
char S[50];
long long p[50];
map < pair <string, string>, long long> st, dr;

void bkt(long long half, long long poz)
{
    if (poz > n)
    {
        string red = "", blue = "";
        for (long long i = (half - 1) * n + 1; i <= half * n; i++)
            if (p[i] == 1)
                red += S[i];
            else
                blue += S[i];
        if (half == 1)
            st[mp(red, blue)]++;
        else
            dr[mp(red, blue)]++;
        return;
    }

    for (long long i = 1; i <= 2; i++)
    {
        p[(half - 1) * n + poz] = i;
        bkt(half, poz + 1);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (long long i = 1; i <= 2 * n; i++)
        cin >> S[i];

    reverse(S + n + 1, S + 2 * n + 1);

    bkt(1, 1);
    bkt(2, 1);

    //for (auto nr: dr)
      //  cout << nr.first.first << ", " << nr.first.second << ": " << nr.second << "\n";

    long long total = 0;
    for (auto nr: st)
        total += nr.second * dr[nr.first];
    cout << total;

    return 0;
}


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

int main(){

    int N;
    cin >> N ;

    if (N == 22){
        cout << "Christmas Eve Eve Eve";
    }
    else if (N == 23){
        cout << "Christmas Eve Eve";
    }
    else if (N == 24){
        cout << "Christmas Eve";
    }
    else if (N == 25){
        cout << "Christmas";
    }

    return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define all(v) v.begin(), v.end()


void solve(long long A, long long B, long long T){
    cout << (T / A) * B << endl;
}

struct IoSetup {
    IoSetup() {
        // cin.tie(nullptr);
        // ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long T;
    scanf("%lld",&T);
    solve(A, B, T);
    return 0;
}


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

using namespace std;

int main(){
 
 int n;
 cin >> n;
 
 int js = 0;
 map<string , char> mp;
 while(n--){
  string s1;
  cin >> s1;
  
  
  if(!mp.count(s1)) js++, mp[s1]++;
 }
 cout << js << endl;
 return 0;
} 

Measured memory_bytes: 19252
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N;string S;cin>>N>>S;
    ll cnt=0;
    ll n1=0,n2=0,n3=0;
    REP(i,N){
        if(S[i]=='R')n1++;
        else if(S[i]=='G')n2++;
        else n3++;
    }
    cnt=n1*n2*n3;
    REP(i,N){
        for(ll k=1;i+2*k<N;k++){
           if(S[i]!=S[i+k]&&S[i+k]!=S[i+2*k]&&S[i+2*k]!=S[i])cnt--;
        }
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 3608
s = gets.chomp.split('')
sum = 0
0.upto(2**(s.size-1)-1) do |i|
  b = format "%0#{s.size-1}b", i
  str = ''
  0.upto(s.size-2) do |j|
    str += s[j]
    str += '+' if b[j] == '1'
  end
  str += s[-1]
  sum += eval str
end
puts sum


Measured memory_bytes: 1916
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, a, b = map(int, input().split())
    S = str(input())
    cnta=0
    cntb=0

    for i in range(N):
        if S[i] == 'a':
            if cnta + cntb < a + b:
                print('Yes')
                cnta+=1
            else:
                print('No')
        elif S[i] == 'b':
            if cnta + cntb < a + b and cntb < b:
                print('Yes')
                cntb+=1
            else:
                print('No')

        else:
            print('No')


resolve()

Measured memory_bytes: 4016
n = int(input())
A = [int(a) for a in input().split()]

ans = "APPROVED"
for i in range(n):
    if A[i] % 2 == 0 and A[i] % 5 != 0 and A[i] % 3 != 0:
        ans = "DENIED"
        break

print(ans)


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

int main()
{
    string s;
    cin>>s;
    int d=INT_MAX;
    for(int i=0;i<=s.size()-3;i++)
    {
        int k=i+2;
        int k1=0;
        for(int j=i;j<=k;j++)
        {
            k1=k1*10+(s[j]-'0');
        }
        int c=k1>753?(k1-753):753-k1;
        d=(c<d)?c:d;

    }
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 3160
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define ll long long int
#define fab(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
vector<int> v[100005];
ll dp[100005];
ll dfs(int src, bool vis[])
{
    vis[src]=1;
    for(auto i:v[src])
    {
        if(!vis[i])
            dfs(i,vis);
        dp[src]=max(dp[src],dp[i]+1);
    }
    return dp[src];
}
int main()
{ quick;

    int n,m;
    cin>>n>>m;
    fab(0,m,i)
    {
        int a,b;
        cin>>a>>b;
        a--;b--;
        v[a].pb(b);
       
    }
    ll ans=0;
    bool vis[n];
    memset(vis,0,sizeof(vis));
    fab(0,n,i)
    {
        if(!vis[i])
            dfs(i,vis);
        ans=max(ans,dp[i]);
    }
   
    cout<<ans<<endl;

 cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

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

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

int main(){
    int n;
    cin >> n;
    int v[n],c[n];
    REP(i,n)cin >> v[i];
    REP(i,n)cin >> c[i];
    int ans=0;
    REP(i,n){
        if(v[i]>c[i])ans += v[i] - c[i];
    }
    cout << ans << endl;
}


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


int main()
{
string a,b;
cin>>a>>b;
long long int c=0;
for(int i=0;i<a.length();i++)
{
if(a[i]!=b[i])
c++;
}
cout<<c<<endl;

return 0;
}







Measured memory_bytes: 3900
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
   lli L,R,N,M,K,sum=1,num=0,flag=0;
   cin >> N;
   Vec(P,lli,N,0);
   rep(i,0,N)cin >> P[i];
   rep(i,1,N){
      if(P[i]>P[i-1]){
         if(flag==0)flag=1;
         else if(flag==2){
            sum++;flag=0;
         }
      }
      else if(P[i]<P[i-1]){
         if(flag==0)flag=2;
         else if(flag==1){
            sum++;flag=0;
         }
      }
   }
   Out(sum);
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int[][] a = new int[4][2];
		while(cin.hasNext()){
			for(int i = 0;i<2;i++){
				double left = cin.nextDouble();
				if(left < 0.2){
					a[3][i]++;
				}
				else if(left < 0.6){
					a[2][i]++;
				}
				else if(left < 1.1){
					a[1][i]++;
				} 
				else{
					a[0][i]++;
				} 

			}

		}
		for(int i = 0;i<4;i++){
			System.out.println(a[i][0]+" "+a[i][1]);
		}
	}

}

Measured memory_bytes: 12000
#include<stdio.h>
     int ouput(int n,int num[]){
        for(int k=0;k<n;k++){
                printf("%d",num[k]);
                if(k<n-1)
                 printf(" ");
                else
                 printf("\n");
            }
     }
     int main(){
     int n;
     while(~scanf("%d",&n) && n>=1 && n<=100){
        int num[100];
        int v,j;
        for(int i=0;i<n;i++)
            scanf("%d",&num[i]);
        ouput(n,num);
        for(int i=1;i<=n-1;i++){
            v=num[i];
            j=i-1;
            while(j>=0 && num[j]>v){
                num[j+1]=num[j];
                j--;
            }
            num[j+1]=v;
            ouput(n,num);
        }
     }
     return 0;
}



Measured memory_bytes: 2760
#include <bits/stdc++.h>
#define LL long long 
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
using namespace std;
int n,k;
int mi=INF;
int a[100010];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n-k+1;i++){
		int ll=a[i],rr=a[i+k-1],t;
		if(rr<0){
			t=-ll;
		}else if(ll<0){
			t=min(2*(-ll)+rr,2*rr-ll);
		}else{
			t=rr;
		}
		mi=min(mi,t);
	}
	cout<<mi<<endl;
	return 0;
}


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

int main()
{
	int x, y, z;
	cin >> x >> y >> z;
	
	int tmp1;
	tmp1 = x;
	x = y;
	y = tmp1;
	
	int tmp2;
	tmp2 = x;
	x = z;
	z = tmp2;
	
	cout << x << " " << y << " " << z << endl;
	
	return 0;
}


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


using namespace std;

using ll = long long;


vector<vector<ll>> graph;
vector<ll> height;


int main() {
    ll N, M;
    cin >> N >> M;
    graph.resize(N + 1);
    height.resize(N + 1);

    for (ll i = 0; i < N; i++) {
        cin >> height[i + 1];
    }

    for (ll i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        bool good = true;
        for (auto e : graph[i]) {
            if (height[i] <= height[e]) {
                good = false;
                break;
            }
        }

        if (good) {
            ans++;
        }
    }

    cout << ans << endl;
}


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

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

    int n;
    cin >> n;
    vector<long long> X(n), L(n);
    vector<pair<long long, long long>> A(n);
    for(int i = 0; i < n; i++){
        cin >> X[i] >> L[i];
        A[i] = make_pair(X[i] + L[i], X[i] - L[i]);
    }

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

    int ans = 0;
    long long pre = -1;
    for(int i = 0; i < n; i++){
        if(i == 0){
            pre = A[i].first;
            ans++;
        }else{
            if(pre <= A[i].second){
                pre = A[i].first;
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
typedef long long ll; 
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
//const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
void solve(){
  #ifndef ONLINE_JUDGE    
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf   
    ll x; 
    cin>>x; 
    ll n=-118,res,res2;
    while(n<120){
      bool ok=1;
      ll m=-119;
      while(m<119){
      ll ans=(ll)pow(n,5)-(ll)pow(m,5);
      if(ans==x){
        ok=0;
        res=n;
        res2=m;
        break; 
      }
      m++;
      }
      if(ok==0){
        break; 
      }
      n++;
    }
    cout<<res<<" "<<res2<<endl; 
    return 0;
}
    

Measured memory_bytes: 4052
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n =scn.nextInt();
		String s=scn.next();
		char []arr = s.toCharArray();
	    LinkedList<Integer> al =new LinkedList<>();
	    int cnt=0;
		for(int i=0;i<arr.length;i++){
			if(arr[i]=='R'){
				al.addFirst(i);
				cnt++;
			}
		}
		int ans=0;
		for(int i=0;i<arr.length;i++){
			if(i<cnt){
				if(arr[i]=='W'){
					ans++;
					int idx = al.removeFirst();
					arr[i]='R';
					arr[idx]='W';
				}
			}
		}
		System.out.println(ans);

	}

}

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

int main() {
	string s;
	cin >> s;
	//[R...L]の部分文字列について解決すればいい
	//r=1,l=1のとき、(1,1)
	//r=偶数,l=偶数のとき、(0がr-1個,r/2+l\2,r/2+l/2,0がl-1個)
	//rが奇数,lが奇数の時、(0がr-1個,ceil(r/2)+l\2,r/2+ceil(l/2),0がl-1個)
	vector<vector<int>>a(0, vector<int>(2));
	int rc = 0;
	int lc = 0;
	for (size_t i = 0; i < s.length(); i++) {
		if (lc==0 && s.at(i) == 'R') rc++;
		else if (rc >= 1 && s.at(i) == 'L') lc++;
		else if (rc >= 1 && lc >= 1 && s.at(i) == 'R') {
			a.push_back({ rc,lc });
			rc = 1;
			lc = 0;
		}
	}
	a.push_back({ rc,lc });
	//for (size_t i = 0; i < a.size(); i++)cout << a.at(i).at(0) << " " << a.at(i).at(1) << endl;
	vector<int>ans;
	for (size_t i = 0; i < a.size(); i++) {
		int rx = a.at(i).at(0);
		int lx = a.at(i).at(1);
		for (size_t j = 0; j < rx - 1; j++) ans.push_back(0);
		ans.push_back(ceil(rx * 0.5) + (lx / 2));
		ans.push_back(ceil(lx * 0.5) + (rx / 2));
		for (size_t j = 0; j < lx - 1; j++)ans.push_back(0);
	}
	cout << ans.at(0);
	for (size_t i = 1; i < ans.size(); i++)cout << " " << ans.at(i);
	cout << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 998244353
#define PI 3.14159265
#define endl '\n'
#define MAX 200001


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

    ll n , m;
    cin >> n >> m;
    string str1 , str2;
    cin >> str1 >> str2;
    if (n < m) {
        swap(n , m);
        swap(str1 , str2);
    }
    if (!str1.compare(str2)) {
        cout << n << endl;
        return 0;
    }
    if (n == m) {
        if (str1 != str2) {
            cout << "-1" << endl;
            return 0;
        }
    }
    if (str1[0] != str2[0]) {
        cout << "-1" << endl;
        return 0;
    }
    ll ans = (n * 1ll * m / (__gcd(n , m)));
    for (ll i = 1; i < m; i++) {
        ll v = (ans / m) * i;
        ll ind = (v / (ans / n));
        if ((v % (ans / n)) == 0 && ind < n && str1[ind] != str2[i]) {
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(void){


char str[1010];


int i,sum;


scanf("%s",str);


while(str[0]!='0'){


i=0;sum=0;


while(str[i]){


sum+=str[i]-'0';i++;


}


printf("%d\n",sum);


scanf("%s",str);


}


return 0;


}

Measured memory_bytes: 536
use std::collections::BinaryHeap;
use std::collections::VecDeque;

fn main(){

  let mut seat: Vec<usize> = vec![0; 18];

  for i in 0 .. 17 {
    seat[i] = 17 - i;
  }

  let mut tm: usize = 0;

  let mut que: VecDeque<usize> = VecDeque::new();
  
  let mut bh: BinaryHeap<(i32, usize, usize)> = BinaryHeap::new();
  
  seat[0] = 0;
  seat[1] = 0;

  let et: i32 = -1 * ((tm + meal_time(0)) as i32);
  bh.push((et, 0, 0));

  let mut rslt: Vec<usize> = vec![0;100];

  let mut ext: bool = false;
  
  loop {
    tm += 1;

    loop {
      match bh.peek() {
        Some(&(tpt, ti, tsn)) => {
          let tt: usize = (-1 * tpt) as usize;
  
          if tt == tm {
            for i in tsn .. tsn + num_member(ti) {
              seat[i] = 1;
            }
            for i in (0..17).rev() {
              if seat[i] != 0 {
                seat[i] = seat[i+1] + 1;
              }
            }
            bh.pop();
          } else { break; }
        },
        None => { break; }
      }
    }
    
    if tm % 5 == 0  && tm < 500{
      que.push_back(tm / 5);
    }

    loop {
      match que.front() {
        Some(&ti) => {
          let tn = num_member(ti);
          match find_seat(&seat, tn) {
            Some(tsi) => {
              for i in tsi .. tsi + tn {
                seat[i] = 0;
              }
              que.pop_front();
              rslt[ti] = tm - 5 * ti;

              let pt: i32 = -1 * ((tm + meal_time(ti)) as i32);
              bh.push((pt, ti, tsi));
              
              if ti == 99 { ext = true; }
            },
            None => { break; }
          }
        },
        None => { break; }
      }
    }
    if ext { break; }
  }

  loop {
    let mut buf = String::new();
    
    if let Ok(c) = std::io::stdin().read_line(&mut buf) {
      if c == 0 { break; }
    }

    let n: usize = buf.trim().parse().unwrap();
    println!("{}", rslt[n]);
  }
}

fn num_member(i: usize) -> usize {
  if i % 5 == 1 { 5 } else { 2 }
}

fn meal_time(i: usize) -> usize {
  17 * (i % 2) + 3 * (i % 3) + 19
}

fn find_seat(st: &Vec<usize>, t: usize) -> Option<usize> {
  for i in 0 .. 17 {
    if st[i] >= t {
      return Some(i)
    }
  }
  None
}



Measured memory_bytes: 5032
#include <bits/stdc++.h>
using namespace std;
int a[2*100005];
int main()
{
	int n,k;
	cin >>k>>n;
	cin >>a[0];
	int maxx=-1,sum=0;
	for(int i=1;i<n;i++)
	{
		cin >>a[i];
		sum+=abs(a[i]-a[i-1]);
		maxx=max(maxx,a[i]-a[i-1]);

	}
	sum+=abs(abs(a[n-1]-k)+a[0]);
	maxx=max(maxx,abs(abs(a[n-1]-k)+a[0]));
	cout <<sum-maxx<<endl;
	
}

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

int main()
{
	int A,B,C,X,ans(0);
	cin >> A >> B >> C >> X;
	if(X >= 500){
		for(int a(0);a <= min(X/500, A); ++a){
			int Xa = X - 500 * a;
			for(int b(0); b <= min(Xa/100, B); ++b){
				int Xb = Xa - 100 * b;
				if(C >= Xb/50) ans++;
			}
		}
	}else if(X >= 100){
		for(int b(0); b <= min(X/100, B); ++b){
			int Xb = X - 100 * b;
			if(C >= Xb/50) ans++;
		}
	}else{
		ans = 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    long[] a = sc.nextLongArray(n);
    HashMap<Long, List<Integer>> sum = new HashMap<>();
    HashMap<Long, List<Integer>> diff = new HashMap<>();
    for (int i = 0; i < n; i++) {
      long s = -1L * (a[i] + (long) i);
      if (!sum.containsKey(s)) sum.put(s, new ArrayList<>());
      sum.get(s).add(i);
      long d = a[i] - (long) i;
      if (!diff.containsKey(d)) diff.put(d, new ArrayList<>());
      diff.get(d).add(i);
    }
    long count = 0;
    for (long key : sum.keySet()) {
      if (!diff.containsKey(key)) continue;
      List<Integer> js = diff.get(key);
      int size = js.size();
      for (int i : sum.get(key)) {
        if (i > js.get(size - 1)) break;
        if (i < js.get(0)) {
          count += size;
          continue;
        }
        int left = -1;
        int right = size - 1;
        while (right - left > 1) {
          int m = left + (right - left) / 2;
          if (js.get(m) > i) right = m;
          else left = m;
        }
        count += (long) size - (long) right;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 118108
#include<stdio.h>
#define d_flag 0 //
#define min(a,b) ((a)<(b)?(a):(b)) //if (a < b) então x = a, senão x = b
#define max(a,b) ((a)<(b)?(b):(a)) 
#define abs(a) max((a),-(a)) //valor absoluto de a, retornando o maior entre a e -a

int main(){
  int n,k;
  scanf("%d%d",&n,&k);
  int i,h[n],dp[n],j;
  
  
  for(i=0;i<min(k,n);i++){
    scanf("%d",&h[i]);
    dp[i]=abs(h[0]-h[i]);
  }
  if(d_flag)
    printf("max(%d,%d)=%d,abs(-5)=%d\n",h[0],h[1],max(h[0],h[1]),abs(-5));
  for(;i<n;i++){
    scanf("%d",&h[i]);
    dp[i]=dp[i-k]+abs(h[i-k]-h[i]);
    if(d_flag) printf("dp[%d]:%d",i,dp[i]);
    for(j=1;j<k;j++){
      int temp=dp[i-j]+abs(h[i-j]-h[i]);
      if(temp<dp[i]){
	dp[i]=temp;
	if(d_flag)printf("-> %d",dp[i]);
      }
    }
    if(d_flag)printf("\n");
  }
  if(d_flag){
    for(i=0;i<n;i++)
      printf(" %d",dp[i]);
    printf("\n");
    for(i=0;i<k;i++){
      printf("dp[%d]=abs(%d-%d)=%d\n",i,h[0],h[i],dp[i]);
    }
    for(;i<n;i++){
      printf("dp[%d]=min( ",i);
      for(j=1;j<=k;j++)
	printf("[%d+%d] ",dp[i-j],abs(h[i-j]-h[i]));
      printf(")=%d\n",dp[i]);
    }
  }
  printf("%d",dp[n-1]);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int n,ans;
char a[100003];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
	cin>>a[i];
	if(i>1)
	    if(a[i]!=a[i-1])
		ans++;
    }
    cout<<ans+1;
    return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(100);
  for (int r = 0; r < N; r++) {
    int s = 0;
    for (int i = 0; i < 2 * M; i++) {
      cin >> vec.at(i);
      if (vec.at(i) == r + 1) {
        s++;
      }
    }   
    cout << s << endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
const int maxn = 3e3 + 5;
#define SZ(x) (int)(x.size())
using namespace std;

int dp[maxn][maxn], from[maxn][maxn];
int main() {
	string s, t;
	cin >> s >> t;
	memset(dp, 0, sizeof(dp));
	for (int i = 1; i <= SZ(s); i++)  {
		for (int j = 1; j <= SZ(t); j++) {
			if (s[i - 1] == t[j - 1]) {
				dp[i][j] = dp[i-1][j-1] + 1;
				from[i][j] = 2;
			}
			else {
				if (dp[i-1][j] >= dp[i][j-1]) {
					dp[i][j] = dp[i-1][j];
					from[i][j] = 1;
				}
				else {
					dp[i][j] = dp[i][j - 1];
					from[i][j] = 3;
				}
			} 
		} 
	}
	int x = SZ(s), y = SZ(t);
	vector<char> ans;
	while (x > 0 && y > 0) {
		if (from[x][y] == 1) x--;
		else if (from[x][y] == 2) {
			ans.push_back(s[x - 1]);
			x--;
			y--;
		}
		else {
			y--;
		}
	}
	reverse(ans.begin(), ans.end());
	
	for (char c:ans) cout << c;
	cout << "\n";
}

Measured memory_bytes: 74096
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vint = vector<int>;

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

	int n[3], resu = 0;
	cin >> n[0] >> n[1] >> n[2];
	sort(n, n+3);
	while (n[1] < n[2]){
		n[0]++;
		n[1]++;
		resu++;
	}
	while((n[1]-n[0]) / 2 >= 1){
		n[0] += 2;
		resu++;
	}
	if (n[1]-n[0] == 1){
		resu += 2;
	}
	cout << resu << "\n";
	return 0;
}

Measured memory_bytes: 256
// Aizu 1167: Pollock's conjecture
// 2017.9.14 bal4u@uu
// 2017.11.23

#include <stdio.h>
#include <string.h>

#define min(a,b) ((a)<=(b)?(a):(b))
#define MAX 1000000
#define N 181
int tbl[N+3], a[MAX+3], b[MAX+3];

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

	for (n = 1; n <= N; n++) tbl[n] = tbl[n-1] + (n*(n+1) >> 1);
	for (i = 1; i <= MAX; i++) {
		a[i] = b[i] = i;
		for (j = 0; tbl[j] <= i; j++) {
			k = i-tbl[j];
			if (a[k]+1 < a[i]) a[i] = a[k]+1;
			if (tbl[j] & 1 && b[k]+1 < b[i]) b[i] = b[k]+1;
		}
	}
	while(scanf("%d", &n) && n)	printf("%d %d\n", a[n], b[n]);
	return 0;
}

Measured memory_bytes: 9504
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
static const int MOD = 1000000007;
static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll
//struct edge {int to,cost;};

signed main(){
    int a,b,c;
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 764
N=int(input())
L_list=list(map(int, input().split()))

ans=0

for i in range(N):
	for j in range(i, N):
		for k in range(j, N):
			if L_list[i]!= L_list[j] and L_list[j] != L_list[k] and L_list[k] != L_list[i]:
				if L_list[i]+L_list[j]> L_list[k] and L_list[j]+L_list[k]>L_list[i] and L_list[k]+L_list[i]>L_list[j]:
					ans+=1
print(ans)


Measured memory_bytes: 9064