akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
A, B, Q = map(int, input().split())
inf = 10**18
S = [-inf]
for _ in range(A):
    S.append(int(input()))
S.append(inf)
T = [-inf]
for _ in range(B):
    T.append(int(input()))
T.append(inf)
def f_s(x, l):
    mn, mx = -1, len(l)
    idx = mx//2
    while mx-mn>1:
        if l[idx] < x:
            idx, mn = (idx + mx)//2, idx
            continue
        idx, mx = (idx + mn)//2, idx
    return idx

for _ in range(Q):
    q = int(input())
    xi, yi = f_s(q, S), f_s(q, T)
    s1, s2 = S[xi], S[xi+1]
    t1, t2 = T[yi], T[yi+1]
    print(min([
        max(q-s1,q-t1),
        max(s2-q, t2-q),
        2*(s2-q) + q-t1,
        2*(t2-q) + q-s1,
        2*(q-s1) + t2-q,
        2*(q-t1) + s2-q,
        ]))
#    print(q, s1, s2, t1, t2)

#    print(S[xi], T[yi])


Measured memory_bytes: 74460
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	string S; cin >> S;
	int n,w,s,e;
	n = w = s = e = 0;
	rep(i,S.size()) {
		if (S[i] == 'N') n = 1;
		if (S[i] == 'W') w = 1;
		if (S[i] == 'S') s = 1;
		if (S[i] == 'E') e = 1;
	}
	cout <<  (((n+s)%2 == 0 && (e+w)%2 == 0) ? "Yes" : "No") << endl;
}




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

int main() {
    int n;
    std::cin >> n;
    for (int i = 1; i < 10; i++) for (int j = 1; j < 10; j++) {
        if (i * j == n) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
N = int(input())
H = [int(i) for i in input().split()]
H = H[::-1]
# print(H)
stair = True
for i in range(len(H)-1):
    if H[i+1] > H[i]+1:
        stair = False
        break
    elif H[i+1] == H[i]+1:
        H[i+1]-=1

if stair == True:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 14396
x, y = map(int, input().split())
a = [1, 3, 5, 7, 7, 8, 10, 12]
b = [4, 6, 9, 11]
if x == 2 or y == 2:
	print('No')
elif x in b and y in b:
	print('Yes')
elif x in a and y in a:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

int main()
{
    ll n,m,total=0;
    cin>>n>>m;
    vector<ll> v(m);
    for(ll i=0;i<m;i++)
    {
        cin>>v[i];
        total += v[i];
    }
    cout<<max(-1ll,n-total);
}

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

long long N, A[200009], B[200009], C[200009], sum, cnt1, cnt2; vector<tuple<long long, int, int>>vec;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i] >> B[i];
		vec.push_back(make_tuple(A[i], i, 0));
		vec.push_back(make_tuple(B[i], i, 1));
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < N; i++) {
		C[get<1>(vec[i])]++; sum += get<0>(vec[i]);
		if (get<2>(vec[i]) == 0) cnt1++; else cnt2++;
	}
	for (int i = 1; i <= N; i++) {
		if (C[i] >= 2 || (cnt1 == 0 || cnt2 == 0)) {
			cout << sum << endl;
			return 0;
		}
	}
	long long V1 = cnt1; if (get<1>(vec[N]) == get<1>(vec[N - 1])) { if (get<2>(vec[N]) == 0) cnt1++; else cnt1--;  /* 1 -> 0, 0 -> 1*/ }
	if (get<1>(vec[N]) != get<1>(vec[N - 1]) || (cnt1 == 0 || cnt1 == N)) {
		sum += get<0>(vec[N]) - get<0>(vec[N - 1]);
	}
	else {
		long long P1 = get<0>(vec[N + 1]) - get<0>(vec[N - 1]);
		long long P2 = get<0>(vec[N + 0]) - get<0>(vec[N - 2]);
		sum += min(P1, P2);
	}
	cout << sum << endl;
	return 0;
}

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

uint64_t randint(){
    static int64_t seed = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
    static mt19937_64 rnd(seed);
    return rnd();
}

template<int64_t mod=int64_t(1e9+7)>
struct RollingHash{
    vector<int64_t> hash;
    vector<int64_t> base_pow;
    int64_t base;

    RollingHash(string S="", int64_t base_=-1):base(base_){
        if(base < 0) base = 1000 + randint() % 10000;
        if(S.size() > 0) initialize(S);
    }

    void initialize(string& S){
        int N = S.size();
        vector<int> s(N);
        for(int i=0; i<N; i++) s[i] = S[i];
        initialize(s);
    }

    void initialize(vector<int>& S){
        int sz = S.size();
        hash.resize(sz+1);
        base_pow.resize(sz+1);
        hash[0] = 0;
        base_pow[0] = 1;
        for(int i=1; i<=sz; i++){
            hash[i] = (hash[i-1] * base + S[i-1]) % mod;
            base_pow[i] = base_pow[i-1] * base % mod;
        }
    }

    // 0-indexed, [a, b)
    int64_t between(int a, int b){
        return (mod + hash[b] - hash[a] * base_pow[b-a] % mod) % mod;
    }
};

int main(){
    int N;
    string S;
    cin >> N >> S;
    int ok = 0, ng = N/2+1;
    RollingHash<> rh1(S);
    RollingHash<int64_t(1e9+9)> rh2(S);

    while(ng-ok>1){
        int len = (ng+ok)/2;
        set<pair<int64_t, int64_t>> val;
        vector<pair<int64_t, int64_t>> v(N);
        bool success = false;
        for(int i=0; i+len<=N; i++){
            if(i >= len) val.insert(v[i-len]);
            v[i] = {rh1.between(i, i+len), rh2.between(i, i+len)};
            if(val.count(v[i])){
                success = true;
                break;
            }
        }
        (success ? ok : ng) = len;
    }
    cout << ok << endl;
    return 0;
}


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

using namespace std;

int main(void){
    int N;
    double M;
    int a;
    double total=0.0;
    int ans=0;
    vector<int> v;

    cin>>N>>M;
    


    for(int i=0;i<N;i++){
        cin>>a;
        total +=a;
        v.push_back(a);
    }

    for(int i=0;i<v.size();i++){
        //cout<<v[i]<<":"<<total/(4.0*M)<<endl;
        if(v[i] >= total/(4.0*M)){
            ans++;
        }
    }

    if(ans >= M){
        
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

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

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

int main()
{

    //cinでファイルから読込
    ifstream in("./input.txt");
    cin.rdbuf(in.rdbuf());

    //cinの高速化
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    int count = 0;
    for (int i = 1; i <= N; i++)
    {
        if (to_string(i).length() % 2 == 1)
        {
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
X = list(map(int, input().split()))
 
ans = 0
if N >= M: # コマのほうが多い場合
    print(ans)
    exit()
 
X.sort() # ソートする
x_diff = [0]*M 
for i in range(1, M):
    x_diff[i-1] = X[i] - X[i-1]
x_diff.sort(reverse=True)
ans = sum(x_diff[N-1:]) # 切れ目のN-1こめまでは、Nこのコマが担当するので移動しなくて良い
print(ans)

Measured memory_bytes: 13968
/*
 * atcoder/abc137/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <queue>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * 1日1つと考えると最大でM個の仕事をM日間で受けられる.
 * 1日でもらえるものの最大値
 * 2日以内にもらえるものの最大値
 * 3日以内...
 * M-1日以内にもらえるものの最大値
 * とすると取りこぼし無し
 */
int N, M;
vector<int> A[100001];
void solve() {
  cin >> N >> M;
  int a, b;
  loop(i,0,N) {
    cin >> a >> b;
    if (a > M) continue; // 報酬が間に合わないので受けるだけ無駄
    A[a].push_back(b);
  }
  ll score = 0;
  priority_queue<int> Q;
  for (int day=1; day<=M; day++) { // M-dayに行う仕事で最大報酬のものを受ける
    for (auto b: A[day]) Q.push(b);
    if (Q.empty()) continue;
    score += Q.top();
    Q.pop();
  }
  cout << score << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 5632
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <utility>

using namespace std;

int main()
{
    int a, b;
    cin>>a>>b;
    if (a+b==15) cout<<"+\n";
    else if (a*b==15) cout<<"*\n";
    else cout<<"x\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define int long long
using namespace std;
signed main() {
	int n; cin >> n;
	int w[123];
	int sum = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		sum += w[i];
	}
	ans = sum;
	w[n] = 5000;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		cnt += w[i];
		ans = min(ans, abs(cnt - (sum - cnt)));
	}
	cout << ans << endl;
	cin >> n;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	ans := ""
	if la, lb := len(a), len(b); la < lb {
		ans = "LESS"
	} else if la > lb {
		ans = "GREATER"
	} else {
		for i := 0; i < la; i++ {
			if a[i] == b[i] {
				continue
			}

			if a[i] > b[i] {
				ans = "GREATER"
			} else {
				ans = "LESS"
			}
			break
		}
	}
  if ans == "" {
    ans = "EQUAL"
  } 
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define clt(x) 63-__builtin_clzll(x)
#define bct(x) __builtin_popcountll(x)
#define all(v) (v).begin(),(v).end()
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector<pair<ll,ll>>
#define maxq priority_queue<ll>
#define minq priority_queue<ll,vector<ll>, greater<ll>>
#define cont continue;
#define reto return 0;
#define sz size()
#define spmod 1116295198451
#define mod 1000000007
#define md 998244353 
#define N 200009
//typedef tree<int,null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> //pbds;

ll a[N],f[N];
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll n,x;
  cin>>n;
  ll i=0;
  while(i<n)
    cin>>a[i++];
  i=n-1;
  while(i>-1)
  {
    f[i]=a[i]+f[i+1];
    f[i]%=mod;
    i--;
  }
  ll ans=0;
  i=0;
  while(i<n-1)
  {
    x=a[i]*(f[i+1]);
    //deB(a[i],f[i+1])
    x%=mod;
    ans+=x;
    ans%=mod;
    i++;
  }
  deb(ans)
}

Measured memory_bytes: 6788
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define M 1000000007

ll permutation(string &s, int n){

    ll dp[n+1][n+1], prefix[n+1][n+1];
    memset(dp, 0, sizeof(dp));
    memset(prefix, 0, sizeof(prefix));

    for(int i=1; i<=n; i++){
        dp[1][i] = 0;
        prefix[1][i] = 1;
    }
    dp[1][1] = 1;


    for(int i=2; i<=n; i++){
        if(s[i-2] == '<'){
            for(int j=1; j<=i; j++){
//                ll sum = 0;
//                for(int k=1; k<j; k++)
//                    sum = (sum + dp[i-1][k])%M;
                ll sum = (prefix[i-1][j-1] - prefix[i-1][0] + M)%M;
                dp[i][j] = sum;
                prefix[i][j] = (prefix[i][j-1] + sum)%M;
            }
            for(int j=i+1; j<=n; j++)
                prefix[i][j] = prefix[i][j-1];
        }
        else{
            for(int j=1; j<=i; j++){
//                ll sum = 0;
//                for(int k=j; k<=n; k++)
//                    sum = (sum + dp[i-1][k])%M;
//                dp[i][j] = sum;
                ll sum = (prefix[i-1][n] - prefix[i-1][j-1] + M)%M;
                dp[i][j] = sum;
                prefix[i][j] = (prefix[i][j-1] + sum)%M;
            }
            for(int j=i+1; j<=n; j++)
                prefix[i][j] = prefix[i][j-1];
        }
    }
    ll ans = 0;
    for(int i=1; i<=n; i++)
        ans = (ans + dp[n][i])%M;
    return ans;
}

int main()
{
 int n;
 cin>>n;
 string s;
 cin>>s;
 ll ans = permutation(s, n);
 cout<<ans;
 return 0;
}



Measured memory_bytes: 144300
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	static int n, m, p, s, g;
	static double ticket[];
	static Node city[];

	static class Node {
		int num;
		int degree;
		Node neighbor[] = new Node[30];
		double cost[] = new double[30];
		double minCost[] = new double[257];

		Node(int n) {
			this.num = n;
		}

		void joint(Node n, double cost) {
			this.neighbor[this.degree] = n;
			this.degree++;
			this.cost[n.num] = cost;
			n.neighbor[n.degree] = this;
			n.degree++;
			n.cost[this.num] = cost;
		}
	}

	static class Pair {
		int num;
		int ticket;

		Pair(int num, int ticket) {
			this.num = num;
			this.ticket = ticket;
		}
		
		@Override
		public int hashCode() {
			// TODO 自動生成されたメソッド・スタブ
			return (num * ticket) ^ ticket;
		}
		
		@Override
		public boolean equals(Object obj) {
			// TODO 自動生成されたメソッド・スタブ
			Pair p = (Pair)obj;
			return p.num == num && p.ticket == ticket;
		}
	}

	public static void dijkstra(int s) {
		int id = s;
		int t = (1 << n) - 1;

		HashSet<Pair> set = new HashSet<Pair>();

		while (true) {
			for (int i = 0; i < city[id].degree; i++) {
				Node nextNode = city[id].neighbor[i];
				for (int j = 0; j < n; j++) {
					if (0 < (t & (1 << j))) {
						int nticket = t ^ (1 << j);
						if (nextNode.minCost[nticket] == 0 || city[id].minCost[t] + city[id].cost[nextNode.num] / ticket[j] < nextNode.minCost[nticket]) {
							nextNode.minCost[nticket] = city[id].minCost[t] + city[id].cost[nextNode.num] / ticket[j];
							set.add(new Pair(nextNode.num, nticket));
						}
					}
				}
			}
			if (set.isEmpty()) {
				break;
			}
			Pair min = null;
			for (Pair p: set) {
				if (min == null || city[p.num].minCost[p.ticket] < city[min.num].minCost[min.ticket]) {
					min = p;
				}
			}
			if (min.num == g - 1 && min.ticket == 0) {
				break;
			}
			id = min.num;
			t = min.ticket;
			set.remove(min);
		}
	}

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

		while (true) {
			n = sc.nextInt();
			m = sc.nextInt();
			p = sc.nextInt();
			s = sc.nextInt();
			g = sc.nextInt();
			if ((n | m | p | s | g) == 0) {
				break;
			}

			ticket = new double[n];
			for (int i = 0; i < n; i++) {
				ticket[i] = sc.nextInt();
			}

			city = new Node[m];
			for (int i = 0; i < m; i++) {
				city[i] = new Node(i);
			}
			for (int i = 0; i < p; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				double z = sc.nextInt();
				city[x - 1].joint(city[y - 1], z);
			}

			dijkstra(s - 1);

			double min = Double.MAX_VALUE;
			for (int j = 0; j < 257; j++) {
				if (city[g - 1].minCost[j] != 0) {
					min = Math.min(min, city[g - 1].minCost[j]);
				}
			}

			if (min == Double.MAX_VALUE) {
				System.out.println("Impossible");
			} else {
				System.out.println(min);
			}
		}
	}
}

Measured memory_bytes: 41332
n,m = map(int,input().split())
a = list(map(int,input().split()))
a_key = sum(a)/(4*m)
count = 0
for i in range(n):
    if a[i] >= a_key:
        count += 1
if count >= m:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
map<char,ll> mp;
int main(){
double x1,y1,x2,y2,x3,y3;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
//S=r(a+b+c)/2 => r=2S/(a+b+c)
double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
double b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
double c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
double s=abs((x1-x3)*(y1-y2)-(y1-y3)*(x1-x2));
double tmp_ma=max({a,b,c});
double ans=s/(a+b+c+2*(s/tmp_ma));
printf("%.10f\n",ans);
}


Measured memory_bytes: 256
fun main(args: Array<String>){
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    val gcdSegTree = IntSegTree(A, ::gcd, 0)
    var max = 0
    for(i in 0 until N){
        val ori = gcdSegTree.get(i)
        gcdSegTree.update(i, 0)
        max = Math.max(max, gcdSegTree.getOp(0, N))
        gcdSegTree.update(i, ori)
    }
    println(max)
}

fun gcd(a: Int, b: Int): Int {
    if (a < b) return gcd(b, a)
    if (b == 0) return a
    return gcd(b, a % b)
}

class IntSegTree(
    original: IntArray,
    private val op: (Int, Int) -> Int,
    private val unit: Int
){
    private var size = 1
    private var node = IntArray(0)

    init {
        while (size < original.size){
            size *= 2
        }
        node = IntArray(2*size-1){unit}
        for(i in original.indices){
            node[i+size-1] = original[i]
        }
        for(i in size - 2 downTo 0){
            node[i] = op(node[2*i+1], node[2*i+2])
        }
    }

    fun update(index: Int, value: Int){
        node[index+size-1] = value
        var x = index + size - 1
        while(x > 0){
            x = (x - 1) / 2
            node[x] = op(node[2*x+1], node[2*x+2])
        }
    }

    fun getOp(a: Int, b: Int, k: Int = 0, l: Int = 0, r: Int = size - 1): Int{
        if(r <= a || b <= l){
            return unit
        }
        if(a <= l && r <= b){
            return node[k]
        }
        val vl = getOp(a, b, 2*k+1, l, (l+r)/2)
        val vr = getOp(a, b, 2*k+2, (l+r)/2, r)
        return op(vl, vr)
    }

    fun get(index: Int): Int{
        return node[index+size-1]
    }
}

Measured memory_bytes: 90692
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
signed main(){
	int n;
	cin>>n;
	vi a(n);
	rep(i,n) cin>>a[i];
	int ans=0;
	rep(k,60){
		int cnt=0;
		rep(i,n){
			if(a[i]&(1ll<<k)) cnt++;

		}
		int t=(cnt*(n-cnt))%MOD;
		loop(k) {
			t*=2;
			t%=MOD;
		}

		ans+=t;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}



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

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  int simpleSum = a * x + b * y;

  int halfWithSimpleSum = c * (x > y ? y : x) * 2;
  if(x > y) {
    halfWithSimpleSum += a * (x - y);
  } else if (y > x) {
    halfWithSimpleSum += b * (y - x);
  }

  int halfSum = c * (x > y ? x : y) * 2;

  int min = simpleSum > halfWithSimpleSum ? halfWithSimpleSum : simpleSum;
  if(min > halfSum) min = halfSum;

  cout << min;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
 
int main(void)
{
    long int H;
  	long int count=0;
  	long int sum=0;
  	int i=0;
    // 整数の入力
    scanf("%ld\n",&H);
   	while(H>0){
    	H=H/2;
      	count++;
    }
  	for(i=0;i<count;i++)
      sum+=pow(2,i);
      printf("%ld\n",sum);
    return 0;
}

Measured memory_bytes: 128
N, Y = [int(i) for i in input().rstrip().split(' ')]

cnt = [int(-1)for i in range(3)]
for A in range(N+1):
    for B in range(N+1 - A):
        C = N - A - B
        calc = A*10000 + B*5000 + C*1000
        if calc == Y:
            cnt = [A, B, C]
            break
    else:
        continue
    break
print(' '.join(map(str,cnt)))


Measured memory_bytes: 3060
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

def cumulative_sum(arr)
  arr.reduce([0]) do |prev, cur|
    prev.push(prev.last + cur)
    prev
  end
end

N, M, Q = get_ints

array = Array.new(N+1) { Array.new(N+1, 0) }
M.times do |i|
  l, r = get_ints
  array[l][r] += 1
end

S = Array.new(N+1) { Array.new(N+1, 0) }

1.step(N) do |i|
  1.step(N) do |j|
    S[i][j] = array[i][j] + S[i][j-1] + S[i-1][j] - S[i-1][j-1]
  end
end

Q.times do
  l, r = get_ints
  puts S[r][r] - S[r][l-1] - S[l-1][r] + S[l-1][l-1]
end


Measured memory_bytes: 18204
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int n;
	cin >> n;
	vi a(n + 1), b(n + 1), c(n + 1);
	repz(i, n)cin >> a[i+1];
	repz(i, n)cin >> b[i+1];
	repz(i, n-1)cin >> c[i+1];

	ll sum = 0;
	for(int i = 1;i<=n;i++) {
		sum += b[a[i]];
	}
	//cout << "kokomade: " << sum << endl;

	for (int i = 1; i < n; i++) {
		if (a[i+1] - a[i] == 1) {
			sum += c[a[i]];
		}
	}


	cout << sum << endl;
	

	system("pause");
	return 0;
}


Measured memory_bytes: 504
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let d: usize = read();
    let g: usize = read();
    let v: Vec<(usize, usize)> = (0..d).map(|_| (read(), read())).collect();

    let mut ans = 100000;
    for bit in 0..(1 << d) {
        let mut sum = 0;
        let mut number = 0;
        for i in 0..d {
            if bit & (1 << i) != 0 {
                sum += (i+1) * 100 * v[i].0 + v[i].1;
                number += v[i].0;
            }            
        }
        if sum < g {
            'outer: for i in (0..d).rev() {
                if bit & (1 << i) == 0 {
                    for _ in 0..v[i].0 {
                        sum += (i+1) * 100;
                        number += 1;
                        if sum >= g {
                            break 'outer;
                        }
                    }
                }
            }
        }
        if number < ans {
            ans = number;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,a,b,res=0;
  cin>>n>>a>>b;
  for(int i=1;i<=n;++i){
    int r=0;
    r+=i%10;
    r+=i/10%10;
    r+=i/100%10;
    r+=i/1000%10;
    r+=i/10000%10;
    if(a<=r&&r<=b)res+=i;
  }
  cout<<res;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

ll D;
ll c[26+1];
ll s[365+1][26+1];

ll last[365+1];

void input(){
    cin>>D;
    repn(i,26) cin>>c[i];
    repn(i,D) repn(j,26) cin>>s[i][j];
}

int main(){
    input();

    ll score=0;
    repn(d,D){
        ll maxi=-LINF;
        ll idx=0;
        repn(i,26){
            ll res=0;
            res+=s[d][i];
            repn(j,26){
                if(i==j) continue;
                res-=c[j]*(d-last[j]);
            }
            if(maxi<res){
                maxi=res;
                idx=i;
            }
        }
        score+=maxi;
        last[idx]=d;
        cout<<idx<<endl;
    }

    //cout<<score<<endl;
}

Measured memory_bytes: 3684
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//最小公倍数、最大公約数
ll gcd(ll a, ll b) {
	return b != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

map<ll, ll> p_f(ll n) { //素因数分解
	map<ll, ll> ans;
	for (ll i = 2; i < sqrt(n) + 1; i++) {
		if (n == 1)break;
		while (n % i == 0) {
			n /= i;
			ans[i]++;
		}
	}
	if (n != 1)ans[n]++;
	return ans;
}

int main() {
	ll A, B;
	cin >> A >> B;
	ll tmp = gcd(A, B);
	auto a = p_f(tmp);
	cout << a.size()+1 << endl;
}

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

int main() {
        int i, j;
        int x, y, s;
        while (cin >> x >> y >> s) {
                if (x == 0 && y == 0 && s == 0) break;
                int ans = -1;
                for (i = 1; i < s; i ++) {
                        for (j = 1; j < s; j ++) {
                                int ii = (i * (100 + x)) / 100;
                                int jj = (j * (100 + x)) / 100;
                                if (ii + jj == s) {
                                        int res = (i * (100 + y)) / 100;
                                        res += (j * (100 + y)) / 100;
                                        ans = max(ans, res);
                                }
                        }
                }
                cout << ans << endl;
        }
        return 0;
}

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

int nCr(int n, int r) {
    int ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

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

    int count = 0;
    if ( n > 1){
        count += nCr(n, 2);
    }
    if ( m > 1){
        count += nCr(m, 2);
    }

    cout << count << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    if(s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23636
//35
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int mode[101]={};
  for(int n;cin>>n;){
    mode[n]++;
  }
  int l=0;
  for(;;){
    int *mp=max_element(mode,mode+101);
    if(*mp<l)break;
    l=*mp;
    cout<<mp-mode<<endl;
    *mp=0;
  }
  return 0;
}

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

int x;

int main() {
    std::cin >> x;
    int m = x % 100;
    int e = (x - m) / 100;
    if (e*5 < m) {
        std::cout << 0 << std::endl;
    }
    else {
        std::cout << 1 << std::endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

int main(){
	using namespace std;
	int i;
	long n,k,r = 0;
	cin >> n >> k;
	long h[n];
	for (i = 0; i < n; i++) {
		cin >> h[n];
		if (h[n] >= k) {
			r++;
		}
	}
	cout << r << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);

    if(a == b)
    {
        if(b != c)
            printf("Yes\n");
        else
            printf("No\n");
    }
    else
    {
        if(a == c || b == c)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=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;
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);
	ll h, w;
	cin >> h >> w;
	ll ans = h * w;
	ans = ans / 2 + (ans % 2 == 0 ? 0 : 1);
	if (h == 1 || w == 1) ans = 1;
	cout << ans << endl;
	return 0;
}


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

int main(){
    int N; cin>>N;
    vector<pair<int,int>> p(N);
    for(int i=0;i<N;i++){
        int a; cin>>a;
        p[i]=make_pair(a,i+1);
    }
    sort(p.begin(),p.end());
    for(int i=0;i<N;i++){
        cout<<p[i].second<<endl;
    }
}

Measured memory_bytes: 1664
n = int(input())
av = [None] * n
for i in range(n):
    a, v = map(int, input().split())
    av[i] = [a, v]

av.sort()
ans = av[0][0]
for a, v in av:
    if av[ans - 1][1] < v:
        ans = a
print(ans, av[ans - 1][1])



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

using namespace  std;

int main(void)
{
    int N, Q;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    cin >> Q;

    unsigned long long sum = 0;
    vector<int> map(100001, 0);
    
    for(int i = 0; i < N; i++){
        sum += A[i];
        map[A[i]]++;
    }

    vector<unsigned long long> ans(Q);
    for(int i = 0; i < Q; i++){
        int B, C;
        cin >> B >> C;

        sum += (C-B)*map[B];
        map[C] += map[B];
        map[B] = 0;

        ans[i] = sum;
    }

    for(unsigned long long a : ans){
        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define yes(a) printf(a ? "yes\n" : "no\n")
#define Yes(a) printf(a ? "Yes\n" : "No\n")
#define YES(a) printf(a ? "YES\n" : "NO\n") 
const long double PI = acos(-1);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
	
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;

  ll mit = min({a, b, c, d, e});
  cout << 5 + ceil(n, mit) - 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int H,W,d;
int s[500][500];
string RYGB="RYGB";
int main(){
	cin>>H>>W>>d;
	rep(i,H) rep(j,W){
		int x = (i+j)/d;
		if(x%2==1) s[i][j]++;
	}
	rep(i,H) rep(j,W){
		int x = (i-j+W)/d;
		if(x%2==1) s[i][j]+=2;
	}
	rep(i,H){
		rep(j,W){
			cout<<RYGB[s[i][j]];
		}
		puts("");
	}
}


Measured memory_bytes: 1408
A, B , K = map(int, input().split())
for k in range(K):
    if k % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B += A // 2
        A -= A // 2
    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B -= B // 2
print(A, B)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>//ソートなどに必要
using namespace std;

int main() 
{
    int n;
    cin >> n;
    int a[n];//配列の宣言。int側に[]は不要。
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    cout << a[n-1]-a[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

//constexpr ll MOD = 1e9+7;
//template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
//constexpr int INF=inf<int>;
//constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
int N, M;
string S;

void run(const string& s, int x, vi& steps) {
  assert(S[x] == '0');
  assert(x<=N);

  if (x==N) return;

  int j = min({x+M, N});
  for (; j>=x; j--) {
    if (S[j]=='0') break;
  }
  if (x==j) {
    steps.clear();
    return;
  }
  steps.emplace_back(j-x);
  run(s, j, steps);
}

int main(int argc, char** argv) {
  cin >> N >> M;
  cin >> S;

  if (N==1) {
    cout << 1 << endl;
    return 0;
  }

  Reverse(S);
  vi steps;
  run(S, 0, steps);
  if (steps.empty()) {
    cout << -1 << endl;
    return 0;
  }

  Reverse(steps);
  for (int i=0; i<steps.size(); i++) {
    cout << steps[i];
    if (i<steps.size()-1) {
      cout << " ";
    }
  }
  cout << endl;


  /*
  // binary search
  int l = 0; // false
  int r = N; // true;
  steps.clear();

  while (l+1<r) {
    int m = (l+r)/2;

    bool ok = [&]() {
      steps.clear();
      run(S, 0, steps);
      assert(steps.size()>0);
      return steps.size() <= m;
    }();

    if (ok) {
      r = m;
    } else {
      l = m;
    }
  }
  */

  return 0;
}


Measured memory_bytes: 7368
/**************************
 *   Saidur Rahman Sajol  *
 * Dept. of CSE,IUBAT(162)*
 **************************/
#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define l long
#define ll long long 
#define ul unsigned long
#define ull unsigned long long

ull minimum(ull a,ull b){
  return (a<b)?a:b;
}
ull maximum(ull a,ull b){
  return (a>b)?a:b;
}
ull great(ull a,ull b){
	if(b==0) return a;
  return great(b,a%b);
}
vector<int>stl;
vector<int>stl1;
set<int>pb;
map<char,int>mp;
vector<pair<int,int> >freak;
vector<pair<int,int> >freak1;

int main(){
	string s;
	cin>>s;
	string sa="AC";
	if(s.find(sa)!=(-1)) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
class UnionFind():
    '''
    UnionFindでグラフの状態を管理する
    '''
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n)
        self.rnk = [0]*(n)

    def find_root(self, x):
        '''
        ルートのノードを見つける
        '''
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    def unite(self, x, y):
        '''
        ノード同士を連結する
        '''
        x = self.find_root(x)
        y = self.find_root(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1

    def is_same_group(self, x, y):
        '''
        同一のルーツを持つかどうか調査する
        '''
        return self.find_root(x) == self.find_root(y)

    def count(self, x):
        return -self.root[self.find_root(x)]

    def get_root(self):
        return self.root

    def get_member(self, x):
        if(self.root[x] < 0):
            return -self.root[x]
        else:
            return -self.root[self.root[x]]


N, M, K = map(int, input().split())
union_find = UnionFind(N)
AB = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int,input().split())
    a, b = a-1,b-1
    AB[a].append(b)
    AB[b].append(a)
    union_find.unite(a, b)

CD = [[] for _ in range(N)]
for _ in range(K):
    c, d = map(int,input().split())
    c, d = c-1,d-1
    CD[c].append(d)
    CD[d].append(c)

for i in range(N):
    union_find.find_root(i)

ret = [0] * N
for i in range(N):
    ret[i] += union_find.get_member(i)

for i in range(N):
    for a in AB[i]:
        if union_find.is_same_group(i, a):
            ret[i] -= 1
    for c in CD[i]:
        if union_find.is_same_group(i, c):
            ret[i] -= 1

print(" ".join([str(i-1) for i in ret]))


Measured memory_bytes: 126188
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int n , a , b;

int main(){
  cin >> n >> a >> b;
  int ans = 0;
  rep(i,0,n) {
    int t;
    cin >> t;
    ans += !(a <= t && t < b);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define scd second
#define fst first
#define pb push_back
#define mkp make_pair
#define all(x) x.begin(), x.end()
#define VT(T) vector<T>
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vint> vvint;
typedef vector<vlong> vvlong;
typedef list<int> lint;
typedef list<ll> llong;
typedef list<pii> lpii;
typedef list<pll> lpll;
typedef list<lint> llint;
typedef list<llong> lllong;
 
ll const LINF=numeric_limits<long long int>::max();
int const INF=numeric_limits<int>::max();
 
ll gcd(ll a, ll b){
	return b ? gcd(b,a%b) : a;
}
 
ll pow_mod(ll a, ll e, ll m){
	ll res=1;
	while(e){
		if(e&1) res=res*a%m;
		a=a*a%m;
		e>>=1;
	}
	return res;
}
 
ll inv_mod(ll b, ll m){
	b%=m;
	ll x=0, y=1, r, q, a=m;
	while(b){
		q=a/b;
		r=a%b;
		a=b;
		b=r;
		r=x;
		x=y;
		y=r-q*y;
	}
	x+=m;
	return x%m;
}

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

	string str;
	cin>>str;

	int n=str.length(), cnt=0;
	for(int i=0; i<n/2; i++){
		if(str[i]!=str[n-1-i]){
			cnt++;
		}
	}

	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>

int main(){
    using namespace std;

    int N, R;
    cin >> N >> R;
    if(N >= 10){
        cout << R << endl;
    }else{
        cout << 100*(10-N)+R << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>
//#include <string.h>
#include <bits/stdc++.h>
#define INF 999999999
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
bool vis[100000]={0};
int main()
{
    boost;
    int n;
    cin >>n;
    string s,w;
    cin >>s;
    int sum=0,num=0;
    for(int i=0;i<n;i++){
        if(s[i]=='('){
           sum++;
        }
        else {
            if(sum>0) sum--;
            else num++;
        }

    }
    for(int i=0;i<num;i++)
        cout<<"(";
        cout<<s;
    for(int i=0;i<sum;i++)
        cout<<")";
    cout<<endl;
    return 0;

}


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


int main(){
    int n;
    cin>>n;
    string w[n];
    for(int i=0;i<n;i++){
        cin>>w[i];
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(w[i]==w[j]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    for(int i=0;i<n-1;i++){
        if(w[i][(w[i].length())-1]!=w[i+1][0]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

    if(R < 1200) cout << "ABC" << endl;
    else if(R < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}


Measured memory_bytes: 256
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,a[100005],ans,k;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i);
    for(int i=1;i<=n;++i){
        if(a[i]>a[i-1])k&=1;
        else if(a[i]<a[i-1])k&=2;
        if(!k)++ans,k=3;
    }
    printf("%d\n",ans);
    //system("pause");
    return 0;
}


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

namespace AC_WA
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, M;
            var word = Console.ReadLine().Split(' ');
            M = int.Parse(word[0]);
            N = int.Parse(word[1]);
            if (N == M)
                Console.WriteLine("Yes");
            else if (N != M)
                Console.WriteLine("No");
            Console.ReadKey();


        }
    }
}

Measured memory_bytes: 11092
AH,AM,AS,AH2,AM2,AS2=map(int,input().split())
BH,BM,BS,BH2,BM2,BS2=map(int,input().split())
CH,CM,CS,CH2,CM2,CS2=map(int,input().split())
A=AH2*3600+AM2*60+AS2-AH*3600-AM*60-AS
B=BH2*3600+BM2*60+BS2-BH*3600-BM*60-BS
C=CH2*3600+CM2*60+CS2-CH*3600-CM*60-CS
print(A//3600,A%3600//60,A%3600%60)
print(B//3600,B%3600//60,B%3600%60)
print(C//3600,C%3600//60,C%3600%60)


Measured memory_bytes: 5592