akhauriyash/Code-Regression huggingface dataset:
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1000008
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;


void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll check(ll n,ll b){
  ll ans=0;
  while (n>0){
    ans+=n%b;
    n/=b;
  }
  return ans;
}
ull na(ull m, ull n)
{
    // We have to calculate m+n-2 C n-1 here
    // which will be (m+n-2)! / (n-1)! (m-1)!
    ull path = 1;
    for (ull i = n; i < (m + n - 1); i++) {
        path *= i;
        path /= (i - n + 1);
    }
    return path;
}

int main() {
int a,b,c;
cin>>a>>b>>c;
cout<<((a+b)*c)/2;


}




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

public class Main {
	int count = 1;
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(a);
		if(n % 2 == 1) {
			if(a[0] != 0) {
				System.out.println(0);
				return;
			}
			for(int i = 2; i < n; i += 2) {
				if(a[i] != i || a[i-1] != i) {
					System.out.println(0);
					return;
				}
				count = count * 2 % 1000000007;
			}
		}
		else{
			for(int i = 1; i < n; i += 2) {
				if(a[i] != i || a[i-1] != i) {
					System.out.println(0);
					return;
				}
				count = count * 2 % 1000000007;
			}
		}
		System.out.println(count);
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void permutation(String q, String ans) { //Call permutation(String, "",) from outside
		if (q.length() <= 1)
			System.out.println(ans + q); //Fill in processing
		else
			for (int i = 0; i < q.length(); i++)
				permutation(q.substring(0, i) + q.substring(i + 1), ans + q.charAt(i));
	}

	public static void combination(String q, String ans, int k) { //Call combination(String, "", n) from outside (nCr)
		if (ans.length() == k)
			System.out.println(ans); //Fill in processing
		else
			while (q.length() > 0) {
				combination(q.substring(1), ans + q.charAt(0), k);
				q = q.substring(1);
			}
	}

	long combination(int n, int r, int m) { //nCr mod m
		long[][] Combination = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			Combination[i][0] = 1;
			for (int j = 1; j <= i; j++)
				Combination[i][j] = (Combination[i - 1][j - 1] + Combination[i - 1][j]) % m;
		}
		return Combination[n][r];
	}

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

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 50980
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define faster ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define ld long double
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define REP(i,a,b) for(ll i = a; i < b; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define bins(v, x) binary_search(v.begin(), v.end(), x)
#define pi 2*acos(0.0)
const int INF = 1e9+1;
const int mod = 1e9+7;
const int mod1 = 998244353;
 
ll modExp(ll base, ll exp, ll mod) {
   ll res = 1;
   while (exp > 0) {
    	if (exp % 2 == 1) {
        	res= (res * base) % mod;
		}
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

ll inverse(ll base, ll exp, ll mod) {
   return modExp(base, exp - 2, mod);
}
 
ll nCr(ll n, ll k) { 
   ll C[n + 1][k + 1]; 
   
   REP(i,0,n+1){ 
      REP(j,0,min(i,k)+1) {
         if(j==0 || j==i) {
            C[i][j] = 1;  
         } else {
            C[i][j] = C[i-1][j-1] + C[i-1][j]; 
         }
      } 
   }
   return C[n][k]; 
}

bool compare(pair<int, int>&i, pair<int, int>&j) {
    return (i.S > j.S || (i.S == j.S && i.F > j.F));
}

void readtxt() {
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
}

void test() {
   int x, n;
   cin >> x >> n;

   vi v(n);
   REP(i,0,n) cin >> v[i];

   sort(all(v));
   if(!bins(v, x)) {
      cout << x << "\n";
   } else {
      for(int i = 1; ; i++) {
         if(!bins(v, x-i) && !bins(v, x+i)) {
            cout << x-i;
            break;
         } else if(!bins(v, x-i) && bins(v, x+i)) {
            cout << x-i;
            break;
         } else if(bins(v, x-i) && !bins(v, x+i)) {
            cout << x+i;
            break;
         }
      }
   }
}

int main() {
   //readtxt();
   faster;

   int t = 1;
   //cin >> t;
   while(t--)
      test();
}


Measured memory_bytes: 3596
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: ans, a, n,i, md=1000000007
    integer(int64),allocatable:: a8(:), frac(:), ifrac(:)

    read*, n
    if (n==1) then
        print'(i0)', 0
        stop
    end if

    allocate(a8(0:n))
    allocate(frac(0:n), ifrac(0:n))

    frac(0)=1; ifrac(0)=1
    do i=1,n
        frac(i) = mod(frac(i-1)*i,md)
        ifrac(i) = inv(frac(i),md)
    end do



    a8(1) = 8

    do i=2,n
        a8(i)=mod(a8(i-1)*8, md)
    end do


    ans = 0
    do i=1,n
        a = mod(factorial(8_8,n-i,md)*comb(n,i,md),md)
        ans=mod(ans+a,md)
    end do

    print'(i0)', modulo(factorial(10_8,n,md) - ans*2 - factorial(8_8,n,md), md)
contains
! frac, ifrac, md を用意!
function comb(a,b,md) result(ret)
    integer(int64):: a,b,md
    integer(int64):: ret
    ret = mod(mod(frac(a)*ifrac(b),md)*ifrac(a-b),md)
end function

function inv(x,md) result(ret)
    integer(int64),intent(in):: x,md
    integer(int64):: ret
    ret = factorial(x,md-2,md)
end function

function factorial(a,b,md) result(ret)
    integer(int64):: a,b,md
    integer(int64):: aa,bb,ret
    aa = a
    bb = b
    ret = 1
    do while(bb > 0)
        if (mod(bb,2_8)/=0) ret=mod(ret*aa,md)
        aa=mod(aa*aa,md)
        bb=bb/2
    end do
end function
end program main

Measured memory_bytes: 26140
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string T,B;
    int dp[1001][1001];
    cin >> T >> B;
    
    if(T[0]==B[0]){
        dp[0][0]=1;
    }
    else{
        dp[0][0]=0;
    }
    for(int j=1;j<T.size();j++){
       dp[0][j]=dp[0][j-1];
        if(T[j]==B[0]){
            dp[0][j]++;
        }
    }
    
    for(int i=1;i<B.size();i++){
        dp[i][0]=0;
        for(int j=1;j<T.size();j++){
            dp[i][j]=dp[i][j-1];
            if(B[i]==T[j]){
                dp[i][j]=(dp[i][j]+dp[i-1][j-1])%1000000007;
            }
        }
    }
    cout << dp[B.size()-1][T.size()-1] << endl;
}


Measured memory_bytes: 7072
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for i in range(M):
  tmp = list(map(int, input().split()))
  BC.append(tmp)

A.sort()
BC.sort(key=lambda x: x[1], reverse=True)

j = 0
for i in range(M):
  count = 0
  while A[j] < BC[i][1]:
    A[j] = BC[i][1]			# 値を置き換える
    j += 1
    count += 1
    if count == BC[i][0] or j == N:
      break
  if j == N:
    break
print(sum(A))

Measured memory_bytes: 32952
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;

ll mt(ll x,ll y){
    if(x<y) return (x-1)*x/2+(y+1)*y/2;
    return (y-1)*y/2+(x+1)*x/2;
}
int main(){
    string s;
    cin >> s;
    int n=s.size();
    vector<int> row;
    int ctr=1;
    rp(i,n-1){
        if(s[i]==s[i+1]) ctr++;
        else {
            row.push_back(ctr);
            ctr=1;
        }
    }
    row.push_back(ctr);
    int r=row.size();
    ll ans=0ll;
    if(s[0]=='<'){
        rp(i,r/2){
            ans+=mt((ll)row[i+i],(ll)row[i+i+1]);
        }
        if(s[n-1]=='>') cout << ans << endl;
        else{
            ans+=((ll)row[r-1]*((ll)row[r-1]+1ll)/2ll);
            cout << ans << endl;
        }
        return 0;
    }
    ans += (ll)((ll)row[0]*((ll)row[0]+1ll)/2ll);
    rp(i,(r-1)/2){
        ans+=mt((ll)row[i+i+1],(ll)row[i+i+2]);
    }
    if(s[n-1]=='>') cout << ans << endl;
    else{
        ans+=((ll)row[r-1]*((ll)row[r-1]+1ll)/2ll);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
//package javaapplication2;
import java.util.*;
import java.io.*;
import static java.lang.System.out;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        StringBuilder res = new StringBuilder();
        int rev = 0,rev_2 = 0;
        int Q = Integer.parseInt(br.readLine());
        char[] forward = new char[Q];
        int ptr1 = Q-1,ptr2 = Q-1;
        char[] backward = new char[Q];
        
        
        
        while(Q-- > 0){
            String[] s2 = br.readLine().split("\\s");
            if(s2[0].equals("1")){
                rev_2 ^= 1;
            }else{
                if(s2[1].equals("1")){
                    if(rev_2 == 0) forward[ptr1--] = s2[2].charAt(0);
                    else backward[ptr2--] = s2[2].charAt(0);
                }else{
                     if(rev_2 == 0) backward[ptr2--] = s2[2].charAt(0);
                    else forward[ptr1--] = s2[2].charAt(0);
                }
            }
        }
            
        
        while(++ptr1 < forward.length) res.append(forward[ptr1]);
        res.append(s);
        for(int i = backward.length-1;i>ptr2;--i) res.append(backward[i]);
        
        
        if(rev_2 == 1) System.out.println(res.reverse().toString());     
        else System.out.println(res.toString());        
    }
    
//    private static int solve(int A,int B){
//      
//    }
}


Measured memory_bytes: 92744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++) 
map<ll,ll> m;

void primeFactors(ll n)  
{      
    while (n % 2 == 0)  
    {  
        m[2]++;  
        n = n/2;  
        // cout<<2<<" ";
    }  
  
    
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
         
        while (n % i == 0)  
        {  
            m[i]++;
            n = n/i; 
            // cout<<i<<" "; 
        }  
    }  
  
    if (n > 2){
        m[n]++;
        // cout<<n<<" ";
    }
}  
ll f(pair<ll,ll> p){
    ll x = 1, y = p.second,ans = 0;
    while(y>=x){
        y -=x;
        x++;
        ans++;
    }
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    // cout<<f(make_pair(2,6));
    ll n,ans = 0;
    cin>>n;
    primeFactors(n);
    for(auto i:m){
        pair<ll,ll> p = i;
        // cout<<i.second<<" ";
        ans += f(p);
    }

    cout<<ans;

}   

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

#define pb(x) push_back(x);
#define in(y) insert(y);
#define tt(t) while(t--)
#define itr ::iterator it;
#define ll long long
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define si set<int>                      
#define msi map<string, int>
#define new cout<<endl
#define ff(n) for(int i=0;i<n;i++)
#define all(v) sort(v.begin(),v.end())

using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	// tell if a*a+1*a+2*..b= 0 or -ve or +ve
	if(a>b) swap(a,b); // WLOG
	if(a<=0 and b>=0) cout<<"Zero\n";
	else if(a>0 and b>0) cout<<"Positive\n";
	else {
	int rang=abs(b)-abs(a)+1;
	if(rang%2==0) cout<<"Positive\n";
	else cout<<"Negative\n";
	}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int n,ans=1;
  cin>>n;
  vector<int> d(n);
  rep(i,n) cin>>d.at(i);
  sort(d.begin(), d.end());
  rep(i,n-1){
  if(d.at(i)!=d.at(i+1)) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
a = input()
b = input()
c = input()

d = a[0]
a = a[1:]
while True:
    if d == "a":
        if len(a) == 0:
            print("A")
            break
        d = a[0]
        a = a[1:]
    if d == "b":
        if len(b) == 0:
            print("B")
            break
        d = b[0]
        b = b[1:]
    if d == "c":
        if len(c) == 0:
            print("C")
            break
        d = c[0]
        c = c[1:]


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		int n = 0;
		switch(S) {
			case "SUN":
				n = 7;
				break;
			case "MON":
				n = 6;
				break;
			case "TUE":
				n = 5;
				break;
			case "WED":
				n = 4;
				break;
			case "THU":
				n = 3;
				break;
			case "FRI":
				n = 2;
				break;
			case "SAT":
				n = 1;
				break;
		}

		if(S == "SUN") {
			n = 7;
		}else
		System.out.println(n);
	}

}

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

int main() {
    string s;
    cin >> s;
    int C = s.size() , F = -1;
    for(int i = 0; i < s.size(); i++){
        if(s.at(i) == 'C'){
            if(i < C){
                C = i;
            }
        }
        if(s.at(i) == 'F'){
            if(i > F){
                F = i;
            }
        }
    }
    if(C < F){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,v;
int main(){
	scanf("%d%d",&n,&v);
	for (int i=0;i<=n;i++)
		for (int j=0;j+i<=n;j++)
			if (i*10000+j*5000+(n-i-j)*1000==v)
				return printf("%d %d %d",i,j,n-i-j),0;
	printf("-1 -1 -1"); 
} 


Measured memory_bytes: 128
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0007&lang=jp*/

#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int n,r=100;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        r=ceil(r*1.05);
    }
    cout<<r*1000<<endl;
    return 0;
}

Measured memory_bytes: 1164
def func():
    pass


def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))

    m = a[0]
    for i in range(n + 1):
        if m == 2:
            print(i + 1)
            return
        m = a[m - 1]
    print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7084
import kotlin.math.floor

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (a, b) = readLongList()
    for (price in 1..1250) {
        if (floor(price * 0.08).toLong() == a && floor(price * 0.1).toLong() == b) {
            println(price)
            return
        }
    }
    println(-1)
}

Measured memory_bytes: 36460
a,b,k = $stdin.gets.chomp.split(' ').map(&:to_i)
# a = a.to_i,b = b.to_i,k = k.to_i #(.map(&:to_i)でいいんだけど…)

num = a.to_i

k.times do
  puts num
  num = num + 1
  if num > b
    exit
  end
end

if num > b-k
  	(b - num + 1).times do
   	puts num
  	num = num + 1
	end 
else
  num = b - k + 1
	k.times do
  	puts num
  	num = num + 1
	end
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  vector<ll> sum(n+1); rep(i, n) sum[i+1] = sum[i]+A[i];
  ll ans = longinf;
  rep(i, n-1) {
    chmin(ans, abs(sum[i+1]-(sum[n]-sum[i+1])));
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 6340
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
string s;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>s;
	cout<<s[0]<<s[1]<<s[2]<<endl;
	return 0;
}


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

line = gets.chomp.split('')



=begin
(0...line.length).each do |i|
  puts line[i]
end
=end

ans = ''
bool = (line[2] == line[3] && line[4] == line[5])
if bool
  ans = 'Yes'
else
  ans = 'No'
end

puts ans

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
#define ll long long

void solve()
{
	string s,t;
	int r,b;
	cin>>s>>t;
	cin>>r>>b;
	string u;cin>>u;
	if(u==s)
	cout<<--r<<" "<<b;
	else 
	cout<<r<<" "<<--b;
}
int main()
{
//	int t;cin>>t;
//	while(t--)
	solve();
}


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

using namespace std;
using ll = long long;

const int mx = 2e5 + 9;

int n;
ll k;
ll a[mx];

ll ceill(ll x, ll y) {
    return (x + y - 1) / y;
}

bool ok(ll x) {
    ll ttl = 0;
    for (int i = 0; i < n; i++) {
        ttl += ceill(a[i], x);
    }

    return (ttl - n <= k);
}

int main() {
    scanf("%d %lld", &n, &k);
    for (int i = 0; i < n; i++) scanf("%lld", &a[i]);

    ll ans = *max_element(a, a + n);
    ll lo = 1, hi = 2e9;
    while (lo <= hi) {
        ll mid = (lo + hi) / 2;
        if (ok(mid)) {
            ans = mid;
            hi = mid - 1;
        } else {
            lo = mid + 1;
        }
    }

    printf("%lld\n", ans);
}

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

int main() {
    ll r, d, x;
    cin >> r >> d >>x;
    rep(i,10){
        x = r*x-d;
        cout << x << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;

int main(){
  ll x;
  cin >> x;
  ll a, b;
  a = 0;
  ll a5, b5;
  while(1){
    a5 = a*a*a*a*a;
    b5 = a5 - x;
    b = pow(abs(b5), 0.2);
    if (b5 < 0) b *= -1;
    if (b*b*b*b*b == b5)
      break;
    a++;
  }
  
  cout << a << ' ' << b << endl;
  
  return 0;
}

Measured memory_bytes: 4076
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


int calc(int N, int A, int B, int C, int D, string mp){
  mp += "#######";

  while(A < C){
    if(A < B) break;
    if(mp[A + 1] != '#' && A != D && (A && mp[A-1] != '#')) break;
    else if(mp[A + 1] != '#') A++;
    else if(mp[A + 2] != '#') A += 2;
    else return 0;
  }
  mp[A] = '#';
  while(B < D){
    if(mp[B + 1] != '#') B++;
    else if(mp[B + 2] != '#') B += 2;
    else return 0;
  }

  if(B != D) return 0;
  mp[B] = '#';
  
  while(A < C){
    if(mp[A + 1] != '#') A++;
    else if(mp[A + 2] != '#') A += 2;
    else return 0;
  }
  return A == C;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, A, B, C, D;
  cin>>N>>A>>B>>C>>D; A--, B--, C--, D--;
  string mp;
  cin>>mp;

  int a = calc(N, A, B, C, D, mp);
  int b = calc(N, B, A, D, C, mp);
  //pr(a, b);
  int ans = a | b;
  cout<<(ans? "Yes":"No")<<endl;

  return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int m,n;
bool flag[7368793];
int main(){
  	while(cin>>m>>n){
      if(m==0&&n==0){break;}
      vector<int>v;
      for(int i=0; i<=7368791; i++){flag[i]=false;}
      while(n--){
        for(int j=m; j<=7368791; j+=m){
          flag[j]=true;
        }
        while(flag[m]){m++;}
      }
      cout<<m<<endl;
    }
}
		
                   
        


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

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

int main()
{
    int64_t A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << max(A * C, max(A * D, max(B * C, B * D)));
}

Measured memory_bytes: 3628
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    ll k,x;
    while(cin>>k>>x)
    {
        if(k*500>=x)cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
n, m, x = gets.split.map(&:to_i)

books = n.times.map{|i|
    items = gets.split.map(&:to_i)
    # {
    #     :price => items[0],
    #     :vals => items[1..-1]
    # }
}

choices = (1...(2 ** n)).map{|status|
    (0..n).select{|i|
        status[i] == 1
    }.map{|i|
        books[i]
    }.transpose.map{|it|
        it.inject(:+)
    }
}

choices.keep_if{|it|
    it[1..-1].all?{|it| it >= x}
}

if choices.empty?
    puts -1
else
    puts choices.map{|it| it[0]}.min
end

Measured memory_bytes: 15552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  int u[M], v[M];
  for (int i = 0; i < M; i++) {
    cin >> u[i] >> v[i];
    u[i]--;
    v[i]--;
  }
  int S, T;
  cin >> S >> T;
  S--;
  T--;
  vector<int> adj[N];
  for (int i = 0; i < M; i++) {
    adj[u[i]].push_back(v[i]);
  }
  deque<int> q;
  q.push_back(S);
  int d[N];
  int INF = 1000000000;
  for (int i = 0; i < N; i++) {
    d[i] = INF;
  }
  d[S] = 0;
  int vis[N]{};
  vis[S] = 1;
  int cnt = 0;
  int vis1[N]{};
  int vis2[N]{};
  while(!q.empty()) {
    int t = q.front();
    q.pop_front();
    for (int i : adj[t]) {
      if (vis1[i] == 1 && vis2[i] == 1) continue;
      vis1[i] = 1;
      for (int j : adj[i]) {
        if (vis2[j] == 1 && vis1[j] == 1) continue;
        vis2[j] = 1;
        for (int k : adj[j]) {
          if (vis[k] == 0) {
            vis[k] = 1;
            d[k] = d[t] + 1;
            q.push_back(k);
          }
        }
      }
    }
  }
  if (d[T] != INF) {
    cout << d[T] << "\n";
  } else {
    cout << "-1";
  }
  return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
//------------------------------------------------------------------//
typedef long long ll;
typedef vector<int> vi;
template <typename T> inline T read() {
	bool f = 1; T x = 0; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = !f;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	return f ? x : -x;
}
#define gi read<int>()
#define gl read<ll>()
//------------------------------------------------------------------//

int h, w, k;
char s1[7][7], s2[7][7];
int main() {
	h = gi, w = gi, k = gi;
	for (int i = 1; i <= h; ++i)	scanf ("%s", s1[i] + 1);
	int tot = 0;
	for (int i = 0; i < (1 << h); ++i)
		for (int j = 0; j < (1 << w); ++j) {
			memcpy(s2, s1, sizeof(s1));
			for (int u = 1; u <= h; ++u)
				for (int v = 1; v <= w; ++v) {
					if ((i >> (u - 1) & 1) || (j >> (v - 1) & 1)) s1[u][v] = 'O';
				}
			int ans = 0;
			for (int u = 1; u <= h; ++u)
				for (int v = 1; v <= w; ++v) ans += s1[u][v] == '#';
			tot += ans == k;
			memcpy(s1, s2, sizeof(s2));
		}
	cout << tot << '\n';
	return 0;
}


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

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

	if ((a == b && a != c)||
		(b == c && b != a)||
		(c == a && c != b)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
n, x, m = gets.split.map(&:to_i)
a = [x]
h = {}
h[x] = 0
t = 0
n.pred.times do |i|
  t = a[i] * a[i] % m
  break if h.key?(t)
  h[t] = 0
  a << t
end
b = a.dup
a = a[0...a.find_index{ _1 == t }]
b -= a
ans = a.sum
if b.size > 0
  ans += b.sum * ((n - a.size) / b.size)
  ans += b[0, (n - a.size) % b.size].sum
end
puts ans


Measured memory_bytes: 17504
#include <bits/stdc++.h>
     
    using namespace std;
     
    const int N = 1234567;
     
    vector <int> g[N];
     
    int dfs(int v, int pr) {
      int x = 0;
      for (int u : g[v]) {
        if (u == pr) {
          continue;
        }
        x ^= dfs(u, v);
      }
      return x + 1;
    }
     
    int main() {
      int n;
      scanf("%d", &n);
      for (int i = 0; i < n - 1; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        x--; y--;
        g[x].push_back(y);
        g[y].push_back(x);
      }
      printf("%s\n", dfs(0, -1) == 1 ? "Bob" : "Alice");
      return 0;
    }

Measured memory_bytes: 36992
N, K = map(int, input().split())
h_list = list(map(int, input().split()))

dp_list = [0]
for n in range(1, N):
    tmp_h = h_list[n]
    if n < K:
        lst = [abs(tmp_h - h_list[i]) + dp_list[i] for i in range(n)]
    else:
        lst = [abs(tmp_h - h_list[n-k]) + dp_list[n-k] for k in range(1, K + 1)]
    dp_list.append(min(lst))
print(dp_list[-1])

Measured memory_bytes: 86168
N, W = map(int, input().split())
items = [list(map(int, input().split())) for i in range(N)]

# dp1[i][j] := 商品0 ~ i が対象
# dp2[i][j] := 商品i ~ N が対象(順番はそのまま)
# out-of-index 対策に余分に取っておく
dp1 = [[0] * (W + 1) for i in range(N + 2)]
dp2 = [[0] * (W + 1) for i in range(N + 2)]

# dp1を埋める
for i in range(N):
    wi, vi = items[i]
    for j in range(W + 1):
        if j + wi <= W:
            dp1[i + 1][j + wi] = max(dp1[i + 1][j + wi], dp1[i][j] + vi)
        dp1[i + 1][j] = max(dp1[i][j], dp1[i + 1][j])

# dp2を埋める
for i in range(N + 1, 1, -1):
    wi, vi = items[i - 2]
    for j in range(W + 1):
        if j + wi <= W:
            dp2[i - 1][j + wi] = max(dp2[i - 1][j + wi], dp2[i][j] + vi)
        dp2[i - 1][j] = max(dp2[i][j], dp2[i - 1][j])


# 2つのdpテーブルを使って、最後に使う商品を全探索
ans = 0
# ここからは商品を1-indexedとする
for i, (wi, vi) in enumerate(items, start=1):
    for j in range(W):
        ans = max(ans, dp1[i - 1][j] + dp2[i + 1][W - j - 1] + vi)

print(ans)


Measured memory_bytes: 180228
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int n,a[20],t,ans,p[20],c1,c2,c3,c4;

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    if (n<10) rc(0);
    for (int i = 2; i <= n/2; ++i)
    {
        ans=0;
        for (int j = 1; j <= i; ++j)
            if (i%j==0) ++ans;
        if (ans==2) ++t, a[t]=i;
    }
    fort (i,t)
        fort (j,6)
            p[i]+=n/pow(a[i],j);
    fort (i,t)
    {
        if (p[i]>73) ++c1;
        if (p[i]>23) ++c2;
        if (p[i]>13) ++c3;
        if (p[i]>3) ++c4;
    }
    cout << c1+c2*(t-1)+max(0,c3*(c4-1))+max(0,(c4*(c4-1)/2)*(t-2));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

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

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	int t=1;
	// cin>>t;
	while(t--)
	{
		double x, y, d, n ;
		double dis;
		int c=0;
		cin>>n>>d;
		for(int i = 0; i < n; i++)
		{
		cin>>x>>y;
			if(sqrt(x*x+y*y)<=d) c++;
		}
		cout<<c<<endl;
	}
	return 0;
}

Measured memory_bytes: 3792
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)*}
    };
}

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        w: [i32; n],
    }
    let total : i32 = w.iter().sum();
    let mut min = std::i32::MAX;
    let mut s1 = 0;
    for t in 0..n {
        s1 += w[t];
        min = std::cmp::min(min, (s1 - (total - s1)).abs());
    }
    println!("{}", min);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void)
{
  int x;
  scanf("%d", &x);

  int judge = 0;
  for (int i = 1; i < 10; i++)
  {
    if (x % i == 0 && x / i < 10)
    {
      printf("Yes\n");
      return 0;
    }
  }

  printf("No\n");
  return 0;
}


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

int main() {
   int a, b, c, d;

   cin >> a >> b >> c >> d;
   
   while(true) {
       c -= b;
       if (c <= 0) {
           cout << "Yes" << endl;
           return 0;
       }

       a -= d;
       if (a <= 0) {
           cout << "No" << endl;
           return 0;
       }
   }
}

Measured memory_bytes: 3624
def lucas(n):
    if n == 0:
        return 2
    if n == 1:
        return 1
    prev_prev = 2
    prev = 1
    for i in range(2, n+1):
        current = prev + prev_prev
        prev_prev = prev
        prev = current
    return current
        

if __name__ == '__main__':
    print(lucas(int(input())))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int x,n;
    cin>>x>>n;
    int a=0,oku,oko;
    vector<int>p(n);
    rep(i,n)cin>>p[i];
    while(1){
        oku=1,oko=1;
        rep(i,n){
            if(x-a==p[i])oku=0;
            if(x+a==p[i])oko=0;
        }
        if(oku){
            cout<<x-a;
            break;
        }
        if(oko){
            cout<<x+a;
            break;
        }
        a++;
    }
	return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) (x.begin()),(x.end())
#define sz(x)  ((ll)x.size())
#define FAST_IO ios_base :: sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
using namespace std;
#ifdef LOCAL
#include "uj.h"
#endif
void tokenize(string str,const char delim,vector<string> & res){
	stringstream p(str);
	string token;
	while(getline(p,token,delim)){
		res.push_back(token);
	}
	return;
}

// Your workSpace ...


		

	
ll N,K;
void test_case(){
	cin >> N >> K;
	vector<ll> v(N);
	for(auto & el : v)
		cin >> el;
	sort(all(v));
	
	auto f = [&](ll answer){
		ll s = 0;
		for(auto el : v){
			s += (el-1)/answer;
		}
		return s;
	};
	
	ll lo = 1,hi = v.back();
	ll ans = hi;
	while(lo <= hi){
		ll mid = lo + (hi - lo)/2;
		if(f(mid) <= K)
			ans = mid,hi = mid - 1;
		else
			lo = mid + 1;
	}
	cout << ans << endl;
}
	





int main(){
	FAST_IO;
	int tt;
	//cin>>tt;
	tt = 1;
	while(tt--){
		test_case();
	}
#ifndef ONLINE_JUDGE
 	cerr << "Running Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 4780
while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except:
	    break
	
	h = 0
	bl = 0
	
	for i in range(4):
            if a[i] == b[i]:
                h += 1
                b[i] = 51
	for i in range(4):
            if a[i] in b:
                bl += 1
	 
	print(h,bl)



Measured memory_bytes: 5592
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(std::string S, std::string T){
 ll cnt=0;
 rep(i,3){
   if(S[i]==T[i])cnt++;
 }
op(cnt)
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 764
/* HARE KRSNA HARE KRSNA KRSNA KRSNA HARE HARE
    HARE RAMA HARE RAMA RAMA RAMA HARE HARE  */

#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define ff first
#define ss second
#define pp pop_back
#define pf pop_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define b_s binary_search
#define all(x) x.begin(),x.end()
#define test ll t; cin>>t; while(t--)
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define rloop(i,s,n) for(ll i=s;i>=n;i--)
#define fill(a,value) memset(a,value,sizeof(a))

#define debug2(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define debug4(a)  for(auto x : a)  cout<<x.ff<<" "<<x.ss<<nl;
#define debug1(a,n) loop(i,0,n)  cout<<a[i]<<" ";  cout<<nl;
#define debug3(a,n,m)  loop(i,0,n){ loop(j,0,m)	cout<<a[i][j]<<" ";	cout<<nl; }

typedef long long ll;
typedef long double ld;

typedef stack<ll> sll;
typedef queue<ll> qll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<ll, pll> ppll;
typedef vector<vector<ll>> vvll;
typedef priority_queue<ll> pqll;

const ll mod = 1000000007;	//998244353;
const ld pi =  acos((ld) - 1);	//3.1415926535;

ll num_generator()		{   return rand() % 1000;	}
void array_generator(ll a[], ll n)		{   loop(i, 0, n)	a[i] = rand() % 100;	}

void solve()
{
	ll n;	cin >> n;
	map<string, ll> M;
	loop(i, 0, n)
	{
		string s;	cin >> s;
		M[s]++;
	}
	ll a[4];	fill(a, 0);
	for (auto x : M)
	{
		if (x.ff == "AC")	a[0] = x.ss;
		else if (x.ff == "WA")		a[1] = x.ss;
		else if (x.ff == "TLE")	a[2] = x.ss;
		else	a[3] = x.ss;
	}
	loop(i, 0, 4)
	{
		if (i == 0)	cout << "AC x " << a[0];
		else if (i == 1)	cout << "WA x " << a[1];
		else if (i == 2)	cout << "TLE x " << a[2];
		else cout << "RE x " << a[3];
		cout << nl;
	}
}

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

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// test
	solve();
	return 0;
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }

int n,k;


int main()
{
  fastio();

  cin >> n >> k;
  int ans = 0;
  forn(i,n) {
    int a; cin >> a;
    if(a >= k) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int md = 998244353;
inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}
inline int mul(int a, int b) {
  return (int)((long long)a * b % md);
}
inline int inv(int a) {
  a %= md;
  if(a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= a * t; swap(a, b);
    u -= v * t; swap(u, v);
  }
  assert(b == 1);
  if(u < 0) u += md;
  return u;
}
#define PMAX 2005
#define FMAX 4005
int tpw[PMAX];
int fct[FMAX];
void calc () {
  tpw[0] = 1;
  for (int i = 1; i < PMAX; i++) {
    tpw[i] = mul(tpw[i - 1], 2);
  }
  fct[0] = 1;
  for (int i = 1; i < FMAX; i++) {
    fct[i] = mul(fct[i - 1], i);
  }
}
int binom(int n, int k){
  assert(n >= 0);
  if (k < 0 || n < k) {
    return 0;
  }
  return mul(fct[n], mul(inv(fct[k]), inv(fct[n - k])));
}
int cntPt(int n, int k){
  if (k == 0) {
    return n == 0 ? 1 : 0;
  }
  return binom(n + k - 1, k - 1);
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  calc();
  int k, n;
  cin >> k >> n;
  stack<int> stk;
  for (int i = 2; i <= k + 1; i++) {
    int a = abs((k + 1) - i);
    int c = (i + 1) & 1;
    int b = (k - a - c) / 2;
    int ret = 0;
    for (int j = 0; j <= b; j++) {
      for (int l = 0; l <= c; l++) {
        if (n - j - l < 0) {
          continue;
        } 
        add(ret, mul(tpw[j], mul(cntPt(n - j - l, a + j), binom(b, j))));
      }
    }
    if (i <= k) {
      stk.push(ret);
    }
    cout << ret << '\n';
  }
  while (!stk.empty()) {
    cout << stk.top() << '\n';
    stk.pop();
  }
  return 0;
}

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

def donguri(n, a, b):
    dp = [0]*(n+1)
    for w in range(n+1):
        x0 = dp[w-a[0]] + b[0] if (w-a[0]>=0) else w
        x1 = dp[w-a[1]] + b[1] if (w-a[1]>=0) else w
        x2 = dp[w-a[2]] + b[2] if (w-a[2]>=0) else w
        dp[w] = max(w, x0, x1, x2)
    return dp[-1]

print(donguri(donguri(N,A,B),B,A))


Measured memory_bytes: 230040
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>
#include <cstring>


int main() {
    int n; std::cin >> n;
    std::vector<int> weight(n), value(n);
    for (int i = 0; i < n; i++) {
        std::cin >> value[i] >> weight[i];
    }
    const int D = 10;
    auto chmax = [](int &a, int b) { return a = std::max(a, b); };
    std::vector<std::vector<int>>
        dp(1 << D, std::vector<int>(1e5 + 2, -1e9));
    dp[0][0] = 0, dp[0][weight[0]] = value[0];
    for (int i = 1; i < std::min(1 << D, n); i++) {
        int par = (i - 1) / 2;
        for (int j = 0; j <= 1e5; j++) {
            chmax(dp[i][j], dp[par][j]);
            if (j + weight[i] <= 1e5)
                chmax(dp[i][j + weight[i]], dp[par][j] + value[i]);
        }
    }
    for (int i = 0; i < std::min(1 << D, n); i++) {
        for (int j = 0; j < 1e5; j++) {
            chmax(dp[i][j + 1], dp[i][j]);
        }
    }
    int q; std::cin >> q;
    std::vector<std::pair<int, int>> buf;
    while (q--) {
        int v, lim; std::cin >> v >> lim;
        v--;
        buf.clear();
        while (v >= 1 << D) {
            buf.emplace_back(weight[v], value[v]);
            v = (v - 1) / 2;
        }
        int m = buf.size();
        int ans = 0;
        for (int i = 0; i < (1 << m); i++) {
            int wg = 0, vl = 0;
            for (int j = 0; j < m; j++) {
                if (~(i >> j) & 1) continue;
                wg += buf[j].first;
                vl += buf[j].second;
            }
            int targ = lim - wg;
            if (targ < 0) continue;
            chmax(ans, vl + dp[v][targ]);
        }
        std::cout << ans << std::endl;
    }
    return 0;
}


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

int a[2005];

int main() {
    int n, x, y;
    cin >> n >> x >> y;

    int d = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = n; j > i; j--) {
            d = min(j - i, abs(x - i) + 1 + abs(y - j));
            a[d]++;
        }
    }

    for (int i = 1; i < n; i++) cout << a[i] << endl;
    return 0;
}


Measured memory_bytes: 3612
//+option:-ansi -Wall -Wextra
//+task:hdu 1216
//press <F7> to update the source to mark file.
//press <S-F7> to open the page
#include "vector"
#include "iostream"
#include "algorithm"
#include "cmath"
#include "cstdio"
#include "cstdlib"
#include "cstring"
#include "iterator"
using namespace std;
#define inc(over, ...)\
        do\
        {\
                static int over = 0;\
                (over)++;\
                __VA_ARGS__;\
        }while(0)
#define rangedo(i, s, t)\
        i=s; i!=t; i++
#define range(a, b, ...)\
	__typeof(a) _ = a; (_ != (b)) && (bool(__VA_ARGS__)); _++
#define each(a, b, ...)\
	for(range(a, b, true)) __VA_ARGS__
#define exist(a, b, pred)\
	({\
	        bool ok=false;\
		for(range(a,b,!ok))\
			if((pred)) ok = true;\
		ok;\
	})
#define countdown(a, ...)\
	for(int _ = a; _--; ) __VA_ARGS__
/* Good Day */

#define x_lambda(args, index, ...)({\
		typedef __typeof(args) type, reft;\
		static reft _1, _2;\
		typedef __typeof(({ ({__VA_ARGS__;});})) rett;\
		struct __class{\
		static rett __func1 (const reft &_1){return rett(({__VA_ARGS__;}));}\
		static rett __func2 (const reft &_1, const reft &_2) {return rett(({__VA_ARGS__;}));}}; \
		&__class::__func##index;})
#define $lb (
#define $1(type)  x_lambda $lb type, 1 
#define $2(type)  x_lambda $lb type, 2 
#define $lambda(...) __VA_ARGS__)
#define $cin(type)   istream_iterator<type>(cin)
#define $cin_end(type) istream_iterator<type>()
#define $cout(type) ostream_iterator<type>(cout)
#define $cout_end(type) ostream_iterator<type>()
#define closure static
/* Good Day */

int main()
{
	each(1, 10)
	{
		int __ = _;
		each(1, 10)
		{
			printf("%dx%d=%d\n", __, _, __*_);
		}
	}
}

Measured memory_bytes: 0