akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n;
vector <pair <int, int> > a;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    a.resize(n);
    for(auto &i : a) cin >> i.first;
    for(auto &i : a) cin >> i.second;
    sort(a.begin(), a.end(), [&](pair <int, int> l, pair <int, int> r){
        return l.second < r.second;
    });
    vector <int> c(n);
    for(int i = 0 ; i < n ; i++){
        c[i] = a[i].first;
    }
    sort(c.begin(), c.end());
    for(int i = 0 ; i < n ; i++){
        if(c[i] > a[i].second) finish("No");
    }
    for(int i = 1 ; i < n ; i++){
        if(i > 0 && c[i] <= a[i - 1].second) finish("Yes");
    }
    map <int, int> m;
    for(auto &i : a) m[i.first];
    int x = 0;
    for(auto &i : m) i.second = x++;
    vector <int> d;
    for(auto &i : a) d.push_back(m[i.first]);
    int cur = 0;
    int cnt = 0;
    do{
        cur = d[cur];
        cnt++;
    } while(cur != 0);
    if(cnt < n) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 6784
def main():
    L, R = map(int, input().split())
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print(0)
        return
    elif 0 in (L % 2019, R % 2019):
        print(0)
        return
    elif R % 673 == 0 and L + 2 <= R:
        print(0)
        return
    elif L % 673 == 0 and L + 2 <= R:
        print(0)
        return
    elif R % 673 < L % 673 and L + 2 <= R:
        print(0)
        return
    print(min(i * j % 2019 for i in range(L, R + 1)
              for j in range(i + 1, R + 1)))
    return


main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int a,b;
  cin >> a >> b;
  cout << (a * (a-1)) / 2 +  (b * (b-1)) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
a=-1
b=-1
from collections import defaultdict
count=defaultdict(lambda: [])
for i in range(len(s)):
    count[s[i]].append(i+1)
for i in count.keys():
    pla=count[i]
    for j in range(len(pla)-1):
        if pla[j+1]-pla[j]<=2:
            a=pla[j]
            b=pla[j+1]
print(a,b)

Measured memory_bytes: 7668
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    n, m, l = LI()
    dist = [[inf] * n for i in range(n)]

    for _ in range(m):
        a, b, c = LI_()
        c += 1
        if c > l:
            continue
        dist[a][b] = c
        dist[b][a] = c

    supply = [[n] * n for i in range(n)]
    for k in range(n):
        distk = dist[k]
        for i in range(n):
            if i == k:
                continue
            disti = dist[i]
            for j in range(i + 1, n):
                if disti[k] + distk[j] < disti[j]:
                    disti[j] = disti[k] + distk[j]
                    dist[j][i] = disti[j]

    lis = [[] for i in range(n)]
    for i in range(n):
        for j in range(i + 1, n):
            if dist[i][j] <= l:
                supply[i][j] = 0
                supply[j][i] = 0
                lis[i].append(j)
                lis[j].append(i)

    for i in range(n):
        q = []
        for k in lis[i]:
            heappush(q, (0, k))
        supplyi = supply[i]

        while q:
            time, p = heappop(q)
            for k in lis[p]:
                if supplyi[k] > time + 1:
                    supplyi[k] = time + 1
                    heappush(q, (time + 1, k))

    q = II()
    for _ in range(q):
        s, t = LI_()
        if dist[s][t] == inf:
            print(-1)
            continue
        else:
            print(supply[s][t])
    return


#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    E()


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

int main() {
  int N;
  cin >> N;
  vector<vector<string>> a(N, vector<string>(3));
  for (int i = 0; i < N; i++) {
    string s;
    string p;
    cin >> s>>p;
   a.at(i).at(0)=s;
    a.at(i).at(1)=p;
    a.at(i).at(2)=to_string(i+1);
    a.at(i).at(1)=-1*(1+stoi(a.at(i).at(1)));
  }

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

  for (int i = 0; i < N; i++) {
  cout<<a.at(i).at(2)<<endl;
  }
}
  

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define sc scanf
using namespace std;
char c;
int main(){
    c=getchar();
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')cout<<"vowel\n";
    else cout<<"consonant\n";
    return 0;
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	}

	static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	}
}

Measured memory_bytes: 47372
n,m=map(int,input().split())
f=[]
for i in range(n):
    y=input().split()
    for g in range(len(y)):
        y[g]=int(y[g])
    f.append(y)
    f[i].remove(f[i][0])
for j in range(n):
    f[j]=set(f[j])
for k in range(n):
    if k==0:
        x=f[k]
    else:
        x=x&f[k]
print(len(x))
    

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int maxn=200010;
int N,K,a[maxn],f[maxn][21],g[maxn][21],lg[maxn];
int query_max(int L,int R){
	int j=lg[R-L+1];
	return max(g[L][j],g[R-(1<<j)+1][j]);
}
int query_min(int L,int R){
	int j=lg[R-L+1];
	return min(f[L][j],f[R-(1<<j)+1][j]);
}
int main(){
	//freopen("in","r",stdin);
	for(int i=1;i<maxn;i++)
		lg[i]=int(log2(1.0*i));
	N=read(),K=read();
	for(int i=1;i<=N;i++)
		f[i][0]=g[i][0]=a[i]=read();
	for(int j=1;j<=20;j++)
		for(int i=1;i<=N;i++){
			if(i+(1<<j)-1>N)break;
			f[i][j]=min(f[i][j-1],f[i+(1<<j-1)][j-1]);
			g[i][j]=max(g[i][j-1],g[i+(1<<j-1)][j-1]);
		}
	int ans=1,seq=0;
	for(int i=1;i<=N;){
		int j=i+1;
		while(a[j]>=a[j-1])
			j++;
		if(j-i>=K)
			seq++;
		i=j;
	}
	if(seq)
		ans-=seq-1;
	for(int i=1;i+K<=N;i++)
		if(a[i]!=query_min(i,i+K-1)||a[i+K]!=query_max(i+1,i+K)){
			ans++;
			//printf("%d %d\n",i,i+K);
		}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 34688
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[3];
int main(){
    REP(i,3)RI(a[i]);
    sort(a,a+3);
    if(a[2]-a[1]!=a[1]-a[0])puts("NO");
    else puts("YES");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>

const int INF = 1000000001;
int main() {
	int n;
	scanf("%d", &n);
	long long sum = 0;
	int m = INF;
	for(int i=0;i<n;i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		sum += a;
		if(a > b && b < m) m = b;
	}
	printf("%lld\n", m == INF ? 0 : sum - m);
	return 0;
}


Measured memory_bytes: 128
let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let () =
  Scanf.scanf "%d %d" @@ fun n x0 ->
  let d = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0))
    |> Array.map (fun x -> abs (x - x0))
  in
  Array.fold_left (fun u v -> gcd u v) d.(0) d
    |> Printf.printf "%d\n"

Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe



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

int n,x,s = 0;

cin >> n;
x = n;

for(int i = 1; i < 11; i++){
   if (n == 0)
   {
      break;
   }else
   {
      s += n % 10;
      n = n/10;   
   }

}

if (x % s == 0)
{
   cout << "Yes" << endl;
}else
{
   cout << "No" << endl;
}




//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
s = int(input())

l = s / 100
r = s % 100


if 1 <= l <= 12:
    if 1 <= r <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= r <= 12:
        print('YYMM')
    else:
        print('NA')


Measured memory_bytes: 2940
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000


int main(){
	long long a[50];
	long long b[50];
	f(i, 50)a[i] = 0;
	long long k;
	long long n, m;
	long long x, y, z;
	bool v = true;
	x = 0;
	y = 0;
	scanf("%lld %lld", &n,&k);
	f(i, n){
		scanf("%lld", &x);
		m = 0;
		while (x > 0){
			if (x % 2 == 1)a[m]++;
			x /= 2;
			m++;
		}
	}
	z = 0;
	long long ans = 0;
	b[0] = 1;
	f(i, 49)b[i + 1] = b[i] * 2;
	for (int i = 49; i >= 0; i--){
		if ((a[i] * 2) >= n)ans += (a[i] * b[i]);
		else{
			if (z + b[i] <= k){
				ans += ((n-a[i]) * b[i]);
				z += b[i];
			}
			else ans += (a[i] * b[i]);
		}
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include "stdio.h"

#define maxT 5000
#define maxN 10

int func(int A, int B){
  int res;
  res = A+B;
  if(res<A-B) res = A-B;
  if(res<A*B) res = A*B;
  return res;
}

int main(){
  int A, B, res;

  scanf("%d %d", &A, &B);
  res = func(A, B);
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 128
// at_dp_g.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<vector>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)

const int MAXN = 1e5 + 5;
vector<int>adj[MAXN];
int nodes, edges;
int dp[MAXN];

int dfs(int cur) {
	if (dp[cur] != -1)return dp[cur];

	int out = 0;
	for (auto x : adj[cur]) {
		out = max(dfs(x)+1,out);
	}
	dp[cur] = out;
	return out;
}
int main()
{
	memset(dp, -1, sizeof(dp));
	cin >> nodes >> edges;
	FOR(i, edges) {
		int v1, v2; cin >> v1 >> v2; v1--; v2--;
		adj[v1].push_back(v2);	
	}
	int out = 0;
	FOR(i, nodes) {
		if (dp[i] == -1) {
			out=max(out,dfs(i));
		}
	}
	cout << out << "\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Measured memory_bytes: 8192
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include <sstream>
#include <vector>
#include <queue>
#include <utility>  
#include <set>
#include<unordered_set>
#include <map>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define PI 3.14159265358979323846264338327950L
#define INF 0x3f3f3f3f
//const int N = 2e5 + 5;
   
int sum(int l, int r) {

	return (l + r)*(r - l + 1) / 2;

}

int gcd(int a, int b) {

	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a%b);
	}

}

 
int f[100001];
 

int Find(int x) {

	if (x == f[x])
		return x;

	return f[x] = Find(f[x]); 

}
const int Mod = 1e9 + 7;

long long fastPower(long long base, long long power) {
	long long result = 1;
	while (power > 0) {
		if (power & 1) { 
			result = result * base % Mod;
		}
		power >>= 1; 
		base = (base * base) % Mod;
	}
	return result;
}
 
int Inv(int x) {
	return fastPower(x, Mod - 2);
}


int nChoosek(int n, int k) {
 
	int ans = 1;

	for (int i = 1; i <= k; ++i) 
		ans = ans * Inv(i) % Mod *(n - i + 1) % Mod;

	return ans % Mod;

}


int arr[200001];

int digit(int n) {

	int cnt = 0;
	
	while (n) {

		n /= 10;
		cnt++;

	}

	return cnt;
}

int binarySearchLessThanOrEqual(int des) {

	int l = 0;
	int r = 1000000000;

	while (l <= r) {

		int mid = (l + r) / 2;

		if (mid > des) {

			r = mid - 1;

		}
		else {
			l = mid + 1;
		}
	}

	return r;

}

vector<vector<int> >v;
 

int32_t main() {

	IOS;

	int n;
	cin >> n;
	v.resize(n);

	vector<pair<int, int>> vp;

	for (int i = 0; i < n - 1; i++) {
		int a, b;

		cin >> a >> b;
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);

		vp.emplace_back(a, b);
	}
 
	int K = 0;
	map<pair<int, int>, int> I;
	vector<int> cs(n, 0); // color of edge between its parent

	vector<int> used(n, 0);
	queue<int> que;
 
	que.push(0);
	used[0] = 1;


	while (!que.empty()) {

		int tmp = que.front();
		que.pop();

		if (v[tmp].size() > K) {
			K = v[tmp].size();
		}

		int curr = 1;

		for (int u : v[tmp]) {

			if (used[u]) {
				continue;
			}

			if (cs[tmp] == curr)
				curr++;

			cs[u] = I[make_pair(u, tmp)] = I[make_pair(tmp, u)] = curr++;
			que.push(u);
			used[u] = 1;
		}

	 

	}
	
	cout << K << endl;

	for (auto c : vp) {
		cout << I[c] << endl;
	}
 


}

Measured memory_bytes: 24424
def solve():
  I=lambda:map(int,input().split())
  N,W=I()
  g={}
  for _ in[0]*N:
    a,b=I()
    g[a]=g.get(a,[])+[b]
  *w,=g.keys()
  v=[]
  for i in range(len(w)):
    s=[0]+sorted(g[w[i]])[::-1]
    for i in range(1,len(s)):
      s[i]+=s[i-1]
    v.append(s)
  for _ in[0]*(4-len(w)):
    w.append(10**18)
    v.append([0])
  ans=0
  for i in range(len(v[0])):
    s0=w[0]*i
    for j in range(len(v[1])):
      s1=s0+w[1]*j
      if s1>W:break
      for k in range(len(v[2])):
        s2=s1+w[2]*k
        if s2>W:break
        l=min((W-s2)//w[3],len(v[3])-1)
        ans=max(ans,v[0][i]+v[1][j]+v[2][k]+v[3][l])
  print(ans)
if __name__=='__main__':
  solve()

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<set>

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

    std::set<char> s;
    for (int i = 0; i < n;i ++ ) {
        char a;
        std::cin >> a;
        s.insert(a);
    }

    std::string ans = s.size() == 3 ? "Three" : "Four";
    std::cout << ans << "\n";
}

Measured memory_bytes: 256
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define ll long long
#define S second
#define F first
using namespace std;
const ll inf = 1e18;
ll n,ans;
ll a[200009];
int main(){
	fast,cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			ans += a[i] * a[j];
		}
	}
	cout<<ans<<endl;
}


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()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;




int main(int argc, char **argv){
	ll n; cin>>n;
	pair<ll,ll> robot[n];

	rep(i,0,n){
		ll xi,li; cin>>xi>>li;
		robot[i]=make_pair(xi+li,xi-li);
	}

	sort(robot,robot+n);

	ll ans=1;
	ll bord=robot[0].first;

	rep(i,1,n){
		if(bord<=robot[i].second){
			ans++;
			bord=robot[i].first;
		}
	}

	cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, d;
    cin >> n >> d;
    d = d * 2 + 1;
    cout << n / d + (bool)(n % d) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
using namespace std;
   
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int x;
  cin>>x;
  if(x==2){
    cout<<x<<'\n';
    return 0;
  }

  bool nasu=true,out=false;
  while(nasu){
    out=false;
    if(x%2==0){
      x++;
      continue;
    }
    for(int i=3;i*i<=x;i+=2){
      if(x%i==0){
	out=true;
	break;
      }
    }
    if(out){
      x+=2;
    }
    else{
      nasu=false;
    }
  }
  cout<<x<<'\n';
  return 0;
}


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

class vertex;
class edge;

class list_node{
    public:
        list_node *prev, *next;
        vertex *data;
        list_node(list_node *_prev,list_node *_next,vertex *_data){
            prev = _prev;
            next = _next;
            data = _data;
        }
};

class list{
    public:
        list_node *front, *back;
        list(){
            front = new list_node(0,0,0);
            back = new list_node(front,0,0);
            front->next = back;
        }
        ~list(){
            list_node *node = front;
            while(node){
                list_node *next = node->next;
                delete node;
                node = next;
            }
        }

        void insert_next(vertex *v,list_node *N){
            list_node *pre_next = N->next;
            N->next = new list_node(N,pre_next,v);
            pre_next->prev = N->next;
        }

        void push_back(vertex* V){
            insert_next(V,back->prev);
        }

        list_node* get_last(){
            return back->prev;
        }
        list_node* get_first(){
            return front->next;
        }
};

class vertex{
    public:
        vector<edge*> edges;
        vertex *prev;
        int label,d;
        vertex(int _label){
            d = -1;
            label = _label;
        }
};

class edge{
    public:
        vertex *to;
        edge(vertex *_to){
            to = _to;
        } 
};

void BFS(vertex *s){
    list *l = new list[100000];
    l[0].push_back(s);
    for(int i = 0; i < 100000; i++){
        for(list_node *node = l[i].get_first(); node != l[i].back; node = node->next){
            vertex *v = node->data;
            for(int j = 0; j < v->edges.size(); j++){
                vertex *to = v->edges[j]->to;
                if(to->prev != 0) continue;
                l[i+1].push_back(to);
                to->prev = v;
            }
        }
    }

}

int main(){
    int N,M,temp1,temp2;
    string result;
    cin >> N >> M;
    vertex *V[N+1];
    for(int i = 0; i <= N; i++){
        V[i] = new vertex(i);
    }
    for(int i = 0; i < M ; i++){
        cin >> temp1 >> temp2;
        V[temp1]->edges.push_back(new edge(V[temp2]));
        V[temp2]->edges.push_back(new edge(V[temp1]));
    }
    BFS(V[1]);
    result = "Yes";
    for(int i = 1; i <= N; i++){
        if(V[i]->label == -1) result = "No";
    }
    cout << result << endl;
    for(int i = 2; i <= N; i++){
        cout << V[i]->prev->label << endl;
    }

}

Measured memory_bytes: 38048
abcd = input()
hugou = ["+","-"]
a,b,c,d = list(abcd)
for i in hugou:
    for j in hugou:
        for k in hugou:
            wa = a + i + b + j + c + k + d
            if eval(wa) == 7:
                print(str(wa)+'=7')
                exit()

Measured memory_bytes: 3060
using System;
using System.Linq;

namespace ConsoleApp6
{
    class Program
    {
        static void Main()
        {
            Console.ReadLine();
            var a = Console.ReadLine().Split(' ').Select(int.Parse).Aggregate(0, (acc, x) => acc | x);
            var i = 0;
            while (true)
            {
                if ((a | 1) == a) break;
                a = a >> 1;
                i++;
            }
            Console.WriteLine(i);
        }
    }
}


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

int main() {
    int a, b;
    cin >> a >> b;

    if (b == 1) {
        cout << 0 << endl;
    } else {
        int r = (b-1) / (a-1);
        if ((b-1) % (a-1) == 0) {
            cout << r << endl;
        } else {
            cout << r + 1 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3632
s = input()
n = len(s)
count = 0

for i in range((n-1)//2):
  if s[i] != s[n-1-i]:
    count = 1
    break

if count == 0:
  for i in range((n-1) // 2 // 2):
    if s[i] != s[(n-3) // 2 - i]:
      count = 1
      break
    elif s[(n+1)//2 + i] != s[n-1-i]:
      count = 1
      break
print("Yes" if count==0 else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int main() {
    fastio;
    ll ans=0, A, B, N;
    cin >> A >> B >> N;
    if (B == 1) {
        ans = 0;
    } else {
        ll x = min(B-1,N);
        ll t = (A*x)/B - A*(x/B);
        ans = max(ans, t);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3548
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}
		int count = 0;
		int flag = 1;
		int i = 0;
		while(flag == 1){
			flag = 0;
			for(int j = n-1; j >= i+1; j--){
				if(arr[j] < arr[j-1]){
					int big = arr[j-1];
					arr[j-1] = arr[j];
					arr[j] = big;
					count++;
					flag = 1;
				}
			}
			i++;
		}

		for(int j = 0; j < n; j++){
			 System.out.printf(j != n-1? "%d " : "%d\n", arr[j]);
		}
		System.out.printf("%d\n", count);
	}
}

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

using namespace std;
using ll = long long;


int main()
{
    int n,m;
    map<string,int> s,t;
    cin >> n;
    for(int i = 0; i < n; i++){
        string tmp; cin >> tmp;
        s[tmp]++;
    }
    cin >> m;
    for(int i = 0; i < m; i++){
        string tmp; cin >> tmp;
        t[tmp]++;
    }

    int sum = 0;
    for(auto i : s){
        sum = max(sum,max(0, i.second - t[i.first]));
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import numpy as np

n = int(input())
ps = list(map(float, input().split()))

dp = np.zeros(n+1)
dp[0] = 1

for i, p in enumerate(ps):
    dp[1:] = (1-ps[i])*dp[1:] + ps[i]*dp[:n]
    dp[0] = (1-ps[i])*dp[0]

ans = 0
for i in range(n//2+1):
    ans += dp[-(i+1)]
print(ans)

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

using namespace std;

/**/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define wt(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define wt(x...)
#endif
/**/

#define LL long long
const int MAXN = 101010;
const int INF  = 0x3f3f3f3f;

const LL MOD = (LL)1e9 + 7LL;

int n, m;
set <int> block;

LL dp[MAXN];

LL solve (int i) {
	if (i == n) return 1;
	
	LL &p = dp[i];
	if (p != -1) return p;

	p = 0;
	if (!block.count (i + 1)) p = (p % MOD + solve (i + 1) % MOD) % MOD;
	if (!block.count (i + 2)) p = (p % MOD + solve (i + 2) % MOD) % MOD;

	return p;
}

int main () {
	
	scanf("%d %d", &n, &m);
	
	for (int i = 0, x; i < m; ++i) {	
		scanf("%d", &x);
		block.insert (x);
	}

	memset (dp, -1, sizeof dp);

	LL ans = solve (0);
	printf("%lld\n", ans);



	return 0;
}



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

void sum(int l, int r, int cur_l, int cur_r, vector<vector<bool> > &seg, int idx, vector<bool> &v) {
  if (l <= cur_l && cur_r <= r) {
    for (int i = 0; i < 26; ++i)
      v[i] = v[i] || seg[idx][i];
    return;
  }
  if (cur_r <= l || r <= cur_l) return;
  
  int m = (cur_l + cur_r) / 2;
  sum(l, r, cur_l, m, seg, 2*idx, v);
  sum(l, r, m, cur_r, seg, 2*idx+1, v);
  return;
}

int main() {
  int n; cin >> n;
  string s; cin >> s;
  
  int size = 1; while (size < n) size <<= 1;
  vector<vector<bool> > seg(2*size, vector<bool>(26, false));
  for (int i = 0; i < n; ++i)
    seg[i+size][s[i]-'a'] = true;
  for (int i = size-1; i >= 1; --i)
    for (int j = 0; j < 26; ++j)
      seg[i][j] = seg[2*i][j] || seg[2*i+1][j];
  
  int q; cin >> q;
  while (q--) {
    int type; cin >> type;
    if (type == 1) {
      int i; char c; cin >> i >> c; i += size - 1; c -= 'a';
      if (seg[i][c]) continue;
      
      for (int j = 0; j < 26; ++j)
        if (seg[i][j]) {
          seg[i][c] = true;
          seg[i][j] = false;
          i >>= 1;
          while (i) {
            seg[i][c] = seg[2*i][c] || seg[2*i+1][c];
            seg[i][j] = seg[2*i][j] || seg[2*i+1][j];
            i >>= 1;
          }
          break;
        }
    }
    else {
      int l, r; cin >> l >> r; --l;
      vector<bool> v(26, false);
      sum(l, r, 0, size, seg, 1, v);
      int cnt = 0;
      for (int i = 0; i < 26; ++i) if (v[i]) ++cnt;
      cout << cnt << endl;
    }
  }
}

Measured memory_bytes: 74500
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline int Rand(){return rand()*32768+rand();}
int n;
int a[100005],cnt[2];
void solve(string F,string S){
	cnt[0]=cnt[1]=0;
	for(int i=1;i<=n;i++)cnt[a[i]&1]++;
	if(cnt[0]%2){
		cout<<F<<endl;
		exit(0);
	}
	if(cnt[1]>=2){
		cout<<S<<endl;
		exit(0);
	}
	int G=0;
	for(int i=1;i<=n;i++){
		if(a[i]&1){
			a[i]--;
		}
		if(!a[i]){
			cout<<S<<endl;
			exit(0);
		}
		G=__gcd(G,a[i]);
	}
	for(int i=1;i<=n;i++)a[i]/=G;
	solve(S,F);
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	if(n==1){
		puts(a[1]%2?"Second":"First");
		return 0;
	}
	solve("First","Second");
	return 0;
} 

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c,d;
            double e = 0;
           
            c = a / b;
            d = a % b;
            e = (double)a / b;


            Console.WriteLine("{0} {1} {2:f5}", c, d, e);
        }
    }
}

Measured memory_bytes: 5660
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main() {
  int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
  ll m = 0;
  vector<int> x(0), y(0);
  pair<int, int> data = make_pair(1, 0);
  for(int i = 0; i * A * 100 <= F; i++) {
    for(int j = 0; i * A * 100 + j * B * 100 <= F; j++) {
      if(i == 0 && j == 0) continue;
      x.push_back((i * A + j * B) * 100);
    }
  }
  for(int k = 0; k < x.size(); k++) {
    for(int i = 0; i * C + x[k] <= F; i++) {
      for(int j = 0; i * C + j * D + x[k] <= F; j++) {
        ll w = i * C + j * D;
        //cout << x[k] / 100 * E << " " << w << " " << i << " " << j << endl;
        m *= (w + x.at(k));
        if(x[k] / 100 * E >= w && chmax(m, w * data.first)) {
          //cout << "did";
          m /= data.first;
          data = make_pair(w + x.at(k), w);
        } else {
          m /= (w + x.at(k));
        }
      }
    }
  }
  if(data.first > 1) cout << data.first << " " << data.second << endl;
  else cout << 100 * A << " " << data.second << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		for(int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		int b = (a[2] - a[1]) + (a[2] - a[0]);
		if(b % 2 == 0) {
			System.out.println(b / 2);
		} else {
			System.out.println(b / 2 + 2);
		}
	}
}

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

int main() {
  int n,c=0;
  cin >> n;
  
  for(int i=1;i<n+1;i++){
    if(i<10 || (i>=100 && i<1000) || (i>=10000 && i<100000)) c++;
  }
  
  cout << c <<endl;
  
  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var A = sc.ReadInt();
        var B = sc.ReadInt();
        if (A + B >= 10)
        {
            Console.WriteLine("error");
        }
        else
        {
            Console.WriteLine(A + B);
        }
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

const int MAX_C = 21;
const int INF = (1<<25);

int edge[MAX_C][MAX_C];
int cost[MAX_C];
int come[MAX_C];

int n,m;

int solve(int start ,int fin){
  fill(come,come+MAX_C,0);
  come[0] = 1;
  for(int i = n+1; i < MAX_C; i++) come[i] =1;
  fill(cost,cost+MAX_C,INF);
  queue <int> Q;
  cost[start]= 0;

  while(1){
    int minPos=-1,minCos = INF;

    for(int i = 0; i < MAX_C; i++){
      if(!come[i]){
	if(minCos > cost[i]){
	  minCos = cost[i];
 	  minPos = i;
	}
      }
    }
    if(minPos == -1) break;
    come[minPos] = 1;

    for(int i = 1; i < MAX_C; i++){
      if(edge[minPos][i] != INF) Q.push(i);
    }

    while(!Q.empty()){
      int now = Q.front();
      Q.pop();
      cost[now] = min(cost[now],cost[minPos] + edge[minPos][now]);
    }
  } 
  return cost[fin];
}

void init(){
  for(int i = 0; i < MAX_C; i++) fill(edge[i],edge[i]+MAX_C,INF);
  fill(cost,cost+MAX_C,INF);
  fill(come,come+MAX_C,0);
  come[0] = 1;
}

int main(){
  char trash;
  while(cin >> n && n){
    init();
    cin >> m;
    for(int i = 0; i < m; i++){
      int from,to,cft,ctf;
      cin >> from >> trash >> to >> trash >> cft >> trash>> ctf;
      edge[from][to] = cft;
      edge[to][from] = ctf;
    }
    int start,fin,mon,cos;
    cin >> start >>trash >> fin >> trash >> mon >> trash >> cos;
    cout << mon - cos - solve(start,fin) - solve(fin,start) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

ll N,K,A[100010],B[100010],sum;
P p[100010];

int main(){
	cin>>N>>K;
	REP(i,N){
		cin>>A[i]>>B[i];
		p[i]={A[i],B[i]};
	}
	sort(p,p+N);
	REP(i,N){
		sum+=p[i].second;
		if(sum>=K){
			cout<<p[i].first<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

signed main(){
	int a, b, c;
	scanf("%lld%lld%lld",&a, &b, &c);
	if(a == b and b == c){
		if(a%2 == 0)printf("-1\n");
		else printf("0\n");
		return 0;
	}
	
	int ans = 0;
	while(1){
		if(a%2 or b%2 or c%2)break;
		int t[3] = {b+c, a+c, a+b};
		a = t[0]/2, b = t[1]/2, c = t[2]/2;
		ans++;
	}
	printf("%lld\n", ans);
	return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
#define foru(i, a, b) for(int i = a; i <= b; ++i)
using namespace std;
const int MAXN = 1010;
int n, c[MAXN], a, b;
int main() {
//   freopen("input.txt","r",stdin);
   scanf("%d%d%d",&n,&a,&b);
   int ans = 0;
   foru(i, 1, n){
      int v;
      cin>>v;
      if(v < a || v >= b) ++ans;
   }
   printf("%d\n", ans);
   return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	int ans = 0;
	for (int ii = A; ii <= B; ++ii){
		int a = (ii % 10);
		int b = (ii / 10) % 10;
		int c = (ii / 1000) % 10;
		int d = (ii / 10000) % 10;
		if ( (a == d) && (b ==c) ){
			ans++;
		}
	}

	cout << ans << "\n";

	return 0;
}


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

int main(){
    string s;
    long long ans;
    long long cnt[26];
    cin>>s;

    ans = s.size()*(s.size()-1)/2;
    for(int i=0; i<26; i++){
        cnt[i] = 0;
    }

    for(int i=0; i<s.size(); i++){
        cnt[s[i]-'a']++;
    }


    for(int i=0; i<26; i++){
        ans -= cnt[i]*(cnt[i]-1) / 2;
    }
    
    cout<<ans+1<<endl;

    return 0;
}

Measured memory_bytes: 640
n=int(input())
a=list(map(int,input().split()))
a.sort()
temp=[a[0]]
for i in range(n-1): temp.append(temp[i]+a[i+1])
a.sort(reverse=True)
temp.reverse()
flag=1
for i in range(n-1):
    if a[i]>2*a[i+1] and a[i]>2*temp[i+1]:
        flag=0
        print(i+1)
        break
if flag: print(n)

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

using ll = long long;
#define int ll

const int nax = 1005;
char sl[nax][nax];

const int mod = 1e9 + 7;

void add_self(int& a,int b)
{
	a += b;
	if(a>=mod)
	{
		a -= mod;
	}
}

int32_t main()
{
	int h,w;
	scanf("%lld%lld",&h,&w);
	for(int row=0;row<h;row++)
	{
		scanf("%s",sl[row]);
	}
	vector<vector<int>> dp(h,vector<int>(w));
	dp[0][0] = 1;
	for(int row=0;row<h;row++)
	{
		for(int col=0;col<w;col++)
		{
			for(int r2 : {row,row + 1})
			{
				int c2 = col;
				if(r2 == row)
				{
					c2 = col + 1;
				}
				if(r2<h && c2<w && sl[r2][c2] == '.')
				{
					add_self(dp[r2][c2],dp[row][col]);
				}
			}
		}
	}
	printf("%lld\n",dp[h-1][w-1]);
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

class UnionFind
{
  public:
	explicit UnionFind(ll size)
		: mParent(size, -1)
		, mRank(size, 0)
        , mData(size, 0)
        , mData1(size, 0)
		{}
	bool unionSet(ll x, ll y)
	{
		if ((x = root(x)) == (y = root(y)))
			return false;
		if( mRank[x] < mRank[y] )
		{
			mParent[y] += mParent[x];
			mParent[x] = y;
            unionData( mData[y], mData[x] );
            unionData( mData1[y], mData1[x] );
		}
		else
		{
			mParent[x] += mParent[y];
			mParent[y] = x;
			if( mRank[x] == mRank[y] ) ++mRank[x];
            unionData( mData[x], mData[y] );
            unionData( mData1[x], mData1[y] );
		}
		return true;
	}
	bool isEqualSet(ll x, ll y)
	{
		return root(x) == root(y);
	}
	ll root(ll x)
	{
		return mParent[x] < 0 ? x : mParent[x] = root(mParent[x]);
	}
	ll size(ll x)
	{
		return -mParent[root(x)];
	}

    void unionData( ll& parent, ll& child )
    {
        parent += child;
    }
    void setData( ll x, ll data )
    {
        mData[root(x)] = data;
    }
    ll getData( ll x )
    {
        return mData[root(x)];
    }
    void setData1( ll x, ll data )
    {
        mData1[root(x)] = data;
    }
    ll getData1( ll x )
    {
        return mData1[root(x)];
    }

  public:
	vector<ll> mParent; // = mSize
	vector<ll> mRank;
	vector<ll> mData;
	vector<ll> mData1;
};

struct St{
    ll a = 0;
    ll b = 0;
    ll y = 0;
};
bool operator<(const St& l, const St& r)
{ 
if( l.y == r.y ) 
{ 
    if( l.a == r.a ) return l.b < r.b;
    else return l.a < r.a;
}
return l.y < r.y; }

int main()
{
    ll n, m;
    cin >> n >> m;
    VEC(ll, n, x, 0);
    REP(i,n) cin >> x[i];
    
    vector<St> edgeSt(m, St());
    REP( i, m )
    {
        ll a, b, y;
        cin >> a >> b >> y;
        edgeSt[i].a = a-1;
        edgeSt[i].b = b-1;
        edgeSt[i].y = y;
    }

    sort( ALL( edgeSt ), less<St>() );
    
    UnionFind uf( n );
    ll use = 0;
    REP( i, n ) uf.setData( i, x[i] );
    REP( i, m )
    {
        uf.unionSet( edgeSt[i].a, edgeSt[i].b );
        auto d = uf.getData( edgeSt[i].a );
        if( d >= edgeSt[i].y )
        {
            use++;
            use += uf.getData1(edgeSt[i].a);
            uf.setData1( edgeSt[i].a, 0 );
        }
        else
        {
            uf.setData1( edgeSt[i].a, uf.getData1( edgeSt[i].a ) + 1 );   
        }    
    }

    cout << m-use << endl;

    return 0;
}

Measured memory_bytes: 6528
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <sstream>
#include <unistd.h>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define rep(n) for(int __x = 0; __x < n; __x++)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (x.at(x.size()-1))

using namespace std;

#define EPS 0.0000000001
#define MOD 1000000007

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

string s[] = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
Int a[] = { 7, 6, 5, 4, 3, 2, 1 };

string S;

void input() {
  cin >> S;
}

void solve() {
  loop(i,0,7) {
    if (s[i] == S) {
      cout << a[i] << endl;
      return;
    }
  }

  cout << -1 << endl;
}

int main(void) {
  input();
  solve();
  return 0;
}



Measured memory_bytes: 256
s=input()
k="keyence"
if s.find(k,0,7)!=-1 or s.find(k,len(s)-7)!=-1:
    print("YES")  
    exit()
for i in range(1,7):
    a=s.find(k[:i],0,len(k[:i]))
    if a==0:
        b=s.find(k[i:],len(s)-len(k[i:]))
        if b!=-1:
            print("YES")
            exit()
print("NO")









Measured memory_bytes: 38384
l,r = map(int, input().split())
if r-l>2019:
    r=r-2019*((r-l)//2019-1)

ans=2019
for i in range(r-l):
    for j in range(r-l-i):
        #print((l+i),(r-j))
        if ((l+i)*(r-j))%2019<ans:
            ans=((l+i)*(r-j))%2019

print(ans)


Measured memory_bytes: 2940