akhauriyash/Code-Regression huggingface dataset:
# abc163_c.py
# https://atcoder.jp/contests/abc163/tasks/abc163_c

# C - management /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# N人の社員からなる会社があり、各社員には 1,...,Nの社員番号が割り当てられています。
# 社員番号 1の社員以外の全ての社員には、自分より社員番号が小さい直属の上司がちょうど 1人います。
# Xさんが Y さんの直属の上司であるとき、Y さんは Xさんの直属の部下であるといいます。
# 社員番号 iの社員の直属の上司の社員番号が Aiであることが与えられます。
# 各社員について直属の部下が何人いるか求めてください。

# 制約
#     2≤N≤2×105
#     1≤Ai<i

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# A2 ... AN

# 出力
# 社員番号 1,2,...,Nのそれぞれの社員について、直属の部下が何人いるか、改行区切りで出力せよ。

# 入力例 1
# 5
# 1 1 2 2

# 出力例 1
# 2
# 2
# 0
# 0
# 0

# 社員番号 1の社員の直属の部下は社員番号 2,3 の 2人です。
# 社員番号 2の社員の直属の部下は社員番号 4,5 の 2人です。
# 社員番号 3,4,5の社員には直属の部下はいません。

# 入力例 2
# 10
# 1 1 1 1 1 1 1 1 1

# 出力例 2
# 9
# 0
# 0
# 0
# 0
# 0
# 0
# 0
# 0
# 0

# 入力例 3
# 7
# 1 2 3 4 5 6

# 出力例 3
# 1
# 1
# 1
# 1
# 1
# 1
# 0


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    results = [0] * N

    for value in values:
        results[value-1] += 1

    return results


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '1 1 2 2']
        lines_export = [2, 2, 0, 0, 0]
    if pattern == 2:
        lines_input = ['10', '1 1 1 1 1 1 1 1 1']
        lines_export = [9, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    if pattern == 3:
        lines_input = ['7', '1 2 3 4 5 6']
        lines_export = [1, 1, 1, 1, 1, 1, 0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

typedef long long LL;
const int N = 5005, mod = 1000000007;

int n, head[N], g[N], tot;
struct edge { int to, nxt; } e[N << 1];

void link(int x, int y) {
	e[++tot] = (edge) { y, head[x] }, head[x] = tot;
	e[++tot] = (edge) { x, head[y] }, head[y] = tot;
}

typedef std::vector<int> poly;

poly operator * (const poly &a, const poly &b) {
	poly ret(a.size() + b.size() - 1);
	for (int i = 0; i < a.size(); ++i)
		for (int j = 0; j < b.size(); ++j)
			ret[i + j] = (ret[i + j] + (LL) a[i] * b[j]) % mod;
	return ret;
}

poly calc(poly a) {
	for (int i = 1; i < a.size(); ++i)
		a[0] = (a[0] + (LL) (mod - a[i]) * g[i]) % mod;
	return a;
}

poly dfs(int x, int f = 0) {
	poly ret(2); ret[1] = 1;
	for (int i = head[x]; i; i = e[i].nxt) if (e[i].to != f) {
		ret = ret * calc(dfs(e[i].to, x));
	}
	return ret;
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n;
	g[0] = 1;
	for (int i = 2; i <= n; i += 2)
		g[i] = (LL) (i - 1) * g[i - 2] % mod;
	for (int i = 1, x, y; i < n; ++i)
		std::cin >> x >> y, link(x, y);
	poly ret = dfs(1);
	int ans = 0;
	for (int i = 0; i < ret.size(); ++i)
		ans = (ans + (LL) g[i] * ret[i]) % mod;
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 25
#define NIL -1
struct tree {
        int parent;
        int left;
        int right;
};
void dispf(int, struct tree*);
void dispm(int, struct tree*);
void dispb(int, struct tree*);
main()
{
        struct tree t[MAX];
        int i, j, n, id, l, r, prec, root;
        scanf("%d", &n);
        for (i = 0; i < n; i++) {
                t[i].parent = NIL;
        }
    for(i = 0; i < n; i++) {
        scanf("%d %d %d", &id, &l, &r);
        t[id].left = l;
                t[id].right = r;
                if (l != -1) {
                        t[l].parent = id;
                }
                if (r != -1) {
                        t[r].parent = id;
                }
    }
    for (i = 0; i < n; i++) {
        if(t[i].parent == NIL) {
                        root = i;
                        break;
                }
        }
        printf("Preorder\n");
        dispf(root, t);
        printf("\nInorder\n");
        dispm(root, t);
        printf("\nPostorder\n");
        dispb(root, t);
        putchar('\n');
}
void dispf(int u, struct tree *t)
{
        if (u == NIL) {
                return;
        } else {
                printf(" %d", u);
                dispf(t[u].left, t);
                dispf(t[u].right, t);
        }
}
void dispm(int u, struct tree *t)
{
    if (u == NIL) {
        return;
    } else {
        dispm(t[u].left, t);
                printf(" %d", u);
        dispm(t[u].right, t);
    }
}
void dispb(int u, struct tree *t)
{
    if (u == NIL) {
        return;
    } else {
        dispb(t[u].left, t);
        dispb(t[u].right, t);
                printf(" %d", u);
    }
}

Measured memory_bytes: 1816
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n; cin>>n;
    double v[n], ans = 0;
    for(int i = 0; i < n; i++) cin>>v[i];
    sort(v, v + n);
    for(int i = 1; i < n; i++)
        v[i] = (v[i] + v[i - 1]) / 2;
    cout<<v[n - 1]<<'\n';
    return 0;
}

Measured memory_bytes: 256
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  string s;
  cin >> s;
  int cnt = 0;
  int len = s.length();
  for(int i = 0; i < len; i++){
    if(s[i] == '+') cnt++;
    else cnt--;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 2e18;

template< int mod >
struct ModInt {
    int x;

    ModInt() : x(0) {}

    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;


signed main() {
    int N;
    cin >> N;
    vector<pair<int, int>> ans;
    if (N % 2 == 1) {
        for (int i = 1; i <= N - 1; i++) ans.emplace_back(N, i);
        N--;
    }
    for (int i = 1; i <= N / 2; i++) {
        for (int j = i + 1; j <= N - i; j++) {
            ans.emplace_back(i, j);
            ans.emplace_back(N - i + 1, j);
        }
    }
    cout << ans.size() << endl;
    for (auto temp : ans) {
        cout << temp.first << " " << temp.second << endl;
    }
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	long long int a[n],b[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	long long int plus = 0;
	for(int i = n - 1; i >= 0; i--) {
		long long int nowa = a[i] + plus;
		if(nowa % b[i] == 0) continue;
		if(nowa <= b[i]) {
			plus += b[i] - nowa;
		} else {
			plus += b[i] - (nowa % b[i]);
		}



	}

	cout << plus << endl;



}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b ;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    //*
    if( a < b ){
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    //*/
    
    //cout << vec.at(0) + vec.at(1) << endl;

    return 0; 
}


Measured memory_bytes: 3580
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int board[9];

signed main() {
    cin >> board[0] >> board[1] >> board[4];
    board[6] = board[0] + board[1] - board[4];
    board[7] = board[0] + board[4] - board[6];

    int sum = board[1] + board[4] + board[7];
    board[3] = sum - board[0] - board[6];
    board[8] = sum - board[7] - board[6];
    board[2] = sum - board[0] - board[1];
    board[5] = sum - board[2] - board[8];

    rep(i,0,3) {
        rep(j,0,3) {
            if(j != 0) printf(" ");
            printf("%lld", board[i*3+j]);
        }
        printf("\n");
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
int a[100001];
int main() {
	//freopen("input.txt","r",stdin);
	int n,b;
	cin >>n;
	for(int x=0;x<n;x++){
		cin >>b;
		a[b]++;
	}
	int best = 0;
	for(int x=1;x<1e5;x++){
		best = max(best,a[x-1]+a[x]+a[x+1]);
	}
	cout << best << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,a[333333];
  cin>>n;
  for(int i=0;i<3*n;i++)cin>>a[i];
  
  int la[111111],lb[111111];
  priority_queue<int> aq,bq;
  int asum=0,bsum=0;
  
  for(int i=0;i<n;i++){
    asum+=a[i];
    bsum+=a[3*n-1-i];
    aq.push(-a[i]);
    bq.push(a[3*n-1-i]);
  }

  for(int i=0;i<=n;i++){
    la[i]=asum;
    lb[i]=bsum;
    asum+=a[n+i];
    bsum+=a[2*n-1-i];
    aq.push(-a[n+i]);
    bq.push(a[2*n-1-i]);
    asum+=aq.top();
    bsum-=bq.top();
    aq.pop(),bq.pop();
  }
  int ans=la[0]-lb[n];
  for(int i=0;i<=n;i++){
    ans=max(ans,la[i]-lb[n-i]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6252
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=1e6;
LL A[L];
int N;
LL f(LL b){
	LL s=0;
	for(int i=1;i<=N;i++){
		s+=abs(A[i]-(b+i));
	}
	return s;
}
int main() {
	cin >> N;
	for(int i=1;i<=N;i++){
		cin >> A[i];
	}
	LL low=-1e6;
	LL hi=1e9+1e6;
	LL a=f(low),b,c,d=f(hi);
	while(low+2<hi){
		LL p=low+(hi-low)/3;
		LL q=low+2*(hi-low)/3;
		b=f(p);
		c=f(q);
		if(a<=b){
			hi=p;
			d=b;
		}
		else if(c>=d){
			low=q;
			a=c;
		}
		else if(b<=c){
			hi=q;
			d=c;
		}
		else{
			low=p;
			a=b;
		}
	}
	LL mid=(low+hi)/2;
	cout << min(min(a,d),f(mid)) << endl;

	return 0;
}



Measured memory_bytes: 1792
H, W = map(int, input().split())
grid = [input() for _ in range(H)]
MOD = 10**9 + 7
dp = [[0]*W for _ in range(H)]
for i in range(H):
    if grid[i][0] == '#': break
    dp[i][0] = 1
for j in range(W):
    if grid[0][j] == '#': break
    dp[0][j] = 1
for i in range(1, H):
    for j in range(1, W):
        dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD if grid[i][j] == '.' else 0
print(dp[H-1][W-1])

Measured memory_bytes: 43732
using System;
using System.Numerics;

    class Program
    {
        static void Main(string[] args)
        {
            var A = BigInteger.Parse(Console.ReadLine());
            var B = BigInteger.Parse(Console.ReadLine());
            if(A==B)
            {
                Console.WriteLine("EQUAL");
                return;
            }
                Console.WriteLine(A>B? "GREATER" : "LESS");
        }
    }

Measured memory_bytes: 13396
#include<stdio.h>
#include<stdlib.h>
#define MAX 100005
#define NIL -1

struct Node {
  int parent;
  int left;
  int right;
};

struct Node T[MAX];

int n,D[MAX],H[MAX];

void setDepth(int u,int d){
  if(u==NIL)return;
  
  D[u]=d;
  
  setDepth(T[u].left,d+1);
  setDepth(T[u].right,d+1);
}

int setHeight(int u){
  int h1=0,h2=0;
  
  if(T[u].left != NIL) h1 = setHeight(T[u].left) + 1;
  
  if(T[u].right != NIL) h2 = setHeight(T[u].right) + 1;
  
  return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u){
  if(T[u].parent == NIL)return NIL;
  
  if(T[T[u].parent].left!=u&&T[T[u].parent].left!=NIL)return T[T[u].parent].left;
  
  if(T[T[u].parent].right!=u&&T[T[u].parent].right!=NIL)return T[T[u].parent].right;
  
  return NIL;
}


void print(int u){
  int i,c;
  
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  
  int deg=0;
  
  if(T[u].left != NIL)deg++;
  if(T[u].right != NIL)deg++;
  
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  
  if(T[u].parent == NIL)printf("root\n");
  else if(T[u].left == NIL&&T[u].right == NIL) printf("leaf\n");
  else  printf("internal node\n");
}

int main(){

  int v,l,r,root=0,i;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    T[i].parent = NIL;
  }

  for(i=0; i<n; i++){
     scanf("%d",&v);
     scanf("%d",&l);
     scanf("%d",&r);
     T[v].left = l;
     T[v].right = r;
     if(l != NIL)T[l].parent = v;
     if(r != NIL)T[r].parent = v;
  }
  for(i=0; i<n; i++){
    if(T[i].parent == NIL)root = i;
  }
  
  setDepth(root,0);
  setHeight(root);
  for(i=0; i<n; i++) print(i);

  return 0;
}



Measured memory_bytes: 2044
#include<bits/stdc++.h>
#define FILEIN freopen("input.txt", "r", stdin)
using namespace std;

#define ll long long
#define endl "\n"

const ll INF = 1e9;

vector<int> v(10, 0);

bool check(int n){
    while(n){
        if(v[n%10]){
            return false;
        }
        n /= 10;
    }
    return true;
}

int main(){
    // FILEIN;
    int n, k, a; cin>>n>>k;
    for(int i = 0; i<k; i++){
        cin>>a;
        v[a] = 1;
    }
    for(int i = n; ; i++){
        if(check(i)){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// ---------- begin ModInt ----------
const MOD: u32 = 998_244_353;

#[derive(Clone, Copy)]
struct ModInt(u32);

impl std::ops::Add for ModInt {
    type Output = ModInt;
    fn add(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::AddAssign for ModInt {
    fn add_assign(&mut self, rhs: ModInt) {
        *self = *self + rhs;
    }
}

impl std::ops::Sub for ModInt {
    type Output = ModInt;
    fn sub(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + MOD - rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::SubAssign for ModInt {
    fn sub_assign(&mut self, rhs: ModInt) {
        *self = *self - rhs;
    }
}

impl std::ops::Mul for ModInt {
    type Output = ModInt;
    fn mul(self, rhs: ModInt) -> Self::Output {
        ModInt((self.0 as u64 * rhs.0 as u64 % MOD as u64) as u32)
    }
}

impl std::ops::MulAssign for ModInt {
    fn mul_assign(&mut self, rhs: ModInt) {
        *self = *self * rhs;
    }
}

impl std::ops::Neg for ModInt {
    type Output = ModInt;
    fn neg(self) -> Self::Output {
        ModInt(if self.0 == 0 {0} else {MOD - self.0})
    }
}

impl std::fmt::Display for ModInt {
    fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl std::str::FromStr for ModInt {
    type Err = std::num::ParseIntError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let val = s.parse::<u32>()?;
        Ok(ModInt::new(val))
    }
}

impl From<usize> for ModInt {
    fn from(val: usize) -> ModInt {
        ModInt((val % MOD as usize) as u32)
    }
}

#[allow(dead_code)]
impl ModInt {
    pub fn new(n: u32) -> ModInt {
        ModInt(n % MOD)
    }
    pub fn zero() -> ModInt {
        ModInt(0)
    }
    pub fn one() -> ModInt {
        ModInt(1)
    }
    pub fn pow(self, mut n: u32) -> ModInt {
        let mut t = ModInt::one();
        let mut s = self;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        t
    }
    pub fn inv(self) -> ModInt {
        assert!(self.0 > 0);
        self.pow(MOD - 2)
    }
}
// ---------- end ModInt ----------

use proconio::*;

fn run() {
    input! {
        n: usize,
        w: usize,
        a: [usize; n],
    }
    let mut dp = vec![ModInt::zero(); w + 1];
    dp[0] = ModInt::one();
    for a in a {
        let mut next = vec![ModInt::zero(); w + 1];
        for (i, v) in dp.into_iter().enumerate() {
            next[i] += ModInt(2) * v;
            if let Some(p) = next.get_mut(i + a) {
                *p += v;
            }
        }
        dp = next;
    }
    println!("{}", dp[w]);
}

fn main() {
    run();
}


Measured memory_bytes: 2180
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,ans,i;string s;cin >> n >> s;ans = 1;
  for(i=1;i<n;i++){
    if (s[i]!=s[i-1]) ans += 1;
  }
  cout << ans << endl;
}
  

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

int main() {
    int N , ans=0;
    cin >> N;
    vector<int> cost(N);
    vector<int> value(N);
    int i = 0;
    for(i = 0;i<N;i++){
        cin >> value.at(i);
    }
    for(i = 0;i<N;i++){
        cin >> cost.at(i);
    }
    for(i = 0;i<N;i++){
        int a = value.at(i)-cost.at(i);
        if(a>0) ans+=a;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DLunlunNumber solver = new DLunlunNumber();
        solver.solve(1, in, out);
        out.close();
    }

    static class DLunlunNumber {
        int MAXN = 200005;
        PrintWriter out;
        InputReader in;
        int k;
        int c;
        long[] ans = new long[MAXN];

        void go(int ind, int val, int len, long sum) {
            if (ind == len) {
                ans[c++] = sum;
                return;
            }
            int i = 0;
            for (i = Math.max(val - 1, 0); i <= Math.min(val + 1, 9); i++) {
                go(ind + 1, i, len, sum * 10 + i);
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            k = ni();
            if (k <= 9) {
                pn(k);
                return;
            }
            int i = 0, j = 0;
            c = 9;
            for (i = 2; i <= 11 && c <= k; i++) {
                for (j = 1; j <= 9 && c <= k; j++)
                    go(1, j, i, j);
            }
            pn(ans[k - 1]);
        }

        int ni() {
            return in.nextInt();
        }

        void pn(long zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadLineInt();
            var a = ReadLineIntList();

            var num = a[0];
            for(var i = 1; i <a.Count; i++) 
            {
                num ^= a[i];
            }

            for (var i = 0; i < a.Count; i++)
            {
                Console.WriteLine(num ^ a[i]);
            }
        }


        #region 使いまわし
        static string ReadLineStr() { return Console.ReadLine(); }
        static int ReadLineInt() { return Convert.ToInt32(Console.ReadLine()); }
        static (int, int) ReadLineInt2()
        {
            var temp = Console.ReadLine().Split(' ');
            return (Convert.ToInt32(temp[0]), Convert.ToInt32(temp[1]));
        }
        static List<int> ReadLineIntList()
        {
            var data = new List<int>();
            foreach (var temp in Console.ReadLine().Split(' '))
            {
                data.Add(Convert.ToInt32(temp));
            }

            return data;
        }

        static long ReadLineLong() { return Convert.ToInt64(Console.ReadLine()); }
        #endregion
    }
}


Measured memory_bytes: 57412
fib = [1,1,1,2]
def fibonacci(n):
    if n<len(fib):
        return fib[n]
    x = len(fib)
    a = fib[len(fib)-2]
    b = fib[len(fib)-1]
    while x<=n:
        c = b
        b = a+b
        a = c
        x+=1
    return b

h = input().split(" ")
n = int(h[0])
a = []
for i in range(n+1):
    a.append(1)

m = int(h[1])
for i in range(m):
    an = int(input())
    a[an]=0

prod=1
ck = 0
sum = 0

for i in range(n+1):
    if a[i]==0:
        if ck==1:
            prod =0
            break
        prod*=fibonacci(sum)
        sum=0
        ck=1
    else:
        sum+=1
        ck=0
prod*=fibonacci(sum)
print(prod%1000000007)

Measured memory_bytes: 4016
N = int(input())
a = list(map(int,input().split()))

b = [0]*N

for i in range(N):
    j = N-i
    k = 2*j
    context = 0
    while k<=N:
        context+=b[k-1]
        k+=j
    if context%2==a[j-1]:
        b[j-1]=0
    else:
        b[j-1]=1

M=sum(b)

ans = []
for i,v in enumerate(b):
    if v==1:
        ans.append(i+1)

print(M)
print(*ans)

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a=2,b=1,MOD=1e9+7;
	string s;
	cin >> s;
	for(int i=1;i<s.size();i++){
		if(s[i]=='0'){
			(b*=3)%=MOD;
		}else{
			b = (b*3+a)%MOD;
			(a *= 2)%=MOD;
		}
	}
	cout << (a+b) % MOD << endl;
}

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

#define INF (1<<30)
typedef pair< int , int > P;
struct Edge {
  int to,cost;
  Edge(){}
  Edge(int to,int cost):to(to),cost(cost){};
};
vector< vector< Edge > > Graph;
vector< int > min_cost;
int V,E;

bool Bellman_Ford(int s){
  min_cost.assign(Graph.size()+1,INF);
  bool negative_loop = false;
  min_cost[s] = 0;
  for(int k=0;k<V;k++){
    for(int i=0;i<V;i++){
      for(int j=0;j<Graph[i].size();j++){
	if(min_cost[i] == INF) continue;
	Edge e = Graph[i][j];
	if(min_cost[e.to] > min_cost[i]+e.cost){
	  min_cost[e.to] = min_cost[i]+e.cost;
	  if(k == V - 1){
	    min_cost[e.to] = -INF;
	    negative_loop = true;
	  }
	}
      }
    }
  }
  return negative_loop;
}

int main(){
  int r;
  cin >> V >> E >> r;
  Graph.resize(V+1);
  for(int i=0;i<E;i++){
    int s,t,d;
    cin >> s >> t >> d;
    Graph[s].push_back(Edge(t,d));
    //Graph[t].push_back(Edge(s,d));
  }
  bool flg = Bellman_Ford(r);
  if(flg) cout << "NEGATIVE CYCLE" << endl;
  else {
    for(int i=0;i<V;i++){
      if(min_cost[i] == INF) cout << "INF" << endl;
      else cout << min_cost[i] << endl;
    }
  }
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 60; //10e18+10e17ちょっとくらい
const int MOD = 1000000007;
const int MAX_N = 200100;

bool stage[6][6];
signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int n;
    cin >> n;
    vi a(n);
    rep(i, n){
        cin >> a[i];
    }
    sort(all(a));
    reverse(all(a));
    priority_queue<pair<int,int>>pq;
    pq.push(make_pair(a[1], a[0]));
    pq.push(make_pair(a[1], a[0]));
    int ans = a[0];
    rep(i, n-2){
        int f = pq.top().first;
        int s = pq.top().second;
        pq.pop();
        ans += f;
        pq.push(make_pair(a[i+2], f));
        pq.push(make_pair(a[i+2], s));
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 9012
#include <stdio.h>
#include <stdlib.h>
#define N 1000

int main( void ) {
  int i;
  char ch[ N ];
  int comp[ N ][ 3 ]; // 使用未使用、顧客番号、カウント
  int num;

  for( i = 0; i < N; i++ )
    comp[ i ][ 0 ] = comp[ i ][ 1 ] = comp[ i ][ 2 ] = 0;

  while( 1 ) {
    for( i = 0; ; i++ ) {
      scanf( "%c", &ch[ i ] );
      if( ch[ i ] == 10 )
        break;
    }
    if( ch[ 0 ] == 10 ) break;

    num = atoi( ch );

    for( i = 0; i < N; i++ )
      if( !comp[ i ][ 0 ] || // 未使用かどうか
          comp[ i ][ 1 ] == num ) { // 同じ顧客番号があるか
        comp[ i ][ 0 ] = 1;
        comp[ i ][ 1 ] = num;
        comp[ i ][ 2 ]++;
        break;
      }
  }

  while( 1 ) {
    int t;
    for( i = 0; ; i++ ) {
      t = scanf( "%c", &ch[ i ] );
      if( ch[ i ] == 10 ||
          t == EOF )
        break;
    }
    if( !i ) break;

    num = atoi( ch );

    for( i = 0; i < N; i++ )
      if( !comp[ i ][ 0 ] || // 未使用かどうか
          comp[ i ][ 1 ] == num ) { // 同じ顧客番号があるか
        if( comp[ i ][ 0 ] )
          comp[ i ][ 0 ] = 2;
        comp[ i ][ 1 ] = num;
        comp[ i ][ 2 ]++;
        break;
      }
  }

  while( 1 ) {
    int Min, MIn; // 最小値、最小値インデックス

    for( i = 0; i < N; i++ )
      if( comp[ i ][ 0 ] == 2 )
        break;

    if( i == N ) break;

    Min = comp[ i ][ 1 ];
    MIn = i;

    for( i++ ; i < N; i++ )
      if( comp[ i ][ 0 ] == 2 &&
          Min > comp[ i ][ 1 ] ) {
        Min = comp[ i ][ 1 ];
        MIn = i;
      }

    comp[ MIn ][ 0 ] = 0;
    printf( "%d %d\n", comp[ MIn ][ 1 ], comp[ MIn ][ 2 ] );
  }

  return( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<int> ans(N, 0);

    rep(i, N - 1) {
        int A;
        cin >> A;
        ans[A - 1]++;
    }

    rep(i, N) cout << ans[i] << endl;
    return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int a[100000], b[100000];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, h;
    cin >> n >> h;
    rep(i, n) cin >> a[i] >> b[i];
    sort(b, b + n);
    sort(a, a + n);
    int latte = 0, malta = 0;
    rep(i, n) {
        if(b[n - 1 - i] > a[n - 1]) {
            latte += b[n - 1 - i];
            ++malta;
            if(latte >= h) {
                cout << malta << endl;
                return 0;
            }
        }
        else {
            break;
        }
    }
    h -= latte;
    malta += h / a[n - 1] + ((h % a[n - 1]) ? 1 : 0);
    cout << malta << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.*;

class Main{
    public static void main(String args[]){
        try{
            BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
            String s=reader.readLine();
            StringTokenizer st=new StringTokenizer(s," ");
            
            String W=st.nextToken();
            String H=st.nextToken();
            String x=st.nextToken();
            String y=st.nextToken();
            String r=st.nextToken();
            
            int Wn=Integer.parseInt(W);
            int Hn=Integer.parseInt(H);
            int xn=Integer.parseInt(x);
            int yn=Integer.parseInt(y);
            int rn=Integer.parseInt(r);
            
            if((xn-rn)>=0 && (xn+rn)<=Wn && (yn-rn)>=0 && (yn+rn)<=Hn){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
            
            
        }catch(IOException e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 24344
#include<bits/stdc++.h>
using namespace std;
long long int dp[111][31] = {0};
int main(){
    int inp;
    scanf("%d",&inp);
    vector<int>num;
    num.push_back(0);
    int res;
    for(int i = 0;i < inp-1;i++){
        int n;
        cin >> n;
        num.push_back(n);
    }
    cin >> res;
    for(int i = 1;i < inp;i++){
        for(int j = 0;j <= 20;j++){
            if(i == 1 && j == num[i]){
                dp[i][j]++;
            }
            else{
                if(j-num[i] >= 0){
                    dp[i][j] += dp[i-1][j-num[i]];
                }
                if(j+num[i] <= 20){
                    dp[i][j] += dp[i-1][j+num[i]];
                }
            }

        }
    }
    /*for(int i = 1;i < inp;i++){
        for(int j = 0;j <= 20;j++){
            cout << dp[inp-i][j] << ' ';
        }
        cout << endl;
    }*/
    cout << dp[inp-1][res] << endl;
    //cout << num[inp] << ':' << res << endl;

    return 0;
}

Measured memory_bytes: 3232
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var n = consoleReader.Int;
            return n < 1200 ? "ABC" : n < 2800 ? "ARC" : "AGC";
        }

        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(0)

// *start on @date: 2020-02-22 20:06

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

int main()
{
    IOS;
    int a, b;
    cin >> a >> b;
    if (a < 10)
    {
        int t = 100 * (10 - a);
        cout << b + t;
    }
    else
    {
        cout << b;
    }

    return 0;
}


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = INT_MAX / 2;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	bool c = false;
	rep (i, s.size()) {
		if (c && s[i] == 'F') {
			cout << "Yes" << endl;
			return 0;
		}
		if (s[i] == 'C') {
			c = true;
		}
	}
	cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 384
n = gets.chomp.to_i

results = []
n.times do |_|
  results << { a: 0, b: 0, c: 0 }
end

n.times do |i|
  a, b, c = gets.chomp.split.map(&:to_i)

  if i == 0
    results[i][:a] = a
    results[i][:b] = b
    results[i][:c] = c
  else
    results[i][:a] = [results[i-1][:b] + a, results[i-1][:c] + a].max
    results[i][:b] = [results[i-1][:a] + b, results[i-1][:c] + b].max
    results[i][:c] = [results[i-1][:a] + c, results[i-1][:b] + c].max
  end
end

puts results[-1].values.max


Measured memory_bytes: 41260
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int ans = s;
        int m = 0;
        int n = 0;
        int cnt =1;

        list.add(s);

        while(true){
            if(ans%2==0){
                ans=ans/2;
            }else{
                ans=ans*3+1;
            }
            cnt++;

            if(list.contains(ans)){
               n = list.indexOf(ans);
               m = cnt;
               break;

            }else{
                list.add(ans);
            }

        }

        System.out.println(m);


    }
}


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


int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long count[100005];
  long long a[100005];
  long long sum=0;
  long long n;
  cin>>n;

  for(int i=1;i<100005;i++){
    count[i]=0;
  }
  for(int i=1;i<=n;i++){
    cin>>a[i];
    count[a[i]]++;

  }
  for(int i=1;i<100004;i++){
    sum+=count[i]*i;
  }
  int q;
  cin>>q;

  while(q--){
    long long x,y;
    cin>>x>>y;
    sum-=count[x]*x;
    sum+=count[x]*y;
    if(count[x]){
      count[y]+=count[x];
    }
    count[x]=0;
    cout<<sum<<endl;
  
    
  }


  





}

Measured memory_bytes: 5216
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace std;

int n, k;

int main() {
	cin >> n >> k;
	if (n < 10)
		cout << k + (10 - n) * 100 << endl;
	else
		cout << k << endl;

	return 0;
}

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

int main() {
    int L;
    cin >> L;
    double answer;
    answer = L / 3.0 * L / 3.0 * L / 3.0;
    cout.precision(17);
    cout << answer << endl;
    return 0;
}


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

#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=100010;

ll a[3];
string s;

int main(){
  cin>>s;
  for(ll i=0;i<3;i++){
    if(s[i]=='a')a[0]++;
    else if(s[i]=='b')a[1]++;
    else if(s[i]=='c')a[2]++;

  }
  if(a[0]==1&&a[1]==1&&a[2]==1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


  return 0;
}


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


int main(){
  int N;
  cin >>N;
  int64_t L1=2,L2=1,L;
  if (N==0){
    cout <<2<<endl;
  }
  else{
    if (N==1){
      cout <<1<<endl;
    }
    else{
      for (int i=0;i<N-1;i++){
        L=L1+L2;
        L1=L2;
        L2=L;
      }
      cout <<L<<endl;
    }
  }
  
}

Measured memory_bytes: 256
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A,B = readInts()
P = sorted(readInts())
i = 0
nya = 0
ans = 0
while i < n:
    if nya == 0:
        if 1 <= P[i] <= A:
            nya = 1
            P[i] = -1
    elif nya == 1:
        if A < P[i] <= B:
            nya = 2
            P[i] = -1
    elif nya == 2:
        if B < P[i]:
            nya = 0
            P[i] = -1
            ans += 1
            i = 0
    i += 1
#print(P)
print(ans)


Measured memory_bytes: 5136
#include<iostream>
#include<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>

//#include"gap.h"

using namespace std;


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

	int nmx = 9 * 7;
	int cnt = 0;
	for (int i = 1; i < nmx; i++) {
		int x = 1;
		for(int j=0; j<n; j++)
		{
			x *= (i + a);
		}
		if (x > m) break;
		int y = 0;
		while (x > 0)
		{
			y += x % 10;
			x /= 10;
		}
		if (i == y) cnt++;
	}

	cout << cnt << endl;


	return 0;
}



Measured memory_bytes: 3084
S = input()

n = len(S)
x = [1] * n
for i in range(n):
    if S[i] == "R":
        if S[i + 1] == "R":
            x[i + 2] += x[i]
            x[i] = 0

for i in reversed(range(n)):
    if S[i] == "L":
        if S[i - 1] == "L":
            x[i - 2] += x[i]
            x[i] = 0

print(*x)


Measured memory_bytes: 78116
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a;
    cin>>n>>a;
    int x[n];
    vector<vector<vector<long long>>>dp(n+1,vector<vector<long long>>(n+1,vector<long long>(2501,0)));
    dp[0][0][0]=1;
    for(int i=0;i<n;i++){
        cin>>x[i];
        for(int j=0;j<=n;j++){
            for(int k=0;k<=2450;k++){
                dp[i+1][j][k]+=dp[i][j][k];
                if(j<n)dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
            }
        }
    }
    long long ans=0;
    for(int i=0;i<=n;i++)for(int j=0;j<=2500;j++)if(i*a==j)ans+=dp[n][i][j];
    cout<<ans-1<<endl;
    return 0;
}

Measured memory_bytes: 55180
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
#include <queue>
#include <sstream>
#include <map>
#include <unordered_map>
#include <cmath>
using namespace std;
using LLI = long long int;

#define Rep(i, N) for (int i = 0; i < N; i++)


int main(int argc, char *argv[])
{
    char a;
    cin >> a;
    cout << char(a + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  
  int main(){
     lint n,q,k;
     string s;
     //lint a[n];
     cin>>k>>s;
      n=s.size();
     if(n<=k)cout<<s;
     else{
         rep(i,k)cout<<s[i];
         cout<<"...";
     }

  } 
      
      
    

  
          
  

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int N;
	string S, T;
	cin >> N >> S>>T;
	rep(i, N)cout << S[i] <<T[i];
}

Measured memory_bytes: 256
[N,M] = list(map(int,input().split()))
A = list(map(int,input().split()))

kijun = sum(A) / (4*M)

count=0
for i in range(N):
    if A[i]>=kijun:
        count+=1

if count>=M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38256