akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int A, B, K; cin >> A >> B >> K;
    chmin(K, B - A + 1);
    set<int> s;

    rep(i, K){
        s.insert(A + i);
        s.insert(B - i);
    }

    for(auto& e : s){
        cout << e << endl;
    }

    return 0;
}


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

template <typename T>
vector<T> uni(vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}

template<typename T>
struct Imos2D {
    vector<vector<T>> imos;
    Imos2D(int h = 0, int w = 0) : imos(h + 2, vector<T>(w + 2)) { }
    void add(int i, int j, T x) { imos[i + 1][j + 1] += x; }
    void add_rect(int i1, int j1, int i2, int j2, T x = 1) {
        add(i1, j1, +x); add(i1, j2, -x); add(i2, j1, -x); add(i2, j2, +x);
    }
    void build() {
        int H = imos.size(), W = imos[0].size();
        for (int i = 1; i < H; i++) for (int j = 1; j < W; j++) {
            imos[i][j] += imos[i][j - 1] + imos[i - 1][j] - imos[i - 1][j - 1];
        }
    }
    T get(int i, int j) { return imos[i + 1][j + 1]; }
    T diff(int si, int sj, int ti, int tj) {        // [si, ti) x [sj, tj)
        return imos[ti][tj] - imos[ti][sj] - imos[si][tj] + imos[si][sj];
    }
};

int main() {
    int n; cin >> n;
    vector<int> x1(n), y1(n), x2(n), y2(n);
    vector<int> xx, yy;
    for (int i = 0; i < n; i++) {
        cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
        xx.emplace_back(x1[i]);
        xx.emplace_back(x2[i]);
        yy.emplace_back(y1[i]);
        yy.emplace_back(y2[i]);
    }
    xx = uni(xx);
    yy = uni(yy);
    auto getX = [&](int x) {
        return lower_bound(begin(xx), end(xx), x) - begin(xx);
    };
    auto getY = [&](int y) {
        return lower_bound(begin(yy), end(yy), y) - begin(yy);
    };
    int h = yy.size(), w = xx.size();
    Imos2D<int> imos(h, w);
    for (int i = 0; i < n; i++) {
        imos.add_rect(getY(y1[i]), getX(x1[i]), getY(y2[i]), getX(x2[i]));
    }
    imos.build();
    long long ans = 0;
    for (int i = 0; i < h - 1; i++) for (int j = 0; j < w - 1; j++) {
        if (imos.get(i, j)) {
            ans += 1LL * (yy[i + 1] - yy[i]) * (xx[j + 1] - xx[j]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 65704
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	ans := int(1e+5)
	var dfs func(rest, count int)
	dfs = func(rest, count int) {
		if rest < 6 {
			if rest+count < ans {
				ans = rest + count
			}
			return
		}
		dfs(f(rest, 6), count+1)
		dfs(f(rest, 9), count+1)
	}
	dfs(N, 0)

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}

func f(rest, num int) int {
	total := 1
	for rest > total {
		total *= num
	}
	if rest == total {
		return 0
	} else {
		return rest - total/num
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int a, b;
bool isLeap(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool f = false;
    for(int r = a; r <= b; r++) {
        if(isLeap(r)){f = true; cout << r << endl;}
    }
    if(!f) {
        cout << "NA" << endl;
    }
}

int main(void) {
    int d = 0;
    while(cin >> a >> b, a|b) {
        if(d++) putchar('\n');
        solve();
    }
    return(0);
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void){

int a[20000],b[20000],i=0;
char op[20000];
	
	for(i=0;i<20000;i++){
		scanf("%d %c %d",&a[i],&op[i],&b[i]);
		if(op[i]=='?'){
			break;
		}
		if(op[i]=='+'){
			printf("%d\n",a[i]+b[i]);
		}
		else if(op[i]=='-'){
			printf("%d\n",a[i]-b[i]);
		}
		else if(op[i]=='*'){
			printf("%d\n",a[i]*b[i]);
		}
		else if(op[i]=='/'){
			printf("%d\n",a[i]/b[i]);
		}
	}
return 0;
}



Measured memory_bytes: 2072
N, Q = map(int, input().split())

tree_list = [input().split() for _ in range(N-1)]

query_list = [input().split() for _ in range(Q)]
query_list_int = [[int(k) for k in i] for i in query_list]

val_list = [0]*N
linked_node_list = [[] for _ in range(N)]

# 無向グラフのリンク関係を作成（上流への接続も含んでいる）
for a, b in tree_list:
  a, b = int(a)-1, int(b)-1
  linked_node_list[a].append(b) #子の追加
  linked_node_list[b].append(a) #子の追加
  
for index, val in query_list_int:
  val_list[index-1] += val

stack = [0] #ルートノードの値を入れたスタックを生成、巡回するターゲットを格納する
parent = [0] * (N+1) #訪問済みノードを記憶するスタックを格納する

#再帰関数を使うとメモリ制限に引っかかるので、whileで順次実行する
# スタックでLIFOを使う。LIFOになるので、一番若い者をみながら深さ優先探索にできる。
# 親ノードを覚えておいて弾くようにする
# 有向グラフで定義すれば親を弾く処理はいらない

while True:
  #ルートから順に巡回
  v=stack.pop()   # 後ろから要素を取り出す
  for child in linked_node_list[v]:
    if child != parent[v]:
      parent[child] = v # 訪問済みノードを格納
      stack.append(child) #このノードvの接続先ノードをスタックに格納
      val_list[child] += val_list[v] #累積和
  if not stack:
    #スタックがなくなれば巡回終了
    break

print(*val_list)

Measured memory_bytes: 207768
#include <stdio.h>
int N, a[200005];
int main()
{
	scanf("%d", &N);
	for(int i=1;i<=N;i++)
	    scanf("%d", &a[i]);
	int min = a[1], sum = 1;
	for(int i=2;i<=N;i++)
	{
		if(a[i]<=min)
		{
			min = a[i];
			sum++;
		}
	}
	printf("%d\n", sum);
	return 0;
}

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

long long cnt = 0; //for counting num of invensions
const int INF = 2147483647;

void merge(int *a, int left, int mid, int right) {

    int nL = mid - left;
    int nR = right - mid;

    int L[nL+1], R[nR+1];

    for(int i=0; i<nL; i++) {
        L[i] = a[left + i];
    }
    for(int i=0; i<nR; i++) {
        R[i] = a[mid + i];
    }
    L[nL] = R[nR] = INF;
    

    int indexL = 0,  indexR = 0;
    for(int i = left; i<right; i++) {

        if( L[indexL] <= R[indexR] ) {
            a[i] = L[indexL];
            indexL++;
            cnt += indexR; //L[]?????????????????¨??????????????§???R[]???????????????????????????????´?????????°(indexR)?????°????????°??????????????¢?????°????????????
                          //????????°????????????????°????????????????a[]???????????????????????¨??????????????§?????????????????????????????????????????¨????????????????????????????????????
        } else {
            a[i] = R[indexR];
            indexR++;
        }
        
    }

//    //display info. about this step
//    cout << "-----\n";
//    cout << "merge(" << left << ", " << mid << ", " << right <<")" << endl;
//
//    cout << "L" << " = "; for(int i=0; i<nL+1; i++) {cout << L[i] << " ";} cout << endl;
//    cout << "R" << " = "; for(int i=0; i<nR+1; i++) {cout << R[i] << " ";} cout << endl;
//    
//    cout << "cnt = " << cnt << endl;

    return;
}


void mergeSort(int *a, int left, int right) {

    if(left+1  <  right) {
        int mid = (left + right) / 2;

        mergeSort(a, left, mid);
        mergeSort(a, mid, right);

        merge(a, left, mid, right);

    }

    return;
}


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

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

//    //display a[] before sorting
//    cout << "a[] = ";
//    for(int i=0; i<N; i++) {
//        cout << a[i] << " ";
//    }
//    cout << endl;

    //merge sort a[]
    mergeSort(a, 0, N);

//    //display a[] after sorting
//    cout << "a[] = ";
//    for(int i=0; i<N; i++) {
//        cout << a[i] << " ";
//    }
//    cout << endl;
    

//    cout << "Num of inversions = ";
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 4644
MOD = int(1e9) + 7
M = int(1e9) + 7
L = input()
N = len(L)
dp = [[0] * 2 for i in range(N+5)]
dp[0][0] = 1
for i in range(N):
    nd = int(L[i])
    for j in range(2):
        ni = i+1
        nj = j
        if j == 0:
            if nd == 0:
                dp[ni][nj] = dp[i][j]
            else:
                dp[ni][nj] = (dp[i][j] * 2) % MOD
                dp[ni][1] += dp[i][j]
        else:
            dp[ni][nj] += dp[i][j] * 3
            dp[ni][nj] %= MOD
print((dp[N][0] + dp[N][1]) % MOD)


Measured memory_bytes: 85304
H,W,K=map(int,input().split())
s=[]
for i in range(H):
    ss=str(input())
    s.append(ss)
ans=0

for i in range(2**H):
    seen=[]
    for n in range(H):
        if ((i>>n) & 1):
            seen.append(s[n])
    for j in range(2**W):
        count=0
        for m in range(W):
            if ((j>>m) & 1):
                for l in range(len(seen)):
                    if seen[l][m]=="#":
                        count+=1
        if count==K:
            ans+=1
print(ans)


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    ll n, a, b;
    cin >> n >> a >> b;
    ll h[n];
    rep(i, n) cin >> h[i];
    sort(h, h + n); reverse(h, h + n);
    ll high = h[0] / b + 1, low = 1, mid;
    while(low < high) {
        mid = (high + low) / 2;
        ll damage = b * mid, cnt = 0;
        rep(i, n) {
            if (h[i] <= damage) break;
            cnt += (h[i] - damage) / (a - b);
            if ((h[i] - damage) % (a - b) != 0) cnt++;
        }
        if (cnt <= mid) high = mid;
        else low = mid + 1;
    }
    cout << high << endl;
    return 0;
}

Measured memory_bytes: 1152
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
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 ll mod=1e9+7;
 
int main(){
    ll n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    ll ans=1;
    bool con=false;
    rep(i,n){
        if(i==0){
            if(s[i]==t[i]){
                ans*=3;
                continue;
            }
            else{
                ans*=6;
                con=true;
                i++;
                continue;
            }
        }
        if(s[i]==t[i]){
            if(con){
                con=false;
                continue;
            }
            else{
                ans*=2;
                ans%=mod;
                continue;
            }
        }
        else{
            if(con){
                ans*=3;
                ans%=mod;
                i++;
                continue;
            }
            else{
                ans*=2;
                ans%=mod;
                i++;
                con=true;
                continue;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for _ in range(d)]
ans=1000
for i in range(2**d):
    s,cnt=0,0
    for j in range(d):
        if i>>j&1:
            s+=pc[j][0]*(j+1)*100+pc[j][1]
            cnt+=pc[j][0]
    if s<g:
        k=d-1
        while i>>k&1:
            k-=1
            if k<0:
                break
        if k>=0:
            if g-s>=pc[k][0]*(k+1)*100:
                continue
            else:
                cnt+=(g-s)//((k+1)*100)+1
                if (g-s)%((k+1)*100)==0:
                    cnt-=1
                ans=min(ans,cnt)
    else:
        ans=min(ans,cnt)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-6
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 2e5+10;
const int N = 1e5+10;
const int E = 1e6+10; 
int n,k;
ll h[maxn];

int main() {
	cin>>n>>k;
	F(i,1,n) cin>>h[i];
	sort(h+1,h+1+n,greater<int>() );
	ll ans = 0;
	F(i,1,n){
		if(k>0){
			k--;
		} 
		else{
			ans+=h[i];
		}
	} 
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=1;i<=b;i++)
	{
		if((i%k==0)&&(i>=a)&&(i<=b))
		{
			cout<<"OK"<<endl;
			return 0;
		}
	}
	cout<<"NG"<<endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a<b){
        swap(a,b);
    }
    if(a<c){
        swap(a,c);
    }
    if(b<c){
        swap(b,c);
    }
    int dif = a-b+a-c;
    int ans = 0;
    if(dif%2){
        dif++;
        ans+=1;
    }
    cout << ans+dif/2<<endl;
}

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

public class Hello
{
    public struct coordinate
    {
        public int y;
        public int x;
    }

    static int[,] map = new int[50, 50];
    static int[,] map2 = new int[50, 50];
    static Queue<coordinate> que = new Queue<coordinate>();
    static int R;
    static int C;

    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        R = int.Parse(str[0]);
        C = int.Parse(str[1]);

        // str = Console.ReadLine().Split(' ');
        var s = new coordinate();
        s.y = 0;//int.Parse(str[0]) - 1;
        s.x = 0;//int.Parse(str[1]) - 1;

        // str = Console.ReadLine().Split(' ');
        var g = new coordinate();
        g.y = R - 1;//int.Parse(str[0]) - 1;
        g.x = C - 1;//int.Parse(str[1]) - 1;

        string str2 = "";
        int whiteCount = 0;

        for (int i = 0; i < R; i++)
        {
            str2 = Console.ReadLine();
            for (int j = 0; j < C; j++)
            {
                if (str2[j] == '#') map[i, j] = 1;
                else
                {
                    map[i, j] = 0;
                    whiteCount++;
                }
            }
        }
        
        que.Enqueue(s);

        while(que.Count() != 0)
        {
            widthSearch(que.Dequeue());
        }
        if (map2[g.y, g.x] != 0)
            Console.WriteLine(whiteCount - map2[g.y, g.x] - 1);
        else Console.WriteLine("-1");

        return;
    }

    public static void widthSearch(coordinate point)
    {
        var nextPoint = new coordinate();
        nextPoint.y = point.y + 1;
        nextPoint.x = point.x;
        check(point, nextPoint);

        nextPoint.y = point.y - 1;
        nextPoint.x = point.x;
        check(point, nextPoint);

        nextPoint.y = point.y;
        nextPoint.x = point.x + 1;
        check(point, nextPoint);

        nextPoint.y = point.y;
        nextPoint.x = point.x - 1;
        check(point, nextPoint);
        return;
    }

    public static void check(coordinate point ,coordinate nextPoint)
    {
        if(nextPoint.y < 0 || nextPoint.y >= R || nextPoint.x < 0 || nextPoint.x >= C)
        {
            return;
        }
        if (map[nextPoint.y, nextPoint.x] == 0 && map2[nextPoint.y, nextPoint.x] == 0)
        {
            map2[nextPoint.y, nextPoint.x] = map2[point.y, point.x] + 1;
            que.Enqueue(nextPoint);
        }
        return;
    }

}

Measured memory_bytes: 13396
#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(int i=0;i<int(n);i++)
#define N 200010


int main(){
	long long a[N];
	long long dp[N][5];
	f(i, N){
		a[i] = 0;
		f(j, 5)dp[i][j] = 0;
	}
	int n, k;
	long long x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	f(i, n){
		scanf("%lld", &a[i]);
	}
	f(i, 5)dp[0][i] = 0;
	f(i, n){
		if (a[i] == 0){
			f(ii, 5){
				s = 1100000000;
				f(jj, ii+1){
					s = min(s, dp[i][jj]);
				}
				if (ii == 0 || ii == 4){
					dp[i + 1][ii] = s;
				}
				else if (ii == 1 || ii == 3){
					dp[i + 1][ii] = s + 2;
				}
				else{
					dp[i + 1][ii] = s + 1;
				}
			}

		}
		else if (a[i] % 2 == 1){
			f(ii, 5){
				s = 1100000000;
				f(jj, ii+1){
					s = min(s, dp[i][jj]);
				}
				if (ii == 0 || ii == 4){
					dp[i + 1][ii] = s + a[i];
				}
				else if (ii == 1 || ii == 3){
					dp[i + 1][ii] = s + 1;
				}
				else{
					dp[i + 1][ii] = s;
				}
			}
		}
		else{
			f(ii, 5){
				s = 1100000000;
				f(jj, ii+1){
					s = min(s, dp[i][jj]);
				}
				if (ii == 0 || ii == 4){
					dp[i + 1][ii] = s + a[i];
				}
				else if (ii == 1 || ii == 3){
					dp[i + 1][ii] = s;
				}
				else{
					dp[i + 1][ii] = s + 1;
				}
			}
		}
	}
	ans = 10000000000;
	f(i, 5){
		ans = min(ans, dp[n][i]);
	}
	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 3e5+5;
const ll mod =   1e9+7;
ll n,m,k;
ll a1[N],a2[N];
int main()
{  fast
cin>>n>>m>>k;
for(int i=1;i<=n;i++)
cin>>a1[i];
for(int i=1;i<=m;i++)
cin>>a2[i];
for(int i=1;i<=n;i++)
a1[i]+=a1[i-1];
for(int i=1;i<=m;i++)
a2[i]+=a2[i-1];
ll ans=0;
for(ll i=0;i<=n;i++){
	if(a1[i]>k)
	break;
	ll x=k-a1[i];
	ll cnt=i;
	ll z=lower_bound(a2+1,a2+m+1,x)-a2;
	if(z==m+1)
	cnt+=m;
	else{
		if(z!=0)
		{
			if(a2[z]!=x)
			z--;
		}
		cnt+=z;
	}
	ans=max(ans,cnt);
}
cout<<ans;
}

Measured memory_bytes: 6780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int a,b,c;
		try (Scanner sc = new Scanner(System.in)) {
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
		}

		if(a < b && b < c) {
            System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}

}



Measured memory_bytes: 26136
s = input()

x = ""
y = ""

Q = int(input())

rev = 0
for i in range(Q):
    q = list(input().split())
    
    if q[0] == "2":
        q[1] = int(q[1])
        q[1] -= 1 
        
        if rev:
            q[1] = 1 - q[1]
        
        if q[1] == 0:
            x += q[2]
        else:
            y += q[2]
    else:
        rev = 1 - rev
        
x = x[::-1]
ans = x + s + y

if rev:
    ans = ans[::-1]

print(ans)

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

public class Solution
{
    public static void Main()
    {
        var K = int.Parse(Console.ReadLine());
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var A = vals[0];
        var B = vals[1];
        var ok = false;
        for (int i = A; i <= B; i++)
        {
            if (i % K == 0)
            {
                ok = true;
                break;
            }
        }

        Console.WriteLine(ok ? "OK" : "NG");
    }
}

Measured memory_bytes: 28288
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    ll n;
    cin >> n;
    ll ans = (n*(n+1)*(n+2))/6;
    rep(i,n-1){
        ll u,v;
        cin >> u >> v;
        if(u>v) swap(u,v);
        --u;--v;
        ans -= (u+1)*(n-v);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3476
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int n;cin>>n;
  int ans = 0;
  rep(i,n){
    int a;cin>>a;
    ans^=a;
  }
  if(ans)print("No");
  else print("Yes");
  return 0;
}

Measured memory_bytes: 3652
H, W = map(int,input().split())

A = [str(input()) for _ in range(H)]

LH = set([])
LW = set([])

for i in range(H):
  for j in range(W):
    if A[i][j] == "#":
      LH.add(i)
      LW.add(j)

UH = len(LH)
ans = []
for i in LH:
  temp = ""
  for j in LW:
    #print(i,j,A[i][j])
    temp += A[i][j]
  ans.append(temp)
print(*ans, sep="\n")

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
	int x;
	scanf("%d", &x);
	if(400 <= x && x <= 599){
		printf("8\n");
	} else if(x <= 799){
		printf("7\n");
	} else if(x <= 999){
		printf("6\n");
	} else if(x <= 1199){
		printf("5\n");
	} else if(x <= 1399){
		printf("4\n");
	} else if(x <= 1599){
		printf("3\n");
	} else if(x <= 1799){
		printf("2\n");
	} else if(x <= 1999){
		printf("1\n");
	}
	return 0;
}

Measured memory_bytes: 1624
#include<stdio.h>
int main()
{
    int N,i,j,k,l;
    scanf("%d",&N);
    for(i=1;i<=N;i++)
    {
        scanf("%d%d%d",&j,&k,&l);
    if(j*j==k*k+l*l||k*k==j*j+l*l||l*l==j*j+k*k)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    }
    return 0;
}


Measured memory_bytes: 1968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
const ll linf=1e18;
const int inf=1001001001;
const ll mod=1e9+7; // 998244353 = (119<<23)+1
// head
const int nax=2e3+7;
int n;
int s[nax];
int fen[nax];
vi st;
void add(int p,int x) {
	for(int i=p;i<=nax;i+=i&-i) fen[i]+=x;
}
int sum(int p) {
	int ans=0;
	for(int i=p;i;i-=i&-i) ans+=fen[i];
	return ans;
}
int main() {
	  ios::sync_with_stdio(false);
  	cin.tie(0);
		cin>>n;
		rep(i,0,n) cin>>s[i];
		rep(i,0,n) st.pb(s[i]);
		rep(i,0,n) add(s[i],1);
		int t=0;
		sort(s,s+n);
		rep(i,0,n) {
			rep(j,i+1,n) {
				t+=lower_bound(s,s+n,s[i]+s[j])-s;
				t-=j+1;
				/*int a=s[i];
				int b=s[j];
				if(a<b) swap(a,b);
				cout<<a<<' '<<b<<'\n';
				cout<<sum(a+b-1)<<' '<<sum(a-b)<<'\n';
				t+=sum(a+b-1)-2;
				if(b<=a/2) t-=sum(a-b)-1;
				else t-=sum(a-b);*/
			}
		}
		cout<<t;
		return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;

int main()
{
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    for(int i=1;i<=b;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j<=a)
            {
                cout<<1;
            }
            else
            {
                cout<<0;
            }
        }
        cout<<endl;
    }
    for(int i=b+1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j>a)
            {
                cout<<1;
            }
            else
            {
                cout<<0;
            }
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3580
import java.util.*;

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

        int N = sc.nextInt();
        int K = sc.nextInt();

        double ansers = 0;

        for(int i=1; i<=N; i++){
            int j = 0;
            int ans = i;
            while(ans < K){
                ans *= 2;
                j++;
            }
            ansers += (double)1/N*Math.pow(0.5,j);
        }
        System.out.println(ansers);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  ll n;
  cin >> n;
  map<ll,int> factor;
  for (ll i = 1;i*i <= n;i++){
    if (n%i == 0){
      factor[n/i]++;
    }
  }
  ll ans = 0;
  for (auto q: factor){
    //cout << q.first << endl;
    if (n/(q.first) < q.first-1) ans += (q.first-1);
  }
  cout << ans << endl;

 
 
 

  return 0;
}


Measured memory_bytes: 3760
package main

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

func solve() {
	n := getInt()
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		a := getInt()
		m[a]++
	}

	first, second := 0, 0
	for a, num := range m {
		// cnt := 0
		for num >= 2 {
			if a > first {
				second = first
				first = a
			} else if a > second {
				second = a
			}

			num -= 2
			// cnt++
			// if cnt == 2 {
			// 	break
			// }
		}
	}

	ans := first * second
	fmt.Fprintln(wr, ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
bool Check(int num){
    
    string s = to_string(num);
    int len = s.size();
    for(int i=0;i<(len/2);i++){
        if(s[i] != s[len-i-1]) return false;
    }
    
    return true;
}
int main(void){
    
    int A,B,ans=0;
    cin >> A >> B;
 
    for(int i=A;i<=B;i++) if(Check(i)) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3772
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K;
	int A[200001];
	scan(N>>K);
	rep(i,N){
		scan(A[i]);
	}
	rep(k,K){
		int imos[200001]={};
		rep(i,N){
			imos[max(0,i-A[i])]++;
			imos[min(N,i+A[i]+1)]--;
		}
		rep(i,N){
			imos[i+1]+=imos[i];
		}
		int flag=1;
		rep(i,N){
			A[i]=imos[i];
			if(A[i]<N) flag=0;
		}
		if(flag) break;
	}
	rep(i,N){
		printf("%d ",A[i]);
	}
	kaigyo;
	return 0;
}


Measured memory_bytes: 5260
#include<stdio.h>
int a[1111],b[1111],c[1111],d[1111],p[1111],i,j,x,y,z;
main(){
  for(;scanf("%d%d%d",a,b,c)&&(*a+=*b+*c);){
    for(i=0,scanf("%d",p);i++<*p;scanf("%d%d%d%d",a+i,b+i,c+i,d+i),p[i]=2);
    for(;i--;)
      for(j=0;j++<*p;d[j]?p[a[j]]=p[b[j]]=p[c[j]]=1:(x=p[a[j]]&1)&(y=p[b[j]]&1)?p[c[j]]=0:x&(z=p[c[j]])?p[b[j]]=0:y&z?p[a[j]]=0:0);
    for(i=0;i<*a;printf("%d\n",p[++i]));
  }return 0;
}

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

const int INF = 0x3f3f3f3f;
int n;
const int kN = 300 + 5;
int a[kN][kN];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i)
        for (int j = 0; j < n; ++ j)
            scanf("%d", &a[i][j]);
    for (int k = 0; k < n; ++ k)
        for (int i = 0; i < n; ++ i)
            for (int j = 0; j < n; ++ j)
                if (a[i][k] + a[k][j] < a[i][j])
                    return puts("-1"), 0;
    for (int k = 0; k < n; ++ k)
        for (int i = 0; i < n; ++ i)
            for (int j = 0; j < n; ++ j)
                if (a[i][k] + a[k][j] == a[i][j] && i != k && k != j)
                    a[i][j] = INF;

    long long result = 0;
    for (int i = 0; i < n; ++ i)
        for (int j = i + 1; j < n; ++ j)
            if (a[i][j] != INF)
                result += a[i][j];
    printf("%lld\n", result);
}


Measured memory_bytes: 512
if __name__ == '__main__':
    N, M = list(map(int, input().split(" ")))

    temp = [list(map(int, input().split(" "))) for i in range(M)]
    s_list = [temp[i][0] for i in range(M)]
    t_list = [temp[i][1] for i in range(M)]

    ans = 0
    bridge = 0
    for ele in sorted(enumerate(t_list), key=lambda x: x[1]):
        if s_list[ele[0]] > bridge:
            bridge = ele[1]-1
            ans += 1

    print(ans)

Measured memory_bytes: 41008
def gcd(a, b):
    while b > 0:
        a,b = b, a%b
    return a

def lcm(a, b):
  return a//gcd(a,b)*b

a, b, c, d = map(int, input().split())

def res(n):
  return n - n // c - n // d + n // lcm(c, d)

print(res(b) - res(a-1))

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

bool judgeCanIMakeSign( string s, string a )
{
    int as = a.size(), ss = s.size();
    char* b = new char[as];

    for( int i = 0; i < ss; i++ )
    {
        int con = 1;
        b[0] = s[i];
        while(  i + con * ( as - 1 ) < ss )
        {
            int p = con;
            for( int j = 1; j < as; j++ )
            {
                b[j] = s[i+con];
                con += p;
            }
            con = p + 1;
            
            string res = "";
            for( int j = 0; j < as; j++ )
                res += b[j];

            if( a == res )
            {
                delete b;
                return true;
            }
        }
    }

    delete b;
    return false;
}

int main()
{
    int n;
    string a, s;

    cin >> n >> a;

    int cnt = 0;
    for( int i = 0; i < n; i++ )
    {
        cin >> s;
        if( judgeCanIMakeSign( s, a ) )
            cnt++;
    }

    cout << cnt << endl;

    return 0;
}


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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define mod 1000000007
using namespace std;
const int N= 400005;

vector<int>adj[N];
int vis[N];


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

int n,m;
cin>>n>>m;

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

   adj[a].pb(b);
   adj[b].pb(a);

}

queue<pii>q;
q.push({0,1});
vis[1]=1;


while(!q.empty())
{
   auto p = q.front();
   int u = p.second;
   int dis = p.first;

    q.pop();
   if(u==n)
   {
       ans = dis;
       break;
   }
   for(int v : adj[u])
   {
      if(!vis[v])
        {q.push(mp(dis+1 , v));
         vis[v]=1;
        }

   }

}

if(ans==1 || ans==2)
    cout<<"POSSIBLE";
else
    cout<<"IMPOSSIBLE";

//cout<<ans;
return 0;
}


Measured memory_bytes: 18288
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
#define sz(v) (v).size()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_taple
using namespace std;

signed main() {
	int N;
	int p[11];
	cin >> N;
	rep(i, 0, N) {
		cin >> p[i];
	}
	sort(p, p+N);
	int ans = 0;
	rep(i, 0, N-1) ans += p[i];
	ans += p[N-1]/2;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    LL(N,K);
    VEC(ll,h,N);
    ll ans = 0LL;
    for(int i = 0; i < N; ++i){
        if(h[i]>=K){
            ans++;
        }
    }

cout << ans << endl;
    
   
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	
	int a, b;
	cin >> a >> b;
	if (a*b == 2 || a*b == 4 || a*b == 6){
		cout << "No" << endl;
	}
	else{ cout << "Yes" << endl; }

	return 0;
}

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

int main(){
    string s;   cin>>s;
    int a=0;    a+=10*(s[0]-'0')+(s[1]-'0');
    int b=0;    b+=10*(s[2]-'0')+(s[3]-'0');

    if((min(a,b)==0 && max(a,b)>12) || (a>12&&b>12) || (a==0&&b==0))cout<<"NA"<<endl;
    else{
        if(a==0)cout<<"YYMM"<<endl;
        else if(b==0)cout<<"MMYY"<<endl;
        else{
            if(a<=12&&b<=12)cout<<"AMBIGUOUS"<<endl;
            else{
                if(a>12)cout<<"YYMM"<<endl;
                else cout<<"MMYY"<<endl;
            }
        }
    }


    return 0;
}


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

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

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

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

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

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

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

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

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

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

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

fn main() {
    input!{
        l: usize,
        r: usize
    }
    let mut tab = vec![vec![vec![vec![None; 2]; 2]; 2]; 61];
    for i in 0..2 {
        for j in 0..2 {
            for k in 0..2 {
                tab[0][i][j][k] = Some(1);
            }
        }
    }
    println!("{}", solve(60, 0, 0, 0, l, r, &mut tab));
}

fn solve(n: usize, fl: usize, fr: usize, fmsb: usize, l: usize, r: usize, tab: &mut Vec<Vec<Vec<Vec<Option<usize>>>>>) -> usize {
    if n == 0 {
        return 1;
    }
    if let Some(ret) = tab[n][fl][fr][fmsb]  {
        return ret;
    }
    let d = 1000000007;
    let lb = l & 1 << n - 1;
    let rb = r & 1 << n - 1;
    let mut ret = 0;
    if fl == 1 || lb == 0 {
        if rb > 0 {
            ret += solve(n - 1, fl, 1, fmsb, l, r, tab);
        } else {
            ret += solve(n - 1, fl, fr, fmsb, l, r, tab);
        }
    }
    if (fl == 1 || lb == 0) && (fr == 1 || rb > 0) && fmsb == 1 {
        ret += solve(n - 1, fl, fr, fmsb, l, r, tab);
    }
    if fr == 1 || rb > 0 {
        if lb > 0 {
            ret += solve(n - 1, fl, fr, 1, l, r, tab);
        } else {
            ret += solve(n - 1, 1, fr, 1, l, r, tab);
        }
    }
    ret %= d;
    tab[n][fl][fr][fmsb] = Some(ret);
    ret
}


Measured memory_bytes: 4352
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
d=[1]*(n+1)
for i in range(m):
  d[a[i]]=0
for i in range(2,n+1):
  if d[i]!=0:
    d[i]=d[i-1]+d[i-2]
print(d[n]%(10**9+7))

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

const ll INF = 1001001001;

const double PI=3.141592653;

const ll MOD = 1000000007;//大きい素数


//提出のときに言語がc＋＋似合っていることを確認する

//絶対値の関数
int z(int a,int b){
  if(a>b) return a-b;
  else return b-a;
}



int main(){
    string s;cin>>s;
    if(s.at(5)>'0'){
      cout<<"TBD"<<endl;
    }else if(s.at(5)=='0' && s.at(6)>'4'){
      cout<<"TBD"<<endl;
    }else if(s.at(6)<='4'){
       cout<<"Heisei"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
a, b, c, x = [int(input()) for i in range(4)]
ans = 0
# a:500, b:100, c:50
 
for i_a in range(a+1):
    for i_b in range(b+1):
        for i_c in range(c+1):
            money = i_a*500 + i_b*100 + i_c*50
            if x == money:
                ans += 1
print(ans)

Measured memory_bytes: 3060
def heappush(heap, item)
    heap.push(item)
    _siftdown(heap, 0, heap.size-1)
end
 
def heappop(heap)
    lastelt = heap.pop
    if !heap.empty?
        returnitem = heap[0]
        heap[0] = lastelt
        _siftup(heap, 0)
    else
        returnitem = lastelt
    end
    returnitem
end
 
def heappushpop(heap, item)
    if !heap.empty? && (heap[0]<=>item)<0
        item, heap[0] = heap[0], item
        _siftup(heap, 0)
    end
    item
end
 
def heapify(x)
    n = x.size
    (n/2-1).downto(0){|i|_siftup(x, i)}
end
 
def _siftdown(heap, startpos, pos)
    newitem = heap[pos]
    while pos > startpos
        parentpos = (pos - 1) >> 1
        parent = heap[parentpos]
        if (newitem<=>parent)<0
            heap[pos] = parent
            pos = parentpos
        else
            break
        end
    end
    heap[pos] = newitem
end
 
def _siftup(heap, pos)
    endpos = heap.size
    startpos = pos
    newitem = heap[pos]
    childpos = 2*pos + 1
    while childpos < endpos
        rightpos = childpos + 1
        if rightpos < endpos && (heap[childpos]<=>heap[rightpos])>=0
            childpos = rightpos
        end
        heap[pos] = heap[childpos]
        pos = childpos
        childpos = 2*pos + 1
    end
    heap[pos] = newitem
    _siftdown(heap, startpos, pos)
end
 
### main ###
q=[]
loop{
    a=gets.split
    break if a[0]=='end'
    if a[0]=='insert'
        heappush(q,-a[1].to_i)
    else
        p -heappop(q)
    end
}

Measured memory_bytes: 16740
#テストファイルで実行する時
import sys
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

n = int(input())

l = [list(map(str,input().split())) for i in range(n) ]

for i in range(n):
	l[i].insert(0,i+1)
	
for i in range(n):
	l[i][2] = int(l[i][2])
	

#2次元リストの中の特定の列で並び替える(降順)
l.sort(key=lambda x: x[2], reverse=True )
#print(l)

l.sort(key=lambda x: x[1])

for i in range(n):
	print(l[i][0])


Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;


int main(){
  int N,M;
  ll a[100],b[100],c[100],d[100];
  cin>>N>>M;

  for(int i=1;i<=N;i++) cin>>a[i]>>b[i];

  for(int i=1;i<=M;i++) cin>>c[i]>>d[i];

  for(int i=1;i<=N;i++){
    ll temp=2000000000;
    int ans;
    for(int j=1;j<=M;j++){
      if(temp>abs(a[i]-c[j])+abs(b[i]-d[j])){
        temp=abs(a[i]-c[j])+abs(b[i]-d[j]);
        ans=j;
      }
    }
    cout<<ans<<endl;
  }
}


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int gp[] = {-1, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0};
  int x, y;
  cin >> x >> y;
  if (gp[x] == gp[y])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0; 
}


Measured memory_bytes: 256