akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		for (auto i : boost::irange(0, 63))
		{
			if (p & (1ULL << i))
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<std::uint64_t Mod>class modnum :
		private boost::addable<modnum<Mod>>,
		private boost::subtractable<modnum<Mod>>,
		private boost::multipliable<modnum<Mod>>,
		private boost::dividable<modnum<Mod>>
	{
		std::uint64_t val;
		void clamp()
		{
			val %= Mod;
		}
	public:
		modnum() = default;
		modnum(std::int64_t v) :val()
		{
			if (v < 0)
			{
				v += (std::abs(v) / Mod + 1) * Mod;
			}
			val = v;
			clamp();
		}
		modnum(std::uint64_t v) :val(v)
		{
			clamp();
		}
		modnum(std::int32_t v) :modnum(static_cast<std::int64_t>(v))
		{

		}
		modnum(std::uint32_t v) :modnum(static_cast<std::uint64_t>(v))
		{

		}
		friend std::ostream& operator<<(std::ostream& os, modnum const& num)
		{
			return os << num.val;
		}
		auto& operator+=(modnum const& rhs)
		{
			val += rhs.val;
			clamp();
			return *this;
		}
		auto& operator-=(modnum const& rhs)
		{
			val += Mod - rhs.val;
			clamp();
			return *this;
		}
		auto& operator*=(modnum const& rhs)
		{
			val *= rhs.val;
			clamp();
			return *this;
		}
		auto& operator/=(modnum const& rhs)
		{
			val *= pow(rhs, Mod - 2).val;
			clamp();
			return *this;
		}
		auto const& operator*()const
		{
			return val;
		}
	};
}
using mod_t = lib::modnum<1000000007>;
using inside_t = lib::modnum<13>;

void Main()
{
	std::string value;
	std::cin >> value;
	std::array<mod_t, 13> dp = {};
	dp[0] = 1;
	inside_t digit = 1;
	for (auto&& c : value | adaptor::reversed)
	{
		std::array<mod_t, 13> next = {};
		if (c == '?')
		{
			for (int i : boost::irange(0, 10))
			{
				for (int j : boost::irange(0, 13))
				{
					next[*(i * digit + j)] += dp[j];
				}
			}
		}
		else
		{
			int i = c - '0';
			for (int j : boost::irange(0, 13))
			{
				next[*(i * digit + j)] += dp[j];
			}
		}
		digit *= 10;
		std::swap(dp, next);
	}
	std::cout << dp[5] << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 512
#define FNAME ""

#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < (n); i++)
#define forab(i, a, b) for (int i = (a); i < (b); i++)
#define fornr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(), v.end()

using namespace std;

typedef long long LL;
typedef LL ll;
typedef unsigned long long ULL;
typedef ULL ull;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int, int> pii;

const int M = 1e5 + 10;

void fin() {
    cout << "NO";
    exit(0);
 }
ll a[M];
ll cnt[M];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
#ifdef LOCAL
    freopen(FNAME".in", "r", stdin);
    freopen(FNAME".out", "w", stdout);
#endif
    ll n;
    cin >> n;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    if (sum % (n * (n + 1) / 2)) fin();
    ll k = sum / (n * (n + 1) / 2);
    ll su = 0;
    for (int i = 0; i < n; i++) {
        ll d = (a[(i + 1) % n] - a[i]);
        if ((k - d) % n) fin();
        ll t = (k - d) / n;
        su += t;
        if (!(0 <= t && t <= k)) fin();
        cnt[i] = t;
    }
    if (su != k) fin();
    ll res = 0;
    for (int i = 0; i < n; i++) {
        res += cnt[i] * (n - i);
    }
    if (res != a[0]) fin();
    for (int i = 1; i < n; i++) {
        res += k;
        res -= n * cnt[i - 1];
        if (res != a[i]) fin();
        
    }
    cout << "YES\n";



    return 0;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

ll N,C;
ll D[32][32]; // D[color from][color to]
ll c[512][512];

ll m0[32]; // m1[color] -> num of elements
ll m1[32]; // m1[color] -> num of elements
ll m2[32]; // m1[color] -> num of elements

signed main() {
    cin>>N>>C;
    rep(i,1,C+1)
        rep(j,1,C+1)
            cin>>D[i][j];
    rep(i,1,N+1)
        rep(j,1,N+1)
            cin>>c[i][j];

    rep(i,1,N+1)
        rep(j,1,N+1) {
            if ((i+j)%3 == 0){
                m0[c[i][j]]++;
            } else if ((i+j)%3 == 1){
                m1[c[i][j]]++;
            } else{
                m2[c[i][j]]++;
            }
        }

    ll ans = 1ll << 62;
    rep(c0,1,C+1) rep(c1,1,C+1) rep(c2,1,C+1) {
        if (c0 == c1 || c1==c2 || c0 == c2)
            continue;
        ll t = 0;
        rep(c0_from, 1, C+1) t += D[c0_from][c0] * m0[c0_from];
        rep(c1_from, 1, C+1) t += D[c1_from][c1] * m1[c1_from];
        rep(c2_from, 1, C+1) t += D[c2_from][c2] * m2[c2_from];
        ans = min(ans, t);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2304
import heapq
Q = int(input())

A_left, A_right = [], []
A_left_sum, A_right_sum = 0, 0
heapq.heapify(A_left)
heapq.heapify(A_right)

B_sum = 0
for _ in range(Q):
    query = list(map(int,input().split()))

    if query[0] == 1:#更新クエリ
        now = query[1]#a
        B_sum += query[2]#b

        l, r = len(A_left), len(A_right)
        #中央値がA_left[0]になるように、出し入れする。
        if l <= r:
            heapq.heappush(A_right, now)
            A_right_sum += now

            out = heapq.heappop(A_right)
            A_right_sum -= out

            heapq.heappush(A_left, -out)
            A_left_sum += out
        else:
            heapq.heappush(A_left, -now)
            A_left_sum += now

            out = -heapq.heappop(A_left)
            A_left_sum -= out

            heapq.heappush(A_right, out)
            A_right_sum += out
        #print(A_right, A_left, A_right_sum, A_left_sum)   
    else:#求値クエリ
        m = -A_left[0]
        #A_left は 全て m より小さいので、　m - xi の和は
        #m * len(A_left) - (xiの和）となる。
        #xiの和が、A_left_sumである。
        #A_right も同様だが。引く数の方が大きいため、正負が入れ替わることに注意
        ans = len(A_left) * m - A_left_sum - len(A_right) * m + A_right_sum + B_sum
        print(m, ans)
        


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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if(H==0 && W==0) break;
        
        for(int i=1; i<=H; i+=1){
            for(int j=1; j<=W; j+=1){
                
                if(i==1||i==H){
                    cout << "#";
                    
                }else if(j==1 || j==W){
                    cout << "#";
                    
                }else if((1<i && i<H) && (1<j && j<W)){
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t
 
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
 
int N,M;
vint g[100010];
bool used[100010];
bool visit[100010];
int par[100010];
int kodomo[100010];
 int cnt[100010];
 
signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>N>>M;
    rep(i,0,N+M-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        g[a].pb(b);
        cnt[b]++;
    }
    queue<int>que;
    rep(i,0,N)if(cnt[i]==0)que.push(i);
    while(!que.empty()){
        int now=que.front();que.pop();
        for(auto e:g[now]){
            cnt[e]--;
            if(cnt[e]==0){
                par[e]=now+1;
                que.push(e);
            }
        }
    }
    
    rep(i,0,N){
        if(used[i]==false)cout<<par[i]<<endl;
        else cout<<par[i]<<endl;
    }
    
    
    
    
    
    
    
    return 0;
}

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

#define debug(x) cout << #x << ": " << (x) << endl
#define For(i, j, k) for (int i = j; i <= k; ++ i)
#define Forr(i, j, k) for (int i = j; i >= k; -- i)

using namespace std;

inline int read() {
	int x = 0, p = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') p = -1;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x * p;
}

inline void File() {
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
}

const int N = 400 + 10, mod = 1e9 + 7;
int a[N], b[N], n, c, pw[N][N], s[N][N], dp[N][N];

inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }

inline void Init(int n) {
	For(i, 1, n) {
		pw[i][0] = 1;
		For(j, 1, n) pw[i][j] = 1ll * pw[i][j - 1] * i % mod;
		For(j, 0, n) s[i][j] = add(s[i - 1][j], pw[i][j]);
	}
}

int main() {
 Init(N - 5);

	n = read(), c = read();

	For(i, 1, n) a[i] = read(); For(i, 1, n) b[i] = read();

	dp[0][0] = 1;
	For(i, 1, n) For(j, 0, c) For(k, 0, j) 
		dp[i][j] = add(dp[i][j], 1ll * dp[i - 1][j - k] * (mod - s[a[i] - 1][k] + s[b[i]][k]) % mod);	

	cout << dp[n][c] << endl;
	return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

const int MAX_V = 1001;

vector<vector<ll> > d(MAX_V, vector<ll>(MAX_V, INFLL)); //距離と隣接行列を兼ねる（ただし対角=0とする）
vector<vector<ll> > pre(MAX_V, vector<ll>(MAX_V, 0)); //iからjへの最短経路でjの前の点
ll n;
void warshall_floyd(bool rep_pre = true) {
    if(rep_pre) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                pre[i][j] = i;
            }
        }
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ll a = d[i][j];
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                if(rep_pre && a != d[i][j]) {
                    pre[i][j] = pre[k][j]; //iからjへの最短経路でjの前の点
                }
            }
        }
    }
}
 
int main () {

    int h,w; cin >>h>>w;
    vector<vector<ll> > c(10, vector<ll>(10)); REP(i,10) REP(j,10) cin >> c[i][j];
    vector<vector<ll> > a(h, vector<ll>(w)); REP(i,h) REP(j,w) cin >> a[i][j];

    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            d[i][j] = c[i][j];
        }
    }
    n = 10;
    warshall_floyd(false);

    ll sum = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] != -1 && a[i][j] != 1) {
                sum += d[a[i][j]][1];
            } 
        }
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll N=1000000007;
//ll power(ll a,ll b,ll mod)
//{
//    ll result=1;
//    while(b>0)
//    {
//        if(b%2==1)
//            result=(result*a)%mod;
//        a=(a*a)%mod;
//        b=b/2;
//    }
//    return result;
//}
//ll d,x,y;
//void extendedEuclid(ll a,ll b)
//{
//    if(b==0)
//    {
//        d=a; x=1; y=0;
//    }
//    else
//    {
//        extendedEuclid(b,a%b);
//        ll temp=x; x=y; y=temp-(a/b)*y;
//    }
//}
//ll modInverse(ll a,ll m)
//{
//    extendedEuclid(a,m);
//    return (x%m+m)%m;
//}
//ll lcm(ll a,ll b)
//{
//    if(a==0||b==0)
//        return 0;
//    else
//        return (a*b)/(__gcd(a,b));
//}
//void sieve(ll n)
//{
//    bool isPrime[n+1];
//    isPrime[0]=false; isPrime[1]=false;
//    for(ll i=2;i<=n;i++)
//        isPrime[i]=true;
//    for(ll i=2;i*i<=n;i++)
//    {
//        if(isPrime[i]==true)
//        {
//            for(ll j=i*i;j<=n;j+=i)
//                isPrime[i]=false;
//        }
//    }
//}
double min(double x, double y)
{
    return (x < y)? x: y;

}
double calcAngle(double h,double m)
{
    if (h == 12) h = 0;
    if (m == 60) m = 0;
    double hour_angle = 0.5 * (h * 60 + m);
    double minute_angle = 6 * m;
    double angle = abs(hour_angle - minute_angle);
    angle = min(360 - angle, angle);
    return angle;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long double a,b,h,m,j,k,p,pi=3.1415926535897932384626433832795;
    cin>>a>>b>>h>>m;
    j=calcAngle(h,m);
    p=(j/180)*(pi);
    k=sqrt((a*a)+(b*b)-(2.0*a*b*cos(p)));
    cout<<fixed<<setprecision(20)<<k;
}


Measured memory_bytes: 4184
#include <iostream>
using namespace std;
typedef long long ll;
// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll moddev(ll a, ll b, ll m) {
  return (a % m) * modinv(b, m) % m;
}

ll modsub(ll a, ll b, ll m) {
  return a - b < 0 ? a - b + m : a - b;
}

ll comb(ll n, ll k, ll p) {
  ll ans = 1;
  for (ll i = 1; i <= k; i++) {
    ans = ans * moddev(n-i+1, i, p) % p;
  }
  return ans % p;
}

int main() {
  ll n, a, b, p, ans;
  p = 1000000007;
  cin >> n >> a >> b;
  ans = modsub(modsub(modsub(modpow(2, n, p), 1, p), comb(n, a, p), p), comb(n, b, p), p);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool isprime(int x) {
	if (x < 2) return false;
	if (x == 2) return true;
	if (x % 2 == 0) return false;
	for (int i = 3; i * i <= x; i += 2)
		if (x % i == 0) return false;
	return true;
}

int main() {
	int x; cin >> x;
	for (int i = x;; ++i) {
		if (isprime(i)) {
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=1;i<=(n);i++)

int main(){
  int n,c=0;cin>>n;
  vector<int> a(n+1,0),x(n+1,0);
  REP(i,n) cin>>a.at(i);

  for(int i=n;i>=1;i--){
    x.at(i)^=a.at(i);
    if(x.at(i)) c++;
    for(int j=1;j*j<=i;j++) if(!(i%j)){
      if(i!=1) x.at(j)^=x.at(i);
      if((j!=1)&&(j!=i/j)) x.at(i/j)^=x.at(i);
    }
  }

  cout<<c<<endl;
  REP(i,n) if(x.at(i)) cout<<i<<" ";
}

Measured memory_bytes: 2432
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] A = new int[N];

            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }

            System.out.println(solve(0, A.length - 1, new RMQ(A)));
        }
    }

    private static long solve(int l, int r, RMQ rmq){
        if (l > r)
            return 0;

        if (l == r)
            return rmq.queryValue(l, r);

        int p = rmq.queryPosition(l, r);
        int key = rmq.queryValue(l, r);

        return (long)key * (p - l + 1) * (r - p + 1) + solve(l, p - 1, rmq) + solve(p + 1, r, rmq);
    }

    private static class RMQ {
        private final int[][] rmq;
        private final int[][] pos;
        private final int LG;
        private final int N;
        private final int[] log2;

        public RMQ(int[] A){
            this.LG = LOG2(A.length);
            this.N = A.length;
            this.rmq = new int[this.LG + 1][this.N + 1];
            this.pos = new int[this.LG + 1][this.N + 1];
            this.log2 = new int[this.N + 1];
            build(A);
        }

        public int queryPosition(int x, int y){
            x++; y++;
            int k = log2[y - x + 1];
            int p = y - (1 << k) + 1;

            if (rmq[k][x] < rmq[k][p])
                return pos[k][x];
            else
                return pos[k][p];
        }

        public int queryValue(int x, int y){
            x++; y++;
            int k = log2[y - x + 1];
            int p = y - (1 << k) + 1;

            if (rmq[k][x] < rmq[k][p])
                return rmq[k][x];
            else
                return rmq[k][p];
        }

        private static int LOG2(int x){
            int c = 0;

            while (x >= 1){
                x >>= 1;
                c++;
            }

            return c;
        }

        private void build(int[] A){
            for (int i = 1; i <= N; i++) {
                rmq[0][i] = A[i - 1];
                pos[0][i] = i - 1;
            }

            log2[1] = 0;

            for (int i = 2; i <= N; i++) {
                log2[i] = log2[i >> 1] + 1;
            }

            for (int i = 1; i <= LG; i++) {
                for (int j = 1; j + (1 << i) - 1 <= N; j++) {
                    int p = 1 << (i - 1);

                    if (rmq[i - 1][j] < rmq[i - 1][j + p]){
                        rmq[i][j] = rmq[i - 1][j];
                        pos[i][j] = pos[i - 1][j];
                    }
                    else{
                        rmq[i][j] = rmq[i - 1][j + p];
                        pos[i][j] = pos[i - 1][j + p];
                    }
                }
            }
        }
    }

}


Measured memory_bytes: 107024
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}
char a[55][55] , b[55][55];
int main()
{
	int a , b;
  	cin >> a >> b;
  	if(a + b >= 10)
      cout << "error" << endl;
 	else
      cout << a + b << endl;
	return 0;
} 



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, K;
  cin >> N >> K;

  if(K<=(N+1)/2){
    cout << "YES\n";
  }else{
    cout << "NO\n";
  }

  return 0;
}

Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: usize,
        q: usize,
        tuv: [(usize, usize, usize); q],
    }

    let mut dsu = DSU::new(n);

    for i in 0..q {
        let (t, u, v) = tuv[i];
        if t == 1 {
            println!("{}", if dsu.same(u, v) { 1 } else { 0 });
        } else {
            dsu.merge(u, v)
        }
    }
}

struct DSU {
//    n: usize,
    parent: Vec<Option<usize>>,
    rank: Vec<usize>,
}

impl DSU {
    fn new(n: usize) -> Self {
        Self {
//            n,
            parent: vec![None; n],
            rank: vec![1; n],
        }
    }

    fn merge(&mut self, u: usize, v: usize) {
//        assert!(u < self.n);
//        assert!(v < self.n);
        let (up, vp) = (self.top(u), self.top(v));
        if up != vp {
            let (p, c) = if self.rank[up] > self.rank[vp] { (up, vp) } else { (vp, up) };
            self.rank[p] += self.rank[c];
            self.rank[c] = 0;
            self.parent[c] = Some(p);
        }
    }

    fn same(&mut self, u: usize, v: usize) -> bool {
//        assert!(u < self.n);
//        assert!(v < self.n);
        self.top(u) == self.top(v)
    }

    fn top(&mut self, u: usize) -> usize {
//        assert!(u < self.n);
        if let Some(p) = self.parent[u] {
            let p = self.top(p);
            self.parent[u] = Some(p);
            p
        } else {
            u
        }
    }
}


Measured memory_bytes: 11680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b=s.nextInt(),c=s.nextInt();
        if(c>=a&&c<=b) System.out.println("Yes");
        else System.out.println("No");


    }


}


class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25400
#include<bits/stdc++.h>
using namespace std;
typedef vector< long long > vi;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define fr(n) for(ll i=0;i<n;i++)
#define tr(a) for(auto it=a.begin();it!=a.end();it++)
#define N 1000000007
#define PI 3.1415926535897932384
#define F first
#define S second
#define elasped_time    1.0 * clock() / CLOCKS_PER_SEC
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair

void tree(ll t[],ll s, ll e, ll a[], ll node){
    if(s==e){
        t[node]=a[s];
    }
    else{
        ll mid=(s+e)/2;
        tree(t,s,mid,a,2*node);
        tree(t,mid+1,e,a,2*node+1);
        t[node]=t[2*node]+t[2*node+1];
    }
    return;
    
}

int query(ll t[],ll s, ll e,ll l, ll r,ll node){
    
    if(l>e || r<s) return 0;
    if(l<=s and e<=r) return t[node];
    
        ll mid=(s+e)/2;
        return query(t,s,mid,l,r,2*node)+
        query(t,mid+1,e,l,r,2*node+1);

}

void update(ll tree[],int node, int start, int end, int idx, int val,ll A[])
{
    if(start == end)
    {
        A[idx] += val;
        tree[node] += val;
    }
    else
    {
        int mid = (start + end) / 2;
        if(start <= idx and idx <= mid) update(tree,2*node, start, mid, idx, val,A);
        else update(tree,2*node+1, mid+1, end, idx, val,A);
        tree[node] = tree[2*node] + tree[2*node+1];
    }
}


void solve(){ 
ll n,ans=0;
cin>>n;
ll a[n];
fr(n) cin>>a[i];
fr(n){
    if(i%2==0 and a[i]%2==1) ans++;
}
cout<<ans;

}
int main()
{   FAST;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout); 
#endif
   
    ll test;
    test=1;
   
    //cin>>test;
    while(test--)
    {
        solve();
    }
     cerr<<endl<<"maut : "<<elasped_time<<endl;
    return 0;
}
 
    



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

int main(void) {
	int n; cin >> n;
	long int a[n], x, y;
	int i;
	bool ax = { false }, ay = { false };

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

	sort(a, a + n);

	for (i = n - 1; i > 0; i--) {
		if (a[i] == a[i - 1]) {
			x = a[i-1]; 
			ax = true;
			i-=2;
			break;
		}
	}
	for (int j = i; j > 0; j--) {
		if (a[j] == a[j - 1]) {
			y = a[j]; 
			ay = true;
			break;
		}
	}
	
	if (ax&&ay) { cout << x * y << endl; }
	else { cout << "0" << endl; }

	return 0;
}

Measured memory_bytes: 1024
import math
n=int(input())
shop=input()
s=[input() for _ in range(n)]
m=len(shop)
cnt=[0]*n
for i in range(n):
    for j in range(len(s[i])):
        for k in range(1,2*math.ceil(len(s[i])/m)):
            if shop in s[i][j::k]:
                cnt[i]=1
print(sum(cnt))


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int n;cin >> n;
    vector<int> a(n);
    REP(i, n) { cin >> a[i]; }
    int ans=0;
    int z = 0;
    vector<int> m(n+1);
    IFOR(i,1,n+1){
        int mod = a[i-1];
        int x = i+i;
        while(x<n+1){
            mod ^= m[x];
            x += i;
        }
        m[i] = mod;
       // cout << i<<" "<<mod << "\n";
        z += m[i];
    }
    cout << z << "\n";
    FOR(i,1,n+1)
    if(m[i]){
        cout << i << " ";
        cout << "\n";
    }

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using vi=vector<int>;  using vs=vector<string>;

int main() {
    int h,w;
    cin>>h>>w;
    vs a(h);
    rep(i,h) cin>>a.at(i);

    rep(i,w+2) cout<<"#";
    cout<<endl;
    rep(i,h){
        cout<<"#"<<a.at(i)<<"#"<<endl;
    }
    rep(i,w+2) cout<<"#";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define mid (l+r>>1)
int n,a[N],ds[N],dp[N];vector<int> e[N];int cntS,rt[N];struct Seg {int v,ch[2];}sg[N*20];
void upd(int p,int l,int r,int &nwP,int x,int v)
{
	sg[nwP=++cntS]=sg[p];sg[nwP].v=max(sg[nwP].v,v);if(l==r) return;
	if(x<=mid) upd(sg[p].ch[0],l,mid,sg[nwP].ch[0],x,v);
	else upd(sg[p].ch[1],mid+1,r,sg[nwP].ch[1],x,v);
}
int qMx(int p,int l,int r,int qL,int qR)
{
	if(!p || qL>qR) return 0;if(l>=qL && r<=qR) return sg[p].v;int res=0;
	if(qL<=mid) res=qMx(sg[p].ch[0],l,mid,qL,qR);
	if(qR>mid) res=max(res,qMx(sg[p].ch[1],mid+1,r,qL,qR));return res;
}
void dfs(int u,int f)
{
	dp[u]=qMx(rt[f],1,ds[0],1,a[u]-1)+1;upd(rt[f],1,ds[0],rt[u],a[u],dp[u]);
	dp[u]=max(dp[u],dp[f]);
	for(int i=0,v;i<e[u].size();++i) {v=e[u][i];if(v!=f) dfs(v,u);}
}
int main()
{
	scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%d",&a[i]),ds[++ds[0]]=a[i];
	sort(ds+1,ds+ds[0]+1);ds[0]=unique(ds+1,ds+ds[0]+1)-ds-1;
	for(int i=1;i<=n;++i) a[i]=lower_bound(ds+1,ds+ds[0]+1,a[i])-ds;
	for(int i=1,u,v;i<n;++i) scanf("%d %d",&u,&v),e[u].push_back(v),e[v].push_back(u);
	dfs(1,0);for(int i=1;i<=n;++i) printf("%d\n",dp[i]);return 0;
}

Measured memory_bytes: 69172
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

    cin >> a >> b >> c;

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

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <iostream>

using namespace std;

class BigArray
{
private:
	long long n;
	long long k;
	map<long long, long long> mp;
public:
	BigArray(){
		cin >> n >> k;
		for (long long i = 0; i < n; ++i)
		{
			long long a;
			long long b;
			cin >> a >> b;
			mp[a] += b;
		}
	}
	void exec(){
		long long cur_i = 0;
		for (auto itr = mp.begin(); itr != mp.end(); ++itr)
		{
			cur_i += itr->second;
			if(cur_i >= k){
				cout << itr->first << endl; 
				return;
			}
		}
	}
};

int main(){
	BigArray ba = BigArray();
	ba.exec();
}


Measured memory_bytes: 4224
m = 10 ** 9 + 7

n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort!

if k == n
    ans = a.inject{|r,v| r * v % m}
elsif a[-1] <= 0
    ans = (k.odd? ? a[-k .. -1] : a[0, k]).inject{|r,v| r * v % m}
elsif a[0] >= 0
    ans = a[-k .. -1].inject{|r,v| r * v % m}
else
    x = a.index{|e| e >= 0}

    s = a[0 ... x]
    t = a[x .. -1]

    ans = k.odd? ? (k -= 1; t.pop) : 1
    while k > 0
        if s.size < 2 
            k.times {ans = ans * t.pop % m}
            break
        elsif t.size < 2
            k.times {ans = ans * s.shift % m}
            break
        else
            x = s[0] * s[1]
            y = t[-1] * t[-2]
            ans = ans * (x > y ? s.shift * s.shift : t.pop * t.pop) % m
            k -= 2
        end
    end
end

puts ans

Measured memory_bytes: 33824
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll P = 998244353;
int main(int argc, char const *argv[]) {
  ll n, s;std::cin >> n >> s;
  vvl dp = VV(n+1, s+1, 0, ll);
  dp[0][0] = 1;
  vll a(n);re(i, n) scanf("%lld", &a[i]);

  for(int i=0;i<n;i++){
    for(int j=0;j<=s;j++){
      dp[i+1][j] = (dp[i+1][j] + (dp[i][j]*2)%P)%P;
      if(j+a[i]<=s) dp[i+1][j+a[i]] = (dp[i+1][j+a[i]] + dp[i][j])%P;
    }
    //for(int j=1;j<=s;j++) dp[i][j] = (dp[i][j]*2)%P;
  }
  std::cout << dp[n][s] << '\n';
  return 0;
}


Measured memory_bytes: 73668
from math import factorial
MOD = 10**9 + 7

# 階乗を用意
fact = [1] * (10**5 + 1)
for i in range(1, 10**5 + 1):
    fact[i] = fact[i-1] * i
    fact[i] %= MOD

def comb(n, k, p):
    """power_funcを用いて(nCk) mod p を求める"""
    global fact
    if n < 0 or k < 0 or n < k:
        return 0
    if n == 0 or k == 0:
        return 1
    a = fact[n]
    b = fact[k]
    c = fact[n-k]
    return (a*power_func(b, p-2, p)*power_func(c, p-2, p)) % p

def power_func(a, b, p):
    """a^b mod p を求める"""
    if b == 0:
        return 1
    if b % 2 == 0:
        d = power_func(a, b//2, p)
        return d*d % p
    if b % 2 == 1:
        return (a*power_func(a, b-1, p)) % p

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

ans = 0

# pos
for i in range(n-1):
    c = comb(n-1-i, k-1, MOD)
    ans += a[n-1-i] * c
    ans %= MOD
    ans -= a[i] * c
    ans %= MOD
print(ans)



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

class Card {
private:
	string type;//入力文字列
	short number;//typeの番号
public:
	short order;//入力順番

	void InputType();//typeへ入力
	void ChangeType();//TypeをNumberへ変更
	short GetNumber();//number取得
	string GetType();
};

void Copy(Card* tocard, Card *fromcard,short size);
void BubbleSort(Card* card, short size);
void SelectSort(Card* card, short size);
void ResultOutput(Card* card, short size);
bool IsStable(Card* card, short size);

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

	Card card[36], copycard[36];

	//カード入力　数字部分変更	入力順番
	for (short i = 0; i < N; i++) {
		card[i].InputType();
		card[i].ChangeType();
		card[i].order = i;
	}

	Copy(copycard, card,N);//配列をソート用にコピー

	BubbleSort(copycard, N);//バブルソート
	ResultOutput(copycard, N);//結果出力

	//安定判定
	if (IsStable(copycard, N)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}

	//もう一度コピー
	Copy(copycard, card, N);

	SelectSort(copycard, N);//選択ソート

	ResultOutput(copycard, N);

	//安定判定
	if (IsStable(copycard, N)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}

	return 0;
}

void Card::InputType()
{
	cin >> type;
}

void Card::ChangeType()
{
	const char* a = &type[1];

	number = atoi(a);
}

short Card::GetNumber()
{
	return number;
}

string Card::GetType()
{
	return type;
}

void Copy(Card* tocard,Card *fromcard, const short size)
{
	for (short i = 0; i < size; i++) {
		tocard[i] = fromcard[i];
	}
}

void BubbleSort(Card *card, const short size)
{

	for (short i = size - 1; i > 0; i--) {
		for (short j = 0; j < i; j++) {
			if (card[j].GetNumber() > card[j + 1].GetNumber()) {
				std::swap(card[j], card[j + 1]);
			}
		}
	}
}

void SelectSort(Card *card, const short size)
{
	int keep;

	for (int i = 0; i < size; i++) {
		keep = i;
		for (int j = i; j < size; j++) {
			if (card[j].GetNumber() < card[keep].GetNumber()) {
				keep = j;
			}
		}
		if (keep != i) {
			std::swap(card[i], card[keep]);
		}
	}
}

void ResultOutput(Card *card,const short size)
{
	for (short i = 0; i < size; i++) {
		cout << card[i].GetType();
		if (i == size - 1) {
			break;
		}
		cout << " ";
	}
	cout << endl;
}

bool IsStable(Card* card,const short size)
{
	for (short i = 0; i < size - 1; i++) {
		//安定していない
		if (card[i].GetNumber() == card[i + 1].GetNumber() && card[i].order > card[i+1].order) {
			return false;
		}
	}

	return true;

}


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

int dp[50][1 << 16];
int n, x, y, z;
int ok(int v) {
	bool a = false, b = false;
	int c = 0, d = 0;
	for (int i = 0; i < 17; i++) {
		c++;
		if (v >> i & 1) {
			if (!a&&c == z)a = true, c = 0;
			if (a && !b&&c == y)b = true, c = 0;
			if (a&&b&&c == x)return -1;
		}
		if (i != 16)d |= (v >> i & 1) << i;
	}
	return d;
}
int main() {
	scanf("%d%d%d%d", &n, &x, &y, &z);
	dp[0][0] = 1;
	rep(i, n)rep(j, 1 << 16) {
		if (dp[i][j] == 0)continue;
		for (int k = 1; k <= 10; k++) {
			int t = j << k; t |= 1 << (k - 1);
			int res = ok(t);
			if (res != -1)(dp[i + 1][res] += dp[i][j]) %= MOD;
		}
	}
	ll ans = 0, b = 1;
	rep(i, n)(b *= 10) %= MOD;
	rep(j, 1 << 16)(ans += dp[n][j]) %= MOD;
	printf("%lld\n", (b - ans + MOD) % MOD);
}

Measured memory_bytes: 11520
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int N;
    int X[100];

    scanf("%d", &N);
    for(int i=0;i<N;i++)
    {
        scanf("%d", &X[i]);
    }

    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += X[i];
    }
    int avg = sum / N; 
    int rem =  sum % N;
    avg = (rem < N -rem) ? avg : avg + 1;
    
    int sq = 0;
    for (int i = 0; i < N; i++)
    {
        sq += (X[i]-avg)*(X[i]-avg);   
    }

    printf("%d", sq);

    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    for (int i = 1; i < 10; i++)
    {
        if (N % i == 0)
        {
            if (N / i < 10)
            {
                cout << "Yes" << endl;
                return 0;
            }
            else
            {
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    assert(n >= r);
    assert(n >= 0);
    assert(r >= 0);
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,a,b,c,d,e,q;

ll x[200005], y[100005], z[100005];
ll k, ans;
ll dp[1005][1005];
ll before[200005];

void solve(){
    cin >> n >> k;
    for(ll i=1;i<=n;i++){
        cin >> x[i];
    }
    for(ll i=1;i<=n;i++){
        before[i] = -1;
    }
    ll v = 1;

    while(true){
        v = x[v];
        k--;
        if(before[v] != -1){
            k %= (before[v] - k);
        }
        before[v] = k;
        if(k == 0){
            p(v);
            return;
        }
    }

    return;
}

int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















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

int main() {
	string S;
	int p;

	cin >> S;

	p=0;
	rep(i, S.size())p+=S.at(i)-'0';
	if (p%9>0) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n;
  cin >> n;
  
  vector<int> v(n);
  for(int i; i < n; i++)
    cin >> v.at(i);
  
  int j = 100;
  for(int i; i < n; i++){
    if((v.at(i) % 10 != 0) && v.at(i) < j)
      j = v.at(i);
  }
  
  int s = 0;
  
  if(j == 100)
    cout << 0 << endl;
  else{
    for(int i; i < n; i++)
      s += v.at(i);
    if(s % 10 == 0)
      cout << s-j << endl;
    else
      cout << s << endl;
  }
}
    

Measured memory_bytes: 256
#include <iostream>

int main() {
    long n, d, x, y, count = 0;
    std::cin >> n >> d;

    while(n--) {
        std::cin >> x >> y;

        if((x*x + y*y) <= d*d) {
            ++count;
        }
    }

    std::cout << count << "\n";
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    vector<int> o = a;
    auto f = [&](auto x) {REP(i, n) cout << x[i] << (i == n - 1 ? endl : ' ');};
    auto b = prev_permutation(ALL(a));
    if (b) f(a);
    f(o);
    b = next_permutation(ALL(o));
    if (b) f(o);
}



Measured memory_bytes: 3216
x1,x2,x3,x4,x5 = map(int,input().split())

if x1 != 1:
  print(1)
elif x2 != 2:
  print(2)
elif x3 != 3:
  print(3)
elif x4 != 4:
  print(4)
else:
  print(5)

Measured memory_bytes: 9108
n, a, b = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    X = 1
    Y = 1
    for i in range(1,r+1):
        X = (X*(n-i+1))%mod
        Y = (Y*i)%mod
    return (X*pow(Y, mod-2, mod))%mod

ans = (pow(2, n, mod) -1 - comb(n, a, mod) - comb(n, b, mod))%mod
print(ans)

Measured memory_bytes: 3064
import copy
import statistics
n = int(input())
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
z.sort()
t = (z[int(n / 2) - 1] + z[int(n / 2)]) / 2

for i in range(n):
  if x[i] < t:
    print(z[int(n / 2)])
  else:
    print(z[int(n / 2) - 1])

Measured memory_bytes: 27292
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    vector<int> pow2(25, 1);
    repr(i, 1, 25) pow2[i] = pow2[i-1] * 2;
    int L; cin >> L;
    int r;
    rep(i, 21) if(pow2[i] > L) {
        r = i-1; break;
    }

    vector<int> u, v, w;
    int N = r + 1;
    repr(i, 1, N){
        u.push_back(i);
        v.push_back(i+1);
        w.push_back(0);
        u.push_back(i);
        v.push_back(i+1);
        w.push_back(pow2[i-1]);
    }

    reprrev(t, 1, N){
        if(L - pow2[t-1] >= pow2[r]){
            u.push_back(t);
            v.push_back(N);
            w.push_back(L - pow2[t-1]);
            L -= pow2[t-1];
        }
    }

    cout << N << " " << (int) u.size() << endl;
    rep(i, (int) u.size()){
        cout << u[i] << " " << v[i] << " " << w[i] << endl;
    }

    return 0;
}

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

y = [[[0 for i in range(10)] for v in range(3)] for k in range(4)]

for i in range(0,n):
    b,f,r,v = map(int,input().split(' '))
    y[b-1][f-1][r-1] += v

for b in range(4):
    for f in y[b]:
        print('', *f)
    if b != 3:
        print('#' * 20)


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

int main() {
  int a;
  int count;
  cin >> a;
  count += a%10;
  a -= a%10;
  count += (a%100)/10;
  a -= a%100;
  count += a/100;
  
  cout << count << endl;
}

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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i=1; i<n; i++) {
    if (s[i] == 'E') ans++;      
  }
  int temp = ans;
  for (int i=1; i<n; i++) {
    if (s[i] == 'E') temp--;
    if (s[i-1] == 'W') temp++;
    if (temp < ans) ans = temp;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 900
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var lines = [];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
reader.on('line', (line) => {
    // ここで入力を処理する
    lines.push(line);
});
reader.on('close', () => {
    // ここで出力する
    var n = Number(lines[0]);
    console.log((n + (n % 2)) / (2 * n));
    //for(var i =0; i<lines.length; i++){
    //  console.log(lines[i]);
    //}
});

Measured memory_bytes: 7756
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define Int long long
#define rep(i, n) for (Int i = 0; i < n; i++)
#define in(params) cin >> params;
#define p(params) cout << params << endl;
#define mod 1000000007LL

using namespace std;

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

  int A;

  double d = 0;

  for (int i = 0; i < N; i++) {
    cin >> A;

    d += (double)1 / (double)A;
  }

  cout << 1 / d << endl;

  return 0;
}

Measured memory_bytes: 256