akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
typedef pair<double,double> Pd;
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<double> x(n),y(n);
	rep(i,n){
		cin>>x[i]>>y[i];
	}
	auto dist=[&](Pd a,Pd b){
		return sqrt((a.fi-b.fi)*(a.fi-b.fi)+(a.se-b.se)*(a.se-b.se));
	};
	auto func=[&](double rx,double ry){
		double ret=0;
		rep(i,n){
			chmax(ret,dist(Pd(rx,ry),Pd(x[i],y[i])));
		}
		return ret;
	};
	auto g=[&](double rx){
		double l=0,r=1000;
		rep(i,100){
			double nel=(2*l+r)/3,ner=(l+2*r)/3;
			if(func(rx,nel)>func(rx,ner)) l=nel;
			else r=ner;
		}
		return func(rx,l);
	};
	double l=0,r=1000;
	rep(i,100){
		double nel=(2*l+r)/3,ner=(l+2*r)/3;
		if(g(nel)>g(ner)) l=nel;
		else r=ner;
	}
	cout<<setprecision(10)<<g(l)<<endl;
}

Measured memory_bytes: 256
/*
/ ￣￣￣＼　
|　ー　ー \　
|　 ◉　◉ |   / ￣￣￣ ＼
\ 　  ▱ 　 / ∠    114514
＼　　 イ    \
／　　　＼    \_________/
/　|　　 \ \　
|　|　　　 | |
*/
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<queue>
#include<set>
#include<string>
#include<sstream>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

namespace FastIO{
    const int SIZE = 1 << 16;
    char buf[SIZE], obuf[SIZE], str[60];
    int bi = SIZE, bn = SIZE, opt;
    int read(char *s){
        while (bn){
            for (; bi < bn && buf[bi] <= ' '; bi++);
            if (bi < bn) break;
            bn = fread(buf, 1, SIZE, stdin);
            bi = 0;
        }
        int sn = 0;
        while (bn){
            for (; bi < bn && buf[bi] > ' '; bi++) s[sn++] = buf[bi];
            if (bi < bn) break;
            bn = fread(buf, 1, SIZE, stdin);
            bi = 0;
        }
        s[sn] = 0;
        return sn;
    }
    bool read(int& x){
        int n = read(str), bf;

        if (!n) return 0;
        int i = 0; if (str[i] == '-') bf = -1, i++; else bf = 1;
        for (x = 0; i < n; i++) x = x * 10 + str[i] - '0';
        if (bf < 0) x = -x;
        return 1;
    }
};

ll Pow_mod(ll a, ll b, ll c){
    ll ans = 1;
    a %= c;
    while (b){
        if (b & 1) ans = (ans * a) % c;
        a = (a * a) % c;
        b >>= 1;
    }
    return (ans % c);
}

ll mul(ll a, ll b, ll c){
    ll ans = 0;
    a %= c;
    while (b){
        if (b & 1) ans = (ans + a) % c;
        a = (a + a) % c;
        b >>= 1;
    }
    return (ans % c);
}

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

const int N = 1e5 + 10;

int n;
int h[N];

int main(){
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++ ) scanf("%d", &h[i]);
    h[1] -- ;
    for (int i = 2; i <= n; i ++ )
        if (h[i] > h[i - 1])
            h[i] -- ;
    for (int i = 1; i < n; i ++ ){
        if (h[i] > h[i + 1]){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m = M) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int exp(int n, int k) {
  if (k == 0) return 1;
  if (k == 1) return n;
  int ax = exp(n, k / 2);
  ax = mod(ax * ax);
  if (k % 2) ax = mod(ax * n);
  return ax;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
//#define MULTIPLE_TEST_CASE
void solution() {
  map<string, int> m;
  int n;
  cin >> n;
  rep(i, 0, n, 1) {
    string s;
    cin >> s;
    m[s]++;
  }
  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  while (t--) solution();
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
        using namespace std;
        #define rep(i,a,b) for(int i =a; i<b;++i)
        #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define endl "\n"
        typedef  long long  int ll;
        const int N = 1e6+5;
        const int mod = 1e9+7;
        ll m,n,y,ans,sum[N],a[N],k;

int  main()
    {
        IOS;
        int t = 1;
        //cin>>t;
        sum [0] = 0;
        while(t--)
        {
            cin>>n>>k;
            rep(i,1,n+1)
            {
                cin>>a[i];
                a[i] %= k;
                sum[i] = sum[i-1] + a[i];
                sum[i] %= k;
            }
            rep(i,1,n+1)
            {
                sum[i] = (sum[i] - i%k) % k;
                if(sum[i]<0)
                    sum[i] += k;
            }
            map <int ,int > mp;
            mp[0] = 1;
            rep(i,1,n+1)
            {
                if(i>=k)
                {
                    mp[sum[i-k]]--;
                }
                ans += mp[sum[i]];
                mp[sum[i]]++;
            }
            cout<<ans<<endl;
        }
    }


Measured memory_bytes: 15360
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid ((l+r)/2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout);
const int maxn=1e6+5,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,Q,K,T;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}int a[maxn],p[maxn];
bool pd1(){
    int Max=0;
    rep(i,1,n)Max=max(Max,a[i]);
    rep(i,2,Max){
        int fl=0;
        for(int j=1;j*i<=Max;++j){
            fl+=p[i*j];
        }if(fl>1)return false;
    }return true;
}
int gcd(int a,int b){
    if(!b)return a;
    return gcd(b,a%b);
}
bool pd2(){
    int res=a[1];
    rep(i,2,n)res=gcd(res,a[i]);
    if(res==1)return true;
    return false;
}
signed main(){
    //file(a);
    n=read();
    rep(i,1,n)a[i]=read(),p[a[i]]++;
    if(pd1())puts("pairwise coprime");
    else if(pd2())puts("setwise coprime");
    else puts("not coprime");


    return 0;
}


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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 55;
const int base = 311;

// dung inverse module de tinh nCk
// beginer 82
// mbeginer
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/


int main()
{
    string s;
    cin >> s;
    ll n = s.size();
    s = ' '+ s;
    ll sum = 0;
    ll dem = 0;
    ll base = 1;
    ll sum1 = 0;
    ll base1 = 1;
    map<ll,ll>kt;
    kt[0] ++;
    for(int i=n; i>=1; i--)
    {
        ll d = s[i]-'0';
        sum = (sum + d*base)%2019;
        dem += kt[sum];
        kt[sum] ++;
        base = (base*10)%2019;
    }
    cout << dem;
}
/*

*/


Measured memory_bytes: 3824
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n;
    cin >> n;
    cout << (n * n * n) << endl;
    return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
  cin.sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;

  int ans = -1;
  rep(i, 60) {
    int arrive = 60 * i + c;

    if (arrive % (a + b) <= a) {
      ans = arrive;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3160
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n,a[100005],ans[100005]={0};
class AFrog1 {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> n;
		f(i,0,n)
		{
			in >> a[i];
			ans[i]=(int)1e18;
		}
		ans[0]=0;
		f(i,0,n)
		{
			ans[i+2]=ans[i]+abs(a[i+2]-a[i]);
			ans[i+1]=min(ans[i+1],ans[i]+abs(a[i+1]-a[i]));
		}
		out << ans[n-1] << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	AFrog1 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	int a[n];
	long long s[n];
	long long sum = 0;

	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);

	for(int i = 0; i < n; i++){
		sum += a[i];
		s[i] = sum;
	}
	int ans = 1;
	for(int i = n-1; i >= 1; i--){
		if(a[i] <= s[i-1]*2){
			ans++;
		}else{
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
n, m = map(int, input().split())

ab_list = [list(map(lambda x: int(x) - 1, input().split())) for i in range(m)]

result_list = [[] for i in range(n)]

for ab in ab_list:
    result_list[ab[0]].append(ab[1])
    result_list[ab[1]].append(ab[0])


for result in result_list:
    print(len(result))

Measured memory_bytes: 3060
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (a, b, c, mut k) = (v[0], v[1], v[2], v[3]);
    let mut ans = 0;
    let used = min(k, a);
    ans += used;
    k -= used;
    let used = min(k, b);
    k -= used;
    let used = min(k, c);
    ans -= used;
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2148
f = f' 10
  where
    f' n x =
      let a = x `div` n
          b = x `mod` n
      in
        if a == 0
        then []
        else (a*b):(f' (n*10) x)

ans = ans' []
  where
    ans' s n =
      let m = maximum $ f n
      in
        if n < 10
        then length s
        else if elem n s
             then -1
             else ans' (n:s) m

main = do
  _ <- getLine
  c <- getContents
  let i = map read $ lines c :: [Int]
      o = map ans i
  mapM_ print o



Measured memory_bytes: 4172
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextLong()
    val x = sc.nextInt()
    val m = sc.nextInt()
    var v = x.toLong()
    val sum = Array(m + 5) { v }
    val a = Array(m + 5) { v }
    val map = mutableMapOf<Long, Int>()
    map[v] = 0
    val size = if (n < m + 5) n.toInt() else m + 5
    for (i in 1 until size) {
        v = (v * v) % m
        a[i] = v
        sum[i] = sum[i - 1] + v
        if (!map.containsKey(v)) {
            map[v] = i
        } else {
            val j = map[v]!!
            val p = i - j
            val psum = sum[i - 1] - if (j > 0) sum[j - 1] else 0
            var ans = if (j > 0) sum[j - 1] else 0
            ans += psum * ((n - j) / p)
            val rem = ((n - j) % p).toInt()
            for (k in j until j + rem) {
                ans += a[k]
            }
            println(ans)
            return
        }
    }
    println(sum[n.toInt() - 1])
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 44540
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

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

    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    rep(i, h) cin >> s[i];

    vector<vector<bool>> seen(h, vector<bool>(w, false));
    queue<pair<int, int>> q;
    q.push(make_pair(0, 0));
    seen[0][0] = true;

    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        seen[y][x] = true;

        int dir_cnt = 0;
        rep(dir, 4){
            int nx = x + dx[dir];
            int ny = y + dy[dir];

            if(0>ny || ny>=h || 0>nx || nx>=w) continue;

            if(s[ny][nx] == '#' && !seen[ny][nx]){
                if(dir > 1) ++dir_cnt;
                q.push(make_pair(nx, ny));
                ++dir_cnt;
            }
        }

        if(dir_cnt > 1) {
            cout << "Impossible" << endl;
            return 0;
        }
    }

    if(seen[h-1][w-1])cout << "Possible" << endl;
    else cout << "Impossible" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        HashMap<Integer, Integer> an = new HashMap<>();
        int count = 0;

        for (int i = 1 ; i - 1 < n ; i++) {
            an.put(i, scanner.nextInt());
        }

        for (int i = 1 ; i - 1 < an.size() ; i++) {
            if (i % 2 != 0 && an.get(i) % 2 != 0) {
                count = count + 1;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 35908
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  int N;
  cin >> N;
  long long A[N];
  rep(i, N)
    cin >> A[i];

  long long MAX = 1000000000000000000;

  rep(i, N){
    if(A[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  
  long long ans = 1;
  rep(i, N){
    if(ans <= MAX/A[i])
      ans *= A[i];
    else{
      cout << -1 << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 4400
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,sum=0;
	cin>>n;
	int num[n];
	for(int i=0;i<n;i++)
		cin>>num[i];
	sort(num,num+n);
	for(int i=0;i<n-1;i++)
		sum+=num[i];
	cout<<sum+num[n-1]/2;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	char s;
	for(int i=0; i<n; i++){
		cin >> s;
		if(s == 'Y'){
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    let limit = 1000001;
    let sieve = make_sieve(limit);
    let mut ans = 1;
    for i in 2..n {
        let tmp = prime_factorize_fast(i, &sieve);
        let mut num = 1;
        for (_, &value) in &tmp {
            num *= value + 1;
        }
        ans += num;
    }
    println!("{}", ans);
    
}

use std::collections::HashMap;
use MyEither::{IsPrime, NotPrime, Undecided};

#[derive(Clone, Copy, PartialEq)]
enum MyEither<T> {
    IsPrime,
    NotPrime(T),
    Undecided,
}

fn make_sieve(limit: usize) -> Vec<MyEither<usize>> {
    let mut sieve: Vec<MyEither<usize>> = vec![Undecided; limit + 1];
    let mut num = 2;

    while num <= limit {
        if sieve[num] == Undecided {
            sieve[num] = IsPrime;
            let mut tmp = num * num;
            while tmp <= limit {
                sieve[tmp] = match &sieve[tmp] {
                    Undecided => NotPrime(num),
                    n => *n,
                };
                tmp += num;
            }
        }
        num += 1;
    }
    sieve
}

fn prime_factorize_fast(mut n: usize, sieve: &Vec<MyEither<usize>>) -> HashMap<usize, usize> {
    let mut res = HashMap::new();

    while sieve[n] != IsPrime {
        match &sieve[n] {
            NotPrime(num) => {
                let entry = res.entry(*num).or_insert(0);
                *entry += 1;
                n = n / *num;
            }
            _ => break,
        }
    }
    let entry = res.entry(n).or_insert(0);
    *entry += 1;

    res
}


Measured memory_bytes: 17652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()

int div_cnt(int x,int y)
{
	int sum = 0;
	if(x % y != 0){
		sum += 0;
	}

	else{
		sum++;
		x /= y;
		sum += div_cnt(x,y);
	}

	return sum;
}

bool prime_check(int n){
    if(n==1)
        return false;
    if(n==2)
        return true;
    
    int x=sqrt(n);
    for(int i=2;i<=x;i++){
        if(prime_check(i)==true){
            if(n%i==0){
                return false;
            }
        }
    }
    return true;
}

int main(){
	int n;
    int cnt3,cnt5,cnt15,cnt25,cnt75,div;
    cnt3=cnt5=cnt15=cnt25=cnt75=0;
	cin >> n;
    FOR(i,1,n+1/2){
        if(prime_check(i) == true){
            FOR(j,1,n+1){
                div += div_cnt(j,i);
            }
            if(div >= 2)cnt3++;
            if(div >= 4)cnt5++;
            if(div >= 14)cnt15++;       
            if(div >= 24)cnt25++;
            if(div >= 74)cnt75++;
            div = 0;
        }
    }
  
	int ans = 0;

	ans += cnt75;
	ans += (cnt3 - 1) * cnt25;
	ans += (cnt5 - 1) * cnt15;
	if(cnt5 != 0){
		ans +=((cnt3 - 2) * (cnt5 - 1) * cnt5) / 2;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
	ll n,q;
	cin>>n>>q;
	string s;
	cin>>s;
	string ss;
	
	ll l,r;


	vl cnt(n,0);
	rep(j,n){
		if(j>0) cnt[j]=cnt[j-1];
		if(s[j-1]=='A' && s[j]=='C'){
			cnt[j]++;
		}
	}
	rep(i,q){
		cin>>l>>r;
		cout<<cnt[r-1]-cnt[l-1]<<endl;
		
	}

    return 0;
}






Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	char s[200005], t[200005];
	scanf("%s%s", s, t);
	int i, ans = 0;
	for (i = 0; s[i] != '\0'; i++)
		if (s[i] != t[i])
			ans++;
	printf("%d\n", ans);
	return 0;
}

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

int main() {
  int N,i, mod=1000000007;
  long long ans=0, sum=0;
  cin>>N;
  vector<long long> A(N);
  for (i=0;i<N;i++) {
    cin>>A[i];
    sum += A[i];
  }
  for (i=0;i<=N-2;i++) {
    sum -= A[i];
    ans += A[i] * (sum % mod);
    ans %= mod;
  }
  cout<<ans<<endl;
  return 0;
}


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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N;
double P[3010];
double dp[3010][3010];

int main(){
    cin >> N;
    for(int i = 0; i < N; i++)
        cin >> P[i];

    for(int i = N; i >= 0; i--){
        for(int j = 0; j <= N; j++){
            double res = 0;
            if(i == N){
                if(j >= N - j){
                    res = 1;
                }
            }
            else{
                res += P[i] * dp[i + 1][j + 1];
                res += (1 - P[i]) * dp[i + 1][j];
            }
            dp[i][j] = res;
        }
    }

    printf("%.10f\n", dp[0][0]);

    return 0;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define edge pair<ll,ll>
using namespace std;


int main()
{
	ll a,b;
	cin>>a>>b;
	float x,y;
	ll i,xx,yy;
	ll flag=0;
	for(i=1;i<=a*100;i++)
	{
		x=(i*0.08);
		y=(i*0.1);
		xx=x/1;
		yy=y/1;
		if(xx==a && yy==b)
		{
			flag=i;
			break;
		}
		
	}
	if(flag>0)
	cout<<flag<<endl;
	else
	cout<<-1<<endl;
}

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

int x[1000],y[1000];
string lab[1000];

int main(){
	int n,m,s,g;
	while(cin >> n >> m >> s >> g && n){
		for(int i = 0 ; i < m ; i++){
			cin >> y[i] >> x[i] >> lab[i];
		}
		string memo[40];
		for(int i = 0 ; i < 40 ; i++) memo[i] = "~";
		memo[g] = "";
		int ref = 0;
		bool bad = 0;
		int p = 0;
		while(1){
			bool f = false;
			for(int j = 0 ; j < m ; j++){
				if(memo[x[j]]=="~") continue;
				string cost = lab[j]+memo[x[j]];
				if(cost < memo[y[j]]){
					memo[y[j]] = cost;
					f = true;
					if(s == y[j] && memo[y[j]].length() > n*6){bad = true; f = false; break;}
				}
			}
			if(!f) break;
			ref++;
			if(ref == 280) { break;}
		}
		if(bad || memo[s] == "~") cout << "NO" << endl;
		else cout << memo[s] << endl;

	}
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = 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; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, int> mp;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    mp[a]++, mp[b]++;
  }
  for (auto e : mp) {
    if (e.second%2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    string ans = "";
    for (int i = 1; i < s.size(); i++)
    {
        if(s[i - 1] == s[i]){
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define x first
#define y second

const int N = 110;
const int M = 1e9 + 7;
const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef pair<int, ll> PII;

int a[N][N];

int main()
{
	int n, m, T, num;
	scanf("%d %d %d", &n, &m, &T);
	int i = 0, j = 0;
	for(int l = 1; l <= T; l++){
		scanf("%d", &num);
		while(i < n){
			if(i & 1){
				for(; j >= 0 && num--; j--)
					a[i][j] = l;
				if(j == -1) j = 0, i++;
			}else{
				for(; j < m && num--; j++)
					a[i][j] = l;
				if(j == m) j = m-1, i++;
			}
			if(num <= 0) break;
		}
	}
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			printf("%d%c", a[i][j], j == m-1 ? '\n' : ' ');
	}
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (ll i = x; i < y; i++)

int main()
{
    int n;
    cin >> n;
    int a[n];
    int max = -2000000;
    int min = 2000000;

    rep(i, 0, n)
    {
        cin >> a[i];
        if (a[i] > max)
            max = a[i];
        if (a[i] < min)
            min = a[i];
    }

    int difference = max - min;
    int sum[difference+1];
    int coordinate = 2000000000;

    rep(i, 0, difference+1)
    {
        sum[i] = 0;
        rep(j, 0, n)
        {
            sum[i] += (a[j] - (min + i) )*(a[j] - (min + i) );
        }

        if (sum[i] < coordinate)
            coordinate = sum[i];
    }

    cout << coordinate << endl;

    return 0;
}

Measured memory_bytes: 3588
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(X: int, t: int):
    print(max(X-t, 0))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    t = int(next(tokens))  # type: int
    solve(X, t)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
/*
___ is a raging sadist.
*/

//Destroy all WA at test 2

#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double
#define pow power
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(a) int((a).size())
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define endl "\n"
#define PI 3.14159265
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MOD1 = 998244353;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7; 
using namespace std;

ll power(ll x, ll y) 
{ 
   ll res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  

        y = y>>1; 

        if (x<=100000000)
        x = (long long)(x*x);

        //cout<<x<<'\n'; 
    } 
    return res; 
} 




ll pr[10000001];
ll cnt[10000001];

int main()
{

#ifndef ONLINE_JUDGE    
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif

fastio();

ll N=1e7+1;

  pr[1]=0;
    for (int i=1;i<N;i++){    
        for (int j=i;j<N;j+=i){
              pr[j]+=1;
          }
      }
  


//cout<<pr[10]<<endl;


ll number;
cin>>number; ll fin=0;

for(ll i=1;i<=number;i++)
{
fin+=i*pr[i];
}

cout<<fin;

return 0;
}


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

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

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    multiset<int> st;
    for (int i = 0; i < n; i++) {
        int now = a[i];
        auto itr = st.lower_bound(now);
        if(itr != st.begin()) st.erase(--itr);
        st.insert(now);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 5376
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  double l;
  cin >> l;
  cout << fixed << setprecision(10) << pow(l/3,3) << endl;
}

Measured memory_bytes: 256
stand = list(map(int,input().split()))
flag = 1
for i in range(2):
  now = list(map(int,input().split()))
  diff = now[0] - stand[0]
  for j in range(1,3):
    if now[j] != stand[j] + diff:
      flag = 0
if flag == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=1e7+2;
fast;
ll ans;
ll n,m,q;
void solve()
{
    int n;cin>>n;ll ar[n+1];
    ans=1;
    ll head[n+1],tail[n+1];
    for(int i=1;i<=n;i++)
        {cin>>ar[i];}
    head[1]=ar[1];
    tail[n]=ar[n];
    for(int i=2;i<=n;i++)
    {
        head[i]=__gcd(ar[i],head[i-1]);
    }
    for(int i=n-1;i>0;i--)
    {
        tail[i]=__gcd(ar[i],tail[i+1]);
    }
    ans=max(head[n-1],tail[2]);
    for(int i=2;i<n;i++)
    {
        ans=max(__gcd(head[i-1],tail[i+1]),ans);
    }
    cout<<ans<<endl;
}

int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
   // int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 2560
#山の数
N = int(input())

#山の高さデータ
H = [int(i) for i in input().split()] 
result = 0

for index, i in enumerate(H):
    if index - 1 < 0:
        result += 1 
    else:
        flag = 0
        for kindex in range(index):
            if H[kindex] > i:
                flag = 1     
        if flag == 0:
            result += 1
            

print(result)

Measured memory_bytes: 3060
n=int(input())
a=[]
b=[]
for i in range(n):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)

a.sort()
b.sort()
    
if n%2==0:
    n2=n//2
    ca=(a[n2-1]+a[n2])
    cb=(b[n2-1]+b[n2])
    c=cb-ca+1
else:
    n2=(n-1)//2
    ca=a[n2]
    cb=b[n2]
    c=cb-ca+1
    
print(c)


Measured memory_bytes: 25460
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int q,h,s,d;
ll n;

int main(){
	cin>>q>>h>>s>>d;
	cin>>n;
	
	if(q*2<h)h=q*2;
	if(h*2<s)s=h*2;
	if(s*2<d)cout<<s*n<<endl;
	else cout<<(n/2)*d+(n%2)*s;
	return 0;
}


	

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

int main()
{
 
  long long int N;
  cin>>N;
  
  long long int K;
  cin>>K;
  
  int m[N];
  for(int i=0;i<N;i++)
  cin>>m[i];
  
  sort(m,m+N,greater<int>());
  
  long long int count=0;
  
  for(int i=0;i<N;i++)
  {
      if(K!=0)
      {
          m[i]=0;
          K--;
      }
      else
      {
          count=count+m[i];
      }
  }
  
cout<<count<<" ";

return 0;
}
  
  



Measured memory_bytes: 1024
n, k = map(int, input().strip().split(' '))
d = []
a = []
for i in range(k):
	d.append(int(input().strip()))
	a.append(list(map(int, input().strip().split(' '))))
finallist = []
for i in range(len(d)):
	for j in a[i]:
		if j not in finallist:
			finallist.append(j)
print(n-len(finallist))

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

int N, a[101];

int main(){
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  a[N] = 0;
  int ans = 0;
  int tmp = 0, before = 0;
  for(int i = 0; i <= N; i++){
    if(a[i] == before){
      tmp++;
    }else{
      ans += tmp/2;
      before = a[i];
      tmp = 1;
    }
  }
  cout << ans << endl;
}


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

long long pow(long long a, long long p = 5)
{
    long long ret = 1;
    for (int i = 0; i < p; ++i) ret *= a;
    return ret;
}

int main()
{
    long long X;
    cin >> X;
    for (long long a = -1000; a <= 1000; ++a)
    {
        for (long long b = -1000; b <= 1000; ++b)
        {
            if (pow(a) - pow(b) == X)
            {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3536
#include<iostream>
using namespace std;
int main()
{
  	int n,count=0,c=0;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  for(int i=0;i<n;i++)
    if(arr[i]%2==0)
      c++;
  for(int i=0;i<n;i++)
    if((arr[i]%3==0 ||arr[i]%5==0) && arr[i]%2==0)
      count++;
  if(count==c)
    cout<<"APPROVED";
  else
    cout<<"DENIED";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  vector<int> v2019(s.size()+1, 0);
  ll m2019 = 0, power = 1;
  map<int, int> mp;
  mp[0]++;
  rep(i, s.size()){
    int sn = s.at(i) - '0';
    m2019 = (m2019 + sn*power) % 2019;
    power = (power * 10) % 2019;
    mp[m2019]++;
  }
  ll ans = 0;
  for(auto p : mp){
    ans += p.second * (p.second-1) / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4384
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// 0-indexed bottom up Segment Tree
// UNIT is the identity element of operation func
template <typename T = int>
struct SegmentTree {
    using F = function<T(T, T)>;
    int n;
    vector<T> dat;
    F func;
    T UNIT;

    SegmentTree(int n_, F func_, T UNIT_) : func(func_), UNIT(UNIT_) {
        n = 1;
        // full binary tree: num of leaves = n = 2^k >= n_
        while (n < n_)
            n *= 2;
        dat.assign(2 * n - 1, UNIT);
    }
    SegmentTree(vector<T> v_, F func_, T UNIT_) : func(func_), UNIT(UNIT_) {
        n = 1;
        while (n < v_.size())
            n *= 2;
        dat.assign(2 * n - 1, UNIT);
        for (int i = 0; i < v_.size(); ++i) {
            dat[n - 1 + i] = v_[i];
        }
        for (int i = n - 2; i >= 0; --i) {
            dat[i] = func(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }
    void update(int k, T a) {
        // leaves are at index n-1 to 2*n-2
        k += n - 1;
        dat[k] = a;
        while (k > 0) {
            // k -> parent node
            k = (k - 1) / 2;
            // func(child nodes)
            dat[k] = func(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }
    // get result of func() in [l, r)
    T query(int l, int r) {
        l += n - 1;
        r += n - 1;
        T ret = UNIT;
        while (l < r) {
            if ((l & 1) == 0)
                ret = func(ret, dat[l]);
            if ((r & 1) == 0)
                ret = func(ret, dat[r - 1]);
            l = l / 2;
            r = (r - 1) / 2;
        }
        return ret;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    auto f = [](ll l, ll r) { return min(l, r); };
    SegmentTree<ll> st(n + 1, f, INF);
    st.update(n, 0);
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == '1')
            continue;
        ll mini = st.query(i, min(i + m + 1, n + 1));
        st.update(i, mini + 1);
    }
    if (st.query(0, 1) == INF) {
        cout << -1 << "\n";
      	return 0;
    }
    int curr     = 0;
    int currstep = st.query(0, 1);
    while (curr != n) {
        for (int i = 1; i <= n; ++i) {
            ll nxt = st.query(curr + i, curr + i + 1);
            if (nxt == currstep - 1) {
                cout << i << " ";
                curr = curr + i;
                currstep--;
                break;
            }
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 2688
<?php
$line = trim(fgets(STDIN));
$array = explode(" ", $line);
$N = $array[0];
$X = $array[1];
$T = $array[2];

for($i=1;$i<10000;$i++) {
    if($N <= $X * $i) {
        echo $i*$T;
    break;
    }
}

Measured memory_bytes: 15968
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		String S = next();
		int N = S.length();
		char[] C = S.toCharArray();
		int[] child = new int [N];
		Arrays.fill(child,1);

		for(int i=0;i<N;i++) {
			int ti = i;
			if(C[i]=='R')ti++;
			else if(C[i]=='L')ti--;

			if(C[ti]=='R')ti++;
			else if(C[ti]=='L')ti--;

			int tmp = child[i];
			child[i] = 0;
			child[ti] += tmp;

		}
		for(int i=N-1;0<=i;i--) {
			int ti = i;
			if(C[i]=='R')ti++;
			else if(C[i]=='L')ti--;

			if(C[ti]=='R')ti++;
			else if(C[ti]=='L')ti--;

			int tmp = child[i];
			child[i] = 0;
			child[ti] += tmp;


		}

		StringBuilder buf = new StringBuilder();
		for(int i=0;i<N;i++) {
			if(i<N-1) {
				buf.append(child[i]+" ");
			}else if(i==N-1){
				buf.append(child[i]);
			}
		}
		out.println(buf);
	}


	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}


}

Measured memory_bytes: 44940
/*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/

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

typedef long long ll;
const int mx=1e5+5;
int ara[mx];
multiset<int> myset;
priority_queue<int> myPQ;
ll A1[mx],A2[mx];
int main ()
{
    int i,n,x;
    ll a1,a2;
    a1=0;   a2=0;
    scanf ("%d",&n);
    for (i=0;i<n;i++) {
        scanf ("%d",&x);
        myset.insert(x);
        a1+=x;
    }
    for (i=1;i<=n;i++) scanf ("%d",&ara[i]);
    for (i=0;i<n;i++) {
        scanf ("%d",&x);
        myPQ.push(x);
        a2+=x;
    }
    A1[0]=a1;   A2[n]=a2;
    for (i=1;i<=n;i++) {
        a1+=ara[i];
        myset.insert(ara[i]);
        a1-=*myset.begin();
        myset.erase(myset.begin());
        A1[i]=a1;
    }
    for (i=n-1;i>=0;i--) {
        a2+=ara[i+1];
        myPQ.push(ara[i+1]);
        a2-=myPQ.top();
        myPQ.pop();
        A2[i]=a2;
    }
    ll ans=-1e15;
    for (i=0;i<=n;i++) {///cout<<A1[i]<<' '<<A2[i]<<endl;
            ans=max(ans,A1[i]-A2[i]);
    }
    printf ("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 7420
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
	long long ans=0;
  	int n,m;
  	cin>>n>>m;
  	vector<int> v(m);
  	for(int i=0;i<m;i++) cin>>v[i];
  	sort(v.begin(),v.end());
  	vector<int> vv(m-1);
  	for(int i=0;i<m-1;i++) {vv[i]=v[i+1]-v[i];ans+=vv[i];}
  	sort(vv.rbegin(),vv.rend());
  	if(n>=m) cout<<0;
  	else {
    	for(int i=0;i<n-1;i++) ans-=vv[i];
      	cout<<ans;
    }

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    ll N;
    cin >> N;
    ll a;
    cin >> a;
    for(int i=1; i<N; ++i){
        ll b;
        cin >> b;
        a = GCD(a, b);
    }
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 3564
N, = map(int, input().split())
xs = list(map(int, input().split()))
r = 0
for k in range(1, N):
    a = (N-1) % k
    b = a - k
    n = (N-1-a)//k
    if a <= k:
        a += k
    if a <= k:
        a += k

    for _ in range((N-1-a)//k):
        b = a - k
        n = (N-1-a)//k
        if a <= b:
            a += k
            continue
        if a%(a-b) == 0:
            if a <= (a-b)*n:
                a += k
                continue
    if a <= b or a >= N-1:
        continue
    s1 = a
    s2 = n * (a-b)
    t = xs[s1]
    ps = [(s1,t)]
    for i in range(n):
        s1 += a-b
        t += xs[s2]
        t = max(t,0)
        t += xs[s1]
        ps.append((s2,xs[s2]))
        ps.append((s1,xs[s1]))
        s2 -= a-b
    #print(ps, t)
    r = max(r, t)

print(r)


Measured memory_bytes: 75860
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<P> ans(n);
    rep(i, n) {
        ans[i] = P(a[i],i+1);
    }
    sort(all(ans));
    rep(i, n) {
        cout << ans[i].second << endl;
    }

}

Measured memory_bytes: 2048
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()

# dp[日数][今回ABCのどれにしたか] = その時点での最大値
dp = [[0] * 3 for i in range(N)]
dp[0][0], dp[0][1], dp[0][2] = MAP()

for i in range(N-1):
    abc = LIST()
    # 送り元ループ
    for j in range(3):
        # 送り先ループ
        for k in range(3):
            # 今回と同じ所には送れない
            if j != k:
                dp[i+1][k] = max(dp[i][j] + abc[k], dp[i+1][k])
# 最終日にABCどれにしたかの最大を取る
print(max(dp[N-1]))


Measured memory_bytes: 24864
a,b,c,d = map(int,input().split())
u = b - a + 1
from fractions import gcd
cd = c*d//gcd(c,d)
n_c = b//c - (a-1)//c
n_d = b//d - (a-1)//d
n_cd =b//cd - (a-1)//cd
print(int(u - n_c - n_d + n_cd))

Measured memory_bytes: 5104
#include<bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
#define lowbit(x) x & (-x)
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
template<class T>
void read(T &res) {
  int f = 1; res = 0;
  char c = getchar();
  while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); }
  while(c >= '0' && c <= '9') { res = res * 10 + c - '0'; c = getchar(); }
  res *= f;
}
int dp[110][110];
int main() { 
  string s, t;
  cin >> s;
  t = s;
  reverse(t.begin(), t.end());
  int n = s.size(), cat = 0;
  for(int i = 0; i < n/2; i++) {
    if(s[i] != t[i]) cat++;
  }
  cout << cat << endl;
} 


Measured memory_bytes: 256