akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<array>
#include<vector>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <utility>
#include <set>

using llint = long long int;
using namespace std;

namespace CsF {
#define MIN_INT -2147483648
#define MAX_INT 2147483647

#define nfor(I,J,K) for(int I = 0;I < J;I+=K)


	string ConvertBit(int N, int e) {
		string s = "";
		int r = 0;
		while (N != 0) {
			r = N % e;
			s = to_string(r) + s;
			N -= r;
			N /= e;
		}
		return s;
	}

	int GCD(int a, int b) {
		if (a < b)swap(a, b);
		int r = a % b;
		while (r != 0) {
			a = b;
			b = r;
			r = a % b;
		}
		return b;
	}

	int LCM(int a, int b) {
		int n = a * b;
		return (n / GCD(a, b));
	}

	int Count(string s, char c) {
		int cou = 0;
		nfor(i, s.length(), 1) {
			if (s[i] == c)cou++;
		}
		return cou;
	}
}

using namespace CsF;


int main() {
	int H, W;
	cin >> H >> W;
	string s[100];
	bool w[100];
	bool h[100];
	nfor(i, H, 1) {
		cin >> s[i];
	}
	nfor(i, H, 1) {
		if (s[i][0] == '.' && Count(s[i], s[i][0]) == W) {
			h[i] = false;
		}
		else h[i] = true;
	}
	bool flag = true;
	nfor(i, W, 1) {
		if (s[0][i] == '#') {
			w[i] = true;
			continue;
		}
		flag = true;
		nfor(j, H, 1) {
			if (s[0][i] != s[j][i]) {
				flag = false;
				break;
			}
		}
		if (flag) {
			w[i] = false;
		}
		else w[i] = true;
	}
	bool write = false;
	nfor(i, H, 1) {
		if (!h[i])continue;
		write = false;
		nfor(j, W, 1) {
			if (h[i] && w[j]) {
				cout << s[i][j];
				write = true;
			}
		}
		if (write)cout << endl;
	}

	return 0;
}



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

int main(void) {
	ios::sync_with_stdio(false);
	int N, M, i, j, K, re;
	cin >> N >> M;
	re = 0;
	int A_count[M],A[M];
	for (i = 0; i < M; i++) {
		A_count[i] = 0;
	}
	for (i = 0; i < N; i++) {
		cin >> K;
		for (j = 0; j < K; j++) {
			cin >> A[j];
			A_count[A[j] - 1] += 1;
			
		}
	}
	for (i = 0; i < M; i++) {
		if (A_count[i] == N) re += 1;
	}
	cout << re;
	return 0;
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
ans = ""
dif_y = ty-sy
dif_x = tx-sx
ans += "U" * dif_y
ans += "R" * dif_x
ans += "D" * dif_y
ans += "L" * dif_x
ans += "L"
ans += "U" * (dif_y+1)
ans += "R" * (dif_x+1)
ans += "D"
ans += "R"
ans += "D" * (dif_y+1)
ans += "L" * (dif_x+1)
ans += "U"
print(ans)

Measured memory_bytes: 3064
use proconio::input;

fn main() {
    input! {
        n:i32,
    }
    match n % 10 {
        2 => println!("hon"),
        4 => println!("hon"),
        5 => println!("hon"),
        7 => println!("hon"),
        9 => println!("hon"),
        0 => println!("pon"),
        1 => println!("pon"),
        6 => println!("pon"),
        8 => println!("pon"),
        3 => println!("bon"),
        _ => unreachable!(),
    }
}


Measured memory_bytes: 2112
N = int(input())
P = list(map(float, input().split()))

dp = [[0 for _ in  range(N+1)] for _ in range(N+1)] # dp[i][j]: コインをi+1枚投げたとき、表がj枚出る確率

dp[0][0] = 1

for i in range(N):
    for j in range(0, i+1):
        dp[i+1][j] += dp[i][j] * (1 - P[i])
        dp[i+1][j+1] += dp[i][j] * P[i]

ans = 0
for i in range(N+1)[::-1]:
    if i > (N - i):        
        ans += dp[N][i]

print(ans)

Measured memory_bytes: 256776
#include <stdio.h>

int main(void){
  int a, b, c, i;
  int d = 0;
  
  scanf("%d %d %d\n", &a, &b, &c);
  
  for(i = a; i <= b; i++)
    if(c % i == 0)
      d++;

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

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A;
  cin >> N >> A;
  if(A >= N){
    cout << "Yes" << endl;
  }
  else if(N%500 <= A){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main(){
    cin>>N;
    cout<<N*(N-1)/2<<endl;
}

Measured memory_bytes: 256
// Author: Shusuke Ueda
// AtCoder Beginner Contest 134 - Problem C

#include <iostream>
#include <vector>

int main() {
    int n;
    std::cin >> n;
    std::vector<int> a(n + 2);
    for (int i = 1; i <= n; i++) {
        std::cin >> a[i];
    }
    std::vector<int> left(n + 2), right(n + 2);
    for (int i = 1; i <= n; i++) {
        left[i] = std::max(left[i - 1], a[i]);
        right[n + 1 - i] = std::max(right[n + 2 - i], a[n + 1 - i]);
    }

    for (int i = 1; i <= n; i++) {
        std::cout << std::max(left[i - 1], right[i + 1]) << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

signed main() {
	int i, n,A[2][110];
	cin >> n;
	rep(i, n) cin >> A[0][i];
	rep(i, n) cin >> A[1][i];
	int s1[110] = { 0 };
	int s2[110] = { 0 };
	for (int i = 1; i < n + 1; i++) {
		s1[i] = s1[i - 1] + A[0][i - 1];
		s2[i] = s2[i - 1] + A[1][i - 1];
	}
	int sum = 0;
	int ans = -1;
	rep(i, n) {
		ans = max(ans, s1[i + 1] + s2[n] - s2[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 31940
import java.util.*;
public class Main{
 public static void main(String []args){
 int a,b,c;
   Scanner sc=new Scanner(System.in);
   a=sc.nextInt();
   b=sc.nextInt();
   c=sc.nextInt();
   System.out.print(c+" "+a+" "+b);
  } 
}


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

using namespace std;

int main() {
    string O, E;
    cin >> O >> E;

    bool end_even = O.length() - E.length() == 0;
    for (int i = 0; i < O.length(); i++) {
        cout << O[i];
        if (end_even || i < O.length() - 1) {
            cout << E[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
// AOJ ITP2_9_C Set Difference
// 2019.3.8 bal4u

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

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in()   // 非負整数の入力
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)    // 非負整数の表示　最後に改行あり
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}

#define INF 1000000001
int n, m;
int a[200002], b[200002];

int main()
{
	int i, j;

	n = in();
	for (i = 0; i < n; i++) a[i] = in();
	a[i] = INF;
	m = in();
	for (j = 0; j < m; j++) b[j] = in();
	b[j] = INF;
	i = j = 0; while (1) {
		while (a[i] < b[j]) out(a[i++]);
		while (b[j] < a[i]) j++;
		if (a[i] == INF) break;
		if (a[i] == b[j]) i++, j++;
	}
	return 0;
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int main()
{
    int ans=0;
    ll x,y;
    cin>>x>>y;
    while(x<=y)
    {
        ans++;
        x*=2;
    }
    print(ans);
}

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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
	int a, b;
	cin >> a >> b;
	int c[3] = {a + b, a - b, a * b};
	sort(c, c + 3, greater<int>());
	cout << c[0];
	return 0;
}

Measured memory_bytes: 256
// #include<iostream>
// #include<vector>
// #include<algorithm>
// #include<map>
// #include<cstring>
// #include<math.h>
// #include<bitset>
// #include<queue>
// #include<set>
// #include<iomanip>
// #include<math.h>
// #include<assert.h>
// #include<string>
// #include<cstdlib>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------
int main(){
  ll X,Y;
  cin >> X >> Y;
  ll cnt = 0;
  while(Y>=X){
    Y /= 2;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
typedef long long ll;

using namespace std;

int main(void){
    ll a,b;
    cin>>a>>b;
    ll ans=a*b;
    if(ans%2==0)    cout<<"Even"<<endl;
    else    cout<<"Odd"<<endl;
    return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef double ld;
typedef pair<ll, int> pll;

const ll mod = 1e9 + 7;
const int nmax = 200500;

void add(ll& a, ll b)
{
    a += b;
    if (a >= mod) {
        a -= mod;
    }
}

void mul(ll& a, ll b)
{
    a *= b;
    if (a >= mod) {
        a %= mod;
    }
}

ll binpow(ll a, ll n)
{
    ll ans = 1;
    while (n) {
        if (n & 1) {
            mul(ans, a);
        }
        n >>= 1;
        if (n) {
            mul(a, a);
        }
    }
    return ans;
}

vector<ll> fact(nmax), rfact(nmax);

ll choose(int n, int k)
{
    ll ans = fact[n];
    mul(ans, rfact[k]);
    mul(ans, rfact[n - k]);
    return ans;
}

int main()
{

    //ifstream cin("input.txt");
    //freopen("input.txt", "r", stdin);

    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    fact[0] = rfact[0] = 1;
    for (int i = 1; i < nmax; ++i) {
        fact[i] = fact[i - 1];
        mul(fact[i], i);
        rfact[i] = binpow(fact[i], mod - 2);
    }

    int n, m, a, b;
    cin >> n >> m >> a >> b;
    ll ans = 0;
    a = n - a;

    for (int i = 0; i < a; ++i) {
        ll val = choose(b + i - 1, b - 1);
        mul(val, choose(n + m - b - i - 2, n - i - 1));
        add(ans, val);
    }

    cout << ans << "\n";

}


Measured memory_bytes: 3328
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define sz(x) int(x.size())
#define input_code ifstream in("input.txt");cin.rdbuf(in.rdbuf())

using namespace std;

int main(int argc, const char * argv[]) {
    
    //  [erase]
    //
    
    int k, x;
    cin >> k >> x;
    bool space = false;
    for(int i = x-k+1; i<x+k; i++){
        if(!space){
            space = true;
        }else cout << " ";
        cout <<i;
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
"""
・ビーカーの総重量がFを超えないように
・ビーカー内に砂糖の溶け残りが出ないように（水100gに対しEg溶ける）
・できるだけ濃度の高い砂糖水を作る
この砂糖水の全質量と砂糖の量を答える

操作は
・水を　100*A or 100*B 追加
・砂糖を　C or D 追加

愚直に考えると、
（１）砂糖水の集合がある。これから一つ取り出して、
（２）水（100A or 100B）、砂糖（C or D）のいずれかを加える。行える操作は全部試すので、4通りに分岐
（３）溶け残りやFを超えるなどした場合は除外する
（４）（３）の判定を通過した各砂糖水に対し、これまでに作った砂糖水より濃度が大きければ、答えとして更新する
（５）（４）で評価した砂糖水を（１）の集合に戻す
のように、ありえるパターンを全部試す。
CやDが小さいと間に合わないはず。重複ができたりするとしんどい。

容器の最大容量Fが <=3000と小さい。
なので、今回は先に作れる水の重量を全探索で作っておいて、それらに砂糖を入れられるだけ入れる、の方法でやると、
水の操作と砂糖の操作を独立に行えるので、計算量を減らせる。
砂糖も初めに全探索で、何gのができるか全部つくっておいて、水と全部の組み合わせを試して～みたいな感じにしてもいいかも。
ビーカーが3000までなので、最大でも3000*3000の組み合わせなので、間に合いそう
"""

from collections import deque


A,B,C,D,E,F = map(int, input().split())

waters = set()
for i in range(F // (100*A) + 1):
    for j in range((F - 100*A*i) // (100*B) + 1):
        if 100*A*i + 100*B*j > F:
            continue
        waters.add(100*A*i + 100*B*j)

sugars = set()
for i in range(F // C + 1):
    for j in range((F - C*i) // D + 1):
        if C*i + D*j > F:
            continue
        sugars.add(C*i + D*j)


waters = list(waters)
waters.sort()
sugars = list(sugars)
sugars.sort()

ans = [0.0, 100*A, 0]

for w in waters:
    if w == 0:
        continue
    for s in sugars:
        if w+s > F:
            break
        if s / (w+s+0.0) > E / (E + 100.0):
            break
        
        if s / (w+s) > ans[0]:
            ans = [s / (w+s+0.0), w+s, s]

print(ans[1], ans[2])


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans = (s[0] - '0') + 9 * (s.size() - 1);
    for(int i = 1; i < s.size(); i++){
        if(s[i] != '9'){
            ans--;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<sstream>
using namespace std;stringstream input;struct complex{bool ov;int re,im;complex(int re_,int im_,bool ov_=false):re(re_),im(im_),ov(ov_){if(!ov){ov=max(abs(re),abs(im))>10000;}}complex operator-(){return complex(-re,-im,ov);}void operator+=(const complex&c){*this=complex(re+c.re,im+c.im,ov|c.ov);}void operator-=(const complex&c){*this=complex(re-c.re,im-c.im,ov|c.ov);}void operator*=(const complex&c){*this=complex(re*c.re-im*c.im,re*c.im+im*c.re,ov|c.ov);}};const complex i(0,1);complex term();complex factor();complex expr();complex expr(){complex c=term();char ch;for(;;){if(input.peek()=='+'){input>>ch;c+=term();}else if(input.peek()=='-'){input>>ch;c-=term();}else break;}return c;}complex term(){complex c=factor();for(char ch;input.peek()=='*';c*=factor())input>>ch;return c;}complex factor(){char ch;if(input.peek()=='('){input>>ch;complex c=expr();input>>ch;return c;}if(input.peek()=='i'){input>>ch;return i;}if(input.peek()=='+'){input>>ch;return factor();}if(input.peek()=='-'){input>>ch;return-factor();}int val;input>>val;return complex(val,0,input.fail());}main(){for(string s;getline(cin,s);){input.clear();input.str(s);complex c=expr();if(c.ov)cout<<"overflow";else{if(c.re){cout<<c.re;if(c.im>0)cout<<'+';}else if(!c.im)cout<<'0';if(c.im){cout<<c.im<<'i';}}cout<<endl;}}

Measured memory_bytes: 0
#define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;
const string YES = "Yes";
const string NO = "No";

ll N;
vl x;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    x = vl(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    solve();
}

// 1 ≤ N ≤ 500
// 1 ≤ x_i ≤ N^2
// x_i はすべて相異なる。

// ll N, vl x
// 条件をすべて満たす数列 a が存在しないならば、No を出力せよ。存在するならば、1 行目に Yes を出力し、2 行目に a を空白区切りで出力せよ。
void solve(){
    vl a(N*N,-1);
    rep(i,N)a[x[i]-1]=i+1;

    queue<ll> reserved;
    rep(i,N*N){
        if(a[i]!=-1)rep(j,1,a[i])reserved.push(a[i]);
    }

    vl ans(N*N);
    vl used(N+1);
    queue<ll> waiting;
    rep(i,N*N){
        if(a[i]==-1){
            if(reserved.size()){
                ll x=reserved.front();reserved.pop();
                if(used[x]){
                    cout<<NO<<endl;
                    return;
                }
                ans[i]=x;
            }else{
                if(waiting.empty()){
                    cout<<NO<<endl;
                    return;
                }
                ll x=waiting.front();waiting.pop();
                ans[i]=x;
            }
        }else{
            ans[i]=a[i];
            used[a[i]]=true;
            rep(j,N-a[i])waiting.push(a[i]);
        }
    }
    cout<<YES<<endl;
    rep(i,N*N){
        if(i>0)cout<<' ';
        cout<<ans[i];
    }
    cout<<endl;
}


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

int main() {
  int n;
  cin>>n;
  long a[n], b[n];
  long long a2[n], b2[n];
  for (int i=0; i<n; i++) {
    cin>>a[i]>>b[i];
    a[i] *= 2;
    b[i] *= 2;
    a2[i] = a[i];
    b2[i] = b[i];
  }
  sort(a2, a2 + n);
  sort(b2, b2 + n);
  long init_left = (a2[n/2] + a2[(n-1)/2]) / 2;
  long init_right = (b2[n/2] + b2[(n-1)/2]) / 2;
  long l1 = init_left, r1 = init_right + 1;
  while (r1 - l1 > 1) {
    long mid = (r1 + l1) / 2;
    int cnt_left = 0, cnt_right = 0;
    for (int i=0; i<n; i++) {
      if (mid == a[i] && mid == b[i]) {
        continue;
      }
      if (b[i] < mid) {
        ++cnt_left;
      } else if (a[i] > mid) {
        ++cnt_right;
      }
    }
    if (cnt_left > n / 2 || cnt_right > n / 2) {
      l1 = mid;
    } else {
      r1 = mid;
    }
  }
  long left = l1;
  l1 = init_left-1, r1 = init_right;
  while (r1 - l1 > 1) {
    long mid = (1LL * r1 + l1) / 2;
    int cnt_left = 0, cnt_right = 0;
    for (int i=0; i<n; i++) {
      if (mid == a[i] && mid == b[i]) {
        continue;
      }
      if (b[i] < mid) {
        ++cnt_left;
      } else if (a[i] > mid) {
        ++cnt_right;
      }
    }
    if (cnt_left > n / 2 || cnt_right > n / 2) {
      r1 = mid;
    } else {
      l1 = mid;
    }
  }
  long right = r1;
  if (n % 2 == 0) {
    cout<<right - left + 1<<endl;
  } else {
    cout<<right/2 - left/2 + 1<<endl;
  }
}

Measured memory_bytes: 9884
import numpy as np

N, M, C = map(int, input().split())
B = np.array([int(b) for b in input().split()])
As = np.array([[int(a) for a in input().split()] for _ in range(N)])

res = np.sum(As * B, axis=1) + C
l = len(np.where(res > 0)[0])

print(l)


Measured memory_bytes: 12452
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;

signed main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  int B[N];
  for (int i = 0; i < N; i++) cin >> B[i];
  int C[N];
  for (int i = 0; i < N-1; i++) cin >> C[i];
  int ans = 0;
  int prev = -1;
  rep(i, N) {
    ans += B[A[i]-1];
    if (prev+1 == A[i]) ans += C[A[i-1]-1];
    prev = A[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input
        .split_whitespace()
        .skip(1)
        .map(|x| x.parse::<i64>().unwrap())
        .collect::<Vec<_>>();
    let sum = list.clone().into_iter().sum::<i64>();
    if sum % 10 == 0 {
        let min = list.into_iter().filter(|x| x % 10 != 0).fold(None, |c, x| {
            Some(match c {
                None => x,
                Some(c) => {
                    if x < c {
                        x
                    } else {
                        c
                    }
                }
            })
        });
        match min {
            Some(min) => sum - min,
            None => 0,
        }
    } else {
        sum
    }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!(super::run($input.to_string()), $output.to_string());
                }
            )*
        }
    }
}

tests! {
    test1: "3
5
10
15" => "25",
    test2: "3
10
10
15" => "35",
    test3: "3
10
20
30
" => "0",
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define f first
#define s second
#define ll long long
#define mp make_pair
#define pb push_back
#define sqr(x) (x)*(x)
#define matrix vector < vector<int> >

using namespace std;

const double eps = 1e-9;
const double PI = acos(-1.0);
const int INF = int (1e9+7);
const int mod = int (1e9+7);
const int N = int (2e5+7);    

int n, a[3];           

int main () { 
   	//freopen("peacefulsets.in", "r", stdin);
   	//freopen("peacefulsets.out", "w", stdout);  
   	ios_base::sync_with_stdio(0);
	cin.tie(0);

	for(int i = 0; i < 3; i ++)
		cin >> a[i];
	sort(a, a + 3);
	if(a[0] & 1 && a[1] & 1 && a[2] & 1)
		cout << a[0] * 1ll * a[1];
	else	
		cout << 0;
	return 0;
} 

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

int main(void) {
  long long n, m;
  cin >> n >> m;
  if (n < m) swap(n ,m);
  if (n > 1 && m > 1) {
    cout << (n - 2) * (m - 2) << endl; 
  } else if (n > 1) {
    cout << n - 2 << endl;
  } else {
    cout << 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  priority_queue<ll> q;
  ll res = 0, sum_A = 0, sum_B = 0, x;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum_A += A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
    sum_B += B[i];
  }
  if (sum_A < sum_B) {
    cout << -1 << endl;
    return 0;
  }
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    x = B[i] - A[i];
    res += max(0LL, x);
    if (x < 0) q.push(A[i] - B[i]);
    if (x > 0) ans++;
  }
  if (res == 0) {
    cout << 0 << endl;
    return 0;
  }
  while (!q.empty() && res > 0) {
    x = q.top();
    q.pop();
    res -= x;
    ans++;
  }
  if (res > 0) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2428
n=input()
l=len(n)
n=int(n)
if l==1:
    print(n)
elif l==2:
    print(9)
elif l==3:
    print(n-90)
elif l==4:
    print(909)
elif l==5:
    print(n-90-9000)
else:
    print(90909)


Measured memory_bytes: 38384
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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

template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main() {
	string s;
	cin >> s;
	int sum = 0;
	for (int i = 0; i < s.size(); ++i) {
		sum += stoi(s.substr(i, 1));
		sum = sum % 9;
	}
	if (sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3724
n = int(input())
s = list(input())

cnt = [s.count('.'), s.count('#')]

cnt0 = 0
cnt1 = 0
ans = float("inf")
for i in range(n):
    if s[i] == '.':
        cnt0 += 1
    if s[i] == '#':
        cnt1 += 1
    ans = min(ans, cnt1 + cnt[0] - cnt0)

if ans > min(cnt):
    print(min(cnt))
else:
    print(ans)


Measured memory_bytes: 4840
N = int(input())

pf = [0] * (N + 1)
for n in range(2, N + 1):
    cur = n
    for i in range(2, n + 1):
        while cur % i == 0:
            pf[i] += 1
            cur //= i

def num(n):
    return len(list(filter(lambda x: x >= n - 1, pf)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) \
          + num(5) * (num(5) - 1) * (num(3) - 2) // 2)



Measured memory_bytes: 38512
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "ctime"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 1e-8;

long long int N, M, K, H, W, L, R;

long long int gcd(long long int a, long long int b) {
	if (a < b)swap(a, b);
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

	cin >> N >> K;
	long long int ans = 0;
	cin >> M;
	ans = abs(M-K);
	for (int i = 1; i < N; i++) {
		cin >> M;
		ans = gcd(ans, abs(M - K));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
<?php
[$N, $M] = ints();
$A = ints();
$sum = array_sum($A);
$left = $N-$sum;
echo max(-1, $left);

function str(){return trim(fgets(STDIN));}
function ints(){return array_map('intval',explode(' ',trim(fgets(STDIN))));}
function int(){return intval(trim(fgets(STDIN)));}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}
function popcount($x){$c=0;while($x){$x&=$x-1;++$c;}return$c;}
function o(...$val){
    if(count($val)==1)$val=array_shift($val);
    echo debug_backtrace()[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0)echo "empty array";
        elseif(!is_array(current($val)))echo "array: ",implode(" ", addIndex($val)),"\n";
        else{
            echo "array:array\n";
            if(isCleanArray($val))foreach($val as $row)echo implode(" ", addIndex($row)),"\n";
            else foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row)),"\n";
        }
    }else echo $val."\n";
}
function addIndex($val){if(!isCleanArray($val)){$val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);}return $val;}
function isCleanArray($array){$clean=true;$i = 0;foreach($array as $k=>$v){if($k != $i++)$clean = false;}return $clean;}
// 座圧対象の配列 -> [圧縮された配列,復元用のMap,圧縮用のMap]
function atsu($array){$a = array_flip($array);$fuku=array_flip($a);sort($fuku);$atsu = array_flip($fuku);foreach($array as $i=>$val)$array[$i]=$atsu[$val];return [$array, $fuku, $atsu];}
function gcdAll($array){$gcd=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$gcd=gcd($gcd,$array[$i]);}return $gcd;}
function gcd($m, $n){if(!$n)return $m;return gcd($n, $m % $n);}
function lcmAll($array){$lcm=$array[0];for($i=1,$I=count($array);$i<$I;++$i){$lcm=lcm($lcm,$array[$i]);}return $lcm;}
function lcm($a, $b) {return $a / gcd($a, $b) * $b;}

function dfs($current, $from = -1, $d = 0){
  global $G, $distance;
  $distance[$current] = $d;
  foreach($G[$current] as $to){
    if($from != $to){
      dfs($to, $current, $d + 1);
    }
  }
}

function loadTree($N = false){
  if($N === false)$N = $GLOBALS['N'];
  return loadGraph($N, $N-1);
}
function loadGraph($N = false, $M = false, $both = true){
  if($N === false)$N = $GLOBALS['N'];
  if($M === false)$M = $GLOBALS['M'];
  $G = array_fill(1, $N, []);
  for($i = 0; $i < $M; $i++){
    $values = ints();
    if(count($values) == 2){
      list($a, $b) = $values;
      $G[$a][] = $b;
      if($both)$G[$b][] = $a;
    }else{
      list($a, $b, $d) = $values;
      $G[$a][] = [$b, $d];
      if($both)$G[$b][] = [$a, $d];
    }
  }
  return $G;
}


Measured memory_bytes: 17056
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 2147483647//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int h,w;
    cin >> h >> w;
    vector< vector<char>> table(h,vector<char>(w));
    rep(i,h)rep(j,w)cin >> table.at(i).at(j);
    vector<int> horizon;
    vector<int> virtical;
    rep(i,h){
        bool b = true;
        rep(j,w)if(table.at(i).at(j) != '.')b = false;
        if(b)horizon.push_back(i);
    }
    rep(i,w){
        bool b = true;
        rep(j,h)if(table.at(j).at(i) != '.')b = false;
        if(b)virtical.push_back(i);
    }
    rep(i,h){
        if(find(horizon.begin(),horizon.end(),i) == horizon.end()){
            rep(j,w){
                if(find(virtical.begin(),virtical.end(),j) == virtical.end()){
                    cout << table.at(i).at(j);
                }
            }
            cout << endl;
        }else{
        }
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
S = input()
T = input()

Tn = len(T)
best = 0
for s in range(len(S)-len(T)+1):
    count = 0
    for t in range(Tn):
        if S[s+t] == T[t]:
            count += 1
    if count > best:
        best = count

print(Tn-best)

Measured memory_bytes: 9044
n = int(input())
nums = list(map(int, input().split()))
print(" ".join(list(map(str, nums))))
for i in range(1, n):
    for j in range(i):
        if nums[j] > nums[i]:
            nums.insert(j, nums.pop(i))
    print(" ".join(list(map(str, nums))))


Measured memory_bytes: 5600
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N,K=mis()
    p=lmis()
    p.sort()
    print(sum(p[:K]))


main()



Measured memory_bytes: 9940
#include <bits/stdc++.h>
using namespace std;
const int INF = 2100100100;
using ll = long long;

int main(){
    int a,b;
    cin >> a >> b;
    for (int i=0;i<=1250;i++){
        if(i*8/100 == a && i/10 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern; 

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

        int sum = 0;

        if(a > k){
            sum = k;
        }else if(a + b > k){
            sum = a;
        }else{
            sum = a - (k - a - b);
        }

        System.out.println(sum);

        scan.close();
    }
}

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

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;



int main() {


    int n,m;
    cin>>n>>m;
    vvi v(n);
    vi h(n);rep(i,n)cin>>h[i];
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    int ans=0;
    rep(i,n){
        bool ch=1;
        rep(j,v[i].size()){
            if(h[i]<=h[v[i][j]])ch=0;
        }
        if(ch)ans++;
    }
    fin(ans);
}



Measured memory_bytes: 8804
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * n

dp[0] = 0

for i in range(1, n):
    for j in range(1, k+1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))

print(dp[n-1])


Measured memory_bytes: 55392
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {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;}}
long long COM(int n, int k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int cntw=0;
  rep(i,n) if(s[i]=='W')cntw++;
  ll ans=0;
  for(int i=0;i<n-cntw;i++){
    if(s[i]=='W') ans++;
  }
  cout<<ans<<endl;
}


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
//for set
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   
// for multiset
// typedef tree<
// int,
// null_type,
// less<int>,
// rb_tree_tag,
// tree_order_statistics_node_update> ordered_multiset;

#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
// int MOD=998244353;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int cmp(const ii& p1, const ii& p2) {
	return (p1.ss>p2.ss);
}

signed main(void)
{
	IOS;
	string s; cin>>s;
	for(int i = 0;i < s.length(); i++) {
		cout<<"x";
	}
	cout<<endl;
	time();
	return 0;
}

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

int main(){
 int N;
  cin >>N;
  int ans=0;
  vector<int> flag(101,0);
  
  for (int i=0;i<N;i++){
    int d;
   cin >> d; 
    flag.at(d) =1;
  }
  for (int i=0;i<flag.size();i++){
   ans += flag.at(i);
  }
  
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Alhamdulillah return 0;
#define loop(i,k,n) for (ll i = k ; i < n ; ++i)
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl

void Suhaib_Sawalha (){

    for (int i = 0 ; i < 5 ; ++i){
        int a;
        cin >> a;
        if (a != i+1){
            cout << i+1;
            return;
        }
    }

}

int main(){
                                In_The_Name_Of_Allah_The_Merciful   /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
    freopen("SuhaibSawalha1.txt","r",stdin);
#endif
//int _;for(cin>>_;_;--_,cout<<'\n')
        Suhaib_Sawalha();
                                         Alhamdulillah                    /* الحمد لله */
}


Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <string>

using namespace std;

constexpr auto BASE = 1000000007;


class atcalc {

public:
	static int add(int a, int b)
	{
		return (int)(((long long)a + b) % BASE);
	}
	static int times(int a, int b)
	{
		return (int)(((long long)a * b) % BASE);
	}
	static int div(int a, int b)
	{
		return (int)(((long long)a * atcalc::modinv(b,BASE)) % BASE);
	}

	static int comb(int a, int b)
	{
		if (a < b) { return 0; }
		if (b > a / 2) { b = a - b; }
		if (b == 0) { return 1; }


		int ans = 1;
		for (int i = 0; i < b; i++) {
			ans = atcalc::times(ans, a-i);
		}
		for (int i = 0; i < b; i++) {
			ans = atcalc::div(ans, i+1);
		}


		return ans;
	}
	
	static int modinv(int a, int m)
	{

		long long x = 0, y = 1, gcd = m;
		long long  px = 1, py = 0, pgcd = a;
		long long temp = 0;

		while (gcd > 0)
		{
			long long quotient = pgcd / gcd;

			temp = x;
			x = px - quotient * temp;
			px = temp;

			temp = y;
			y = py - quotient * temp;
			py = temp;

			temp = gcd;
			gcd = pgcd - quotient * temp;
			pgcd = temp;
		}

		while (px < 0) {
			px += BASE;
		}
		return (int)px;
	}
};



string L;


int main()
{
	cin >> L;

	int len = L.length();

	long long ans = 0;
	int upper = 1;

	vector<int> upper_ary = vector<int>(len+1,1);

	for (int i = 0; i < len; i++){
		if (L.at(i) == '1') {
			upper = atcalc::times(upper,2);
		}
		upper_ary.at(i+1) = upper;
	}

	int under = 1;
	ans = atcalc::add(ans, upper_ary.at(len));
	for (int i = len -1 ; i >= 0; i--) {
		if (L.at(i) == '1') {
			int tmp = atcalc::times(under,upper_ary.at(i));
			ans = atcalc::add(ans, tmp);
		}
		under = atcalc::times(under,3);
	}
	

	cout << ans << endl;


	return 0;
}



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


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

    A = N / 1000;
    B = N % 1000;

    if(B==0){
        cout << 0 << endl;
    }else{
        cout << (A + 1) * 1000 - N << endl;
    }
}

Measured memory_bytes: 3552
#include<stdio.h>
int main(){
	int n,i,a[1000];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(i=n;i>0;i--){
		if(i==1){
			printf("%d\n",a[i]);
		}
		else{
			printf("%d ",a[i]);
		}	
	}
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int MOD = 1000000007;

int n, q;
vector<int> S, T;

int binary_search(int key){
    int ng = -1;
    int ok = S.size() - 1;
    
    while(abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if (S[mid] >= key) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(void){
    cin >> n;
    S.resize(n); for(int i = 0; i < n; i++) cin >> S[i];
    cin >> q;
    T.resize(q); for(int i = 0; i < q; i++) cin >> T[i];
    
    int ans = 0;
    for(int i = 0; i < q; i++){
        int index = binary_search(T[i]);
        if (S[index] == T[i]) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3316
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.io.BufferedOutputStream;
import java.util.function.LongPredicate;
import java.util.function.Predicate;
import java.util.List;
import java.io.*;
import java.util.*;
import java.io.PrintWriter;

public class Main {
    public static void main(final String[] args) {
    	Scanner scanner = new Scanner(System.in);
    	int n = scanner.nextInt();
    	System.out.println((n+1)/2);

    }
}


Measured memory_bytes: 21844