akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005

// it's swapnil07 ;)

signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    string s; cin>>s;
    int mul = 1;
    int val;
    int n = s.length();
    int dp[n+1][13];
    For(i, 0, n+1){
        For(j, 0, 13){
            dp[i][j]=0;
        }
    }
    if(s[n-1]=='?'){
        For(i, 0, 10){
            dp[n-1][i] = 1;
        }
    }
    else{
        int a = s[n-1]-'0';
        dp[n-1][a] = 1;
    }
    for(int i=n-2; i>=0; i--){
        mul *= 10;
        mul %= 13;
        if(s[i]!='?'){
            int a = s[i]-'0';
            val = (a*mul)%13;
            for(int j=0; j<13; j++){
                dp[i][j] += dp[i+1][(j-val+13)%13];
            }
        }
        else{
            for(int k=0; k<10; k++){
                int a = k;
                val = (a*mul)%13;
                for(int j=0; j<13; j++){
                    int b = (j-val+13)%13;
                    dp[i][j] += dp[i+1][b];
                }
            }
        }
        For(j, 0, 13){
            dp[i][j] %= MOD;
        }
    }
    cout<<dp[0][5];
    return 0;
}


Measured memory_bytes: 10604
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#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 rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort(all(x), greater<>())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
// clang-format on

void solve(long long N, std::vector<long long> P) {
  ll ans = 0;
  ll min = INF;
  rep(i, N) {
    if(P[i] <= min) {
      min = P[i];
      ++ans;
    }
  }
  ANS(ans);
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  std::vector<long long> P(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&P[i]);
  }
  solve(N, std::move(P));
  return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

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

  if(m>=n)cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;

  return 0;
}


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

int main()
{
	int n;
	cin >> n;
	
	switch(n) {
		case 25:
		  cout << "Christmas" << endl;
		  return 0;
		case 24:
		  cout << "Christmas Eve" << endl;
		  return 0;
		case 23:
		  cout << "Christmas Eve Eve" << endl;
		  return 0;
		case 22:
		  cout << "Christmas Eve Eve Eve" << endl;
		  return 0;
	}
	
	return 0;
}

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

#define all(x) x.begin(),x.end()
#define LB(V,x) lower_bound(all(V),x)-V.begin()

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using pi = pair<int32, int32>;
using pll = pair<int64, int64>;
using vi = vector<int32>;
using vll = vector<int64>;
using ll = int64;

void Main(){
    int N, M;
    cin >> N >> M;
    int NB = N;
    vi V(M,0);
    while(N--){
        int K;
        cin >> K;
        while(K--){
            int A;
            cin >> A;
            V[--A]++;
        }
    }
    cout << count(all(V), NB) << endl;
}

int main(){cin.tie(0);ios::sync_with_stdio(false);Main();return 0;}


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

int main(){
    int N;
    cin>>N;
    int arr[N];
    for(int i=0; i < N; ++i)
        cin>>arr[i];
    int swap_count = 0;
    for(int i = 0; i < N; ++i){
        for(int j = N-1; j >= i+1; --j){
            if(arr[j]<arr[j-1]){
                swap_count++;
                int temp = arr[j];
                arr[j] = arr[j-1];
                arr[j-1] = temp;
            }
        }
    }
    for(int i = 0; i < N; ++i){
        if(i) cout << " ";
        cout << arr[i];
    }
    cout << endl << swap_count << endl;
    return 0;
}

Measured memory_bytes: 3092
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  ioso
  #ifndef ONLINE_JUDGE
  ffe
  #endif
  string s; cin >> s;
  ll ss = 0;
  for(int i=0;i<s.length();i++) {
    ss += s[i]-'0';
  }

  if(ss%9==0) {
    cout << "Yes\n";
  }
  else {
    cout << "No\n";
  }
}

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

s = []

for i in range(n):
    s.append(int(input()))

m = max(s)

s2 = s.copy()

s2.remove(m)

m2 = max(s2)

for i in s:
    if i == m:
        print(m2)
        
    else:
        print(m)

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

int main(){
    
    double n; //mは平均
    while(cin>>n){
        if(n==0)break;
        double m=0, a=0;
        vector<double> s(n);
        for(int i=0;i<n;i++){
            cin>>s[i];
            m+=s[i];
        }
        m/=n;
        
        for(int i=0;i<n;i++){
            a+=pow(s[i]-m, 2);
        }
        a/=n;
        
        printf("%.7f\n", sqrt(a));
    }
    return 0;
}



Measured memory_bytes: 3284
#include <stdio.h>
int main(){
    int a,b;
    scanf("%d%d", &a,&b);
    if(a < b){
        printf("a < b\n");
    }else if (a > b){
        printf("a > b\n");
    }else if (a == b){
        printf("a == b\n");
    }
    return 0;
}


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

using namespace std;

int main(){

  // take input s

  string s;
  cin>>s;



  // string , auto x now check if it is 'B' , pop_back()
  string n;

  int i=0;
  for(auto x:s){

  if(x=='B'){
    if(n.size()>=1){
        n.pop_back();
    }

  }
  else{
    n=n+x;
  }

  }



  cout<<n;

  // eventually you will left with 0 or 1



  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(){
    int N,i,j,num[1001],v,x;
    
    scanf("%d",&N);
    for (i=0; i<N; i++) {
        scanf("%d",&num[i]);
    }
    
    for (i=1; i<N; i++) {
        for (x=0; x<N-1;x++) {
          printf("%d ",num[x]);
        }
         printf("%d\n",num[N-1]);
        v=num[i];
        j=i-1;
        while (j>=0 && num[j]>v) {
            num[j+1]=num[j];
            j--;
        }
        
        num[j+1]=v;

    }
    for (x=0; x<N-1;x++) {
      printf("%d ",num[x]);
    }
    printf("%d\n",num[N-1]);
    
    return(0);
}



Measured memory_bytes: 2040
#include <iostream>
#include <cmath>
using namespace std;
int a[10];
int b[10];
int factory[8]={1,1,2,6,24,120,720,5040};
int cantor(int a[],int n)
{
    int ans=0;
    for(int i=0;i<n-1;i++)
    {
        int temp=0;
        for(int j=i+1;j<n;j++)
        {
            if(a[j]<a[i])
                temp++;
        }
        ans+=temp*factory[n-i-1];
    }
    return ans+1;
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>b[i];
    }
    int aa=cantor(a,n);
    int bb=cantor(b,n);
    cout<<abs(aa-bb);
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int main()
{
	int n, pp;
	while(1) {
		cin >> n >> pp;
		if (!n && !pp) break;
		map<int, int> have;
		int player = 0;
		int p = pp;
		while(1) {
			if(p) {
				have[player]++;
				p--;
				if (have[player] == pp) {
					cout << player << endl;
					break;
				}
			}
			else {
				p = have[player];
				have[player] = 0;
			}

			player++;
			if (player == n) player = 0;

		}
	}

 	return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int64_t sum = 0;
  int64_t r=0, g=0, b=0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 'R') r++;
    else if (S.at(i) == 'G') g++;
    else b++;
  }
  sum += r*g*b;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int k = 2*j - i;
      if (k >= N) continue;
      if (S.at(i) != S.at(j) && S.at(k) != S.at(j) && S.at(i) != S.at(k)) {
        sum--;
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3632
package main

import (
	"fmt"
)

func main() {
	var n int64
	fmt.Scan(&n)

	var n2 int64
	for i := int64(0); i <= n; i++ {
		if i*i >= n {
			n2 = i
			break
		}
	}

	ans := int64(1e12) + 1
	for i := int64(1); i <= n2; i++ {
		if n%i != 0 {
			continue
		}
		b := n / i
		if ans > i+b {
			ans = i + b
		}
	}
	fmt.Println(ans - 2)
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4244) // 最悪をします
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <sstream>
#define BIT(nr) (1UL << (nr))
#define int long long
//#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }


using namespace std;

//デバッグ用カッコの有無
#ifdef DEBUG
template <class T>ostream &operator<<(ostream &o, const vector<T>&v)
{
	o << "{"; for (int i = 0; i<(int)v.size(); i++)o << (i>0 ? ", " : "") << v[i]; o << "}"; return o;
}
#endif // DEBUG

template <class T>ostream &operator<<(ostream &o, const vector<T>&v)
{
	for (int i = 0; i<(int)v.size(); i++)o << (i>0 ? " " : "") << v[i]; return o;
}

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int dxp[4] = { 0, 1 }; // x軸方向への変位(正のみ)
int dyp[4] = { 1, 0 }; // y軸方向への変位(負のみ)

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;

	// libalgo のものに追加、メンバを追加するだけなので互換性は崩さないはず、逆辺のG[e.dstの]インデックスを保持
	int rev;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph& g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph& g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

void solve() {

}

signed main() {
	int n;
	cin >> n;
	vector<int> dp(45, 0);
	dp[0] = dp[1] = 1;

	REP(i, 2, 45) {
		dp[i] = dp[i - 1] + dp[i - 2];
	}

	cout << dp[n] << "\n";
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll x; cin>>x;
  ll cnt=0;
  ll sum=0;
  reps(i,x){
    cnt++;
    sum+=i;
    if(sum>=x) break;
  }
  cout<<cnt<<endl;
}

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

int main()
{
    int n;
    cin >> n;
    int p, w, g, y;
    p = w = g = y = 0;
    for (int i = 0; i < n; i++) {
        char c;
        cin >> c;
        if (c == 'P') p = 1;
        if (c == 'W') w = 1;
        if (c == 'G') g = 1;
        if (c == 'Y') y = 1;
    }
    if (p + w + g + y == 3) {
        cout << "Three" << endl;
    } else if (p + w + g + y == 4) {
        cout << "Four" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long N = sc.nextLong();
      long M = N;
     long max = N-1;
      long maxx = N;
     for(long i=2;i*i<=M;i++){
       if(M%i==0){
         maxx = M/i+i-2;
         if(maxx<max){
          max=maxx; 
         }
       }
     }
      System.out.println(max);
    }

}


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


int main() {
  ll n, r = 0, g = 0, b = 0;
  cin >> n;
  string s;
  cin >> s;
  rep(i,n) {
    if(s[i]=='R') r++;
    else if(s[i]=='G') g++;
    else b++;
  }
  ll ans = r*g*b;
  int i = 1;
  while(2*i<n) {
    for(int j = 0; j+2*i < n; j++) {
      if(s[j]==s[j+i]) continue;
      if(s[j]==s[j+2*i]) continue;
      if(s[j+i]==s[j+2*i]) continue;
      ans--;
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define maxn 100020
#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define inf 0x3f3f3f3f
typedef long long ll;
typedef pair<int,int> pr;

struct node{
	int x,y,w;
};
int L;
int n,m,s,t,a[maxn],cnt;
vector <node> edge;

void mul(int &s,int t,int &cur){
	int news = s - 1;
	rvc(i,edge) edge[i].w *= 2;
	edge.pb((node){news,s,1});
	edge.pb((node){news,s,0});
	s = news;
	cur *= 2;
}
void add(int s,int t,int &cur){
	edge.pb((node){s,t,cur});
	cur++;
}
int main(){
	scanf("%d",&L);
	while ( L > 2 ){
		if ( L & 1 ) a[++cnt] = 1 , L--;
		else a[++cnt] = 2 , L /= 2;
	}
	t = n = 20 , s = 19;
	int cur = 2;
	edge.pb((node){s,t,1});
	edge.pb((node){s,t,0});
	repd(i,cnt,1){
		if ( a[i] == 2 ){
			mul(s,t,cur);
		}
		else{
			add(s,t,cur);
		}
	}
	while ( s > 1 ) edge.pb((node){s - 1,s,0}) , s--;
	cout<<n<<" "<<edge.size()<<endl;
	rvc(i,edge){
		cout<<edge[i].x<<" "<<edge[i].y<<" "<<edge[i].w<<endl;
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
    double a,b,c,d,e,f;
    while (cin>>a>>b>>c>>d>>e>>f) {
        double y = (c * d - a * f) / (b * d - e * a);
        double x = (c - (b * y)) / a;
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 1236
#include <vector>
#include <algorithm>
#include <iostream>
#include <chrono>
#include<bitset>
#include<deque>
#include <map>
#define vint vector<int>
#define vint2 vector<vint>
#define vchar vector<char>
#define vchar2 vector<vchar> 
#define vchar3 vector<vchar2> 
#define pr pair<int,int>
#define vpr vector<pr>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
typedef  long long int ll;
using namespace std;
//CHAR_BIT	ビット フィールドではない最小変数のビット数。	8
//SCHAR_MIN	signed char 型変数の最小値。	–128
//SCHAR_MAX	signed char 型変数の最大値。	127
//UCHAR_MAX	unsigned char 型変数の最大値。	255 (0xff)
//CHAR_MIN	char 型変数の最小値。 - 128、 / J オプション使用時は 0
//CHAR_MAX	char 型変数の最大値。	127、 / J オプション使用時は 255
//MB_LEN_MAX	多文字定数の最大バイト数。	5
//SHRT_MIN	short 型変数の最小値。	–32768
//SHRT_MAX	short 型変数の最大値。	32767
//USHRT_MAX	unsigned short 型変数の最大値。	65535 (0xffff)
//INT_MIN	int 型変数の最小値。	–2147483647 – 1
//INT_MAX	int 型変数の最大値。	2147483647
//UINT_MAX	unsigned int 型変数の最大値。	4294967295 (0xffffffff)
//LONG_MIN	long 型変数の最小値。	–2147483647 – 1
//LONG_MAX	long 型変数の最大値。	2147483647
//ULONG_MAX	unsigned long 型変数の最大値。	4294967295 (0xffffffff)




int  main() {
	int N,x;
	int a[100];
	cin >> N >> x;
	REP(i, N) {
		cin >> a[i];
	}
	sort(a, a + N);
	int nokori = x;
	int cnt = 0;
	
	REP(i, N) {
		nokori -= a[i];
		if (i < N - 1) {
			
			if (nokori > 0) { cnt++; }
			else if (nokori == 0) { cnt++; break; }
			else { break; }
		}
		else {
			if (nokori == 0)cnt++;
		}
	}
	
	
	cout <<cnt<< endl;
	//while (true) {}

	return 0;
}


Measured memory_bytes: 256
x=int(input())
num=[]
for i in range(10001):
    num.append(i**5)

for j in range(10000):
    for k in range(j+1,10001):
        if num[k]-num[j]==x:
            print(k,j)
            exit()
        elif num[k]+num[j]==x:
            print(k,-1*j)
            exit()

Measured memory_bytes: 9564
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;  typedef long long ll;
inline int qr(){
	int ret=0,f=0,c=getchar();
	while(!isdigit(c))f|=c==45,c=getchar();
	while(isdigit(c)) ret=ret*10+c-48,c=getchar();
	return f?-ret:ret;
}
const int maxn=55;
int a[maxn],b[maxn],c[maxn],d[maxn],A[maxn];
int n,m,q,ans;

void dfs(int now){
	if(now==n+1){
		int ret=0;
		for(int t=1;t<=q;++t)
			if(A[b[t]]-A[a[t]]==c[t])
				ret+=d[t];
		ans=max(ret,ans);
		return;
	}
	for(int t=max(1,A[now-1]);t<=m;++t)
		A[now]=t,dfs(now+1);
}

int main(){
	cin>>n>>m>>q;
	for(int t=1;t<=q;++t) cin>>a[t]>>b[t]>>c[t]>>d[t];
	dfs(1);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3636
pub fn main() {
    fn read<T: std::str::FromStr>() -> T {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        s.trim().parse().ok().unwrap()
    }
    fn read_vec<T: std::str::FromStr>() -> Vec<T> {
        read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
    }
    fn answer() {
        let HW = read_vec::<i32>();
        let hw = read_vec::<i32>();
        println!("{}", (HW[0]-hw[0])*(HW[1]-hw[1]));
    }
    answer()
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int A;
  int B;
  
  cin >> A;
  cin >> B;
  if((B-1)%(A-1) == 0){
    cout << (B-1)/(A-1) << endl;
  }
  else{
    cout << (B-1)/(A-1)+1 << endl;
  }  
}

Measured memory_bytes: 256
N,X=map(int,input().split())
count=1

L=[]
LL=list(map(int,input().split()))
for i in range(N):
    c=0
    for j in range(i+1):

        c+=LL[j]
    L.append(c)
#print(L)

for i in range(N):
    if L[i]<=X:
        count+=1
print(count)

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec a(N);
  rep(i, N)cin >> a[i];
  ll ans = accumulate(ALL(a), 0LL);
  ans -=N;
  cout << ans;
  return 0;
}


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

using namespace std;
 
int main() {

	int n;
	cin>>n;

	vector<int> x(n+1);
	vector<int> y(n+1);

	for(int i=1; i<=n; i++) cin>>x[i]>>y[i];

	int maxi = INT_MIN, mini = INT_MAX;

	for(int i=1; i<=n; i++) {

		maxi = max(maxi, x[i] + y[i]);
		mini = min(mini, x[i] + y[i]);
	}

	int d1 = maxi - mini;

	maxi = INT_MIN, mini = INT_MAX;

	for(int i=1; i<=n; i++) {

		maxi = max(maxi, x[i] - y[i]);
		mini = min(mini, x[i] - y[i]);
	}

	int d2 = maxi - mini;

	cout<<max(d1,d2)<<endl;

	return 0;
}

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

#define MOD 1000000007

long long fac[1000001],finv[1000001],inv[1000001];

void COMinit(){
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(int i=2;i<1000001;i++){
		fac[i]=fac[i-1]*i%MOD;
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}
 
long long COM(int n,int k){
	if(n<k)return 0;
	if(n<0 || k<0)return 0;
	return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
 
long long MODpow(long long a,int b){
	if(b==0)return 1;
	if(b%2==0){
		long long t=MODpow(a,b/2);
		return (t*t)%MOD;
	}
	return (a*MODpow(a,b-1))%MOD;
}

int main(){
	COMinit();
	int N;
	cin >> N;
	vector<long long> x(N);
	for(auto &i:x)cin >> i;
	
	long long ans=0;
	
	vector<long long> a(N-1);
	a[0]=fac[N-1];
	for(int i=1;i<N-1;i++)a[i]=(a[0]*inv[i+1])%MOD;
	for(int i=1;i<N-1;i++)a[i]=(a[i]+a[i-1])%MOD;
	
	for(int i=0;i<N-1;i++){
		long long diff=x[i+1]-x[i];
		ans+=diff*a[i];
		ans%=MOD;
	}
	//for(auto i:a)cout << i << endl;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

using ll = long long;

int const mod = 1e9 + 7;

template<int n, int m>
struct Matrix {
    int v[n][m];

    static constexpr Matrix ones() {
        Matrix<n, m> r{};
        for (int i = 0; i < n; i++) {
            r.v[i][i] = 1;
        }
        return r;
    }
};

template<int n, int m, int p>
Matrix<n, p> operator*(Matrix<n, m> const& lhs, Matrix<m, p> const& rhs) {
    Matrix<n, p> res{};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < p; j++) {
            for (int k = 0; k < m; k++) {
                res.v[i][j] = ((ll)res.v[i][j] + (ll)lhs.v[i][k]*rhs.v[k][j]) % mod;
            }
        }
    }
    return res;
}

template<int n>
Matrix<n, n> fexp(Matrix<n, n> a, ll b) {
    auto res = Matrix<n, n>::ones();
    while (b) {
        if (b&1) {
            res = res*a;
        }
        a = a*a;
        b /= 2;
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);

    int n;
    ll k;
    cin >> n >> k;

    Matrix<50, 50> v;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> v.v[i][j];
        }
    }

    auto res = fexp(v, k);

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ans += res.v[i][j];
        }
    }
    cout << ans%mod << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string S;

int main(){
    cin >> S;
    rep(i,sz(S)-1) if(S[i] == S[i+1]){ pr("Bad"); return 0;}
    pr("Good");
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val tl = List.fill(n)(sc.nextLong)

  val res = tl.tail.foldLeft(tl.head)(lcm)

  println(res)



  def lcm(a: Long, b: Long): Long ={
    ( a / gcd(a,b)) * b
  }

  def gcd(a: Long, b: Long): Long ={
    (a,b) match{
      case (x,y) if y == 0 => x
      case (x,y) if x < y  => gcd(y, x)
      case (x,y)           => gcd(y, x % y)
    }
  }


}

Measured memory_bytes: 27448
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;

int main()
{
    FAST
    string s;cin>>s;
    int ans=0;
    int n=s.length();
    f(i,0,n)
    {
        int curr=0;
        while(i<n && s[i]=='R') curr++,i++;
        ans=max(curr,ans);
    }
    cout<<ans<<endl;
}


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

using namespace std;

vector<long long> a;

long long getScore(long long mid) {
	long long res = 0;
	for (auto&& i : a) {
		res += abs(i - mid);
	}
	return res;
}

void hawawa()
{
	long long n, d = 0;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i + 1;
	}
	long long s = -1e9, e = 1e9;
	while (s < e) {
		long long mid1 = (s * 2 + e) / 3;
		long long mid2 = (s + e * 2) / 3;
		long long score1 = getScore(mid1);
		long long score2 = getScore(mid2);
		if (score1 > score2) {
			s = mid1 + 1;
		}
		else if(score2 > score1){
			e = mid2 - 1;
		}
		else {
			s = mid1;
			e = mid2;
		}
	}
	cout << getScore(s) << "\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	hawawa();
	return 0;
}


Measured memory_bytes: 1792
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}

int main()
{
	ll a,b,c;
	cin >> a >> b >> c;
	ll ans;
	if(c <= b)
		ans = c+b;
	else
	{
		ans = b*2;
		c -= b;
		if(a < c)
			ans += a+1;
		else
			ans += c;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
*/
int main()
{
    vector<string> days{"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string S;
    cin >> S;
    int cnt = 0;
    REP(i, days.size())
    {
        if(S == days.at(i)) {
            cnt = days.size() - i;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()

if '.' not in S:
    print(0)
    exit()
elif '#' not in S:
    print(0)
    exit()

white_sum = 0
for i in range(N):
    if S[i] == '#':
        continue
    else:
        white_sum += 1

left_black = 0
right_white = white_sum
min_sum = white_sum
for i in range(N):
    if S[i] == '#':
        left_black += 1
    else:
        right_white -= 1

    min_sum = min(min_sum, left_black + right_white)
print(min_sum)


Measured memory_bytes: 9428
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
 
        if(a > b){
            if(b > c){
                System.out.printf("%d %d %d\n", c, b, a);
            }else if(a > c){
                System.out.printf("%d %d %d\n", b, c, a);
            }else{
                System.out.printf("%d %d %d\n", b, a, c);
            }
        }else{
            if(a > c){
                System.out.printf("%d %d %d\n", c, a, b);
            }else if(b > c){
                System.out.printf("%d %d %d\n", a, c, b);
            }else{
                System.out.printf("%d %d %d\n", a, b, c);
            }
        }
 
    }
}


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

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

  string ans = "Three";
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") { ans = "Four"; }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define MAXN 2005
int n;
int a[MAXN];
bitset<MAXN*MAXN>bts;
int ans[MAXN*MAXN],tot;
int main()
{
	scanf("%d",&n);
	int i;
	bts[0]=1;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		bts|=bts<<a[i];
	}
	for(i=1;i<=MAXN*MAXN;i++)
	{
		if(bts[i])
		{
			tot++;
			ans[tot]=i;
		}
	}
	printf("%d",ans[(tot+1)>>1]);
	return 0;
}

Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> mp(h + 1, INF);
  vector<pair<int, int>> atc(n);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    atc[i] = make_pair(a, b);
  }
  mp[0] = 0;
  repi(i, 1, h + 1) {
    rep(j, n) {
      if (i - atc[j].first <= 0)
        mp[i] = min(mp[i], atc[j].second);
      else
        mp[i] = min(mp[i], mp[i - atc[j].first] + atc[j].second);
    }
  }
  // rep(i, h + 1) cout << mp[i] << endl;
  cout << mp[h] << endl;
  return 0;
}


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

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()

int n,m;

int main(){
    int ans=8;
    cin>>n>>m;
    vector<int> bar(m);
    vector<int> init(n);
    rep(i,m){ cin>>bar[i];bar[i]--; }
    rep(i,n) init[i]=i;
    rep(i,m) swap(init[bar[i]],init[bar[i]+1]);
    sort(all(bar));
    do{
        vector<int> x(n), y(n);
        rep(i,n) x[i]=i;
        int maxy=0;
        rep(i,m){
            swap(x[bar[i]],x[bar[i]+1]);
            int high=max(y[bar[i]],y[bar[i]+1]);
            y[bar[i]]=high+1;
            y[bar[i]+1]=high+1;
            maxy=max(high+1,maxy);
        }
        if(init==x) ans=min(ans,maxy);
    }while(next_permutation(all(bar)));
    cout<<ans<<endl;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target ("avx")
#pragma GCC target ("avx2")
#pragma GCC target ("fma")
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll INF = 1e18;
ll n;
vpll adj[200005]; 
ll dist[200005], bw[200005], val[200005];
void dijkstra(ll src){
	for (ll i = 0; i <= n; i++) dist[i] = INF; dist[src] = 0;                    
  	priority_queue <pll, vpll, greater <pll>> pq; 
	pq.push(mp(0LL, src));
  	while (!pq.empty()){        
    	pll fr = pq.top(); pq.pop();   
    	ll d = fr.fi, u = fr.se;
    	if (d == dist[u]){
      		for (ll j = 0; j < adj[u].size(); j++){
        		pll v = adj[u][j];                      
        		if (dist[u] + v.se < dist[v.fi]){
          			dist[v.fi] = dist[u] + v.se;               
          			pq.push(mp(dist[v.fi], v.fi));
  				}   
			}
		}
	} 
}
void dfs(ll u, ll p){
	bw[u] = 1 - bw[p];
	for (ll i = 0; i < adj[u].size(); i++){
		ll v = adj[u][i].fi; if (v == p) continue; dfs(v, u);
	}
}
int main(){
	// one of the other weird problems on Atcoder ._.
	// this is implement-heavy, but at least a lot better than Codeforces...
	cin >> n; 
	for (ll i = 0; i <= n; i++) val[i] = -1;
	for (ll i = 0; i < n - 1; i++){
		ll u, v; cin >> u >> v;
		adj[u].pb(mp(v, 1LL)); adj[v].pb(mp(u, 1LL));
	}
	dfs(1, 1); // finding black-white
	ll k; cin >> k;
	ll tp = -1;
	for (ll i = 0; i < k; i++){
		ll v, p; cin >> v >> p; val[v] = p;
		adj[0].pb(mp(v, p)); adj[v].pb(mp(0, p));
		if (tp == -1) tp = (p % 2) ^ bw[v];
		else{
			ll t = (p % 2) ^ bw[v];
			if (t == tp) continue;
			else{
				cout << "No\n"; return 0;
			}
		}
	}
	dijkstra(0);
	for (ll i = 1; i <= n; i++){
		if (dist[i] < val[i]){
			cout << "No\n"; return 0;
 		}
		val[i] = dist[i];
		ll x = bw[i] ^ tp; x ^= val[i]; x %= 2;
		if (x) val[i]--;
	}
	for (ll i = 1; i <= n; i++){
		for (ll j = 0; j < adj[i].size(); j++){
			ll v = adj[i][j].fi; if (v == 0) continue;
			if (abs(val[i] - val[v]) != 1){
				cout << "No\n"; return 0;
			}
		}
	}
	cout << "Yes\n";
	for (ll i = 1; i <= n; i++) cout << val[i] << endl;
}

Measured memory_bytes: 22580
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define pii pair<ll,ll>
#define pi pair<int ,int> 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i,a,n) for(int i=a;i>=n;i-- )
 
 
int main() {
   
  ll n,k,s;
  cin>>n>>k>>s;
  //vector<ll>A;
  REP(i,0,k)
  {
      cout<<s<<" ";
  }
  REP(i,k,n)
  {
      if(s!=1e9){cout<<s+1<<" ";}
      else
      {
          cout<<1<<" ";
      }
  }
  
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<tuple>
#include<set>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,m;
  cin >> n >> m;
  ll a[n],b[m],val=n*m+1,ans=1,tmp;
  ll ra[val],rb[val],avsum[val+1],bvsum[val+1];
  bool way=true;
  fill(ra,ra+val,-1);
  fill(rb,rb+val,-1);
  fill(avsum,avsum+val+1,0);
  fill(bvsum,bvsum+val+1,0);
  for(ll i=0;i<n;i++){
    cin >> a[i];
    if(ra[a[i]]!=-1){
      way=false;
    }
    avsum[a[i]]++;
    ra[a[i]]=i;
  }
  for(ll i=0;i<m;i++){
    cin >> b[i];
    if(rb[b[i]]!=-1){
      way=false;
    }
    bvsum[b[i]]++;
    rb[b[i]]=i;
  }
  if(!way){
    cout << "0\n";
    return 0;
  }
  for(ll i=val-1;i>=0;i--){
    avsum[i]+=avsum[i+1];
    bvsum[i]+=bvsum[i+1];
  }
  for(ll i=val-1;i>0;i--){
    if(ra[i]==-1&&rb[i]==-1){
      tmp = avsum[i]*bvsum[i];
      tmp -= n*m-i;
      tmp%=MOD;
    }else if(ra[i]==-1){
      tmp = avsum[i];
    }else if(rb[i]==-1){
      tmp = bvsum[i];
    }else{
      tmp = 1;
    }
    ans *= tmp;
    ans%=MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 31488
from functools import reduce

def cmb(n, r, p):
    r = min(n - r, r)
    if r == 0:
        return 1
    numer = reduce(lambda x, y: (x*y)%p, range(n, n - r, -1))
    denom = reduce(lambda x, y: (x*y)%p, range(1, r + 1))
    return (numer * pow(denom, p-2, p)) % p

p = 10 ** 9 + 7
n, a, b = map(int, input().split())

ans = pow(2, n, p) - 1
ans -= cmb(n, a, p) + cmb(n, b, p)
print(ans % p)


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;  ///1e9+7

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    ll a,b,c,k,ans;
    cin>>a>>b>>c>>k;
    while(k and a>=b) b*=2,k--;
    while(k and b>=c) c*=2,k--;
    if(a<b and b<c) cout<<"Yes" el;
    else cout<<"No" el;
}

main()
{
//    fastio();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 3636
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int n;
  cin >> n;
  multiset<int> st;
  rep(i, 1 << n)
  {
    int s;
    cin >> s;
    st.insert(-s);
  }
  vector<int> v;
  auto itr0 = st.begin();
  v.push_back(*itr0);
  st.erase(itr0);
  while (v.size() < (1 << n))
  {
    int sz = v.size();
    rep(i, sz)
    {
      auto itr = st.upper_bound(v[i]);
      if (itr == st.end())
      {
        Yes(0);
        return;
      }
      v.push_back(*itr);
      st.erase(itr);
    }
  }
  Yes(1);
}

int main()
{
  init_main();
  solve();
  return 0;
}


Measured memory_bytes: 16524
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "Yes";
const string NO = "No";

void solve(string S) {
  bool pred = true;

  for (size_t i = 0; i != S.size(); ++i) {
    if ((i%2 && S[i] == 'R') || (i%2==0 && S[i] == 'L')) {
      pred = false;
      break;
    }
  }
  
  cout << (pred ? YES : NO) << endl;
}

int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

int main() {
    int N = 0;
    double x, y;
    while(~scanf("%lf,%lf", &x, &y)) {
        P[N++] = xy_t(x,y);
    }

    double sum = 0.0;
    for(int i = 0; i+2 < N; i++) {
        xy_t a=P[0], b=P[i+1], c=P[i+2];
        sum += cross_product(b-a,c-a)/(double)2;
    }
    printf("%.6f\n", abs(sum));
    
    return 0;
}


Measured memory_bytes: 2576
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int counter = 0;
		for (int i = 0; i < length; i++) {
			int number = sc.nextInt();
			while (number % 2 == 0) {
				number= number/2;
				counter += 1;
			}
		}
		System.out.println(counter);
	}

}

Measured memory_bytes: 34240
#include<stdio.h>
 
int main(){
 
int W,H,x,y,r;
 
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
 
if((r<=x)&&(x<=(W-r))&&(r<=y)&&(y<=(H-r)))
printf("Yes\n");
else printf("No\n");
 
return 0;

}
  

Measured memory_bytes: 584
s = int(input())
a = [s]
i = 1
while True :
    if a[i-1] % 2 == 0:
        t = int((a[i-1])/2)
    else:
        t = int((a[i-1])*3+1)
        
    i +=1 
    
    if t in a:
        print(i)
        break  
    a.append(t)

Measured memory_bytes: 3060