akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        sc.close();

        int max = 0;

        for(int i = 1; i < S.length(); i++){
            if((S.length()-i) % 2 != 0)
                continue;
            else{
                if(S.substring(0,(S.length()-i)/2).equals(S.substring((S.length()-i)/2, S.length()-i))){
                    max = Math.max(S.length()-i, max);
                    break;
                }
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

#define MAXN 100010
#define ri register int

using namespace std;

int N;
int a[MAXN];

inline int read_int()
{
	register int ret = 0, f = 1; register char c = getchar();
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') {ret = (ret << 1) + (ret << 3) + int(c - 48); c = getchar();}
	return ret * f;
}

inline bool cmp(int x, int y) {return x > y;}

inline void init()
{
	N = read_int();
	for(ri i = 1; i <= N; i++)
		a[i] = read_int();
	sort(a + 1, a + N + 1, cmp);
}

inline void dp()
{
	for(ri i = 1; i <= N; i++)
	{
		if(i + 1 > a[i + 1])
		{
			ri j = i + 1, ans = 0;
			while(a[j] == i)
				ans ^= 1, j++;
			if((ans || ((a[i] - i) & 1)))
				puts("First");
			else
				puts("Second");
			return;
		}
	}
}

int main()
{
	init();
	dp();
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
	int x, n, i, j;

	cin >> x;
	i = 0;
	j = 0;
	while (j < x) {
		i++;
		j += i;
	}

	cout << i;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int A,B,x,y,z;
    scanf("%d %d",&A,&B);
    x=(A+B);
    y=(A-B);
    z=(A*B);
    if (x>=y&&x>=z)
    {
        printf("%d\n",x);
    }
    else if (y>=x&&y>=z)
        {
        printf("%d\n",y);
        }
    else
        {
        printf("%d\n",z);
        }
    return 0;
}


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

int main() {
	int A, B, V, W, T;
	cin>>A>>V;
	cin>>B>>W;
	cin>>T;
	if(W > V) {
		cout<<"NO\n";
	} else {
		int v_rel = V-W;
		int distance = max(A-B, B-A);
		long long distance_covered = (long long)v_rel*T;
		if(distance_covered >= (long long)distance) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

//入力
int n, a, b;
int p[110];
int c1, c2, c3;

int main()
{
    cin >> n;
    cin >> a >> b;
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (p[i] <= a)
            c1++;
        else if (p[i] >= a + 1 && p[i] <= b)
            c2++;
        else if (p[i] >= b + 1)
            c3++;
    }
    cout << min(min(c1, c2), c3) << endl;
}

Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


ll mp[Max];


void primefact(ll n)
{

    ll cnt=0;

    while(n%2==0)
    {
        n/=2;
        cnt++;
    }

    mp[2]=max(mp[2],cnt);

    cnt=0;


    for(ll i=3; i<=sqrt(n); i+=2)
    {
        cnt=0;

            while(n%i==0)
            {
                n/=i;

                cnt++;
            }

            mp[i]=max(mp[i],cnt);

    }

    if(n>2)
        mp[n]=max(mp[n],1ll);
}
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}
int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;


        cin>>n;

        ll ara[n+2];

        input(ara,n);

        sum=accumulate(ara,ara+n,0);


        cout<<sum-n<<endl;













}


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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}
//---------------------------------------------------------------
int main(){
  ll A,B,C,D;
  cin>>A>>B;
  cin>>C>>D;
  string ans;
  while(1){
    C-=B;
    if(C<=0){
      ans = "Yes";
      break;
    }

    A-=D;
    if(A<=0){
      ans = "No";
      break;

    }

  }
  cout<<ans<<endl;



}


Measured memory_bytes: 3640
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,k;
	int ans = 1;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		if(i==0) ans *= k;
		else ans *= k - 1;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 128
n=io.read("*n","*l")
t={}
for i=1,n do
    x=io.read()
    s,p=x:match("(%w+) (%d+)")
    table.insert(t, {s,tonumber(p),i})
end
table.sort(t,function(x,y)
    if x[1]~=y[1] then
        return x[1]<y[1]
    else
        return x[2]>y[2]
    end
end)
for i=1,n do
    print(t[i][3])
end

Measured memory_bytes: 256
from collections import defaultdict
n,k = map(int,input().split())
l = list(map(int,input().split()))

mod = [0]
for i in range(n):
    a = (l[i]-1)%k
    mod.append((mod[-1]+a)%k)
dic = {0:1}
ans = 0
for i in range(1,n+1):
    if i < k:
        if mod[i] in dic:
            ans += dic[mod[i]]
            dic[mod[i]] += 1
        else:
            dic[mod[i]] = 1
    else:
        dic[mod[i-k]] -= 1
        if mod[i] in dic:
            ans += dic[mod[i]]
            dic[mod[i]] += 1
        else:
            dic[mod[i]] = 1
    
print(ans)


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

def dfs(s):
    if int(s) > n:
        return 0
    else:
        ret = 0
        if all(s.count(i) > 0 for i in "753"):
            ret += 1
        for i in "753":
            ret += dfs(s+i)
    return ret

print(dfs("0"))

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

int main(void){
    int n, k;
    cin >> n >> k;

    int ans = 1;
    for(int i=0; i<n; i++){
        if(ans < k){
            ans *= 2;
        }else{
            ans += k;
        }
    }

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

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

int main() {
    int a, b;
    cin >> a >> b;
    
    int ans = 0;
    if(a >= 13) ans = b;
    else if(a >= 6) ans = b/2;
    else ans = 0;

    cout << ans << endl;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    else if(s == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

struct Data {
    ll y, x, dir, cost, rem;
    
    bool operator<(const Data &b) const {
        if (cost == b.cost) return rem < b.rem;
        return cost > b.cost;
    };
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    const ll dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
    ll h, w, k;
    cin >> h >> w >> k;
    ll sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    sx--; sy--; gx--; gy--;
    swap(sx, sy); swap(gx, gy);
    vector<string> c(h);
    rep(i, h) cin >> c[i];
    // dp[y][x][dir] = { cost, rem }
    vector<vector<vector<pair<ll, ll>>>> dp(h, vector<vector<pair<ll, ll>>>(w, vector<pair<ll, ll>>(4, make_pair(inf, 0))));
    priority_queue<Data> pq;
    auto push = [&](Data d) {
        if ((d.x < 0) || (d.x >= w) || (d.y < 0) || (d.y >= h)) return;
        if (c[d.y][d.x] == '@') return;
        if (d.rem < 0) {
            d.rem = k - 1;
            d.cost++;
        }
        if (dp[d.y][d.x][d.dir].first < d.cost) return;
        if ((dp[d.y][d.x][d.dir].first == d.cost) && (dp[d.y][d.x][d.dir].second >= d.rem)) return;
        dp[d.y][d.x][d.dir] = make_pair(d.cost, d.rem);
        pq.push(d);
    };
    rep(i, 4) push((Data){sy, sx, i, 1, k});
    while(!pq.empty()) {
        Data d = pq.top(); pq.pop();
        if (dp[d.y][d.x][d.dir] != make_pair(d.cost, d.rem)) continue;
        // 直進
        {
            push((Data){d.y + dir[d.dir][0], d.x + dir[d.dir][1], d.dir, d.cost, d.rem - 1});
        }
        // 方向転換
        rep(i, 4) {
            push((Data){d.y + dir[i][0], d.x + dir[i][1], i, d.cost + 1, k - 1});
        }
    }
    ll ans = LONG_LONG_MAX;
    rep(i, 4) ans = min(ans, dp[gy][gx][i].first);
    cout << ((ans == inf) ? -1 : ans) << endl;
    return 0;
}


Measured memory_bytes: 207268
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

vector<string> G(805);
vector<vector<bool> > used(805, vector<bool>(805, false));
vec x = {-1, 0, 1, 0}, y = {0, -1, 0, 1};
bool in_grid(ll i, ll j){
    return i >= 0 && i < H && j >= 0 && j < W;
}

int main() {
    cin>>H>>W>>K;
    rep(i,H) cin>>G[i];
    ll start, minD = INF;
    rep(i,H) rep(j,W) if(G[i][j] == 'S') start = i * W + j;
    queue<P> que;
    que.emplace(start, K);
    used[start/W][start%W] = true;
    while(!que.empty()){
        P p = que.front();
        que.pop();
        ll i = p.fi/W, j = p.fi%W;
        minD = min({minD, i, j, H - 1 - i, W - 1 - j});
        if(p.se == 0) continue;
        --p.se;
        rep(k,4){
            ll I = i + x[k], J = j + y[k];
            if(in_grid(I, J)){
                if(!used[I][J] && G[I][J] == '.') {
                    used[I][J] = true;
                    que.emplace(I*H + J, p.se);
                }
            }
        }
    }
    cout<<1LL + (minD + K - 1LL)/K<<endl;
    //cout<<minD<<endl;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0;i < n;i ++){
        cin >> h.at(i);
    }

    for(int i = n-2;i >= 0;i --){
        if(h.at(i) > h.at(i+1) +1){
            cout <<"No" << endl;
            return 0;
        }
        if(h.at(i) == h.at(i+1) +1){
            h.at(i) --;
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 640
//Compete against Yourself.
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

char c;
int32_t main(){_
   
   cin >> c;  
   
   char n = 'a' + (c - 'a' + 1) % 26;
   cout<<n;

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g;}
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	int n,h,w; 
      cin >> n>>h>>w;
      n++;
	co((n-h)*(n-w));
	return 0;
}
//Submitted from iphone

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//実行部
void Main()
{
  ll a; cin >> a;
  if(a < 1000) fin("ABC")
  else fin("ABD")
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=1002;
int f[N],n;
double t,x[N],y[N],r[N],d[N],a[N][N];
int main(){
	scanf("%lf%lf%lf%lf%d",x,y,x+1,y+1,&n);
	for (int i=2;i<n+2;i++)scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
	for (int i=1;i<n+2;i++)
		for (int j=0;j<i;a[j][i]=a[i][j],j++)
			if ((a[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j])<0)a[i][j]=0;
	for (int i=0;i<n+2;i++)d[i]=a[0][i];
	f[0]=1;
	for (int i=0;i<n;i++){
		int k,t=2e9;
		for (int j=1;j<n+2;j++)
			if (!f[j]&&d[j]<t)k=j,t=d[j];
		f[k]=1;
		for (int j=1;j<n+2;j++)
			if (d[k]+a[k][j]<d[j])d[j]=d[k]+a[k][j];
	}
	printf("%.9f",d[1]);
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  ll n; cin >> n;
  ll ans = LINF;
  ll a[n];
  ll sum = 0;
  REP(i,n) { cin >> a[i]; sum+=a[i]; }

  ll left=0;
  REP(i,n-1) {
    left+=a[i];
    ans = min(ans, abs(left - (sum-left)));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
# include<iostream>
using namespace std;
int main()
{
	int n, k, x, y;
	cin >> n 
		>> k
		>> x 
		>> y;
	if (k > n)
	{
		cout << n * x << endl;
	}
	else
	{
		cout << (k*x) + (n - k)*y << endl;
	}
		return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

money = 0
now = 0
for i in range(N):
    money += abs(now - A[i])
    now = A[i]
money += abs(A[i])

now = 0
for i in range(N):
    add = 0
    add -= abs(now - A[i])
    if i < N-1:
        add -= abs(A[i] - A[i+1])
        add += abs(now - A[i+1])
    else:
        add -= abs(A[i])
        add += abs(now)
    now = A[i]
    print(money + add)




Measured memory_bytes: 14048
n, m = list(map(int,input().split()))
a = list(map(int,input().split()))
s = sum(a)
x = (1/(4*m))*(s)
u = 0
for i in a:
    if(i>=x):
        u+=1
if(u>=m):
    print("Yes")
else:
    print("No")

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



int sc1() {int x; scanf("%d", &x); return x;}
long long sc2() {long long x; scanf("%lld", &x); return x;}

void out(int x) { printf("%d", x);}
void outnl(int x) { printf("%d\n", x);}
void outsps(int x){printf("%d ", x);}

#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>
#define  nl               printf("\n");

const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 2e6 + 5;

inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (ll)a * b % mod;}


 int vis[N];

 int a[N],b[N];

int solve() {

    int a=Int,b=Int,c=Int;
    if(a+b+c>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;
    return 0;
}




int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int test = 1, tc = 0;
    //scanf("%d", &test); 
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }

    return 0;




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
string S;

ll dp[3010][3010];

void solve() {
	cin >> N;
	cin >> S;
	rep(i, 0, N) {
		dp[1][i] = 1;
	}
	rep(i, 1, N) {
		rep(j, 0, N - i + 1) {
			if(S[i - 1] == '>') {
				ADD(dp[i + 1][0], dp[i][j]);
				ADD(dp[i + 1][j], mod - dp[i][j]);
			}
			else {
				// debug(i, j, N - i - j);
				ADD(dp[i + 1][j], dp[i][j]);
				ADD(dp[i + 1][N - i], mod - dp[i][j]);
			}
		}
		// debug(vi(dp[i + 1], dp[i + 1] + N));
		rep(j, 0, N - i) {
			ADD(dp[i + 1][j + 1], dp[i + 1][j]);
		}
		// debug(vi(dp[i + 1], dp[i + 1] + N));
	}
	cout << dp[N][0] << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 70016
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

cnt = 0; correct = 0
for v in d.values():
    if "AC" not in v:
        continue
    correct += 1
    cnt += v.index("AC") 

print(correct, cnt)


Measured memory_bytes: 31564
// c lib
#include <cstdio>
#include <cstdlib>
#include <cmath>

// container
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <array>

// Convenience
#include <algorithm>
#include <functional>

// IO
#include <iostream>

using namespace std;
constexpr long long NMAX = 200000;
constexpr long long AMAX = 1e9;

long long result = 0;

long long L[NMAX];
long long R[NMAX];
void merge(long long* A, long long s, long long m, long long e) {
    auto lp = L;
    auto rp = R;
    for (auto i = s; i < m; i++) {
        L[i - s] = A[i];
    }
    L[m - s] = AMAX + 1ll;
    for (auto i = m; i < e; i++) {
        R[i - m] = A[i];
    }
    R[e - m] = AMAX + 1ll;

    auto ap = A + s;
    while (ap != A + e) {
        if (*lp > *rp) {
            *ap = *rp;
            ap++;
            result += (L + (m - s)) - lp;
            rp++;
        } else {
            *ap = *lp;
            ap++;
            lp++;
        }
    }
}

void merge_sort(long long* A, long long s, long long e) {
    auto m = (s + e) / 2ll;
    if (m == s) {
        return;
    }
    merge_sort(A, s, m);
    merge_sort(A, m, e);
    merge(A, s, m, e);
}

int main() {
    auto n = 0ll;
    cin >> n;
    
    auto A = new long long [n];
    for (auto i = 0ll; i < n; i++) {
        cin >> A[i];
    }

    merge_sort(A, 0, n);

    cout << result << endl;
}


Measured memory_bytes: 6192
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    string s; cin >> s;
    bool res = true;
    REP(i, s.size()){
        if(s[i] == 'R' and (i + 1) % 2 == 0) res = false;
        else if(s[i] == 'L' and (i + 1) % 2 != 0) res = false;
        
        if(!res) break;
    }

    cout << (res ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define umap unordered_map
#define uset unordered_set
#define ll long long
#define lll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
#define Lets_be_precise cout<<fixed<<setprecision(10)
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
	cin>>v[i];
}
//#define cerr if(false)cerr//uncomment to remove cerr from program...
void solveforthiscase(const int & test)
{//deb(test);
cin>>k;
cin>>n;
vll v(n);
read(v);
ll ans=v[n-1]-v[0];
for(int i=0;i<n;i++)
{
    if(i!=n-1)
    {
    temp=k-(v[i+1]-v[i]);
    ans=min(ans,temp);
    }
    if(i!=0)
    {
        ans=min(ans,k-(v[i]-v[i-1]));
    }
}
cout<<ans;









return ;
}

int main()
{
	ios_base::sync_with_stdio(false);
	Lets_be_precise;
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 1792
import std.stdio;
import std.algorithm;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{//try{
	auto tokens = split(my_readln());
	auto N = to!ulong(tokens[0]);

	ulong[] A;

	foreach (i; 0..N)
	{
		auto tokens2 = split(my_readln());
		A ~= to!ulong(tokens2[0]);
	}

	string ans = "second";

	foreach (e; A)
	{
		if (e % 2 == 1)
		{
			ans = "first";
			break;
		}
	}

	writeln(ans);
	stdout.flush();
/*}catch (Throwable e)
	{
		writeln(e.toString());
	}
readln();*/
}

Measured memory_bytes: 4092
import collections
import numpy as np
 
N,M = list(map(int,input().split()))
A = np.array(input().split(),dtype='int64')
C = np.append([0],np.cumsum(A))

L = C % M
L_c = collections.Counter(L)
 
ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Measured memory_bytes: 23808
import java.util.*;
 
class Main{
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		List<String> list = new ArrayList<String>();

        while(true){
			int m = scan.nextInt(); //??????????¨?????????°(50?????????)
			int f = scan.nextInt(); //??????????¨?????????°(50?????????)
			int r = scan.nextInt();	//???????¨?????????° (100?????????)

			if(m==-1 && f==-1 && r==-1){
				break;
			}
			
			if(m==-1 || f==-1){ //??????????¨??????????????¨????????????????????¬????????????´???????????? F???
				list.add("F");
			}
			else if((m + f) >= 80){ //??????????¨???¨??????????¨????????¨??????°??? 80 ??\???????????°????????? A
				list.add("A");
			}
			else if((m + f) >= 65 && (m + f) < 80){ //??????????¨???¨??????????¨????????¨??????°??? 65 ??\??? 80 ??????????????°????????? B
				list.add("B");
			}
			else if((m + f) >= 50 && (m + f) < 65){ //??????????¨???¨??????????¨????????¨??????°??? 50 ??\??? 65 ??????????????°????????? C
				list.add("C");
			}
			else if((m + f) >= 30 && (m + f) < 50){ //??????????¨???¨??????????¨????????¨??????°??? 30 ??\??? 50 ??????????????°????????? D
				if(r >= 50){ //???????????????????¨?????????°??? 50 ??\???????????°????????? C
					list.add("C");
				}
				else{
					list.add("D");
				}
			}
			else if((m + f) < 30){ //??????????¨???¨??????????¨????????¨??????°??? 30 ??????????????°????????? F
				list.add("F");
			}
		}
		for(String str : list){
			System.out.println(str);
		}
    }
}

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

using namespace std;
using ll = long long;

int odd, even;

ll dp[51][51];

ll bino(int n, int r)
{
    if (n < r || n < 0 || r < 0)
        return 0;
    
    ll &ret = dp[n][r];

    if (ret == -1)
        ret = bino(n - 1, r) + bino(n - 1, r - 1);

    return ret;
}

ll po(ll a, int b)
{
    if (!b)
        return 1;

    if (b == 1)
        return a;
    
    if (b & 1)
        return po(a, b - 1) * a;
    
    return po(a * a, b / 2);
}

int main()
{
    memset(dp, -1, sizeof dp);
    ios::sync_with_stdio(false); cin.tie(0);
    dp[0][0] = dp[1][0] = dp[1][0] = 1;

    int n, p;
    cin >> n >> p;

    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;

        if (x & 1)
            ++odd;
        else
            ++even;
    }

    int factor;
    ll res = 0;

    if (!p)
    {
        factor = 0;

        while (factor <= odd)
        {
            res += po(2, even) * bino(odd, factor);
            factor += 2;
        }
    }
    else
    {
        factor = 1;

        while (factor <= odd)
        {
            res += po(2, even) * bino(odd, factor);
            factor += 2;
        }    
    }

    cout << res;
}

Measured memory_bytes: 3676
import sys
input = sys.stdin.readline

class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

def main():
    n = int(input())
    xy = [list(map(int,input().split())) for i in range(n)]
    xy2 = [[x[0],x[1],i] for (i,x) in enumerate(xy)]
    xy2.sort()
    u = Unionfind(n)

    l = []
    for x,y,ind in xy2:
        M = y
        le = ind
        while l and xy[l[-1]][1] < y:
            v = l.pop()
            if M > xy[v][1]:
                M = xy[v][1]
                le = v
            u.union(ind,v)
        l.append(le)
    for i in range(n):
        print(u.size(i))

if __name__ == "__main__":
    main()

Measured memory_bytes: 128452
import java.util.*;

public class Main {
    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String S = sc.next();
        for(int i=0; i<(int)S.length()/2; i++){
            if(S.charAt(i) != S.charAt(S.length()-i-1)){
                count++;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 35368
import kotlin.math.*

fun main(args: Array<String>) {
    val (x, n) = readListInt()
    if (n == 0) {
        println(x)
        return
    }
    val p = readListInt()
    p.sorted()
    var m = Int.MAX_VALUE
    var a = 0
    for (i in p) {
        if (m > abs(i - x)) {
            m = min(m, abs(i - x))
            a = i
        }
    }
    var k = a
    var j = a
    var ans = 0
    while (true) {
        k--
        j++
        if (!p.contains(k)) {
            ans = k
            break
        }
        if (!p.contains(j)) {
            ans = j
            break
        }
    }
    println(ans)




}

private fun read() = readLine()!!

private fun readInt() = read().toInt()

private fun readLong() = read().toLong()

private fun readDouble() = read().toDouble()

private fun readListString() = read().split(" ")

private fun readListInt() = readListString().map { it.toInt() }

private fun readListLong() = readListString().map { it.toLong() }

private fun readListDouble() = readListString().map { it.toDouble() }

private fun readMatrixString(n: Int): List<List<String>> {
    val matrix = mutableListOf<List<String>>()
    for (i in 0 until n) {
        val list = readListString()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixInt(n: Int): List<List<Int>> {
    val matrix = mutableListOf<List<Int>>()
    for (i in 0 until n) {
        val list = readListInt()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixDouble(n: Int): List<List<Double>> {
    val matrix = mutableListOf<List<Double>>()
    for (i in 0 until n) {
        val list = readListDouble()
        matrix.add(list)
    }
    return matrix
}

private fun readMatrixLong(n: Int): List<List<Long>> {
    val matrix = mutableListOf<List<Long>>()
    for (i in 0 until n) {
        val list = readListLong()
        matrix.add(list)
    }
    return matrix
}



Measured memory_bytes: 39028
#include <iostream>
#include <math.h>
using namespace std;

int n;

int main() {
	while(cin>>n){
		if(n==-1)return 0;
		int m=n,d=1;
		while(m>3){m/=4;d++;}
		for(int i=d-1;i>=0;i--)cout<<(n/(int)(pow(4,i)+0.1))%4;
		cout<<endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

const int M = 13;

string s;
ll t = 1, ans;
ll dp[2][13];
int ho = 0, ge = 1;

int main() {
    cin >> s;
    dp[ho][0] = 1;
    for (int i = (int)s.size()-1; i >= 0; i--) {
        rep(j,M) dp[ge][j] = 0;
        if (s[i] != '?') {
            int x = s[i]-'0';
            rep(j,M) dp[ge][(t*x+j)%M] = dp[ho][j];
        } else {
            rep(j,10) {
                rep(k,M) dp[ge][(t*j+k)%M] = (dp[ge][(t*j+k)%M]+dp[ho][k]) % MOD;
            }
        }
        t = t * 10 % M;
        swap(ho,ge);
    }
    cout << dp[ho][5] << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<algorithm>
using namespace std;
char ans[20]="CODEFESTIVAL2016";
char in[20];
int main(){
	scanf("%s",in);
	int ret=0;
	for(int i=0;i<16;i++)if(in[i]!=ans[i])ret++;
	printf("%d\n",ret);
}

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

 int main() {
  char b;
  cin >> b;
   
  if(b == 'A'){
    cout << 'T' << endl; 
  }else if(b == 'C'){
    cout << 'G' << endl;
  }else if(b == 'G'){
    cout << 'C' << endl;
  }else if(b == 'T'){
    cout << 'A' << endl;
  }
} 

Measured memory_bytes: 256
#pragma warning (disable:4996)
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	long long x[1005][3];
	for (int i = 0; i < n; i++)
	{
		cin >> x[i][0] >> x[i][1] >> x[i][2];
	}
	long long out=-1000000000;
	long long v[1005];
	long long z;
	int a[3];

	a[0] = -1;
	a[1] = -1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = -1;
	a[1] = -1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = -1;
	a[1] = 1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = -1;
	a[1] = 1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = -1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = -1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = 1;
	a[2] = -1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;


	a[0] = 1;
	a[1] = 1;
	a[2] = 1;
	z = 0;
	for (int i = 0; i < n; i++)
	{
		v[i] = a[0] * x[i][0] + a[1] * x[i][1] + a[2] * x[i][2];
	}
	sort(v, v + n);
	for (int i = 0; i < m; i++)
	{
		z += v[n - 1 - i];
	}
	if (out < z) out = z;

	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

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

func main() {
	sc.Split(bufio.ScanWords)

	N, K := getInt(), getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}

	sort.Ints(a)

	sum := 0
	ans := N
	for i := len(a) - 1; i >= 0; i-- {
		if a[i]+sum < K {
			sum += a[i]
		} else {
			ans = i
		}
	}
	out(ans)
}


Measured memory_bytes: 768
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<functional>
#include <bitset>
#include<algorithm>
#include<fstream>
#include<string>
#include <cstring>
#include<stdio.h>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<vector>
#include<assert.h>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
// never lose hope ..
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-8
using namespace std;
double const  PI = 3.141592653;
const int OO = 1000000000+ 4;
 
void fast() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL), cout.tie(NULL);
}
 
ll n, w;
vector<pair<int, int>>v;
ll dp[104][(int)1e5 + 4];
 
ll solve(int i, int val) {
	if (val == 0)return 0;
	if (i>= n || val < 0)return OO;
	if (dp[i][val] != -1) {
		return dp[i][val];
	}
	return dp[i][val] = min(solve(i+1, val), solve(i + 1, val - v[i].second) + v[i].first);
}
 
 
int main()
{
	fast();
 
	cin >> n >> w;
	v.resize(n);
	for (auto& i : v) {
		cin >> i.first >> i.second; //w,v
	}
	memset(dp, -1, sizeof(dp));
	int an = 0;
	for (int i = 0;i < (int)1e5 + 4;i++) {
		if (solve(0, i) > w)continue;
		an = max(an, i);
	}
	cout << an;
 
	return 0;
}

Measured memory_bytes: 81536
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
#define PI 3.1415926535

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;}

char upper(char c){
    if('a' <= c && c <= 'z'){
        c = c - ('a' - 'A');
    }
    return c;
}

char lower(char c){
    if('A' <= c && c <= 'Z'){
        c = c + ('a' - 'A');
    }
    return c;
}

const ll INF = 1000000000000000000;

//input



//processing



//dpTable
//int dp[100050];

int main(){
    ll A,V,B,W,T;
    cin >> A >> V >> B >> W >> T;
    if (V <= W) cout << "NO" << endl;
    else {
        if ((V - W) * T >= abs(B - A)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int p, q, r;
	cin >> p >> q >> r;

	int maxi = max({p, q, r});
	int ans = p + q + r - maxi;

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


Measured memory_bytes: 764
import java.io.PrintWriter
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val n = sc.nextLong()
    val k = sc.nextLong()
    abc161c(n,k)
}

fun abc161c(n:Long, k:Long) {
   if(n == k){
       println(0)
   }else if(n > k){
       val tmp = n % k
       val next = Math.abs(tmp-k)
       if(tmp > next) println(next) else println(tmp)
   }else{
       if(Math.abs(n-k) > n) println(n) else println(Math.abs(n-k))
   }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 31260
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

const ll MXV=1e6;
vl G[MXV];
vl seen(MXV,0);
vl d(MXV,0);

ll dfs(ll s){
    if(seen[s]==2){
      	return d[s];
    }
    seen[s]=1;
    ll k=G[s].size();
    if(k==0){
      	d[s]=0;
      	seen[s]=2;
        return d[s];
    }
    else{
    	rep(i,k){
        	if(seen[G[s][i]]==1){
            	cout << -1 << endl;
            	exit(0);
        	}
        	d[s]=max(dfs(G[s][i])+1,d[s]);
    	}
    	seen[s]=2;
    	return d[s];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    rep(i,N){
        vl A(N-1);
        rep(j,N-1){
            cin >> A[j];
            A[j]--;
        }
        rep(j,N-1){
            int x=min(A[j],i),y=max(A[j],i);
            A[j]=y*(y-1)/2+x+1;
        }
        G[0].pb(A[0]);
        rep(j,N-2){
            G[A[j]].pb(A[j+1]);
        }
    }
    ll x=dfs(0);
  	cout << x << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> as(n);
    for (int i = 0; i < n; i++) cin >> as[i];
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        bool ok = true;
        for (int j = 0; j < i; j++) {
            if (as[j] > as[i]) ok = false;
        }
        if (ok) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N, filledCols;
bool emptyCol[500];
char g[500][500];

int getCost(int row) {
    int cost = 0;
    if (emptyCol[row]) cost ++;
    F0R(j,N) if (g[row][j] == '.') cost ++;
    return cost;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    F0R(i,N) F0R(j,N) cin >> g[i][j];
    
    F0R(j,N) {
        int num = 0;
        F0R(i,N) if (g[i][j] == '.') num ++;
        if (num == 0) filledCols ++;
        if (num == N) emptyCol[j] = 1;
    }
    bool ok = 0;
    F0R(i,N) if (!emptyCol[i]) {
        ok = 1;
    }
    if (!ok) {
        cout << -1;
        exit(0);
    }
    
    int cur = MOD;
    // number of not filled cols 
    F0R(i,N) cur = min (cur,getCost(i));
    cout << cur+N-filledCols;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;


char a[105][105];
bool rr[105], cc[105];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        int c = 0;
        for(int j = 0; j < m; j++){
            c += (a[i][j] == '.');
        }
        rr[i] = (c == m);
    }
    for(int i = 0; i < m; i++){
        int c = 0;
        for(int j = 0; j < n; j++){
            c += (a[j][i] == '.');
        }
        cc[i] = (c == n);
    }
    for(int i = 0; i < n; i++){
        if(rr[i]) continue;
        for(int j = 0; j < m; j++){
            if(cc[j]) continue;
            cout << a[i][j];
        }
        cout << '\n';
    }


    return 0;
}



Measured memory_bytes: 3640
#!/usr/bin/env python3
import sys


def solve(N: int):
    lb = 0
    ub = N + 1
    while lb + 1 < ub:
        m = (lb + ub) // 2
        if m * m > N:
            ub = m
        else:
            lb = m
    print(lb * lb)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060