akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

int main(){
    ll n;
    cin>>n;
    map<ll,ll> kosu;
    rep(i,n){
        ll a;
        cin>>a;
        kosu[a]++;
    }
    ll ans = 0;
    for(pl ngo:kosu){
        if(ngo.first > ngo.second) ans += ngo.second;
        else ans += (ngo.second-ngo.first);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9644
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)
// コンパイル　g++ -std=c++17 a.cpp

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll tmp = 0;
    if(a == b){
        tmp++;
    }
    if(b == c){
        tmp++;
    }
    if(c == a){
        tmp++;
    }

    if(tmp == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


}

Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line: Vec<u64> = read_as_vec();
    let (n, k) = (line[0], line[1]);
    
    let mut ans: u64 = (n/k).pow(3);


    if k%2 == 0{
        //ans += ((n+(k-n%k))/k).pow(3);
        let mut count = (n as f64/k as f64).ceil() as u64;
        if count * k - k/2 > n{
            count -= 1;
        }
        ans += count.pow(3);

    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
import static java.lang.Long.bitCount;

public class Main {

	public static void main(String[] args) {
		FastScanner in = new FastScanner();
		int n=in.nextInt();
		System.out.println((1000-(n%1000))%1000);
	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

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

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

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


Measured memory_bytes: 32768
x = int(input())
p = [True] * 100004
p[0] = False
p[1] = False
for i in range(int(100003 ** 0.5)):
    if p[i] == False:
        continue
    for j in range(2, 100003 // i + 1):
        p[i * j] = False
for i in range(x, 100004):
    if p[i] == True:
        print(i)
        break

Measured memory_bytes: 3828
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int l=s.length();
    if(l==1){
        cout << s << endl;
        return 0;
    }

    int ans= (int)(s[0]-'0')-1+9*(l-1);
    bool b=true;
    for(int i=1; i<l; i++){
        if(s[i]!='9') b=false;
    }
    if(b) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
#define rep(i,n) for (ll i=0;i<n;i++)
using namespace std;

struct UnionFind {
    vector<ll> par;
    vector<ll> rank;

    UnionFind(ll N) : par(N),rank(N){
        // 初期化
        rep(i,N) {
            par[i] = i;
            rank[i] = 0;
        }
    }


    ll root(ll x){
        // unionfind木をたどって頂点を探す
        if(par[x]==x) return x;
        else return par[x] = root(par[x]);
    }

    void unite(ll x,ll y){
        // 高さを考慮し、結合する。
        ll rx = root(x);
        ll ry = root(y);
        if(rx==ry) return;
        if(rank[x]<rank[y]){
            par[rx] = y;
        }else{
            par[ry] = x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(ll x,ll y){
        // 親が同じなら同じグループ
        return root(x)==root(y);
    }

};

ll ans = 0;
ll n;
vector<vector<ll>> a;
vector<ll> b;

void dfs(ll start){
    // b[start] = 1;
    bool r = true;
    rep(i,n){
        if(b[i]==0) r = false;
    }
    if(r) {
        ans++;
        // cout << start << endl;
        return;
    }

    for(ll v:a[start]){
        if(b[v]==0){
            b[v] = 1;
            dfs(v);
            b[v] = 0;
        }
    }
    return;
}


void solve(){

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

    cin >> n;

    ll m;
    cin >> m;
    a.resize(n,vector<ll>());
    b.resize(n);
    rep(i,m){
        ll q,w;
        cin >> q >> w;q--;w--;
        a[q].push_back(w);
        a[w].push_back(q);
    }
    b[0] = 1;

    dfs(0);

    cout << ans;




    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <map>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;

#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define IVFOR(p,a) for(vector<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ILFOR(p,a) for(list<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define CHECK(x)  cout << #x << " = " << (x) << endl
#define FINA(y) cout << (y) << endl

int main(){

  int n, l;

  cin >> n >> l;

  vector<string> v(n);

  REP(i,n){
    cin >> v[i];
  }
  SORT(v);

  REP(i,n){
    cout << v[i];
  }

  cout << endl;
    

 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<cctype>
#include<cstring>
#include<list>
#include<map>
#include<sstream>
#include<set>
#include<string>
#include<vector>
typedef long long ll;
using namespace std;
#define MN 300005
#define MM 600005
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define RF(i,a,b) for(int i=a;i>=(b);--i)
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define int long long
signed main()
{
   int n;
   cin>>n;
   int a[n+1];
   memset(a,0,sizeof(a));
   for(int i=0;i<n-1;i++){
       int t;
       cin>>t;
       a[t]++;
   }
   for(int i=1;i<=n;i++)
   cout<<a[i]<<endl;
   return 0;
}


Measured memory_bytes: 5116
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,t,s=0,p=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        t=i;
        while(t>0){
            s++;
            t=t/10;
        }
        if(s%2==1){
            p++;
        }
        s=0;
    }
    cout<<p;
    return 0;
}



Measured memory_bytes: 256
n=int(input())
s=int(input())
ans=-1
def f(a,x):
  if a>x:
    return x
  else:
    return f(a,x//a)+(x%a)
  
for i in range(2,int(n**(1/2))+1):
  if ans<0 and f(i,n)==s:
    ans=i
  

for p in range(1,int(n**(1/2))+1)[::-1]:
  if ans<0:
    if s-p>=0 and (n+p-s)%p==0:
      b=(n+p-s)//p
      if b>=p+1 and b>=s-p+1:
        ans=b
    
if ans<0 and n==s:
  ans=(n+1)

print(ans)


  



Measured memory_bytes: 41712
import itertools
while True:
    n,x = [int(i) for i in input().split()]
    if (n,x)  == (0,0):
        break
    else:
        l = itertools.combinations(range(1,n+1),3)
        ans = 0
        for i in l:
            if sum(i) == x:
                ans += 1
        
        print(ans)



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

using namespace std;
using ll = long long int;

int main(void) {
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n, m, s;
    cin >> n >> m >> s;

    vector<ll> res(n, 1e15);

    vector<vector<tuple<ll,ll,ll>>> G(n);
    while(m--) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--, v--;
        G[u].push_back({v, a, b});
        G[v].push_back({u, a, b});
    }

    vector<tuple<ll,ll>> cd(n);
    for(auto &[c, d]: cd) cin >> c >> d;

    if(s >= 50*50*1) {
        priority_queue<tuple<ll,ll>> q;
        q.push({-0, 0});
        res[0] = 0;
        while(!q.empty()) {
            auto [d, i] = q.top(); q.pop();
            d = -d;
            for(auto [j, a, b] : G[i]) {
                if(res[j] <= d + b) continue;
                res[j] = d + b;
                q.push({-(d+b), j});
            }
        }
        for(ll i=1; i<n; i++)
            cout << res[i] << endl;
        return 0;
    }

    vector<vector<ll>> dp(n, vector<ll>(50*50*1 + 1, 1e15));
    dp[0][s] = 0;
    priority_queue<tuple<ll,ll,ll>> q;
    q.push({-0, s, 0});
    bitset<100> bs;
    while(!q.empty()) {
        auto [d, c, i] = q.top(); q.pop();
        bs[i] = 1;
        if(bs.count() == n) break;
        d = -d;
        if(dp[i][c] < d) continue;
        {
            auto [cc, dd] = cd[i];
            if(c+cc <= 50*50*1 && dp[i][c+cc] > d + dd) {
                dp[i][c+cc] = d+dd;
                q.push({-(d+dd), c+cc, i});
            }
        }
        for(auto [j, a, b]: G[i]) {
            if(c - a < 0) continue;
            if(dp[j][c-a] <= d + b) continue;
            dp[j][c-a] = d + b;
            q.push({-(d+b), c-a, j});
        }
    }
    for(ll i=1; i<n; i++)
        cout << *min_element(dp[i].begin(), dp[i].end()) << endl;
}


Measured memory_bytes: 7196
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  vector<int> ans(100);
  for(int p=0;p<=100;p++){
    int sum=0;
    for(int j=0;j<n;j++){
      sum+=(p-x[j])*(p-x[j]);
    }
    ans[p]=sum;
  }
  sort(ans.begin(),ans.end());
  
  cout << ans[0] << endl;
}


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

int main()
{
	int t1 = 0;
	int t2 = 0;
	int t3 = 0;
	for (int i = 0; i < 10; i++)
	{
		int h;
		cin >> h;
		
		if (t1 < h)
		{
			t3 = t2;
			t2 = t1;
			t1 = h;
		}
		else if (t2 < h)
		{
			t3 = t2;
			t2 = h;
			//t1
		}
		else if (t3 < h)
		{
			t3 = h;
		}
	}
	
	cout << t1 << endl;
	cout << t2 << endl;
	cout << t3 << endl;
	
	return 0;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{ 
    ll n,q,sum=0;
    ss s;
    cin >>n >> q >> s;
    vll l(q),r(q),count(SIZE(s));
    rep(i,q){
        cin >> l[i] >> r[i];
        l[i]--; r[i]--;
    } 
    rep(i,SIZE(s)){
        if(i == 0)continue;
        if(s[i-1] == 'A' && s[i] == 'C')sum++;
        count[i] = sum;
    }
    rep(i,q){
        cout << count[r[i]]-count[l[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
struct mint {
  ll divisor = 998244353;
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % divisor) {
    if (val < 0) val += divisor;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = divisor, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += divisor;
    u %= divisor;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= divisor) val -= divisor;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += divisor;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % divisor;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % divisor;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
};

void answer() {
  ll n, s;
  cin >> n >> s;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<mint> dp(s+1, 0), p(s+1, 0);
  dp[0] = 1;
  rep(i, n) {
    swap(p, dp);
    repc(j, s) {
      dp[j] = mint(2) * p[j];
      if(a[i] <= j) dp[j] += p[j-a[i]];
    }
  }
  cout << dp[s] << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3748
import math
a = int(input())

def f1(i):
    lst = []
    while i > 0:
        lst.append(i%10)
        i //= 10
    lst.reverse()
    return lst

b = f1(a)
c = int (math.log10(a) + 1)
d = 0
e = 9999
for i in range(c-2):
    d = abs(753 - (100*b[i]+10*b[i+1]+b[i+2]))
    if d <= e:
        e = d
print(e)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

signed main() {
  int N;
  cin >> N;
  vector<P> v;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    v.push_back(P(a, 1));
  }
  for (int i = 0; i < N; i++) {
    int b;
    cin >> b;
    v.push_back(P(b, 0));
  }

  sort(ALL(v));

  int ans = 1, a = 0, b = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].second == 1) {
      if (a == 0) {
        b++;
      } else {
        ans *= a;
        ans %= MOD;
        a--;
      }

    } else {
      if (b == 0) {
        a++;
      } else {
        ans *= b;
        ans %= MOD;
        b--;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
  #include "_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

struct UnionFind{
  vector<int> par; //親
  vector<int> size; //集合の大きさ

  UnionFind(int n){
    par.resize(n); size.resize(n, 1);
    for(int i = 0; i < n; i++){
      par[i] = i;
    }
  }

  //木の根を求める
  int root(int x){
    if(par[x] == x){
      return x;
    }else{
      return par[x] = root(par[x]);
    }
  }

  //xとyの属する集合を併合
  void unite(int x,int y){
    x = root(x), y = root(y);
    if(x == y) return;
    if(size[x] < size[y]) swap(x,y);
    par[y] = x;
    size[x] += size[y];
  }

  bool same(int x, int y){
    return root(x) == root(y);
  }
};

struct edge{ 
  int from, to, cost;
  bool operator<(const edge& p) const {
    return cost < p.cost;
  }
  bool operator>(const edge& p) const {
    return cost > p.cost;
  }
};

vector<int> dikstra(vector<vector<edge>> G, int s){
  using P = pair<int, int>;
  priority_queue<P,vector<P>,greater<P>> q;
  vector<int> d(G.size(), 1LL << 60); //sからの最短距離
  d[s] = 0;
  q.push({0, s}); //{最短距離,頂点}

  while(!q.empty()){
    auto p = q.top(); q.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(auto e : G[v]){
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        q.push(P(d[e.to], e.to));
      }
    }
  }
  return d;
}

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v) {
    for (auto &e : t) fill(e, v);
}
// auto v = make_vec<int>(h, w);
// fill(v, 0);

using P = pair<int, int>;

signed main(){

  int n, m; cin >> n >> m;
  map<P, int> mp;
  for(int i = 0; i < m; i++){
    int a, b, c; cin >> a >> b >> c;
    a--, b--;
    if(mp.find(P(a, b)) == mp.end()){
      mp[P(a, b)] = c;
    }else{
      mp[P(a, b)] = min(mp[P(a, b)], c);
    }
  }
  vector<edge> es;
  for(auto p : mp){
    int a = p.first.first, b = p.first.second, c = p.second;
    es.push_back({a, b, c});
    es.push_back({b, a, c});
  }

  sort(es.begin(), es.end());
  int total = 0;
  struct E { int to, cost; };
  vector<vector<E>> g(n);
  UnionFind uf(n);
  for(auto e : es){
    int u = e.from, v = e.to, cost = e.cost;
    if(!uf.same(u, v)){
      total += cost;
      uf.unite(u, v);
      g[u].push_back({v, cost});
      g[v].push_back({u, cost});
    }
  }

  auto dp = make_vec<int>(n, n);
  int start;
  auto dfs = [&](auto&& dfs, int u, int par, int Max)->void{
    dp[start][u] = Max;
    for(auto e : g[u]){
      if(!(par == e.to)){
        dfs(dfs, e.to, u, max(Max, e.cost));
      }
    }
  };
  for(int i = 0; i < n; i++){
    start = i;
    dfs(dfs, i, -1, 0);
  }

  int q; cin >> q;
  for(int i = 0; i < q; i++){
    int u, v; cin >> u >> v;
    u--, v--;
    int ans = total - dp[u][v];
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 172556
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
   int A, B, C;
   cin >> A >> B >> C;
   cout << A * B / 2 << endl;
   return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	int n, c, l, r, ans = 0;
	scanf("%d%d%d", &n, &l, &r);
	REP(i, 0, n){
		scanf("%d", &c);
		if (c < l || c >= r){
			ans++;
		}
	}
	printf("%d\n", ans);
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

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

vector<int> v;

int main(void){
	int input;

	for(int i = 0; i < 3; i++){
		scanf("%d", &input);
		v.push_back(input);
	}

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

	printf("%d %d %d\n", v[0], v[1], v[2]);

	return 0;
}

Measured memory_bytes: 2760
N = input()
A = list(map(int, input().split()))
count = 0
existOdd = False
while not existOdd:
    for a in A:
        if a % 2 == 1:
            existOdd = True

    if not existOdd:
        A = list(map(lambda x: x / 2, A))
        count += 1

print(count)

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long A = l[0], B = l[1];

            var ans = Lcm(A, B);

            Console.WriteLine(ans);
        }

        static long Gcd(long a, long b)
        {
            if (b > a) return Gcd(b, a);
            if (b == 0) return a;
            return Gcd(b, (a % b));
        }

        static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
 
using namespace std;
using vecint = vector<int>;


int main(){
  int n;
 cin >> n;
  int a[2][n];
  int ue=0;
   for(int i=0;i<n;i++){
       cin >> a[0][i];
       ue = ue +a[0][i];
   }
   for(int j=0;j<n;j++){
       cin >> a[1][j];
   }
   int ans1 = ue + a[1][n-1];
   int ans2 = ans1;
   for(int i=0;i<n-1;i++){
        int shita = ans1;
     for(int j=i;j<n-1;j++){
         shita = shita - a[0][j+1]+a[1][j];
     }
       ans2 = max(shita,ans2);
   }
   cout << ans2 << endl;
}


Measured memory_bytes: 256
n=int(input())
N=[list(map(int, input().split())) for i in range(n)]
x=0
for j in range(n):
    if N[j][0]==N[j][1]:
        x+=1
        if x>=3:
            break
    else:
        x=0
        
if x>=3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9172
from fractions import gcd


def main():
    N = int(input())
    A = [0] + list(map(int, input().split()))

    L = [0] * (N+2)
    R = [0] * (N+2)
    G = [0] * (N+1)
    L[1] = A[1]
    R[N] = A[N]
    for i in range(2, N+1):
        L[i] = gcd(L[i-1], A[i])
    for i in range(1, N)[::-1]:
        R[i] = gcd(R[i+1], A[i])
    for i in range(1, N+1):
        if i == 1:
            G[i] = R[2]
        elif i == N:
            G[i] = L[N-1]
        else:
            G[i] = gcd(L[i-1], R[i+1])
    print(max(G[1:]))


main()


Measured memory_bytes: 16124
from math import sqrt
n = int(input())
x = input().split()
y = input().split()
max_num = -1
D_p1 = 0
D_p2 = 0
D_p3 = 0

for i in range(0, n):
    x[i] = abs(float(x[i]) - float(y[i]))
    y[i] = x[i] ** 2
    D_p1 += x[i]
    D_p2 += y[i]
    D_p3 += x[i] ** 3
    if (x[i] > max_num):
        max_num = x[i]

print(D_p1)
print(sqrt(D_p2))
print(pow(D_p3, 1.0 / 3))
print(max_num)



Measured memory_bytes: 5716
#include <bits/stdc++.h>
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";
  }
}

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

#define N 200123
#define mod 1000000007

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    bool prime[N];
    fill(prime, prime+N, true);
    int x;
    cin >> x;
    for(int i = 2 ; i < N ; i++){
    	if(prime[i]){
    		if(i >= x){
    			cout << i << endl;
    			break;
    		}
    		for(int j = i*2 ; j < N ; j+=i) prime[j] = false;
    	}
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
using namespace std;

#define max_n 100
#define max_m 100
#define max_w 10000
#define max_h 1000
#define INF 1000000000

typedef long long lint;


    
    
int main()
{
    int n,m;
    char a[max_n][max_m];
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
        
    }
    
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            printf("%c",a[i][j]);
        }
        cout<<"\n";
        for(int j=0;j<m;j++){
            printf("%c",a[i][j]);
        }
        cout<<"\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n,s) for (int i = (s); i < (n); i++)
#define SIZE 201
using namespace std;
typedef long long int LL;

int H, W, A[SIZE][SIZE];
int cache[SIZE][SIZE][SIZE];

LL calc(int x1, int y1, int x2, int y2) {
	if (cache[x1][y1][x2] > -1) return cache[x1][y1][x2];
	if (x1 == H || y1 == W || x2 == H || y2 == W) {
		return 0;
	}
	if (x1 == H-1 && y1 == W-1 && x2 == H-1 && y2 == W-1) {
		return A[H-1][W-1];
	}
	LL res = 0;
	if (x1 == x2) {
		res += A[x1][y1];
		res += max(
			max(
				calc(x1+1, y1, x2+1, y2),
				calc(x1+1, y1, x2, y2+1)
			), calc (x1, y1+1, x2, y2+1));
	} else {
		res += A[x1][y1] + A[x2][y2];
		res += max(
			max(
				calc(x1+1, y1, x2+1, y2),
				calc(x1+1, y1, x2, y2+1)
			), max(
				calc(x1, y1+1, x2+1, y2),
				calc(x1, y1+1, x2, y2+1)));
	}
	cache[x1][y1][x2] = res;
	return res;
}

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

	cin >> H >> W;
	REP(i, H, 0) {
		REP(j, W, 0) {
			cin >> A[i][j];
		}
	}
	memset(cache, -1, sizeof(cache));
	cout << calc(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 32128
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    A,B,K=map(int,input().split())
    c=0
    for i in range(100,-1,-1):
        if A%i==B%i==0:
            c+=1
        if c==K:
            print(i)
            exit()

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
package main

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

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	arr := scanArrayInt()
	n, y := arr[0], arr[1]
	ret := []int{-1, -1, -1}
	for y10000 := 0; y10000 <= n; y10000++ {
		for y5000 := 0; y10000+y5000 <= n; y5000++ {
			y1000 := n - y10000 - y5000
			t := y10000*10000 + y5000*5000 + y1000*1000
			if t == y {
				ret = []int{y10000, y5000, y1000}
			}
		}
	}
	fmt.Println(ret[0], ret[1], ret[2])
}
func scanArrayInt() []int {
	var ret = []int{}
	stdin.Scan()
	for _, s := range strings.Split(stdin.Text(), " ") {
		i, _ := strconv.Atoi(s)
		ret = append(ret, i)
	}
	return ret
}


Measured memory_bytes: 640
n,m,q=map(int,input().split())
table=[[0]*(n+1)for i in range(n+1)]
for i in range(m):
    a,s=map(int,input().split())
    table[a][s]+=1
from itertools import accumulate
for i,v  in enumerate(table):
    table[i]=list(accumulate(v))

for i in range(n):
    for j in range(n):
        table[j+1][i+1]+=table[j][i+1]
for i in range(q):
    a,s=map(int,input().split())
    a-=1
    print((table[s][s]+table[a][a]-table[s][a]-table[a][s]))

Measured memory_bytes: 19076
#include <iostream>

using namespace std;

int main ( ){
    int n;
    cin >>n;
    int highest=0;
    int sum=0;
    for(int i=0;i<n;i++){
        int num;
        cin>>num;
        if(num>highest){
            sum+=highest;
            highest=num;
        }
        else {sum+=num;}
    }
    cout<<sum+highest/2<<endl;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }

int main() {
  int N;
  cin >> N;
  cout << (N + 1) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N, K = iim()
    *A, = iim()

    ans = []
    for i in range(N-K):
        ans.append("Yes" if A[i] < A[i+K] else "No")

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


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

list_aaa = [111,222,333,444,555,666,777,888,999]
cnt =0

for i in range(len(list_aaa)):
    if N > list_aaa[i]:
        cnt +=1

if cnt ==0:
    print(111)
else:
    print(list_aaa[cnt])


Measured memory_bytes: 2940
MAE="R"
RHP=0
LHP=0
LPO=0
S=input()
T=[0]*len(S)
for i in range(len(S)):
 if S[i]=="L" and MAE=="R":
  T[i-1]+=int((RHP+1)/2)
  T[i]+=int(RHP/2)
  LPO=i-1
  MAE="L"
  LHP=1
 elif S[i]=="R" and MAE=="L":
  T[LPO]+=int(LHP/2)
  T[LPO+1]+=int((LHP+1)/2)
  RHP=1
  MAE="R"
 elif S[i]=="R" and MAE=="R":
  RHP+=1
 else:
  LHP+=1
T[LPO]+=int(LHP/2)
T[LPO+1]+=int((LHP+1)/2)
T=[str(a) for a in T]
print(' '.join(T))

Measured memory_bytes: 10364
n = input()
a = list(map(int, input().split()))

even = []
for target_list in a:
    if target_list%2 == 0:
        even.append(target_list)

ans = []

for target_list in even:
    c1 = target_list%3
    c2 = target_list%5
    if c1 == 0 or c2 == 0:
        pass
    else:
        ans.append(target_list)

if len(ans) >= 1:
    print("DENIED")
else:
    print("APPROVED")


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

using namespace std;

const int maxn = 200005;
const int treesize = 1 << 18;

int tree[2 * treesize];
int add[2 * treesize];
int a[maxn], pos[maxn];
vector<int> xs;
int n;

int getans(int cur)
{
    return tree[cur] + add[cur];
}

void push(int cur)
{
    tree[cur] += add[cur];
    add[cur * 2] += add[cur];
    add[cur * 2 + 1] += add[cur];
    add[cur] = 0;
}

void update(int cur)
{
    tree[cur] = max(getans(cur * 2), getans(cur * 2 + 1));
}

int get(int cur, int cl, int cr, int l, int r)
{
    if (cl > r || cr < l) return (int)(-1e9);
    if (cl >= l && cr <= r) return getans(cur);
    int cm = (cl + cr) / 2;
    push(cur);
    return max(get(cur * 2, cl, cm, l, r), get(cur * 2 + 1, cm + 1, cr, l, r));
}

void addd(int cur, int cl, int cr, int l, int r, int t)
{
    if (cl > r || cr < l) return;
    if (cl >= l && cr <= r)
    {
        add[cur] += t;
        return;
    }
    int cm = (cl + cr) / 2;
    push(cur);
    addd(cur * 2, cl, cm, l, r, t);
    addd(cur * 2 + 1, cm + 1, cr, l, r, t);
    update(cur);
}

int t[maxn];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        xs.push_back(a[i]);
    }
    sort(xs.begin(), xs.end());
    xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
    for (int i = 0; i < n; i++) pos[i] = lower_bound(xs.begin(), xs.end(), a[i]) - xs.begin();
    long long answer = 0;
    for (int i = 0; i < n; i++)
    {
        addd(1, 0, treesize - 1, 0, pos[i] - 1, 1);
        answer += t[i] = get(1, 0, treesize - 1, pos[i], pos[i]);
    }
    for (int i = 0; i < n; i++)
    {
        addd(1, 0, treesize - 1, 0, pos[i] - 1, -1);
    }
    for (int i = 0; i < n; i++)
    {
        addd(1, 0, treesize - 1, pos[i], xs.size(), 1);
    }
    for (int i = 0; i < (int)xs.size(); i++) addd(1, 0, treesize - 1, i, i, -xs[i]);
//     for (int i = 0; i < (int)xs.size(); i++) cout << get(1, 0, treesize - 1, i, i) << endl;
//     cout << answer << endl;
    for (int i = n - 1; i >= 0; i--)
    {
        addd(1, 0, treesize - 1, pos[i], xs.size(), -1);
//         cout << get(1, 0, treesize - 1, pos[i], xs.size() - 1) + xs[pos[i]] - (i - t[i]) << endl;
        answer -= (get(1, 0, treesize - 1, pos[i], xs.size() - 1) + xs[pos[i]] - (i - t[i]));
    }
    cout << answer << endl;
    
}

Measured memory_bytes: 7284
import java.util.*;
import java.io.*;

class Main{
  static int n;

  public static void main(String[] args) throws IOException{
      int i,j=0;
      BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
      n = Integer.parseInt(buffer.readLine());
      Set<String> d = new HashSet<String>();
      String[] str;

      for(i=0;i<n;i++) {
          str = buffer.readLine().split(" ");
          if(str[0].equals("insert")){
            d.add(str[1]);
          }
          else{
            if(d.contains(str[1])){
              System.out.println("yes");
            }
            else{
              System.out.println("no");
            }
          }
        }
          }
        }



Measured memory_bytes: 190032
#include <stdio.h>

int main (void)
{
    int n,i,k,p[1001],a[1001],sum=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
    }
    a[0]=p[0];
    for(i=1;i<n;i++)
    {
        int j=i;
        a[j]=p[j];
        while(a[j]<a[j-1]&&j>0)
        {
            int t=a[j];
            a[j]=a[j-1];
            a[j-1]=t;
            j--;
        }
    }
    for(i=0;i<k;i++)
    {
        sum+=a[i];
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 1740
#include <iostream>
#include<cstring>
using namespace std;
int main()
{
  int i,n;
  cin>>n;
  string s,t;
  cin>>s>>t;
  for(i=0;i<n;i++)
  {
      cout<<s[i]<<t[i];
  }
   return 0;
}


Measured memory_bytes: 3620
n = int(input())
d,x = map(int,input().split())
a =[0]*n
count = 0
for i in range(n):
    a[i] = int(input())
    if d%a[i] == 0:
        count += int(d/a[i])
    else:
        count += int(d/a[i]) + 1
print(count+x)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main( void )
{
	while ( 1 )
	{
		vector <string> M(3);
		bool not_found;

		cin >> M[0];
		if ( M[0] == "0" ) break;
		cin >> M[1] >> M[2];

		not_found = true;
		for ( int i = 0; not_found && i < 3; i++ )
		{
			if ( M[i][0] == M[i][1] && M[i][1] == M[i][2] )
			{
				if ( M[i][0] == 'b' || M[i][0] == 'w' )
				{
					cout << M[i][0] << endl;
					not_found = false;
				}
			}
			if ( M[0][i] == M[1][i] && M[1][i] == M[2][i] )
			{
				if ( M[0][i] == 'b' || M[0][i] == 'w' )
				{
					cout << M[0][i] << endl;
					not_found = false;
				}
			}
		}
		if ( not_found && M[0][0] == M[1][1] && M[1][1] == M[2][2] )
		{
			if ( M[0][0] == 'b' || M[0][0] == 'w' )
			{
				cout << M[0][0] << endl;
				not_found = false;
			}
		}
		if ( not_found && M[0][2] == M[1][1] && M[1][1] == M[2][0] )
		{
			if ( M[0][2] == 'b' || M[0][2] == 'w' )
			{
				cout << M[0][2] << endl;
				not_found = false;
			}
		}

		if ( not_found ) cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main()
{
    int x, y;
    scanf("%d %d", &x, &y);

    for (int i = 0; i <= x; i++)
    {
        if (2 * i + 4 * (x - i) == y)
        {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
}

Measured memory_bytes: 1728
#include<stdio.h>
#include<algorithm>
using namespace std;
int M[100][100];
int v[100][100];
int x[100][100];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<a;i++)
			for(int j=0;j<a;j++)
				scanf("%d",&M[i][j]);
		for(int i=0;i<b;i++)
			for(int j=0;j<b;j++)
				scanf("%d",&v[i][j]);
		int row=999999;
		int col=999999;
		for(int i=0;i<4;i++){
			for(int j=0;j<a-b+1;j++)
				for(int k=0;k<a-b+1;k++){
					bool ok=true;
					int D=99999;
					int E=99999;
					for(int l=0;ok&&l<b;l++)
						for(int m=0;ok&&m<b;m++){
							if(~v[l][m]&&v[l][m]!=M[j+l][k+m])ok=false;
							if(~v[l][m]){
								if(D>l+j||(D==l+j&&E>m+k)){
									D=l+j;
									E=m+k;
								}
							}
						}
					if(ok){
				//		printf("%d %d %d %d\n",j,k,D,E);
						if(row>D||(row==D&&col>E)){
							row=D;
							col=E;
						}
					}
				}
			for(int j=0;j<b;j++)
				for(int k=0;k<b;k++)
					x[j][k]=v[k][b-1-j];
			for(int j=0;j<b;j++)
				for(int k=0;k<b;k++)
					v[j][k]=x[j][k];
		}
		if(row==999999)printf("NA\n");
		else printf("%d %d\n",col+1,row+1);
		
	}
}

Measured memory_bytes: 1124
n,a,b = list(map(int, input().split()))
h = []
for i in range(n):
    h.append(int(input()))

import math

sup = sum([hh // a + 1 for hh in h])
inf = 1
 
while sup - inf > 1:
    x = (sup + inf) // 2
    c = sum([math.ceil((hh - x * b)/(a-b)) for hh in h if hh > x * b])
    if c <= x:
        sup = x
    else:
        inf = x
 
print(sup)

Measured memory_bytes: 11044
#include<bits/stdc++.h>
using namespace std;
int a = 0,b = 0,c = 0;
int main(){
    int N; cin >> N;
    for(int i = 0; i < N; ++i){
        int t; cin >> t;
        (t % 4 == 0 ? a : t % 2 == 0 ? b : c)  += 1;
    }
    if(b % 2)
        ++c;
    if(a == 0 and c > 0) return puts("No") * 0;
    cout << ( a + 1 >= c  ? "Yes" : "No") << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	string s;
	cin >> s;
	int n = s.length(), i;
	string t;
	fo(i, 0, n)
	t.pb('x');
	cout << t;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    int m=(n-1)*(n-2)/2-k;
    if(m<0){
        cout << -1<<endl;
        return 0;
    }
    vector<pair<int,int> > ans;

    for(int i=2;i<=n;i++){
        ans.pb(make_pair(1,i));
    }
    for(int i=2;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if(m==0)break;
            ans.pb(make_pair(i,j));
            m--;
        }
        if(m==0)break;
    }
    int maki=ans.size();
    cout << maki<<endl;
    for(int i=0;i<maki;i++){
        cout <<ans[i].first<<" "<<ans[i].second<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    vector<ll> A(N);
    rep(i,N) cin>>A[i];
    ll tmp=1;
    rep(i,N){
        if(A[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    rep(i,N){
        if(tmp>((pw10[18])/A[i])){
            cout<<-1<<endl;
            return 0;
        }
        tmp*=A[i];
    }
    cout<<tmp<<endl;
}



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

int main(){
  int n;
  cin >> n;
  vector<long long> hoge(n);
  for (int i = 0; i < n; i++){
    cin >> hoge.at(i);
  }

  bool flag = true;
  for (int i = n - 1; i > 0; i--){
    if (hoge[i-1] - hoge[i] == 1){
      hoge[i - 1] = hoge[i - 1] - 1;
    }else if(hoge[i-1] - hoge[i] > 1){
      // cout << i << endl;
      // cout << hoge[i - 1] << " " << hoge[i] << endl;
      flag = false;
      break;
    }
  }

  // for (int i = n; i > 0; i--){
  //   if (hoge[i-1] - hoge[i] > 0){
  //     flag = false;
  //     break;
  //   }
  // }
  // for (int i = 0; i < hoge.size() - 1; i++){
  //   if (hoge[i] - hoge[i+1] > 0){
  //     flag = false;
  //     break;
  //   }
  // }
  if (flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int n = sc.nextInt();
        int div = 1;
        for (int i = 0; i < d; i++) div *= 100;
        if (n == 100) n++;
        System.out.println(n * div);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const double INF = 1e18;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int W, H;
void bfs(double dist[500][500], int sx, int sy, string grid[500]){
  queue<int> qx, qy;
  qx.push(sx); qy.push(sy);
  dist[sy][sx] = 0;
  while(!qx.empty()){
    int x = qx.front(), y = qy.front();
    qx.pop(); qy.pop();
    REP(r, 4){
      int nx = x + dx[r], ny = y + dy[r];
      if(valid(nx, ny, W, H) && grid[ny][nx] == '.'){
        if(dist[ny][nx] == -1.0 || dist[ny][nx] > dist[y][x] + 1){
          dist[ny][nx] = dist[y][x] + 1;
          qx.push(nx);
          qy.push(ny);
        }
      }
    }
  }
}

int main(){
  while(cin >> W >> H && W){
    string grid[500];
    REP(i, H) cin >> grid[i];

    int sx, sy;
    REP(y, H) REP(x, W) if(grid[y][x] == 's') {
      sx = x, sy = y;
      grid[y][x] = '.';
    }

    int N = 0;
    REP(y, H) REP(x, W) if(grid[y][x] == '.') N++;

    double dist_goal[500][500], dist_spring[500][500];
    REP(y, H) REP(x, W) dist_goal[y][x] = dist_spring[y][x] = -1.0;
    REP(y, H) REP(x, W) if(grid[y][x] == 'g') bfs(dist_goal, x, y, grid);
    REP(y, H) REP(x, W) if(grid[y][x] == '*') bfs(dist_spring, x, y, grid);
    REP(y, H) REP(x, W) if(dist_goal[y][x] == -1) dist_goal[y][x] = INF;
    REP(y, H) REP(x, W) if(dist_spring[y][x] == -1) dist_spring[y][x] = INF;

    double lb = 0, ub = 1e18;
    REP(_, 200){
      const long double sum = (ub + lb) * 0.5;
      long double S = 0;
      REP(y, H) REP(x, W)if(grid[y][x] == '.'){
        long double exp = min((long double)dist_goal[y][x], dist_spring[y][x] + sum / N);
        S += exp;
      }
      if(sum - S > 0){
        ub = sum;
      }else{
        lb = sum;
      }
    }
    double all_exp = lb / N;
    printf("%.12f\n", min((double)dist_goal[sy][sx], dist_spring[sy][sx] + all_exp));
  }
  return 0;
}

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





int main() {
  int N;
  cin>>N;
  
  int count=0;
  while (N>1){
    N/=2;
    count+=1;
  }
  
  int answer=1;
  
  for (int i=0;i<count;i++){
    answer*=2;
  }
  cout<<answer<<endl;
    
  
}
  













Measured memory_bytes: 256