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

using namespace std;
int main() {
    int n;
    cin>>n;
    if(n == 25){
        cout<<"Christmas"<<endl;
    }else if(n == 24){
        cout<<"Christmas Eve"<<endl;
    }else if(n == 23){
        cout<<"Christmas Eve Eve"<<endl;
    }else if(n == 22){
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
    return 0;
}

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

int main(){
  vector<int> ans(3);
  for(int i=0;i<3;i++)cin >> ans.at(i);
  sort(ans.begin(),ans.end());
  int ae =0;
  ae += ans.at(2) - ans.at(0) ;
  cout << ae;
}


Measured memory_bytes: 3628
from fractions import gcd
from math import factorial
mod = 998244353

# comb init
nmax = 3 * 10 ** 5 + 1  # change here
fac = [0] * (nmax + 1)
finv = [0] * (nmax + 1)
inv = [0] * (nmax + 1)
fac[0] = 1
fac[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, nmax):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def comb(n, r):
    if n < r:
        return 0
    else:
        return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod


N, A, B, K = map(int, input().split())
if A < B:
    A, B = B, A
ans = 0

gcdAB = gcd(A, B)
da = B // gcdAB
db = A // gcdAB

numAB = []
for i in range(N, -1, -1):
    if A * i > K:
        continue
    numB, m = divmod(K - A * i, B)
    if m == 0:
        numAB = (i, numB)
        break

numAB_list = [numAB]
if len(numAB) > 0:
    numA = numAB[0]
    numB = numAB[1]
    while True:
        numA -= da
        numB += db
        if numA >= 0 and numB <= N:
            numAB_list.append((numA, numB))
        else:
            break

for numAB in numAB_list:
    numA = numAB[0]
    numB = numAB[1]
    ans = (ans + comb(N, numA) * comb(N, numB)) % mod

print(ans)


Measured memory_bytes: 93528
def count(word, text):
    """Count the word in text.
    Counting is done case-insensitively.

    >>> count('a', 'A b c a')
    2
    >>> count('computer', 'Nurtures computer scientists' \
              + ' and highly-skilled computer engineers' \
              + ' who will create and exploit "knowledge"' \
              + ' for the new era. Provides an outstanding' \
              + ' computer environment.')
    3
    """
    return (text
            .lower()
            .split()
            .count(word.lower()))


def run():
    word = input()
    text = ""

    line = input()
    while line != "END_OF_TEXT":
        text += line + "\n"
        line = input()

    print(count(word, text))


if __name__ == "__main__":
    run()


Measured memory_bytes: 5576
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    int M = N.size();
    vv<int> dp = vvec(M + 1, 2, INF);
    dp[0][0] = 0;
    rep(i, M) {
        int just = N[i] - '0';
        int over = 10 - (N[i] - '0');
        if (N[i] != '0') {
            dp[i + 1][0] = min(dp[i][0] + just, dp[i][1] + just + 1);
            dp[i + 1][1] = min(dp[i][0] + over, dp[i][1] + over - 1);
        }
        else {
            dp[i + 1][0] = min(dp[i][0], dp[i][1] + 1);
        }
    }
    write(min(dp[M][0], dp[M][1] + 1));
}

Measured memory_bytes: 55964
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n;
	cin >> n;
	long long k = n;
	int res = 0;
	int ans_k = 0;
	while (k) {
		ans_k += k % 10;
		k /= 10;
		res++;
	}
	long long ans = n;
	auto keta_sum = [&](long long p) {
		int ret = 0;
		while (p) {
			ret += p % 10;
			p /= 10;
		}
		return ret;
	};
	function<void(long long, int)> Dfs = [&](long long a, int keta) {
		if (ans_k < keta_sum(a)) {
			ans = a;
			ans_k = keta_sum(a);
		}
		if (keta < 0) return;
		long long tmp = 1;
		for (int i = 0; i < keta; ++i) tmp *= 10;
		bool ok = false;
		for (int i = 9; i >= 0; --i) {
			if (ok) {
				Dfs(i * tmp + a, keta - 1);
				break;
			}
			if (i * tmp + a <= n) {
				Dfs(i * tmp + a, keta - 1);
				ok = true;
			}
		}
	};
	Dfs(0, res);
	cout << ans_k << endl;
	return 0;
}

Measured memory_bytes: 3584
package main;

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	edge := make([][]int, N + 1)
	for i := 1; i <= N; i++ {
		edge[i] = make([]int, N + 1)
		for j := 1; j <= N; j++ {
			edge[i][j] = 1 << 30
		}
	}
	a := make([]int, M)
	b := make([]int, M)
	c := make([]int, M)

	for i := 0; i < M; i++ {
		fmt.Scan(&a[i], &b[i], &c[i])
		edge[a[i]][b[i]] = c[i]
		edge[b[i]][a[i]] = c[i]
	}
	for k := 1; k <= N; k++ {
		for i := 1; i <= N; i++ {
			for j := 1; j <= N; j++ {
				edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j])
			}
		}
	}
	ans := M
	for k := 0; k < M; k++ {
		if edge[a[k]][b[k]] == c[k] {
			ans--
		}
	}
	fmt.Println(ans)

}
func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 768
import java.util.*
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d:String = " ") = str().split(d)
fun <T> list(d:String = " ",f:String.()->T) = read(d).map {f(it)}
fun list() = list {toInt()}

const val mod = 998244353L

fun main() {
	abc000X()
}

fun abc000X() {
	val n = int()
	val a = list().sortedDescending()

	fun t(i:Int,j:Int) = Triple(min(a[i],a[j]),i,j)

	val l = PriorityQueue<Triple<Int,Int,Int>>(compareBy {-it.first})
	l.add(t(0,1))
	l.add(t(1,0))

	var r = a[0].toLong()
	for(i in 2 until n) {
		val (v,pi,pj) = l.poll()
		r+=v
		l.add(t(pi,i))
		l.add(t(i,pj))
	}
	println(r)
}


Measured memory_bytes: 96176
#include<cstdio>
#include<cctype>
#include<iostream>
using namespace std;
int main(){
    int counter[26];
    char ch;
    for (int i = 0; i < 26; i++){
        counter[i] = 0;
    }
    while(cin >> ch){
        if (isalpha(ch)){
            if(islower(ch)) counter[ch - 'a']++;
            else counter[tolower(ch) - 'a']++;
        }
    }
    for(int i = 0; i < 26; i ++){
        printf("%c : %d\n", i+'a', counter[i]);
    }
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=32;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int r;
	scanf("%d",&r);
	double pi=acos(-1.0);
	printf("%.6f\n",2*pi*r);
	return 0;
}

Measured memory_bytes: 3800
# -*- coding: utf-8 -*-
N,A,B,C,D=map(int,input().split())
S=input()
if C<D:
    Slist=S[A-1:D].split(".")
    if S[A-1:D].count("#")==Slist.count("#"):
        print("Yes")
    else:
        print("No")
else:
    if S[A:B-1].split(".").count("#")!=S[A:B-1].count("#"):
        print("No")
    else:
        if S[B-2:D+1].split("#").count(".") \
        +S[B-2:D+1].split("#").count("..")*2 \
        ==S[B-2:D+1].count("."):
            print("No")
        else:
            print("Yes")

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* main */

ll LOG2(ll x){
    ll ans = 0;
    while(x){
        ans += 1;
        x >>= 1;
    }
    return ans;
}

signed main(){
    ll N;
    cin >> N;
    vector<ll> a(N);
    vector<ll> a2(N);
    vector<ll> a3(N);
    FOR(i,0,N)cin >> a[i];
    FOR(i,0,N)a2[i] = a[i]-1;
    FOR(i,0,N)a3[i] = a[i]^a2[i];
    sort(ALL(a3));
    reverse(ALL(a3));
    ll XOR = 0;
    ll ans = 0;
    FOR(i,0,N)XOR ^= a[i];
    for(auto x:a3){
        if(LOG2(XOR) == LOG2(x)){
            ans++;
            XOR ^= x;
        }
    }
    if(XOR == 0)cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 2560
<?php
$pA=0;
$pB=0;
$L=trim(fgets(STDIN));
for($i=0;$i<$L;$i++){
  list($A,$B)=explode(' ',trim(fgets(STDIN)));
  $c=strcmp($A,$B);
  if($c<0) $pB+=3;
  elseif($c>0) $pA+=3;
  else{++$pA;++$pB;}
}
echo $pA,' ',$pB;
?>

Measured memory_bytes: 15336
#include <stdio.h>

int main(void){
	int n, a, b;
	int i,j,sum=0;
	scanf("%d%d%d", &n,&a,&b);
	
	for (i = 1; i <= n; i++){
		int c = 0,t = i;
		for (j = 0; j < 5; j++){
			c += t % 10;
			t /= 10;
		}
		if (a <= c&&c <= b){
			sum += i;
		}
	}

	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll a, b, c; cin >> a >> b >> c;
  ll res = min(a*b*(c%2), b*c*(a%2));
  res = min(res, c*a*(b%2));
  cout << res << endl;
}
  

Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

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

fn main() {
    input!{
      n: usize,
      aa: [usize; n],
    }
    let mut aa = aa;
    aa.sort();

    let v1 = aa[aa.len()-1];
    let mut v2_val = aa[0];
    let mut ans_v2 = aa[0];
    for i in 0..n-1 {
        let mut v2 = aa[i];
        if v2 > v1/2 {
            v2 = v1 - v2;
        }
        ans_v2 = max(v2, ans_v2);
        if v2 == ans_v2 {
            v2_val = aa[i];
        }
    }
    println!("{} {}", v1, v2_val);
}


Measured memory_bytes: 4352
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll H,W;
    in >> H >> W;
    if (H == 1 || W == 1) {
        out << 1 << endl;
        return 0;
    }
    ll ans = 0;
    auto a = (W + 1) / 2;
    auto b = W / 2;
    ans = (H+1)/2 * a + H/2 * b;
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve() {
  int ans = 0;
  int N, K; cin >> N >> K;
  REP0(i, N) {
    int h; cin >> h;
    if (h >= K) ans++;
  }
  cout << ans << endl;
}

int main(int argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 256
import math
n = int(input())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]

def dist(x, y, p):
    tmp = 0
    lst = []
    for x, y in zip(x, y):
        tmp += (abs(x-y))**p
        lst.append((abs(x-y)))
    if p==0:
        return max(lst)
    return tmp**(1/p)


print(dist(x, y, 1))
print(dist(x, y, 2))
print(dist(x, y, 3))
print(dist(x, y, 0))


Measured memory_bytes: 5704
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{

    ll n,m,i,j,k,p,q,o,l,s,t,a;
    cin>>n;
    s=1;k=0;l=1;
    for(i=1; i<=n; i++)
    {
        cin>>o;
        if(o==s)
        {
            k+=(i-l);
            l=i+1;
            s++;
        }
    }
    if(l<=n){k+=(n-l+1);}
    if(s>1)cout<<k<<endl;
    else{cout<<-1<<endl;}



    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by AMK on 8/27/2019.
 * Life is nice :)
 * Enjoy coding :D
 */
public class Main {
    static int n;
    private static int arr[];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        int k = scanner.nextInt();
        arr = new int[n + 1];
        int memo[] = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            arr[i] = scanner.nextInt();
        }
        memo[1] = 0;
        memo[2] = Math.abs(arr[2] - arr[1]);
        for (int i = 3; i <= n; i++) {
            int min = Integer.MAX_VALUE;
            int xx = 0;
            for (int j = 1; i - j >= 1 && j <= k; j++) {
                if (memo[i - j] + Math.abs(arr[i] - arr[i - j]) < min){
                    min = memo[i - j] + Math.abs(arr[i] - arr[i - j]);
                    xx = j;
                }
            }
//            System.out.println(i + " " + xx + " " + memo[i - xx] + " " + arr[i] + " " + arr[xx]);
            memo[i] = min;
        }
//        System.out.println(Arrays.toString(memo));
        System.out.println(memo[n]);
    }

}


Measured memory_bytes: 59916
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main()
{
  int n, k;
  string s;
  cin >> n >> k >> s;
  if(s[k-1]=='A') s[k-1]='a';
  if(s[k-1]=='B') s[k-1]='b';
  if(s[k-1]=='C') s[k-1]='c';    
  cout <<s<<endl; 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> x;
  int ans;
  ans = 0;
  for (int i = 0; i <= a; i++){
    for (int j = 0; j <= b; j++){
      for (int k = 0; k <= c; k++){
        if (500*i+100*j+50*k==x){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

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

def main():
    # # 整数の入力
    # a = int(input())
    # # スペース区切りの整数の入力
    # b, c = map(int, input().split())
    # # 文字列の入力
    # s = input()
    # # 出力
    # print("{} {}".format(a+b+c, s))
    N, D = map(int, input().split())
    ret = int(N / (2*D+1)) if N % (2*D+1) == 0 else int(N / (2*D+1)) + 1
    print(ret)

    
if __name__=='__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1000000000;                 // 10^9
const long long LONG_INF = 1000000000000000000; // 10^18

using namespace std;

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

    int sum = 0;
    for (int i = 0; i < n - 1; i++)
    {
        sum += a[i];
    }
    if (sum > a[n - 1])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a[ohara],b[ohara],cost,d,cmp,cmpp,m,h,w,x,y,sum=0,pos,dp[12][10000];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
      cin>>n>>cost;
      rep(i,n){
        cin>>a[i]>>b[i];
        cnt+=a[i];
      }
      rep(i,n){
        rep(j,1001){
          rep(k,a[i]+1){
            if(k==a[i])pos=b[i];
            else pos=0;
            dp[i+1][j+k]=max(dp[i+1][j+k],dp[i][j]+100*(i+1)*k+pos);
          }
        }
      }
      rep(j,1200){
        if(dp[n][j]>=cost){
          Cout(j);
          return 0;
        }
      }
      

    
       
return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b, t;

    cin >> a >> b >> t;
    OP((t / a) * b);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  int N;
  cin >> N;

  vector<int> A(N);
  REP(i, N) cin >> A[i];
  
  int B[9] = {0};
  REP(i,N){
    if(A.at(i)<3200){
      B[A.at(i)/400]++;
    }else{
      B[8]++;
    }
  }
  int sum = 0;
  REP(i,8){
    if(B[i]!=0){
      sum++;
      
    }
  }
  if(sum==0){
    cout << 1 << " " << sum+B[8] << endl;
  }else{
    cout << sum << " " << sum+B[8] << endl;
  }
}

Measured memory_bytes: 256
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let isok c = c = 'A' || c = 'G' || c = 'C' || c = 'T'

let main() =
    let s = readChars()
    let mutable ans = 0
    let mutable l = 0
    let len = Array.length s
    while l < len do
        let mutable r = l
        while r < len && isok s.[r] do
            r <- r + 1

        let tmp = r - l
        ans <- max ans tmp
        l <- r + 1
    puts ans
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


Measured memory_bytes: 11220
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let A: usize = sc.get();
    let B: usize = sc.get();
    println!("{}", A*B);
}


Measured memory_bytes: 2136
def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
found = set()
counter = 0
for i in A[::-1]:
	if (i not in found):
		pat.append(i)
		found.add(i)
		pos[i] = counter
		counter += 1
		if(counter == M):
			break
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)	
for i in A[::-1]:
	temp = pos[i]
	if (freq[temp] > 0):
		freq[temp] -= 1
		freq[temp+1] += 1
start = M
for i in range(M):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")

Measured memory_bytes: 19556
import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii, std.numeric, std.random;
import std.typecons, std.functional, std.traits,std.concurrency;
import std.algorithm, std.container;
import core.bitop, core.time, core.memory;
import std.bitmanip;
import std.regex;

enum INF = long.max/3;
enum MOD = 10L^^9+7;

//辞書順順列はiota(1,N),nextPermituionを使う


void end(T)(T v)
if(isIntegral!T||isSomeString!T||isSomeChar!T)
{
    import core.stdc.stdlib;
    writeln(v);
    exit(0);
}

T[] scanArray(T = long)()
{
    static char[] scanBuf;
    readln(scanBuf);
    return scanBuf.split.to!(T[]);
}

dchar scanChar()
{
    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    return cast(dchar)c;
}

T scanElem(T = long)()
{
    import core.stdc.stdlib;
    static auto scanBuf = appender!(char[])([]);

    scanBuf.clear;

    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    while (!isWhite(c) && c != -1)
    {
        scanBuf ~= cast(char) c;
        c = getchar;
    }
    return scanBuf.data.to!T;
}

dchar[] scanString(){
    return scanElem!(dchar[]);
}


void main()
{
  auto s = [scanElem, scanElem,scanElem].sort();
  s[1] *=-1;
  s.sum.writeln;
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << x << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    ll k;
    cin >> k;
    if(s == string(s.size(),s[0])){
        REE(s.size()*k/2)
    }
    ll ile = 0;
    string ss = s;
    ll ilec = 0;
    FOR(i,1,ss.size()){
        if(ss[i] == ss[i-1]){
            ss[i] = i&1;
            ++ile;
        }
    }
    ss += s;
    FOR(i,s.size(),ss.size()){
        if(ss[i] == ss[i-1]){
            ss[i] = i&1;
            ++ilec;
        }
    }
    cout << ile+(k-1)*ilec << '\n';
}



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

int main(){
    int n; cin>>n;
    if(n>17){cout<<"Yes"; return 0;}
    for(int i=0; i<=2; i++){
        for(int j=0; j<=4; j++){
            if(7*i+4*j == n){cout<<"Yes"; return 0;}
        }
    }
    cout<<"No";
}

Measured memory_bytes: 256
using System;

class Program{
	static void Main(){
		int s, m, h;
		s = int.Parse(Console.ReadLine());
		m = s/60;
		s = s%60;
		h = m/60;
		m = m%60;
		Console.WriteLine("{0}:{1}:{2}", h, m, s);
	}
}

Measured memory_bytes: 9104
#include <iostream>

int main() {
  size_t N;
  std::cin >> N;

  size_t max_price = 0;
  size_t sum = 0;

  for (size_t i=0; i<N; i++) {
    size_t p;
    std::cin >> p;
    max_price = std::max(p, max_price);
    sum += p;
  }

  std::cout << (sum - max_price / 2) << std::endl;

  return 0;
}


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

int main()
{	
	string s;
	int n = 0;
	cin >> s;
	for(char c : s){
		n += (c - '0');
	}
	cout << ((n % 9) == 0 ? "Yes" : "No") << endl;
return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n,a,m,sum=1;
	cin>>n;
	cin>>a;
	m=a;
	for(int i=1;i<n;i++)
	{
		cin>>a;
		if(a>=m)sum++;
		m=max(m,a);
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int setNum = Integer.parseInt(sc.nextLine());
        int inputNum = setNum * 2;
        String[][] inputSet = new String[setNum][2];

        int cnt = 0;
        boolean zero = true;
        while (0 < inputNum--) {
            String input = sc.nextLine();
            if(zero)
                inputSet[cnt][0] = input;
            else
                inputSet[cnt++][1] = input;

            zero = !zero;
        }

        for(int i=0; i < setNum; i++) {
            output(inputSet[i][0], inputSet[i][1]);
        }
    }

    public static void output(String a, String b) {
        String[] partA = slice(a);
        String[] partB = slice(b);
        String[] output = new String[10];

        Long carry = 0L;
        int cnt = 0;
        for(int i=0; i < 9; i++) {
            Long x = Long.valueOf(partA[i] != null ? partA[i] : "0") + Long.valueOf(partB[i] != null ? partB[i] : "0") + carry;
            String y = String.format("%10s", x).replace(" ", "0");
            output[i] = y.length() <= 10 ? y : y.substring(y.length()-10);
            if(y.length() <= 10 && partA[i+1] == null && partB[i+1] == null) break;
            carry = y.length() <= 10 ? 0L : Long.valueOf(y.substring(0, y.length()-10));
            cnt++;
        }

        boolean leadFlg = true;
        if(partA[8] != null || partB[8] != null || 8 <= cnt) {
            System.out.println("overflow");
        } else {
            for(int i=7; 0<=i; i--) {
                if(leadFlg && output[i] != null) {
                    System.out.print(Long.valueOf(output[i]));
                    leadFlg = !leadFlg;
                }
                else
                    System.out.print(output[i] != null ? output[i] : "");
            }
            System.out.println();
        }
    }

    public static String[] slice(String a) {
        int len = a.length();
        String[] ret = new String[10];
        int cnt = 0;
        while(10 < len) {
            ret[cnt++] = a.substring(len-10, len);
            len = len - 10;
        }
        ret[cnt] = a.substring(0, len);
        return ret;
    }
}

Measured memory_bytes: 26440
#include <stdio.h>
int main(){
	int a, b, d, r;
	double a2,b2,f;
	scanf("%d%d", &a, &b);
	a2 = a;
	b2 = b;
	d = a / b;
	r = a % b;
	f = a2 / b2;
	printf("%d %d %.5lf", d, r, f);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#define ll long long
const ll md = 998244353;
using namespace std;
int n, m, k;
ll fkt[200001] = {}, rs = 0;
ll pw(ll b, ll e)
{
	ll t = 1;
	while (e)
	{
		if (e & 1) {t *= b; t %= md;}
		b *= b; b %= md; e >>= 1;
	}
	return t;
}
ll c(ll n, ll r)
{
	return ((fkt[n] * pw(fkt[r], md - 2)) % md * pw(fkt[n - r], md - 2)) % md;
}
int main()
{
	cin >> n >> m >> k;
	fkt[0] = 1;
	for (int i = 1; i <= n; i++) {fkt[i] = (fkt[i - 1] * i) % md;}
	for (int i = 0; i <= k; i++)
	{
		rs += (pw(m - 1, n - 1 - i) * c(n - 1, i)) % md;
		rs %= md;
	}
	cout << (m * rs) % md << "\n";
	return 0;
}

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

void main_()
{
    ll N, K;
    cin >> N >> K;

    ll ans = 0;
    for (ll b = 1; b <= N; b++) {
        ans += (N / b) * max(0LL, b - K);
        ans += max(0LL, N % b - K + 1);
        if (K == 0) {
            // K==0の時はa=0が余り0として入るのでその分を除外する
            ans--;
        }
    }
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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++)
#define all(x) x.begin(),x.end()
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

using namespace std;

int main() {
   int n,m;
   cin >> n >> m;
   vector<int> ans(60);

   for(int i=0; i<m; i++){
      int a,b;
      cin >> a >> b;
      ans[a-1]++; 
      ans[b-1]++;
   }

   rep(i,n)
   cout << ans[i] << endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

long long pow(long long x, long long y) {
    long long ans = 1;
    
    while (y > 0) {
        if (y & 1) ans = ans * x;
        x = x * x;
        y >>= 1;
    }
    
    return ans;
}

int main() {
    long long n, p, ans = 1, i;
    
    scanf("%lld %lld", &n, &p);
    
    if (n == 1) {
        printf("%lld\n", p);
        
        return 0;
    }
    
    for (i = 2; i * i <= p; i++) {
        if (p % i == 0) {
            int c = 0;
            
            while (p % i == 0) {
                p /= i;
                c++;
            }
            
            ans *= pow(i, c / n);
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s,t;cin>>s>>t;
  int n=s.size();
  REP(i,n){
    string n_s;
    n_s+=s.substr(i);
    n_s+=s.substr(0, i);
    if(n_s == t){
      P("Yes");
      return 0;
    }
  }
  P("No");
  return 0;
}


Measured memory_bytes: 256
#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int N;
  cin >> N;
  vi X(N);
  cin >> X;

  ll ans = INF;
  rep(i, 101) {
    ll t = 0;
    rep(j, N) {
      t += (X[j] - i) * (X[j] - i);
    }
    chmin(ans, t);
  }

  out(ans);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	long int A,B,K;
	scanf("%ld%ld",&A,&B);
	if(A%2==0 && B%2==0)
	{
		K=(A+B)/2;
		printf("%ld",K);
	}
	else if(A%2==1 && B%2==1)
	{
		K=(A+B)/2;
		printf("%ld",K);
	}
	else
	printf("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
void insertion(int *a,int n);

int main(){
  int i,n,m,a[100000],q,sum=0,left,right,mid;

  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&a[i]);}
  insertion(&a,n);

  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&q);
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(a[mid]==q){
	sum++;
	break;
      }
      else if(q<a[mid]) right=mid;
      else left=mid+1;
    }
  }
  printf("%d\n",sum);
  return 0;
}


void insertion(int *a,int n){
  int i,j,k,v;
  for(i=1;i<n;i++){
    v=a[i];
    j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
  }
}


Measured memory_bytes: 2184
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using P = pair <int,int>; //to, cost
using WeightedGraph = vector<vector <P>>; //to cost
const long long INF = 1LL << 60;
const int MOD = 1000000007;
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; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n, l; cin>>n>>l; 
    vector <string> a(n);   
    rep(i,n) cin>>a[i]; 
    sort(a.begin(),a.end());
    rep(i,n) cout<<a[i];
    cout<<endl;
}


Measured memory_bytes: 256
//Threeletteracronym.cpp (A)
#include <iostream>
#include <string>
using namespace std;

int main(){
  string S[3];
  cin >> S[0] >> S[1] >> S[2];
  for(int i = 0; i < 3; i++) cout << string(1,'A' + S[i][0] -'a');
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
 
int main(void){
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed << sqrt(pow(x1-x2, 2.0)+pow(y1-y2, 2.0));
	return 0;
}

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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

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

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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

inline tuple<ll, ll> rotate45(tuple<ll, ll> p) { ll x = get<0>(p), y = get<1>(p); return tuple<ll, ll>(x + y, x - y); }

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

	ll N, M; cin >> N >> M;
	ll ans = 0, cnt = 0, x;
	FOR(i, 1, N+1) {
		cin >> x;
		cnt += (i-1) * x - (N - i) * x;
		cnt %= MOD_CONST;
	}
	FOR(i, 1, M+1) {
		cin >> x;
		ans += (i-1) * x - (M - i) * x;
		ans %= MOD_CONST;
	}
	ans *= cnt;
	ans %= MOD_CONST;
	cout << ans << endl;

	return 0;
}


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

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

    int count = 0;
    for(int i=0;i<n-1;i++){
        if(s[i] == s[i+1]) count++;
    }

    cout << min(n-1,count + 2*k) << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,ans=0; cin>>n;
vector<int> a(n+1);
vector<int> b(n+1);
vector<int> c(n);
a[0]=0;b[0]=0;c[0]=0;
for(int i=1;i<=n;i++){
    cin>>a[i];
}
for(int i=1;i<=n;i++){
    cin>>b[i];
}
for(int i=1;i<=n-1;i++){
    cin>>c[i];
}
for(int i=1;i<=n;i++){
    ans+=b[a[i]];
    if(a[i]-a[i-1]==1){ans+=c[a[i-1]];}
}
cout<<ans;
}


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

int main() {
    int N;
    cin >> N;
    vector<char> alp={'M','A','R','C','H'};
    vector<long long> num(10);
    long long ans=0;
    string s;
    for(int i=0;i<N;i++){
        cin >> s;
        for(int j=0;j<5;j++){
            if(s[0]==alp[j]){
                num[j]++;
            }
        }
    }

    for(int a=0;a<3;a++){
        for(int b=a+1;b<4;b++){
            for(int c=b+1;c<5;c++){
                ans+=num[a]*num[b]*num[c];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
#from scipy.misc import comb

N,Q = map(int, input().split())
S = input()

L = []
R = []

for i in range(Q):
    l,r = map(int, input().split())
    L.append(l)
    R.append(r)

rs = [0,0]
cnt = 0
for i in range(1,N):
    if S[i-1]=='A' and S[i]=='C':
        cnt += 1
        rs.append(cnt)
    else:
        rs.append(cnt)

for i in range(Q):
    ans = rs[R[i]]-rs[L[i]]
    print(ans)

Measured memory_bytes: 23436