akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

constexpr int64_t MOD= 1'000'000'007;
constexpr bool is_FACTORIAL_STORED= false; // 階乗を配列に格納をする前処理をする/しない
constexpr int Nfac= is_FACTORIAL_STORED ? 200'007
                                        : 0;
/* 剰余環 Z/nZ */
struct mint{ // Z/nZ に関する演算(n:素数の場合は除算も)をサポートする構造体
  int64_t rep; // 出力すべき代表元 rep \in {0,1,..,MOD- 1}
  mint(int64_t x=0): rep(((x%MOD)+ MOD)% MOD){}
  mint operator-() const { return mint(-rep);}
  mint& operator+=(const mint& x){
    rep+= x.rep; 
    if(rep>= MOD) rep-= MOD;
    return *this;
  }
  mint& operator-=(const mint& x){
    rep-= x.rep;
    if(rep< 0) rep+= MOD;
    return *this;
  }
  mint& operator*=(const mint& x){
    rep*= x.rep; rep%= MOD;
    return *this;
  }
  mint operator+(const mint x) const {
    mint ans(*this);
    ans+= x;
    return ans;
  }
  mint operator-(const mint x) const {
    mint ans(*this);
    ans-= x;
    return ans;
  }
  mint operator*(const mint x) const {
    mint ans(*this);
    ans*= x;
    return ans;
  }
  bool operator==(const mint x) const {
    return rep==x.rep;
  }
  bool operator!=(const mint x) const {
    return rep!=x.rep;
  }

  mint pow(int64_t d) const{
    assert(d >= 0); // ここで引っかかったら this.pow(d)= 0 or this.pow(-d).inv() のどちらかを選べ
    assert(!(*this==0 && d==0)); //   this.pow(d)= 0 or 1           　     のどちらかを選べ
    mint ans= 1;
    mint x= *this;
    while(d > 0){
      if(d&1){ ans*= x; }
      d >>= 1;
      x*= x;
    }

    return ans;
  }

  friend istream& operator >> (istream &is, mint& x) noexcept{
    int64_t a;
    is >> a;
    x= a;
    return is;
  }
  friend ostream& operator << (ostream &os, const mint& x) noexcept{
      return os << x.rep;
  }
  // MOD が素数(<=> Z/nZ が体)のとき
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint& x){
    *this *= x.inv();
    return *this;
  }
  mint operator/(const mint x) const {
    mint ans(*this);
    ans/= x;
    return ans;
  }
};
// ^^^ テンプレここまで ^^^
constexpr int Nmax= 21;
using Matrix= vector<bitset<Nmax>>;
using Memo= bitset<(1<<Nmax)>;
using Index= int;

void solve(const Matrix &data, Index idx, vector<mint> *dp, Memo *memo){
  if(memo->test(idx)){ return; }
  else{
    static size_t N= data.size();
    size_t male= __builtin_popcount(idx);
    if(male==N){
      dp->at(idx)= 1;
      memo->set(idx);
    }
    else{
      mint ans_m= 0;
      for(size_t female=0; female<N; female++){
        if(data.at(male).test(female) && !(idx & (1<< female))){
          idx|= 1<< female;
          solve(data, idx, dp, memo);
          ans_m+= dp->at(idx);
          idx&= ~(1<< female);
        }
      }
      dp->at(idx)= ans_m;
      memo->set(idx);
    }
  }
}

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

  Matrix data(N);
  int buf;
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cin >> buf;
      if(buf==1){
        data.at(i).set(j);
      }
    }
  }

  vector<mint> dp(1<<N);
  Memo memo;
  solve(data, 0, &dp, &memo);

  mint ans= dp.at(0);

  cout << ans << endl;
}

Measured memory_bytes: 19900
// AOJ 0091: Blur
// 2017.12.16 bal4u@uu

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

char map[10][10]; int n;
int mv[3][2] = {{1,0},{1,1},{2,0}};
int ansx[12], ansy[12], id[12];

int calc(int r, int c, int id, int mode)
{
    int d, dr, dc, ar, ac, rr, cc;
    
	d = 2; if (!id) d--;
    for (dr = -d; dr <= d; dr++) {
		ar = dr; if (ar < 0) ar = -ar;
		for (dc = -d; dc <= d; dc++) {
			ac = dc; if (ac < 0) ac = -ac;
			if (ar + ac > d) continue;
			if (id == 1 && (dr == 0 && ac == 2 || dc == 0 && ar == 2)) continue;
			rr = r + dr, cc = c + dc;
	        if (rr < 0 || rr >= 10 || cc < 0 || cc >= 10) return 0;
			if (!mode) { if (!map[rr][cc]) return 0; }
			else map[rr][cc] += mode;
		}
    }
    return 1;
}

int rec(int k)
{
	int i, r, c, rr, cc;

	if (k == n) {
        for (r = 0; r < 10; r++) for (c = 0; c < 10; c++) if (map[r][c]) return 0;
        return 1;
    }

    for (r = 0; r < 10; r++) for (c = 0; c < 10; c++) {
		if (!map[r][c]) continue;
        for (i = 0; i < 3; i++) {
			rr = r + mv[i][0], cc = c + mv[i][1];
			if (!calc(rr, cc, i, 0)) continue;
			calc(rr, cc, i, -1);
			ansy[k] = rr, ansx[k] = cc, id[k] = i+1;
            if (rec(k+1)) return 1;
            calc(rr, cc, i, 1);
		}
        return 0;
	}
    return 0;
}

int main()
{
	int i, r, c, v;

	scanf("%d", &n);
    for (r = 0; r < 10; r++) for (c = 0; c < 10; c++) scanf("%d", &v), map[r][c] = v;
    rec(0);
	for (i = 0; i < n; i++) printf("%d %d %d\n", ansx[i], ansy[i], id[i]);
	return 0;
}

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

using namespace std;

typedef long long int llint;

string S;
int K;
llint dp[105][4][2];

int main() {
	cin >> S >> K;
	int N = S.size();
	dp[0][0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 2; k++) {
				int nd = S[i] - '0';
				for (int d = 0; d < 10; d++) {
					int ni = i + 1, nj = j, nk = k;
					if (d != 0)nj++;
					if (nj > K)continue;
					if (k == 0) {
						if (d > nd)continue;
						if (d < nd)nk = 1;
					}
					dp[ni][nj][nk] += dp[i][j][k];
				}
			}
		}
	}
	cout << dp[N][K][0] + dp[N][K][1] << endl;
}

Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<numeric>

typedef long long LL;

using namespace std;

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

int main(void) {
	int n, m;
	cin >> n >> m;
	vector<string>a(n), b(m);
	int k;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < m; i++)cin >> b[i];
	for (int i = 0; i <= n-m; i++) {
		for (int j = 0; j <=n-m; j++) {
			if (a[i].substr(j, m) == b[0]) {
				for (k = 1; k < m; k++) {
					if (a[i+k].substr(j, m) != b[k]) {
						break;
					}
				}
				if (k == m) {
					cout << "Yes";
					return 0;
				}
			}
		}
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Cnt {
	
	public int    number = 0;
	public String ward   = null;
	
	Cnt(String s){this.ward = s;}
}

public class Main {
	
	private static ArrayList<Cnt> list = new ArrayList<Cnt>();
	
	public static void main(String[] args) {

		//input
		Scanner sc = new Scanner(System.in).useDelimiter(System.getProperty("line.separator"));
		String[] wards = sc.next().split("\\s");
		
		
		boolean find_flg;
		int max = 0;
		String max_ward = "";
		for(String s:wards){

			//Frequency of appearance is investigated.
			Cnt c = null;
			find_flg = false;
			for(int i=0;i<list.size();i++){
				c = list.get(i);
				if(c.ward.equals(s)){
					c.number++;
					find_flg = true;
					break;
				}
			}
			if(!find_flg){list.add(new Cnt(s));}
			
			//The number of characters is counted.
			if(s.length() > max){
				max = s.length();
				max_ward = s; 
			}
		}
		
		//calculate frequency of appearance.
		int freq_max = 0;
		String freq_ward = "";
		for(Cnt c:list){
			if(c.number > freq_max){
				freq_max  = c.number;
				freq_ward = c.ward;
			}
		}

		//output
		System.out.println(freq_ward + " " + max_ward);
	}
}

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

public class Main {
    private static final boolean N_CASE = false;

    private boolean isPal(String s) {
        int i = 0, j = s.length() - 1;
        while (i < j) {
            if (s.charAt(i) != s.charAt(j)) {
                return false;
            }
            ++i; --j;
        }
        return true;
    }

    private void solve() {
        String s = sc.next();

        int n = s.length();
        if (isPal(s) && isPal(s.substring(0, (n - 1) / 2)) && isPal(s.substring((n + 3) / 2 - 1))) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    private void run() {
        int T = N_CASE ? sc.nextInt() : 1;
        for (int t = 0; t < T; ++t) {
            solve();
        }
    }

    private static MyWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

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

        List<Integer> nextList(int n) {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(nextInt());
            }
            return list;
        }
    }

    private static class MyWriter extends PrintWriter {
        private MyWriter(OutputStream outputStream) {
            super(outputStream);
        }

        void printArray(int[] a) {
            for (int i = 0; i < a.length; ++i) {
                print(a[i]);
                print(i == a.length - 1 ? '\n' : ' ');
            }
        }

        void printlnArray(int[] a) {
            for (int v : a) {
                println(v);
            }
        }

        void printList(List<Integer> list) {
            for (int i = 0; i < list.size(); ++i) {
                print(list.get(i));
                print(i == list.size() - 1 ? '\n' : ' ');
            }
        }

        void printlnList(List<Integer> list) {
            list.forEach(this::println);
        }
    }

    public static void main(String[] args) {
        out = new MyWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().run();
        out.close();
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define ll  long long

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, "\e[31;1m"); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\e[0m")
#else
    #define eprintf(...) 42
#endif

ll solve(int A, int B)
{
    return 0L;
}

int main(void)
{
    int A, B;
    std::string OP;
    std::cin >> A >> OP >> B;
    if ("+" == OP)
    {
        std::cout << (A + B) << std::endl;
    }
    else
    {
        std::cout << (A - B) << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize);
    let mut g = 0;
    for _ in 0..(n - 1) {
        parse!(it, u: usize, v: usize);
        let (u, v) = if u < v { (u, v) } else { (v, u) };
        g += u * (n + 1 - v);
    }
    let mut ret = 0;
    for i in 1..=n {
        ret += ((n - i + 2) * (n - i + 1)) / 2;
    }
    ret -= g;
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 4740
import java.util.Scanner;

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

    System.out.print(X - K + 1);
    for (int i = X - K + 2; i < X + K; i++) {
      System.out.print(" " + i);
    }
  }
}

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

int main() {
  int D;
  cin >> D;
  if (D == 25) cout << "Christmas" << endl;
  if (D == 24) cout << "Christmas Eve" << endl;
  if (D == 23) cout << "Christmas Eve Eve" << endl;
  if (D == 22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        while(!is_prime(x))
            x++;

        System.out.println(x);
    }

    static boolean is_prime(int x){
        for(int i = 2;i*i <= x;i++){
            if(x%i==0)
                return false;
        }
        return true;
    }
}

Measured memory_bytes: 23636
using System;

class Program{
    static void Main(string[] args){
        string strValue=Console.ReadLine();
        string[] strValueSplit=strValue.Split(' ');
        int a=int.Parse(strValueSplit[0]);
        int b=int.Parse(strValueSplit[1]);
        
        Console.WriteLine(a*b+" "+2*(a+b));
    }
}


Measured memory_bytes: 15936
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define count2way(v, x) high2way(v, x) - low2way(v, x)
#define lower(v, x) low2way(v, x) - v.begin()       //1番左が0、もし見つから無いならｎを出力
#define higher(v, x) high2way(v, x) - v.begin() - 1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout << a << endl
#define putout2(a, b) \
    putout(a);        \
    putout(b)
#define putout3(a, b, c) \
    putout(a);           \
    putout(b);           \
    putout(c)
#define putout4(a, b, c, d) \
    putout(a);              \
    putout(b);              \
    putout(c);              \
    putout(d)
#define putout5(a, b, c, d, e) \
    putout(a);                 \
    putout(b);                 \
    putout(c);                 \
    putout(d);                 \
    putout(e)
#define Gput(a, b) G[a].push_back(b)
#define cin1(a) cin >> a
#define cin2(a, b) cin >> a >> b
#define cin3(a, b, c) cin >> a >> b >> c
#define cin4(a, b, c, d) cin >> a >> b >> c >> d
#define cin5(a, b, c, d, e) cin >> a >> b >> c >> d >> e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
template <typename T>
T modinv(T a, T m)
{
    T b = m, u = 1, v = 0;
    while (b)
    {
        T t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//多次元配列の宣言法
//vector<vector<ll>> field(h, vector<ll>(w));
template <class T>
inline void chmax(T &a, T b)
{
    if (a < b)
        a = b;
}
template <class T>
inline void chmin(T &a, T b)
{
    if (a > b)
        a = b;
}
/*
ライブラリをここに置いてコメントを削除
*/

int main()
{
    cout << fixed << setprecision(30);
    ll x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))

#define equal equalll
#define less lesss
const int N = 1e6 + 10;
const long long INF = 1e9 + 19;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

int a[N];
int n;

bool check(int pos) {
    ll x = a[pos];
    for (int i = n - 1; i >= 0; i--) {
        //db(x);
        if (i == pos) continue;
        if (a[i] <= x * 2) {
            x += a[i];
        }
        else
            return 0;
    }
    return 1;
}

int main(){
#ifdef HOME 
    freopen("in", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    sort(a, a + n);
    reverse(a, a + n);
    int l = -1;
    int r = n;
    //db(check(0));

    for (; r - l > 1; ) {
        if (check((l + r) / 2))
            l = (l + r) / 2;
        else
            r = (l + r) / 2;
    }

    printf("%d\n", l + 1);


    return 0;
}



Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
  int a,b,c,d,e,f,g,h,x,y;
  cin>>a>>b>>c>>d;
  x=a-c;
  y=b-d;
  cout<<c+y<<" "<<d-x<<" "<<a+y<<" "<<b-x<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int used[101]={};
  int t=a;
  while(1){
    if(a%b==c){
      cout<<"YES"<<endl;
      return 0;
    }
    if(used[a%b]++)break;    
    a+=t;
  }
  cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
// クソ汚い.サンプルは合う.
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;
typedef long long ll;

int main(){
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for(int i = 0; i < n; i++)  cin >> a[i];
    vector<ll> b(n), c(n+1);
    b[0] = a[0], b[1] = a[1];
    for(int i = 2; i < n; i++)  b[i] = b[i-2] + a[i];
    c[0] = 0;
    for(int i = 0; i < n; i++)  c[i+1] = a[i]+c[i];

    int x;
    while(q-- > 0){
        cin >> x;
        if(x > a[n-1]){
            cout << b[n-1] << endl;
            continue;
        }else if(x < a[0]){
            cout << c[n-1+1] - c[n/2-1+1] << endl;
            continue;
        }

        // aokiが+-midの範囲のカードを取るとして二分探索
        int l = 0, r = a[n-1]+1;
        int aoki, taka, s, t;
        ll ans = 0;

        int cnt = 35;
        
        while(true){
            int mid = (l+r)/2;
            auto ss = lower_bound(a.begin(), a.end(), x-mid);
            auto tt = lower_bound(a.begin(), a.end(), x+mid);
            s = ss-a.begin(), t = tt-a.begin();
            if(*tt != x+mid) t--;
            aoki = t-s+1;
            taka = n-t-1;
            // cout << "aoki takes " << a[s] << " to " << a[t] << endl;
            // cout << aoki << " " << taka << endl;
            
            if(*ss == x-mid && *tt == x+mid){
                if(aoki-1+1 == taka+1){
                    t--;
                    ll tmp = c[t+1]-c[s];
                    if(s > 0)   tmp += b[s-1];
                    ans = c[n]-tmp;
                    break;
                }
            }

            if(aoki+1 == taka){
                ll tmp = c[t+1]-c[s];
                if(s > 0)   tmp += b[s-1];
                ans = c[n]-tmp;
                break;
            }
            
            if(aoki == taka){
                ll tmp = c[t+1]-c[s];
                if(s > 1)   tmp += b[s-2];
                ans = c[n]-tmp;
                break;
            }

            if(aoki+1 > taka){
                r = mid;
            }else{
                l = mid+1;
            }
        }

        cout << ans << endl;

    }
    return 0;
}

Measured memory_bytes: 3712
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
typedef long long LL;

int main() {
  int N; std::cin >> N;
  for (int i = 0; i < N; ++i) {
    int a; std::cin >> a;
    if (a % 2 == 0) {
      if (a % 3 != 0 && a % 5 != 0) {
        std::cout << "DENIED" << std::endl;
        return 0;
      }
    }
  }
  std::cout << "APPROVED" << std::endl;
}


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

#undef false
#undef true

using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;

/* [💭] [💡] [🎈] */

int a[3][3];
bool b[3][3];

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

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

    int n;
    cin >> n;
    while (n--) {
        int x;
        cin >> x;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (x == a[i][j]) b[i][j] = true;
            }
        }
    }

    bool flag = false;
    for (int i = 0; i < 3; i++) {
        bool flag1 = true, flag2 = true;
        for (int j = 0; j < 3; j++) {
            if (!b[i][j]) flag1 = false;
            if (!b[j][i]) flag2 = false;
        }
        if (flag1 || flag2) flag = true;
    }

    flag |= (b[0][0] && b[1][1] && b[2][2]);
    flag |= (b[0][2] && b[1][1] && b[2][0]);

    cout << (flag ? "Yes" : "No");

    return 0;
}


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

int main() {
  int N,M;
  cin>>N>>M;
  vector<int> x(M);
  vector<int> y(M);
  vector<int> b(N,1);
  vector<int> r(N);
  r[0]=1;
  for(int i=0;i<M;i++){
    cin>>x[i]>>y[i];
  }
  for(int i=0;i<M;i++){
    int p=x[i]-1;
    int q=y[i]-1;
    b[p]--;
    b[q]++;
    if(b[p]==0 && r[p]==1){
      r[p]=0;
      r[q]=1;
    }
    if(b[p]>0 && r[p]==1){
      r[q]=1;
    }
  }
  int ans =0;
  for(int i=0;i<N;i++) if(r[i]==1) ans++;
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 200200;
const int MAXK = 20;

int a[MAX];
int l[MAX][MAXK], r[MAX][MAXK];
int fl[1 << MAXK], fr[1 << MAXK];

int main(void) {
  ios_base::sync_with_stdio(false);

  int N, V;
  cin >> N >> V;
  REP(i, N) cin >> a[i];

  int K = 0;
  int v[MAXK];
  while (V > 0) {
    v[K++] = V;
    V /= 2;
  }
  v[K++] = 0;

  REP(i, N) {
    REP(j, K) {
      if (i > 0 && a[i] - a[i - 1] <= v[j]) {
        l[i][j] = l[i - 1][j];
      } else {
        l[i][j] = i;
      }
    }
  }

  for (int i = N - 1; i >= 0; --i) {
    REP(j, K) {
      if (i < N - 1 && a[i + 1] - a[i] <= v[j]) {
        r[i][j] = r[i + 1][j];
      } else {
        r[i][j] = i;
      }
    }
  }

  REP(s, 1 << K) fl[s] = 0, fr[s] = N - 1;
  REP(s, 1 << K) {
    REP(j, K) {
      if (!(s & (1 << j))) {
        int ns = s | (1 << j);
        int nfl = fl[s] == N ? N : r[fl[s]][j] + 1;
        fl[ns] = max(fl[ns], nfl);
        int nfr = fr[s] == -1 ? -1 : l[fr[s]][j] - 1;
        fr[ns] = min(fr[ns], nfr);
      }
    }
  }

  vector<bool> can(N, false);

  int all = (1 << K) - 1 - 1;
  bool all_can = false;
  REP(s, 1 << K) {
    if ((s & all) == s) {
      int a = fl[s];
      int b = fr[all ^ s];

      if (a > b) {
        all_can = true;
        break;
      }

      if (r[a][0] >= b) can[l[a][0]] = true;
    }
  }

  REP(i, N) {
    if (can[l[i][0]] || all_can) {
      cout << "Possible\n";
    } else {
      cout << "Impossible\n";
    }
  }
  return 0;
}


Measured memory_bytes: 42624
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <functional>
#include <iomanip>
using namespace std;

#define rep(p,q) for(int i = p;i < q;i++)

#define LL long long int

#define inf 10000000000

//1
int main(void) {
	int n;
	cin >> n;
	LL ans = -inf;
	LL min = inf;
	bool isReseted = true;
	rep(0, n) {
		LL r;
		cin >> r;
		if (ans < r - min) ans = r - min;
		if (r < min) min = r;

	}
	
	cout << ans << endl;
	
	
	
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {

	unsigned int N;
	int X[2] = { 0 }, sa;
	unsigned long long int A,B,ans = 0;

	cin >> N >> A >> B;

	for (int i = 0; i < N; i++) {

		cin >> X[1];

		if (i > 0) {
			sa = X[1] - X[0];

			if (sa * A > B)
				ans += B;
			else
				ans += sa * A;
		}
		X[0] = X[1];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;


ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}

//最小公倍数ダヨン
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

bool root(string s){
    int n=s.length();
    if(n==2){
        if(s[0]==s[1]){
            return true;
        }
        else return false;
    }
    if(n==3){
        if(s[0]==s[2]){
            return true;
        }
        else return false;
    }
 
    return false;
}
 


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

    sort(all(a));
    reverse(all(a));

    int ans=0;
    queue<int> betters;
    
    for(int i=0;i<n;i++){
        if(i==0){
            betters.push(a[i]);
            continue;
        }
        int bet=betters.front();
        betters.pop();
        betters.push(a[i]); betters.push(a[i]);
        ans+=bet;
    }

    cout<<ans<<endl;
}   

Measured memory_bytes: 6404
import java.io.*;

public class Main{
	public static void main(String argv[]) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int weeks = Integer.parseInt(line);
		float debt = 100000;
		for(int i=0; i<weeks; i++){
			debt *= 1.05f;
			if((debt % 1000) > 0.0){
				debt = debt+1000-debt%1000;
			}
		}
		System.out.print(Integer.toString((int)debt)+"\n");
	}
}

Measured memory_bytes: 16864
n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])
sum = 0
for i in range(len(n)):
    if i == 0:
        if n[0] != 1:
            sum += int(n[i]) - 1
    else:
        sum += 9
ans = max(ans, sum)
print(ans)

Measured memory_bytes: 3060
import java.util.*;
import java.util.stream.*;
import java.io.*;
import java.math.*;
class Main {
  public static void main(String[] args) {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    br.lines()
      .map(line -> Stream.of(line.split(" "))
                      .mapToInt(Integer::parseInt)
                      .toArray())
      .map(ar -> Stream.of(
                    new BigDecimal((double)(ar[1] * ar[5] - ar[4] * ar[2])/(ar[1] * ar[3] - ar[4] * ar[0])).setScale(3, RoundingMode.HALF_UP),
                    new BigDecimal((double)(ar[5] * ar[0] - ar[2] * ar[3])/(ar[0] * ar[4] - ar[1] * ar[3])).setScale(3, RoundingMode.HALF_UP)
      ).toArray())
      .forEach(xy -> System.out.println(xy[0].toString() + " " + xy[1].toString()));
  }
}

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

using namespace std;


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

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

    sort(s.begin(),s.end());
    string ans = "";
    for(int i = 0;i < n;i++)
    {
        ans += s[i];
    }

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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void showdp(int **dp, int w, int h)
{
	int i =0;
	int j =0;
	while (i < h)
	{
		j = 0;
		while (j < w)
		{
			printf("%d",dp[i][j]);
			j++;
		}
		i++;
		printf("\n");
	}
}
void	backdp(int **dp, char **c, int w, int h)
{
	int i = 0;
	int j = 0;
	while (i < h)
	{
		j = 0;
		while (j < w)
		{
			dp[i][j] = (c[i][j] == '.'?0:1);
			j++;
		}
		i++;
	}
}
int intpow(int a, int b)
{
	int i = 0;
	int j = 1;
	while (i < b)
	{
		j = j * a;
		i++;
	}
	return (j);
}

void redrow(int **dp, int row, int w, int h)
{
	int i = 0;
	while (w--)
		dp[row][w] =2;
}

void redcol(int **dp, int col, int w, int h)
{
	int i = 0;
	while (h--)
		dp[h][col] =2;
}

int main(void)
{
	int h, w, k;
	scanf ("%d %d %d",&h, &w, &k);
	int i=0;
	int j=0;
	char **c;
	int **dp;
	c = (char **)malloc(sizeof(char*)*(h));
	dp = (int **)malloc(sizeof(int*)*(h+1));
	while (i < h)
	{
		c[i] = (char *)malloc(sizeof(char)*(w+1));
		dp[i] = (int *)malloc(sizeof(int)*(w+2));
		scanf("%s",c[i]);
		j = 0;
		while (j < w)
		{
			dp[i][j] = (c[i][j] == '.')?(0):(1);
			j++;
		}
		i++;
	}
	i = 0;
	j = 0;
	while (i < h)
	{
		j = 0;
		while (j < w)
		{
			//printf("%d",dp[i][j]);
			j++;
		}
		//printf("\n");
		i++;
	}
	int cnt = 0;
	i = 0;
	j = 0;
	int check = intpow(2,w+h);
	int mincnt = 0;
	int minh = 0;
	int minw = 0;
	while (check--)
	{
		int bin[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
		backdp(dp,c,w,h);
		mincnt =0;
		if (check%2 == 1 )
		{
			bin[0] = 1;
		}
		if (check%4 / 2 == 1)
		{
			bin[1] = 1;
		}
		if (check%8 / 4 == 1 && h+w >2)
		{
			bin[2] = 1;
		}
		if (check%16 / 8 == 1 && h+w > 3)
		{
			bin[3] = 1;
		}
		if (check%32 / 16 == 1 && h+w >4)
		{
			bin[4] = 1;
		}
		if (check%64 / 32 == 1 && h+w >5)
		{
			bin[5] = 1;
		}
		if (check%128 / 64 == 1 && h+w >6)
		{
			bin[6] = 1;
		}
		if (check%256 / 128 == 1 && h+w >7)
			bin[7] = 1;
		if (check%512 / 256 == 1 && h+w >8)
			bin[8] = 1;
		if (check%1024 / 512 == 1 && h+w >9)
			bin[9] =1;
		if (check%2048 /1024 == 1 && h+w >10)
			bin[10]=1;
		if (check%4096 /2048 == 1 && h+w > 11)
			bin[11]=1;
		//printf("%d %d %d %d %d %d %d %d %d %d %d %d\n",bin[0],bin[1],bin[2],bin[3],bin[4],bin[5],bin[6],bin[7],bin[8],bin[9],bin[10],bin[11]);
		i = 0;
		j = 0;
		while (i < h+w)
		{
		if (i <h && bin[i]==1)
		{
			redrow(dp,i,w,h);
		}
		else if (bin[i]==1)
		{
			redcol(dp,i-h,w,h);
		}
		i++;
		}
		i = 0;
		j = 0;
		while (i < h)
		{
			j = 0;
			while (j < w)
			{
				if (dp[i][j] == 1)
					mincnt++;
				j++;
			}
			i++;
		}
		//printf("w:%d h:%d\n",w,h);
		if (mincnt == k)
		{
			//showdp(dp,w,h);
			cnt++;
		}
		//printf("debug%d\n",mincnt);
		mincnt=0;
		i=0;
		j=0;
		}
	
	printf("%d\n",cnt);
	return (0);
}


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

using namespace std;

using ll = long long;

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

    vector<ll> a(n);
    for(auto &e: a) cin >> e;

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

    ll ng = 2e18, ok = -2e18;
    // ok未満の積がk個未満
    while(ng - ok > 1) {
        ll m = (ok + ng)/2;
        
        ll s = 0;
        for(ll i=0; i<n; i++) {
            if(a[i] < 0) {
                // a[x] * a[i] < m
                ll j = partition_point(a.begin(), a.end(),
                        [&](auto &x) { return x * a[i] >= m; }) - a.begin();
                // >= >= [<] < <
                if(i >= j) j++;
                s += max(n-j, 0ll);
            }
            if(a[i] > 0) {
                // a[x] * a[i] < m
                ll j = partition_point(a.begin(), a.end(),
                        [&](auto &x) { return x * a[i] < m; }) - a.begin();
                // < < [>=] >= >=
                if(i < j) j--;
                s += max(j, 0ll);
            }
            if(a[i] == 0) {
                // a[x] * 0 < m
                s += m > 0 ? n-1 : 0;
            }
        }
        assert(s % 2 == 0);
        s /= 2;

        (s < k ? ok : ng) = m;
    }
    cout << ok << endl;
}



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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n,k; cin >> n >> k;
  int x;
  if(n == 2) return(cout << 1 << endl, 0);
  vector<int> v(n); for(int i = 0; i < n; i++) {cin >> v[i];if(v[i]==1) x = i;}
  ll ans = ((x ? (x + k -2) / (k-1) : 0) + (x < n - 1 ? (n-1-x+k-2)/(k-1) : 0));
  cout << (n-1+k-2)/(k-1) << endl;
}



Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

typedef unsigned long long ull;

int main()
{
    int A, B;
    
    cin >> A >> B;
    
    if (A == 1)
    {
        A += 13;
    }
    if (B == 1)
    {
        B += 13;
    }
    
    printf("%s\n",
        A == B ? "Draw" : (A > B ? "Alice" : "Bob"));
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define LL long long
LL N;
LL ans;
LL m = 1 << 30;
bool flag = true;
int main() {
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		LL A, B;
		std::cin >> A >> B;
		ans += B;
		if (A > B) {
			flag = false;
			m = std::min(m, B);
		}
	}
	ans -= m;
	if (flag)ans = 0;
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int a,b,c;
  bool ans=false;
  std::cin >> a >> b;
  if(a==100) {
      if(b==100)c=a*1000+b;
      else if(b>=10) c=a*100+b;
      else c=a*10+b;
  }

  else if(a>=10) {
    if(b==100) c=(a/10)*10000+(a%10)*1000+b;
    else if(b>=10) c=(a/10)*1000+(a%10)*100+(b/10)*10+b%10;
    else c=(a/10)*100+(a%10)*10+b;

  }
  else {
    if(b==100)c=a*1000+b;
    else if(b>=10) c=a*100+b;
    else c=a*10+b;
  }


  for(int i=1; i<=110000; i++){
    if(c==i*i){
      ans=true;
      break;
    }
  }
  if(ans)printf("Yes\n");
  else printf("No\n");




  return 0;

}


Measured memory_bytes: 256
import scala.io.StdIn.{readLine,readInt}

object Main {
  def main(args:Array[String]) = {
    var dwh = "0 0 0"
    while({dwh=readLine.trim;dwh}!="0 0 0") {
      val s = dwh.split(" ").map(_.toInt).sorted
      val n = readInt
      for(i<-1 to n) {
        val r = readInt
        if(s(0)*s(0)+s(1)*s(1) < 4*r*r) println("OK")
        else println("NA")
      }
    }
  }
}

Measured memory_bytes: 43856
N = int(input())
A = list(map(int, input().split()))

L = [0] * 8
flag = False
for i in range(N):
    if A[i] < 3200:
        flag = True
        num = int(A[i] / 400)
        L[num] = 1
if flag == False:
    S_min = 1
else:
    S_min = sum(L)
count = 0
for i in range(N):
    if A[i] >= 3200:
        count = count + 1
S_max = count + sum(L)
print(S_min, S_max)


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

typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)(N); i++)

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

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    
    cout << min(N*A,B) << endl;
    return 0;
}


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

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
using ll = long long;
using vi  = vector<int>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}

/* 0-indexed, [0, n)
 *
 * requirements: let a, b, c in T
 *   op(op(a, b), c) = op(a, op(b, c))
 *   op(a, e) = op(e, a) = e
 */
template<typename T, typename E> class SegmentTree {
public:
  typedef function<T (T, T)> Operator;
  typedef function<T (T, E)> Apply;

  vector<T> data;
  ll n;        // size of elements (2^x alignment)
  T e;         // identity of monoid
  Operator op; // binary operator of monoid
  Apply apply; // apply effect to monoid

  // construct with size of elements
  SegmentTree(ll _n, T _e, Operator _op, Apply _apply): e(_e), op(_op), apply(_apply) {
    for(n = 1; n < _n; n *= 2);
    data.resize(n * 2 - 1, e);
  }

  // construct with initial values
  SegmentTree(const vector<T> &vec, T _e, Operator _op, Apply _apply): e(_e), op(_op), apply(_apply) {
    for(n = 1; n < vec.size(); n *= 2);
    data.resize(n * 2 - 1, e);
    FOR(i, 0, vec.size()) data[i + n - 1] = vec[i];
    for(ll i = n - 2; i >= 0; i--) data[i] = op(data[i * 2 + 1], data[i * 2 + 2]);
  }

  // query for [a, b)
  T query(ll a, ll b) { return query(a, b, 0, 0, n); }
  T query(ll a, ll b, ll k, ll l, ll r) {
    if(r <= a || b <= l) return e;
    if(a <= l && r <= b) return data[k];
    T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return op(vl, vr);
  }

  // update value at k
  void update(ll k, E x) {
    k += n - 1;
    data[k] = apply(data[k], x);
    while(k > 0) {
      k = (k - 1) / 2;
      data[k] = op(data[k * 2 + 1], data[k * 2 + 2]);
    }
  }
};

ll ext_gcd(ll a, ll b, ll &x, ll &y){ // ax+by=gcd(a,b)なるx,y,gcdを返す
  if(b == 0){
    x = 1; y = 0; return a;
  }
  ll q = a / b;
  ll g = ext_gcd(b, a-q*b, x, y);
  ll z = x - q * y;
  x = y; y = z;
  return g;
}

signed main(){
  SegmentTree<int, int>::Operator op = [](int a, int b){
    int x, y;
    return ext_gcd(a,b,x,y);
  };
  SegmentTree<int, int>::Apply apply = [](int a, int x){
    return x;
  };

  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];

  SegmentTree<int, int> segtree(a, 0, op, apply);

  int ans = 0;
  rep(i,n){
    int x,y;
    chmax(ans, ext_gcd(segtree.query(0,i),segtree.query(i+1,a.size()),x,y));
  }
  cout << ans << endl;
}


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

int main(){
  int x,a;
  cin >> x >> a;
  //cin >> t;
  if(x<a)cout << 0 << endl;
  //else if(6<=a&&a<=12)cout << b/2 << endl;
  else cout << 10 << endl;
  //cout << b*(int)((t+0.5)/a) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define repr(i,a,n) for (int i=a;i<n;i++)
#define rrep(i,a,n) for (int i=n-1;i>=a;i--)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define fi first
#define se second
#define mod 1000000007
const int N = 2e5 + 5;
#define PI acos(-1.0)
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(ll a, ll b) { if (a < b)swap(a, b); return (((a%mod) - (b%mod) + mod) % mod); }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;

void solve() {
	int n,k;
	cin >> n>>k;
	int cnt = 0;
	rep(i, n) {
		int a;
		cin >> a;
		if (a >= k)cnt++;
	}
	cout << cnt << endl;
	

}

signed main()
{
	int tc;
	tc = 1;
	//	cin >> tc;
	while (tc--) {
		solve();
	}


}

Measured memory_bytes: 256
package main

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

func main() {
	var q int
	fmt.Scan(&q)
	type query struct{ l, r int }
	qs := make([]query, q)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var max int
	for i := 0; i < q; i++ {
		l := nextInt(sc)
		r := nextInt(sc)
		qs[i] = query{l, r}
		if max < r {
			max = r
		}
	}
	checkPrime := isPrime(max)
	culumtive := make([]int, (max+3)/2+1)
	sum := 0
	for i := 0; i <= (max+3)/2; i++ {
		culumtive[i] = sum
		t := i*2 + 1
		if _, ok := checkPrime[t]; ok {
			if _, ok := checkPrime[(t+1)/2]; ok {
				sum++
			}
		}
	}
	for _, q := range qs {
		fmt.Printf(
			"%d\n",
			culumtive[(q.r+3)/2-1]-culumtive[(q.l+1)/2-1],
		)
	}
}

func isPrime(max int) map[int]struct{} {
	m := map[int]struct{}{}
	for i := 2; i <= max; i++ {
		m[i] = struct{}{}
	}
	for i := 2; i <= max; i++ {
		for j := 2; j <= max/i; j++ {
			delete(m, i*j)
		}
	}
	return m
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return a
}


Measured memory_bytes: 6656
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val S = sc.nextLine

  val a = S.map(Set('A', 'C', 'G', 'T').contains(_)).foldLeft((0, 0))((z, x) => if (x) (z._1 + 1, math.max(z._2, z._1 + 1)) else (0, z._2))
  println(a._2)
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int n, a, b;
  	cin >> n >> a >> b;
	cout << min(a*n, b) << endl;
  	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


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

using namespace std;

int main() {
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (auto& e : a) cin >> e;
	for (int i = 0; i < k; ++i) {
		vector<int> imos1(n), imos2(n);
		for (int j = 0; j < n; ++j) {
			++imos1[j];
			if (j + a[j] + 1 < n) --imos1[j + a[j] + 1];
		}
		for (int j = 1; j < n; ++j) imos1[j] += imos1[j - 1];
		for (int j = n - 1; j >= 0; --j) {
			++imos2[j];
			if (j - a[j] - 1 >= 0) --imos2[j - a[j] - 1];
		}
		for (int j = n - 2; j >= 0; --j) imos2[j] += imos2[j + 1];
		bool flag = true;
		for (int j = 0; j < n; ++j) {
			a[j] = imos1[j] + imos2[j] - 1;
			if (a[j] != n) flag = false;
		}
		if (flag) break;
	}
	for (int i = 0; i < n; ++i) {
		if (i) cout << " ";
		cout << a[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 5588
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 k;
    cin >> k;

    queue<int64> q;
    for (int i=1; i<=9; i++) q.emplace(i);

    int64 ans;
    for (int i=0; i<k; i++) {
        ans = q.front(); q.pop();
        int64 base = ans*10 + ans%10;
        if (ans % 10 != 0) q.emplace(base - 1);
        q.emplace(base);
        if (ans % 10 != 9) q.emplace(base + 1);
    }

    cout << ans << endl;
}

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

using namespace std;

#define INF 1010001000
#define EPS 1e-10
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef pair<int, int> i_i;
typedef long long int llong;
typedef pair<llong, llong> ll_ll;
typedef struct edge {int f, t;}Edge;

string ac = "CORRECT";
string wa = "WRONG";

typedef pair<int, pair<int, int> > Team;

int main()
{
    int t, p, r;
    while (cin >> t >> p >> r, t) {
        vector<Team> team(t);
        vector<vector<int> > solve(t, vector<int>(p, 0));
        rep(i, t) {
            team[i].second.second = i+1;
        }
        rep(i, r) {
            int a, b, c;
            string d;
            cin >> a >> b >> c >> d;
            if (ac == d) {
                if (solve[a-1][b-1] != -1) {
                    team[a-1].second.first += 
                        solve[a-1][b-1] * 1200 + c;
                    team[a-1].first--;
                    solve[a-1][b-1] = -1;
                }
            } else {
                if (solve[a-1][b-1] != -1) {
                    solve[a-1][b-1]++;
                }
            }
        }
        sort(team.begin(), team.end());
        rep(i, t) {
            cout << team[i].second.second << " " << -team[i].first << " "
                << team[i].second.first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3160
def divisors(c)
  div = []
  (1..c).each do |i|
    if c % i == 0
      div << i
    end
  end
  div
end

a, b, c  = gets.split.map(&:to_i)
array_of_divisors = divisors(c)
number_of_divisors = 0

array_of_divisors.each do |i|
  if i.between?(a, b)
    number_of_divisors += 1
  end
end

puts number_of_divisors

Measured memory_bytes: 6100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
struct edge{ll to, cost;};
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define INF 1000000000000
#define ALL(a)  (a).begin(),(a).end()
#define large 1000000000000000000
std::map<char,int> janken;

int main(){
    ll n,k;
    cin >> n >> k;
    ll r,s,p;
    cin >> r >> s >> p;
    janken['r'] = p;
    janken['s'] = r;
    janken['p'] = s;
    string t;
    cin >> t;
    ll sum = 0;
    bool seen[n];
    for(int i = 0; i < n; i++){
        seen[i] = false;
    }
    for(int i = 0; i < n; i++){
        if(i < k){
            sum += janken[t[i]];
        }
        else{
            if(t[i] != t[i-k]){
                sum += janken[t[i]];
            }
            else if(t[i] == t[i-k] && seen[i-k]){
                sum += janken[t[i]];
            }
            else{
                seen[i] = true;
            }
        }
    }
    cout << sum << endl;

}

Measured memory_bytes: 512