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

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        v: [i64; 4]
    }
    let dx = v[2] - v[0];
    let dy = v[3] - v[1];
    println!("{} {} {} {}", v[2] - dy, v[3] + dx, v[0] - dy, v[1] + dx);
}


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

int main() {
  int n;
  char s[110];

  cin >> n;

  rep(i, n) {
    char tmp;
    cin >> tmp;
    if (tmp == 'Y') {
      cout << "Four" << endl;
      return 0;
    }
  }

  cout << "Three" << endl;

  return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            atcorder.Test.Run();
        }
    }


    public class Pair{
        public char f;
        public int s;
    }

    public class Test
    {
        public static void Run()
        {
            string S = Console.ReadLine();
            int count = 0;
            char now = '0';
            int cnt = 0;
            List<int> cn = new List<int>();
            for (int i = 0; i < S.Length; i++)
            {
                if(i!=0){
                    if(now!=S[i]){
                        cn.Add(cnt);
                        cnt = 0;
                        now = S[i];
                    }
                }else{
                    now = S[i];
                }
                cnt++;
            }
            cn.Add(cnt);
            while(true){
                if (cn.Count <= 1) break;
                count += 2 * (Math.Min(cn[0], cn[1]));
                if (cn[0] > cn[1])
                {
                    if (cn.Count > 2)
                    {
                        cn[0] = cn[0] - cn[1] + cn[2];
                        cn.RemoveAt(2);
                    }
                    cn.RemoveAt(1);
                }
                else if (cn[0] < cn[1])
                {
                    cn[1] = cn[1] - cn[0];
                    cn.RemoveAt(0);
                }
                else
                {
                    cn.RemoveRange(0, 2);
                }
            }
            Console.WriteLine(count);
        }
    }







    public class Input
    {
        int arg;
        int length;
        string s;
        string[] ss;
        char sep;
        public Input(char _sep = '\0')
        {
            sep = _sep;
        }
        public void ReadLine()
        {
            s = Console.ReadLine();
            if (sep != '\0') ss = s.Split(sep);
            else
            {
                ss = new string[1];
                ss[0] = s;
            }
            arg = 0;
            length = ss.Length;
        }
        public T Next<T>()
        {
            if (arg == length) throw new IndexOutOfRangeException();
            return (T)Convert.ChangeType(ss[arg++], typeof(T));
        }
        public void SetSeparater(char _sep)
        {
            sep = _sep;
        }
    }
}

Measured memory_bytes: 13244
#include <bits/stdc++.h>
using namespace std;
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n;
    unsigned long long int a,b=1,c=1e18;
    bool k=1;
    cin>>n;
    while(n--)
    {
        cin>>a;
        if(a==0||b==0)
        {
            b=0;
            k=1;
        }
        else
        {
            if(k)
            {
                if(a>(c/b))
                {
                    k=0;
                }
                else
                {
                    b*=a;
                }
            }
        }
    }
    if(k)
        cout<<b<<endl;
    else
        cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 3652
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    L, R = map(int, input().split())
    mod = 2019

    min_mod = float("inf")

    for i in range(L, min(R, L + mod)):
        for j in range(i + 1, min(R + 1, i + 1 + mod)):
            curr_mod = i * j % mod
            min_mod = min(min_mod, curr_mod)
            if min_mod == 0:
                break

    print(min_mod)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
n=list(input())
count=0
if n[0]=='A' and n[2:-1].count('C')==1:
    del n[0]
    n.remove('C')
    for i in range(len(n)):
        if n[i].islower()==1:
            count+=1
    if count==len(n):
        print('AC')
    else:
        print('WA')
    
else:
    print('WA')

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

    using namespace std;

    #define int long long
    #define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
    #define pb push_back
    #define ff first
    #define ss second
    #define vi vector<int>
    #define all(x) (x).begin(), (x).end()
//    #define for(i,a,b)  for(int i=a;i<b;++i)
//    #define rev(i,a) for(int i=a-1;i>=0;i--)
    #define fill(a,b) memset(a, b, sizeof(a))
    #define lld long double
    #define mii map<int, int>
    #define mci map<char, int>
    #define msi map<string, int>
    #define pii pair<int, int>
    #define mod 1000000007 //998244353
    #define maxn        1000005

    //clear adj and visited vector declared globally after each test case
    //check for long long overflow
    //while adding and subs check if mod becomes -ve
    //while using an integer directly in a builtin function add ll
    //Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
    //Dont keep array name as size or any other key word


    using namespace std;
    int power(int a, int b, int p)
        {
            if(a==0)
            return 0;
            int res=1;
            a%=p;
            while(b>0)
            {
                if(b&1)
                res=(res*a)%p;
                b>>=1;
                a=(a*a)%p;
            }
            return res;
        }


    int lcm(int a, int b)
    {
        int g=__gcd(a, b);
        return a/g*b;
    }

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

	if (count(a.begin(), a.end(), a[0]) == n) {
		cout << 1 << endl;
		for (int i = 0; i < n; ++i) {
			cout << 1 << " ";
		}
		cout << endl;
		return 0;
	}

	if (n % 2 == 0) {
		cout << 2 << endl;
		for (int i = 0; i < n; ++i) {
			cout << i % 2 + 1 << " ";
		}
		cout << endl;
		return 0;
	}

	for (int i = 0; i < n; ++i) {
		if (a[i] == a[(i + 1) % n]) {
			vector<int> ans(n);
			for (int j = 0, pos = i + 1; pos < n; ++pos, j ^= 1) {
				ans[pos] = j + 1;
			}
			for (int j = 0, pos = i; pos >= 0; --pos, j ^= 1) {
				ans[pos] = j + 1;
			}
			cout << 2 << endl;
			for (int pos = 0; pos < n; ++pos) {
				cout << ans[pos] << " ";
			}
			cout << endl;
			return 0;
		}
	}

	cout << 3 << endl;
	for (int i = 0; i < n - 1; ++i) {
		cout << i % 2 + 1 << " ";
	}
	cout << 3 << endl;
    return 0;
}

int32_t main() {

int q=1;
//cin >> q;
for (int qq = 0; qq < q; qq++) {
    int a;
    cin >> a;
    cout << a + a*a +a*a*a << endl;
}

	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll pow(ll m, ll n) {
  if (!n) return 1;
  if (n & 1) return m * pow(m, n -1) % mod;
  return pow(m * m % mod, n / 2);
}
int main() {
  ll m, n;
  cin >> m >> n;
  cout << pow(m, n) << endl;
}

Measured memory_bytes: 1156
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,x,keta_wa=0;
    cin>>n;
    x=n;
    while(x){
        keta_wa+=x%10;
        x/=10;
    }
    if( n % keta_wa == 0 ){
        cout<< "Yes" <<endl;
    }
    else{
        cout<< "No" <<endl;
    }
}


Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        h: usize,
        w: usize,
        m: usize,
        hw: [(Usize1, Usize1); m],
    }
    let mut h_count = vec![0usize; h];
    for &(hk, _) in &hw {
        h_count[hk] += 1;
    }
    let mut w_count = vec![0usize; w];
    for &(_, wk) in &hw {
        w_count[wk] += 1;
    }
    let max_h = *h_count.iter().max().unwrap();
    let max_w = *w_count.iter().max().unwrap();
    let max_h_count = h_count.iter().filter(|&&x| x == max_h).count();
    let max_w_count = w_count.iter().filter(|&&x| x == max_w).count();
    if hw
        .iter()
        .filter(|&&(hk, wk)| h_count[hk] == max_h && w_count[wk] == max_w)
        .count()
        == max_h_count * max_w_count
    {
        println!("{}", max_h + max_w - 1);
    } else {
        println!("{}", max_h + max_w);
    }
}


Measured memory_bytes: 15284
//https://codeforces.com/contest/1295/problem/A
//BROWNIE TK

#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()

#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en

#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

#define pll pair<lli, lli>
#define pii pair<int, int>
#define pil pair<int, lli>

#define forz(i, n) for (int i = 0; i < n; i++)
#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)

#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

#define lb lower_bound
#define ub upper_bound
#define er equal_range

#define findnot find_first_not_of

#define maxe *max_element
#define mine *min_element

#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetlli tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements sbtriectly lesser than k
//2. find_by_order(k) : k-th element in the set
#define ofk order_of_key
#define fbo find_by_order
using namespace std;

/*STD funcions*/
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli modi(lli a, lli m) { return power(a, m - 2, m); }
/*CODE BEGINS*/

int main()
{
    kira;
    set<lli>s;
    lli x;
    lli n;
    cin>>n;
    forz(i,n)
    {
        cin>>x;
        s.insert(x);
    }
    lli vs=lli(s.si);
    if(vs==n)p1("YES");
    else p1("NO");
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>

using namespace std;

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

    string result;
    if(A.size() > B.size())
    {
        result = "GREATER";
        cout << result << endl;
        return 0;
    }
    else if (A.size() < B.size())
    {
        result = "LESS";
        cout << result << endl;
        return 0;
    }

    if(std::string(A) > std::string(B))
    {
        result = "GREATER";
        cout << result << endl;
        return 0;
    }
    else if (std::string(A) < std::string(B))
    {
        result = "LESS";
        cout << result << endl;
        return 0;
    }
    else {
        result = "EQUAL";
        cout << result << endl;
        return 0;
    }
}


Measured memory_bytes: 256
def resolve():
    m, d = map(int, input().split())
    if d < 22:
        return 0
    count = 0
    for mi in range(4, m + 1):
        for di in range(22, d + 1):
            d10, d1 = str(di)
            if int(d10) * int(d1) == mi and int(d1) > 1:
                count += 1
    return count


if __name__ == "__main__":
    print(resolve())


Measured memory_bytes: 39920
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (k <= a) {
    cout << a - k << " " << b << endl;
  } else if (k <= a + b) {
    cout << 0 << " " << b - (k - a) << endl;
  } else {
    cout << 0 << " " << 0 << endl;
  }
  return 0;
}

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

int main() {
	int box_num, op, count = 0;
	std::vector<std::vector<int> > boxes;
	std::vector<bool> red_visited;
	enum ball { RED, WHITE };


	std::cin >> box_num >> op;

	boxes.resize(box_num);
	red_visited.resize(box_num);

	// 箱の初期化を行う
	boxes[0].push_back(ball::RED); // 1番目の箱に赤いボールを入れる
	red_visited[0] = true;
	for (int i = 1; i < box_num; i++) {
		boxes[i].push_back(ball::WHITE);
	}

	for (int i = 0; i < op; i++) {
		int x, y;

		std::cin >> x >> y;

		// 0indexに合わせる
		x--;
		y--;

		auto whiteball_pos = std::find(boxes[x].begin(), boxes[x].end(), ball::WHITE);

		if (whiteball_pos != boxes[x].end()) {
			boxes[x].erase(whiteball_pos);
			boxes[y].push_back(ball::WHITE);
			if (red_visited[x]) {
				red_visited[y] = true;
			}
			if (boxes[x].size() == 0) {
				red_visited[x] = false;
			}
		} else if(boxes[x].size() > 0){
			boxes[x].erase(boxes[x].begin());
			boxes[y].push_back(ball::RED);
			red_visited[x] = false;
			red_visited[y] = true;
		}
	}

	for (int i = 0; i < boxes.size(); i++) {
		if (red_visited[i]) {
			count++;
		}
	}

	std::cout << count << std::endl;

	return 0;
}

Measured memory_bytes: 6396
#include<stdio.h>
int main()
{
    long int a,b,x;
    scanf("%ld %ld",&a,&b);
    x=(a+b)/2;
    if(abs(a-x)==abs(b-x))
          printf("%ld\n",x);
          else printf("IMPOSSIBLE\n");
    return 0;
}


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

int main(void){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i, n){
        cin>>v[i];
    }
    sort(v.begin(), v.end());
    
    int kmin=v[n/2-1];
    int kmax=v[n/2];
    int ans=(kmax-kmin);
    cout<<ans<<endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;

ld sqrt_(ld d) {
	assert(d >= 0.0);
	ld l = 0.0, r = 1000000.0;
	rep(q, 40) {
		ld m = (l + r) / 2.0;
		if (m * m >= d)
			r = m;
		else
			l = m;
	}
	return l;
}

int main() {
	int N, K;
	vd x, y, c;
	cin >> N >> K;
	x.resize(N);
	y.resize(N);
	c.resize(N);
	rep(i, N)
		cin >> x[i] >> y[i] >> c[i];
	ld L = 0.0, R = 1000000.0;
	rep(q, 40) {
		ld t = (L + R) / 2.0;
		//db tt = t;
		//printf("%.12f\n", tt);

		bool can = false;
		rep(i, N) {
			rep(j, N) {
				vector<ld> X(2), Y(2);
				if (i == j) {
					// 円の中心
					X[0] = x[i];
					Y[0] = y[i];
					X[1] = x[i];
					Y[1] = y[i];
				}
				else if (i > j) {
					// 円の交点
					ld A = (t / c[i]) * (t / c[i]);
					ld B = (t / c[j]) * (t / c[j]);
					ld C = (x[i] * x[i] - x[j] * x[j]) + (y[i] * y[i] - y[j] * y[j]) - (A - B);
					ld D = 2.0 * (x[i] - x[j]);
					ld E = 2.0 * (y[i] - y[j]);
					if (D == 0.0) {
						Y[0] = C / E;
						Y[1] = C / E;
						ld AY = A - (Y[0] - y[i]) * (Y[0] - y[i]);
						if (AY < 0.0)
							continue;
						X[0] = sqrt_(AY) + x[i];
						X[1] = -sqrt_(AY) + x[i];
					}
					else {
						ld F = C / D;
						ld G = E / D;
						ld H = F - x[i];
						ld a_ = G * G + 1;
						ld b_ = -1.0 * (G * H + y[i]);
						ld c_ = H * H + y[i] * y[i] - A;
						if (b_ * b_ - a_ * c_ < 0.0)
							continue;
						Y[0] = (-b_ + sqrt_(b_ * b_ - a_ * c_)) / a_;
						Y[1] = (-b_ + -sqrt_(b_ * b_ - a_ * c_)) / a_;
						X[0] = F - G * Y[0];
						X[1] = F - G * Y[1];
					}
				}
				else continue;

				rep(p, 2) {
					int k = 0;
					rep(n, N) {
						ld dist2 = (X[p] - x[n]) * (X[p] - x[n]) + (Y[p] - y[n]) * (Y[p] - y[n]);
						ld ttmp2 = c[n] * c[n] * dist2;
						if (ttmp2 <= t * t + 0.0000000001)
							k++;
					}
					if (k >= K)
						can = true;
				}
			}
		}
		if (can)
			R = t;
		else
			L = t;
	}
	db ans = L;
	printf("%.12f\n", ans);
	return 0;
}

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


int main () {
    int a,b,c;
    cin >> a >> b >> c;
    for (int i=0; i<1; i++){
        int d = a-b;
        if (c-d < 0) {
            cout << 0;
        } else {
        cout << c-d;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>

#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



#include <array>
#include <iterator>



using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl;
typedef pair < int, int> P;


int N,H[1000000];
int main() {
	int ans = 0;
	cin >> N;
	rep(i, N) {
		cin >> H[i];
	}
	int res = 0;
	for (int i = 1; i < N; i++) {
		if (H[i - 1] >= H[i]) {
			
			res++;
		}
		else {
			
			ans = max(ans, res);
			res = 0;
		}
	}
	cout << max(ans,res) << endl;
}

Measured memory_bytes: 640
s = input()
n = len(s)

boundary = []
ans = [0] * n
# "LR"を記録、Lの方のindexをboundaryにappend
for i in range(n - 1):
    if s[i] == "L" and s[i + 1] == "R":
        boundary.append(i)

# n-1があると後のfor文で都合が良いので足しておく
boundary.append(n - 1)
# RR...RLL...L　の形に分割されている

l = 0
for r in boundary:
    middle = 0
    cnt = [0, 0]
    for x in range(l, r + 1):
        # xが偶数ならcnt[0], 奇数ならcnt[1]をincrement
        cnt[x % 2] += 1
        # "RL"を記録、Rの方のindexをmiddleに代入
        if x < r and s[x] == "R" and s[x + 1] == "L":
            middle = x

    # indexが偶数のものが一か所に、奇数のものが別の一か所(左右隣り合う)に集約される
    # middleが偶数の時
    if middle % 2 == 0:
        ans[middle] = cnt[0]
        ans[middle + 1] = cnt[1]
    # middleが奇数の時
    elif middle % 2 == 1:
        ans[middle] = cnt[1]
        ans[middle + 1] = cnt[0]

    l = r + 1

print(*ans)


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

bool check(long long p, long long K, const vector<long long>& w, const vector<long long>& d) {
  int N = (int)w.size();
  long long count = 0;
  for (int i = 0; i < N; i++) {
    if (p >= w[i]) {
      count += (p - w[i]) / d[i] + 1;
    }
  }
  return count >= K;
}

int main(void) {
  long long N, K;
  cin >> N >> K;
  vector<long long> w(N), d(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> d[i];
  }

  long long ng = 0;
  long long ok = 2e18;
  while (abs(ok - ng) > 1) {
    long long mid = (ok + ng) / 2;
    if (check(mid, K, w, d)) {
      ok = mid;
    }
    else {
      ng = mid;
    }
  }
  cout << ok << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>

int main(int argc, char *argv[]) {
  int n;
  std::cin >> n;
  for (int i = 0; i < 50000; ++i) {
    int nn = i * 1.08;
    if (nn == n) {
      std::cout << i << std::endl;
      return 0;
    }
  }
  std::cout << ":(" << std::endl;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0 ; i < n ; i++){
    cin >> a[i];
  }
  int ans = 100;
  for(int i = 0 ; i < n ; i++){
    int cnt = 0;
    while(a[i] % 2 == 0){
      a[i] /= 2;
      cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; 
  string S;
  cin >> N >> S;

  int max = 0;
  for(int thre = 0; thre < N; thre++){
  vector<char> X,Y;
  for(int i = 0 ; i < thre ; i++){
    X.push_back(S.at(i));
  }

  for(int i = thre ; i < N ; i++){
    Y.push_back(S.at(i));
  }
  int ret[27] ={0};
  for(int i = 0; i < X.size(); i++){
    for(int j = 0; j < Y.size(); j++){
      if(X.at(i) == Y.at(j)){
        ret[X.at(i) - 'a'] = 1;
      }
    }
  }
  int sum = 0;
  for(int i =0; i < 27 ;i++){
    //cout << ret[i]<< endl;
    sum += ret[i];
  }
  if(sum > max) max = sum;
  }
  
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < N; X++)
#define PI (acos(-1.0))

using namespace std;

int main(){

    int n;
    cin >> n;
    
    vector<int> x;
    vector<int> v;

    rep(i,n){
        int tmp;
        cin >> tmp;
        x.push_back(tmp);
        v.push_back(tmp);
    }

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

    int med1 = v[n/2 - 1];
    int med2 = v[n/2];

    rep(i, n){
        if(x[i] <= med1){
            cout << med2 << endl;
        }else{
            cout << med1 << endl;
        }
    }

 
    return 0;
}

Measured memory_bytes: 3948
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main()
{
    cin >> N;
    vi arr(N);
    for (int i = 0; i < N; i++) cin >> arr.at(i);

    B = *max_element(all(arr));
    C = *min_element(all(arr));
    cout << B-C;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  lint a, b, n, s = 0, t; cin >> a >> b >> n;
  if(b != 1){
    t = min(b - 1, n);
    s = a * t / b;
  }
  cout << s << "\n";
  return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using ll = long long; using ull = unsigned long long; using pii = pair<int, int>;
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD = 1e9 + 7;

signed main() {
	int a[5];
	for (int n; cin >> n&&n;) {
		int M = -INF, m = INF;
		rep(i, 0, n) {
			rep(i, 0, 5)cin >> a[i];
			int sum = accumulate(a, a + 5, 0);
			M = max(M, sum);
			m = min(m, sum);
		}
		cout << M << " " << m << endl;
	}
	return 0;
}

Measured memory_bytes: 3016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K,N; cin >> K >> N;
    if (K%2==0){
        cout << K/2;
        rep(i,N-1) cout << ' ' << K;
        cout << endl;
        return 0;
    }
    if (K==1){
        cout << K;
        rep(i,(N+1)/2-1) cout << ' ' << K;
        cout << endl;
        return 0;
    }
    vector<int> ans(N,(K+1)/2);
    rep(i,N/2){
        int cnt=0;
        while(ans[N-1-cnt]==0) ++cnt;
        --ans[N-1-cnt];
        if (ans[N-1-cnt]!=0) rep(j,cnt) ans[N-1-j]=K;
        else rep(j,cnt) ans[N-1-j]=0;
    }
    rep(i,N){
        cout << ans[i];
        if (!(i==N-1||ans[i+1]==0)) cout << ' ';
        else {cout << endl; break;}
    }
}

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

using namespace std;
typedef unsigned long long ll;
typedef pair<ll, ll> pi;

int main() {
	ll a;
	cin>>a;
	ll s = sqrt(a);
	for (ll i = s;i > 0 ;--i) {
		if (a%i == 0) {cout <<(i-1)+(a/i-1)<<endl; break;}
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long 
// #define int ll
//#define slld(t) scanf("%lld",&t)
// #define sd(t) scanf("%d",&t)
// #define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define pdd pair<double , double>
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N    200005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
#define s3   1.73205080757          // square root 3
const  int inf = (int)1e18+10 ;
const int MAX= 100;

 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set S;

int powmod(int x , int y){
	int res = 1;
	while(y > 0){
		if(y%2==1)
			res = (res*x)%mod;
		x = (x*x)%mod;
		y/=2;
	}
	return res;
}
int mul(int x , int y){
	return (x*y)%mod;
}

signed main(){
  fast;
 
 int a , b , c;
 cin >> a >> b >> c;
 if(a + b + c >= 22)
 	cout << "bust" << endl;
 else
 	cout << "win" << endl;
 }

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
AC_numbers = [0]

# そうか、まず累積和で全体のACのかずを数えるのか
for i in range(1, N):
  if S[i-1] == 'A' and S[i] == 'C':
    AC_numbers.append(AC_numbers[i - 1] + 1)
  else:
    AC_numbers.append(AC_numbers[i-1])

# そこから引いて数を求める
for q in range(Q):
  start, end = map(int, input().split())
  count = AC_numbers[end-1] - AC_numbers[start-1]
  print(count)


Measured memory_bytes: 6176
import sys


def input():
    return sys.stdin.readline()[:-1]

#N = int(input())
#A = [int(x) for x in input().split()]
#a, b, c = map(int, input().split())
#name1 = str(input())
#alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a, b, c = map(int, input().split())
print(a+b+c-max(a,b,c))

Measured memory_bytes: 2940
#include <cstdio>

int N,K,P;

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

	for(int I = 0; I < N; I++){
		scanf("%d%d",&K,&P);
		int tmp = K%P;
		if(tmp == 0) tmp = P;
		printf("%d\n", tmp);
	}
	return 0;
}



Measured memory_bytes: 2704
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int INF = 1e9 +7;

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    int res = 0;
    REP(i, n - 1){
        if(s[i] == s[i + 1]){
            res++;
        }
    }

    res = min(res + k * 2, n - 1);
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include<iostream>

int main()
{
	using namespace std;
	int a,b,c;
	cin>>a>>b>>c;
	int counter=0;
	int t;
	if(a>b)
	{
		t=a;a=b;b=t;
	}
	if(a>c)
	{
		t=a;a=c;c=t;
	}
	if(b>c)
	{
		t=b;b=c;c=t;
	}
	int minus_=b-a;
	if(minus_%2==0)
	{
		counter+=minus_/2;
		counter+=c-b;
	}
	else
	{
		counter++;
		a+=1;
		c+=1;
		minus_=b-a;
		counter+=minus_/2;
		counter+=c-b;
	}
	cout<<counter<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        for(int i =1; ; i++) {
            int x = stdIn.nextInt();
            if(x == 0) {
                break;
            } else {
                System.out.println("Case"+ " " + i + ":" + " " + x);
            }
        }
    }
}


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

#define X first
#define Y second

typedef long long cc;

const int N = 302;
int n, m, k;
int res[N][N];
bool was[N][N];
char a[N][N];
int s[N][N];
typedef pair <int, int> pii;
#define mp make_pair
vector <pii> points;

int get(int x, int y, int u, int v) {
    return s[u][v] - s[u][y - 1] - s[x - 1][v] + s[x - 1][y - 1];
}

void read_inp() {
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
            s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + (a[i][j] == '#');
            if (a[i][j] == '#') {
                points.emplace_back(mp(j, i));
                was[i][j] = true;
            }
        }
    }
}

void solve() {
    sort(points.begin(), points.end());
    for (int c = 1; c <= k; c++) {
        int x = points[c - 1].Y,
            y = points[c - 1].X;
        int u = x;
        while (u > 1 && !was[u - 1][y]) u--;
        while (x < n && !was[x + 1][y]) x++;
        int v = y;
        while (v > 1 && !was[u][v - 1] && get(u, v - 1, x, y) == 1) v--;
        while (y < m && get(u, v, x, y + 1) == 1) y++;
        for (int i = u; i <= x; i++) {
            for (int j = v; j <= y; j++) {
                was[i][j] = true;
                res[i][j] = c;
            }
        }
    }
}

void print() {
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cout << res[i][j] << " ";
        }
        cout << "\n";
    }
}

int main () {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    read_inp();
    solve();
    print();
    return 0;
}
/*
2 * (x + k) = s + k
2 * x + k = s
2 * x - k = s
*/


Measured memory_bytes: 2548
integer(16)::mo = 10**9 + 7
integer(16)h, w, t
integer(16) gh,gw
integer(16) ans
read*,h,w,t
gh = gcd(h, t)
gw = gcd(w, t)
h =h/ gh
w =w/ gw
ans = mod((power(2_16, h) + power(2_16, w) - 1_16 + mo),mo)
ans = mod((ans + power(2_16,gcd(h, w)) - 2_16 + mo),mo) 
print"(i0)",power(ans, gh * gw)
contains
integer(16) function power(x,y)
integer(16) x,k
integer(16) y,l2
power=1
l2=y
k=x
do
  if(mod(l2,2)==1)power=mod(power*k,mo)
  k=mod(k*k,mo)
  l2=l2/2
  if(l2==0)exit
end do
end function
integer(16) recursive function gcd(a, b)result(res)
  integer(16), intent(in)::a, b
  res=merge(b, gcd(b, mod(a, b)),mod(a, b)==0)
end function
end 


Measured memory_bytes: 256
#include<iostream>
int main()
{
	int n, y;
	std::cin >> n >> y;
	for(int i = 0; i <= n; i++)
	{
		for(int j = 0; j <= n; j++)
		{
			if(i + j > n)
			{
				continue;
			}
			if(10000 * i + 5000 * j + 1000 * (n - i - j) == y)
			{
				std::cout << i << ' ' << j << ' ' << n - i - j << std::endl;
				return 0;
			}
		}
	}
	std::cout << -1 << ' ' << -1 << ' ' << -1 << std::endl;
	return 0;
}

Measured memory_bytes: 256
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
mx=max(X)
my=min(Y)
if mx<my:
    for i in range(mx+1,my+1):
        if x<i<=y:
            print("No War")
            exit()
    print("War")
    
        
    

else:
    print("War")


            


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

class Main{
    public static void main(String[] args) throws Exception{
	int i=0;
	int j=0;
	int tmp;
	int Count_Sort = 0;
	
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String N_str = br.readLine();
	int N = Integer.parseInt(N_str);
	
	int[] A;
	A = new int[N];
	
	String A_str = br.readLine();
	Scanner sc = new Scanner(A_str).useDelimiter("\\s* \\s*");
	
	while(sc.hasNext()){
	    A[i] = sc.nextInt();
	    i++;
	}

	for(i=0;i<N;i++){
	    int minj = i;
	    for(j=i;j<N;j++){
		if(A[j]<A[minj]){
		    minj = j;
		}
	    }
	    tmp = A[i];
	    A[i] = A[minj];
	    A[minj] = tmp;
	    if(i!=minj) Count_Sort++;
	}
	    

	for(i=0;i<N;i++){
	    System.out.print(A[i]);
	    if(i!=N-1) System.out.print(" ");
	}
	System.out.println("");
	System.out.println(Count_Sort);
	sc.close();
    }
}



Measured memory_bytes: 26404
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4

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

  int digit = 1, d10 = 10, cnt = 0;
  for (int i=1;i<=N;i++){
    if (i%d10==0){
      digit++;
      d10*=10;
    }
    if (digit%2==1) cnt++;

  }

  cout << cnt << endl;

  return 0;
}

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

const int N = 1010;

char s[N], t[N];
int n, m;

int main()
{
	char c;
	while ((c = getchar()) != '\n'){
		s[++ n] = c;
	}
	while ((c = getchar()) != '\n'){
		t[++ m] = c;
	}
	int ans = INT_MAX;
	for (int i = 1;i <= n - m + 1; i++){
		int tt = 0;
		for (int j = 1;j <= m; j++)
			if (t[j] != s[i + j - 1])
				tt++;
		ans = min(ans, tt);
	}
	printf("%d\n", ans);
	return 0;		
}

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

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

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

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

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

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

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

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

fn main() {
    input! {
        r: usize,
        d: usize,
        x2000: usize,
    }
    let ans = solve(r, d, x2000);
    for a in ans.iter() {
        println!("{}", a)
    }
}

fn solve(r: usize,
         d: usize,
         x2000: usize) -> Vec<usize> {
    let mut xi = x2000;
    let mut result: Vec<usize> = vec![];
    for _i in 1..11 {
        xi = r * xi - d;
        result.push(xi);
    }
    result
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        let tests: Vec<((usize, usize, usize), Vec<usize>)> = vec![
            ((2, 10, 20), vec![30, 50, 90, 170, 330, 650, 1290, 2570, 5130, 10250]),
        ];
        for t in tests.iter() {
            let ((r, d, x2000), expected) = t;
            let actual = solve(*r, *d, *x2000);
            assert_eq!(actual, *expected);
        }
    }
}


Measured memory_bytes: 4352
from sys import stdin
from collections import deque
def main():
    #入力
    readline=stdin.readline
    n,m=map(int,readline().split())
    G=[[] for _ in range(n*3)]
    for i in range(m):
        a,b=map(lambda x:int(x)-1,readline().split())
        for j in range(3):
            G[3*a+j].append(3*b+(j+1)%3)

    s,t=map(lambda x:int(x)-1,readline().split())
    s*=3
    t*=3
    #bfs
    d=deque([s])
    flags=[-1]*(3*n)
    flags[s]=0
    while len(d)>0:
        now=d.popleft()
        for nex in G[now]:
            if flags[nex]==-1:
                flags[nex]=flags[now]+1
                d.append(nex)

    print(flags[t]//3)

if __name__=="__main__":
    main()


Measured memory_bytes: 78884
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int t = 2 * K - 1;
		if(t <= N) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

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

using namespace std;

int N;
long long int X[100005], L[100005];

vector<pair<long long int, long long int > > V;

int main(void) {

	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> X[i] >> L[i];

		V.push_back(make_pair(X[i] + L[i], X[i] - L[i]));
	}

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

	int ans = 0;

	long long int cur = INT64_MIN;

	for (int i = 0; i < N; i++) {
		auto P = V[i];
		if (P.second < cur) { continue; }
		else { ans++; cur = P.first; }
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());

        if (A < 10 && B < 10) {
            System.out.print(A * B);
        } else {
            System.out.print(-1);
        }
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

bool isprime(ll n){
  bool isPrime = true;
  for(ll i = 2; i <= sqrt(n); ++i)
  {
      if(n % i == 0)
      {
          isPrime = false;
          break;
      }
  }
  return isPrime;
}

int main() {
    ll n,k;
    cin>>n>>k;


    unordered_set<ll> divn,divk;
    {
        ll lim = sqrt(n);
        fr(i, 1, lim+1){
            if(n%i ==0){
                divn.insert(i);
                divn.insert(n/i);
            }
        }
    }
    {
        ll lim = sqrt(k);
        fr(i, 1, lim+1){
            if(k%i ==0){
                divk.insert(i);
                divk.insert(k/i);
            }
        }
    }
    ll sum=0;
    for(auto it:divk) if(divn.count(it)) if(isprime(it)) sum++;
    pr(sum);
}

Measured memory_bytes: 768
# cook your dish here
n=int(input())
v=list(map(int,input().split()))
if 1 not in v:
    print(-1)
else:
    ans=0
    num=1
    for i,e in enumerate(v):
        if e==num:
            num+=1
            ans+=1
            
            
    print(n-ans)


Measured memory_bytes: 32308
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define rep(i, a, N) for(int i = a; i < N; i++)
#define rrep(i, a, N) for(int i = a; i >= N; i--)

int main() {
    int N, Q;
    cin >> N >> Q;

    string S;
    cin >> S;

    vector<int> cnt;
    rep(i, 0, N - 1) {
        if (S[i] == 'A' && S[i + 1] == 'C') cnt.push_back(i);
    }

    rep(i, 0, Q) {
        int l, r;
        scanf("%d %d", &l, &r);
        l--;
        r--;
        l = lower_bound(cnt.begin(), cnt.end(), l) - cnt.begin();
        r = lower_bound(cnt.begin(), cnt.end(), r) - cnt.begin();
        printf("%d\n", r - l);
    }
}

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

using namespace std ; 

#define N 500
#define ll long long
const ll mod = 1e9+7 ; 

ll n , m ;
ll a[ N ] , b[ N ] ;
ll sum[ N ][ N ] , l[ N ][ N ] ;
ll f[ N ][ N ] ;
//f[ i ][ j ]前i个人一共分了j个糖果 
//l[ i ][ j ]储存i的j次方
//sum[ i ][ j ]对l维护前缀和 

int main() {
	scanf( "%lld%lld" , &n ,&m ) ;
	for( int i = 1 ; i <= n ; i ++ ) {
		scanf( "%lld" , &a[ i ] ) ;
	}
	for( int i = 1 ; i <= n ; i ++ ) {
		scanf( "%lld" , &b[ i ] ) ;
	}
	for( int i = 1 ; i < N ; i ++ ) {
		l[ i ][ 0 ] = 1 ;
		for( int j = 1 ; j < N ; j ++ ) {
			l[ i ][ j ] = l[ i ][ j - 1 ] * i  ;
			l[ i ][ j ] %= mod ;
		}
	}
	for( int i = 1 ; i < N ; i ++ ){
		for( int j = 0 ; j < N ; j ++ ) {
			sum[ i ][ j ] += sum[ i - 1 ][ j ] + l[ i ][ j ] ;
			sum[ i ][ j ] %= mod ;
		}
	} 
	f[ 0 ][ 0 ] = 1 ;
	for( int i = 1 ; i <= n ; i ++ ) {
		for( int j = 0 ; j <= m ; j ++ ) {
			for( int k = 0 ; k <= j ; k ++ ) {
				f[ i ][ j ] = ( f[ i ][ j ] % mod + ( 1ll * f[ i - 1 ][ j - k ] *( ( sum[ b[ i ] ][ k ] - sum[ a[ i ] - 1 ][ k ] ) % mod )  + mod ) % mod + mod ) % mod  ;
			}
		} 
	} 
	printf( "%lld\n" , f[ n ][ m ] ) ;
	return 0 ;
} 

Measured memory_bytes: 5760
#include<stdio.h>
#include<string.h>

int main()
{
    int l, r, d, a = 0;

    scanf("%d %d %d", &l, &r, &d);

    for (int i = l; i<=r; i++)
    {
        if ((i%d) == 0)
        {
            a++;
        }
    }

    printf("%d", a);

    return 0;
}

Measured memory_bytes: 1728
n=int(input())
ans=0
from itertools import product
s=[]
for i in range(3,10):
  s+=list(product("357",repeat=i))
for i in range(0,len(s)):
  if "3" in s[i] and "5" in s[i] and "7" in s[i]:
    if n>=int("".join(s[i])):
      ans=ans+1
print(ans)

Measured memory_bytes: 7028