akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define SZ(x) (long long)x.size()
#define endl '\n'
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define tc                                                                     \
  int tc;                                                                      \
  cin >> tc;                                                                   \
  while (tc--)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define REPO(i, b, a) for (int i = b - 1; i >= a; i--)
#define REPI(i, a, b) for (int i = a; i <= b; i++)
#define MOD 1000000007

int32_t main() {
  FAST;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("output.txt", "w", stderr);
#endif
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &l : v)
    cin >> l;
  int x = 0;
  for (auto l : v)
    x ^= l;
  // cout << x;
  for (auto l : v) {
    cout << (x ^ l) << " ";
  }
  return 0;
}

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

#define INF 100000000
#define MOD9(a) (a%1000000009)
#define MOD7(a) (a%1000000007)
#define ABS(a) (a<0?-(a):a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define REP(i,a) for(int i=0;i<a;i++) 

using namespace std;
int main(){
  string S;
  cin >> S;

  REP(i, S.length()){
    if(S[i] == ','){
      cout << ' ';
    }else{
      cout << S[i];
    }
  }
  cout << endl;

}



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

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(string& S) {
    if (S.size() == 1) {
        cout << 1 << "\n";
        return;
    }

    vector<int> A(S.size()+1, -1);
    if (S.front() == '<') A[0] = 0;
    if (S.back() == '>') A[A.size()-1] = 0;
    REP(i,0,S.size()-1) {
        if (S[i] == '>' && S[i+1] == '<') {
            A[i+1] = 0;
        }
    }
    REP(i,0,A.size()) {
        if (A[i] != 0) continue;
        int current = i-1;
        int a = 0;
        // to left
        while (current >= 0 && S[current] == '>') {
            a++;
            A[current] = max(A[current], a);
            current--;
        }
        current = i+1;
        a = 0;
        // to right
        while (current <= S.size() && S[current-1] == '<') {
            a++;
            A[current] = max(A[current], a);
            current++;
        }
    }
	ll answer = accumulate(all(A), 0LL);
//    REP(i,0,A.size()) {
//        cout << A[i] << "\n";
//    }

	stringstream ss;
	ss << answer;
	cout << ss.str() << '\n';

    return;
}

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



Measured memory_bytes: 2820
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int mod = 1000000007;

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

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

int main() {
	ll N, K;
	cin >> N >> K;
	map<ll,ll>A;
	ll a, b;
	for (int i = 0; i < N; i++) {
		cin >> a>> b;
		A[a] += b;
	}
	ll sum = 0;
	for (auto i : A) {

		sum += i.second;
		if (sum >= K) {

			cout << i.first;

			return 0;
		}
	}


}

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

int main() {
    string str;
    cin >> str;
    bool flag = false;

    sort(str.begin(), str.end());
    if (str[0] == str[1] && str[2] == str[3] && str[0] != str[2]) flag = true;

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;

int main(){
	long long k,n;
	cin >> k;
	n=50;
	cout << n << endl;
	vector<long long> a(n,n-1+k/50);
	for(int i=0;i<k%50;i++){
		a[i]+=n;
		for(int j=0;j<n;j++){
			if(j!=i)a[j]-=1;
		}
	}
	for(int i=0;i<n-1;i++){
		cout << a[i] <<" ";
	}
	cout << a[n-1] << endl;
	return 0;
}

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

int		main(void)
{
	int s;

	cin >> s;
	map<int, int> nums;
	int i = 1;

	nums[s] = s;
	while (1)
	{
		i++;
		if (s % 2 == 0)
			s /= 2;
		else
			s = 3 * s + 1;
		if (nums.count(s))
			break ;
		nums[s] = s;
	}
	cout << i << endl;
}


Measured memory_bytes: 256
from fractions import gcd
a,b=map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
x=gcd(a,b)
l=prime_factorize(x)
l=set(l)
print(len(l)+1)

Measured memory_bytes: 5048
#include <iostream>  
#include <string.h> 
using namespace std;
int main() {
    char x, y;
    cin >> x >> y;
    if (x > y)
        cout << ">";
    else if (x < y)
        cout << "<";
    else
        cout << "=";

    

    
    return 0;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long ans = 0;
  
  long N,M;
  cin >> N >> M;
  
  long H[N+1] = {0};
  for(long i=1; i<N+1; i++){
    cin >> H[i];
  }
  
  long bad[N+1] = {0};
  for(long i=1; i<M+1; i++){
    long A,B;
    cin >> A >> B;
	if(H[A] >= H[B]) bad[B]=1;
    if(H[A] <= H[B]) bad[A]=1;
  }
  
  for(long i=1; i<N+1; i++){
    if(bad[i] == 0) ans++;
  }
  
  cout << ans << endl;
  return 0;
}


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

#define ll long long
#define MOD 1000000007
#define MAX 1000000



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

    double ax,ay;
    int j=0;
    for(int i=0;i<=25;i++){
        ay = i;
        ax = (y - 4*i)/2;
        if(ax<0)break;
        if(floor(ax)==ax){
            if(ax+ay==x){
                j=1;
                break;
            }
        }
    }

    if(j==1){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3724
#include <iostream>
#include <vector>
using namespace std;
#define MOD (int)(1e9+7)
typedef long long ll;

ll dp[100001];
bool broken[100001];
ll solve(int n)
{
	if(broken[n])return 0;
	if(dp[n] != -1)return dp[n];
	
	if(n==0)return dp[n] = 1;
	else if(n==1)return dp[n] = 1;
	else return dp[n] = (solve(n-1) + solve(n-2))%MOD;
}

int main() {
	int N,M;cin>>N>>M;
	for(int i=0;i<=N;i++)dp[i] = -1;
	for(int i=0;i<M;i++)
	{
		int a;cin>>a;
		broken[a] = true;
	}
	
	cout << solve(N) << endl;
	
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
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;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1000000007;

const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

//********************************template END****************************************//

int dp[MAX/2][8][2];

void solve(void)
{
	string S;
	cin >> S;

	int l = S.size();

	string a = "357";

	rep(l, n) rep(8, bit)
	{
		if (bit==0) dp[n][0][min(n,1)] = 1;
		rep(2, f) rep(3, i)
		{
			if (!f)
			{
				if (S[n] < a[i])
					break;
				if (S[n] == a[i])
				{
					dp[n + 1][bit | 1 << i][0] += dp[n][bit][0];
				}
				else
				{
					dp[n + 1][bit | 1 << i][1] += dp[n][bit][0];
				}
			}
			else
			{
				dp[n + 1][bit | 1 << i][1] += dp[n][bit][1];
			}
		}

	}

	cout << dp[l][7][0] + dp[l][7][1] << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
long long a[200005],b[200005];
int main()
{
    long long n,m,k,l=0,r=0,rp=0,ans;
    cin>>n>>m>>k;
    for(long long i=0; i<n; i++){
        cin>>a[i];
    }
    for(long long i=0; i<m; i++){
        cin>>b[i];
        r+=b[i];
    }
    rp=m;
    while(r>k){
        rp--;
        r-=b[rp];
    }
    ans=rp;
    for(long long lp=0; lp<n; lp++){
        l+=a[lp];
        if(l>k){
            cout<<ans;
            return 0;
        }
        while(r+l>k){
            rp--;
            if(rp<0){
                cout<<ans;
                return 0;
            }
            r-=b[rp];
        }
        ans=max(ans,lp+rp+1);
    }
    cout<<ans;
}


Measured memory_bytes: 6744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(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;
}
int main()
{
    string S;
    cin >> S;
    int n = S.size();
    stack<char> st;
    for (int i = n - 1; i >= 0; i--)
    {
        if (st.empty() or st.top() == S[i])
        {
            st.push(S[i]);
        }
        else if (st.top() != S[i])
        {
            st.pop();
        }
    }
    cout << n - st.size();
    return 0;
}


Measured memory_bytes: 512
A = {0:0, 10:125, 20:140}
C = [0,10,20]
while True:
    w = input()
    if w == -1:
        break
    print 4280 - (sum(A[c]*min(10, max(0,w-c)) for c in C) + 160*(max(0,w-30)) + 1150)

Measured memory_bytes: 4216
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
#include <list>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()

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

int main(void) {
	int n;
	cin >> n;
	vector<pair<ll, ll> > ab(n);
	REP(i, n) {
		cin >> ab[i].first >> ab[i].second;
	}
	vector<pair<ll, int> > c;
	REP(i, n){
		c.push_back(make_pair(abs(ab[i].first + ab[i].second), i));
	}
	sort(RALL(c));
	ll x = 0, y = 0;	
	REP(i, n){
		if(i % 2 == 0) {
			x += ab[c[i].second].first;
		} else {
			y += ab[c[i].second].second;
		}
	}
	cout << x - y << endl;
}

Measured memory_bytes: 3956
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		String text = scan.next();
		LinkedList<Character> tikei = new LinkedList<Character>();
		LinkedList<Integer> underpos = new LinkedList<Integer>();
		ArrayList<Integer> leftpos = new ArrayList<Integer>();
		ArrayList<Integer> leftmenseki = new ArrayList<Integer>();
		ArrayList<Integer> mizuHyouji = new ArrayList<Integer>();
		int mizuAmount = 0;
		int allMizuArea = 0;
		int kyori = 0;
		int area= 0;

		//??????????????????????????§??°?????????
		for(int textpos=0; textpos<text.length(); textpos++){
			tikei.addLast(text.charAt(textpos));
		}
		for(int textpos=0; textpos<text.length(); textpos++){
			//??????????°´?????????????????????
				if(tikei.get(textpos) == '\\' ){
					underpos.addLast(textpos);
					leftpos.add(textpos);
					leftmenseki.add(0);
//					System.out.println("????????? pos "+underpos.getLast());

				}
				else if(tikei.get(textpos) == '/' ){


//					??????????????????=??????????±±?????´???
					if(underpos.size() == 0){
//						System.out.println("??????????????????");

					}
					else{
//						?????±?????????????£?????????¢?????¬???
						kyori = textpos;
						int leftnaname = underpos.pollLast();
						kyori -= leftnaname;
						area = kyori ;
//						System.out.println("?????¢??? "+area);
						int ser = leftpos.indexOf(leftnaname);
						leftmenseki.set(ser,area);

					}
				}
				else if(tikei.get(textpos) == '_' ){


				}
		}
//		System.out.println("?°´?????? "+mizuAmount+" ??¨????????¢?????? "+allMizuArea);
		int x=0;
		for (int i=0;i<leftpos.size();i++){
//			System.out.println("????????? "+leftpos.get(i)+" ??? "+leftmenseki.get(i));
			area = 0;
//			x = i;
			if(leftmenseki.get(i) == 0){
//				System.out.println("????????????????????????");
			}
			else{
				//?°´???????????????????????§??????
				if (x <leftpos.size()){
					while(true){
	//					System.out.println("X= "+x+"Y= "+y);
//						System.out.println((leftmenseki.get(i))+(leftpos.get(i)) +">"+ leftpos.get(x));
						if((leftmenseki.get(i))+(leftpos.get(i)) >= leftpos.get(x)){
//							System.out.println("?°´?????????????????¢???????¶????");
							area += leftmenseki.get(x);
							x++;
							if(x == leftpos.size()){
								break;
							}
						}
						else{
//							System.out.println("?°´??????????????????");
							break;
						}
					}
				}
			}
			if(area != 0.0){
//				System.out.println("?°´???????????£?????? i="+i);
				mizuAmount += 1;
				allMizuArea += area;
//				System.out.println("??¢?????? "+area);
				mizuHyouji.add(area);
			}
		}
//		System.out.println("????????° "+mizuAmount);
//		System.out.println("?????¢?????? "+allMizuArea);
		System.out.println(allMizuArea);
		System.out.print(mizuAmount);
		for(int i=0; i<mizuHyouji.size();i++){
			System.out.print(" "+mizuHyouji.get(i));
		}
		System.out.println("");



	}
}

Measured memory_bytes: 30320
#include <bits/stdc++.h>
//debug
#define vecprint(v) rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;cout << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define w1(a) cout<<(a)<<" "
#define w2(a,b) cout<<(a)<<" "<<(b)<<" "
#define w3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wl1(a) cout<<(a)<<endl
#define wl2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wl3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};


int main() {
  //input
  char a;
  cin >> a;
  
  //process

   if (isupper(a))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }
}

Measured memory_bytes: 3608
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
 
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cout << #x << " = " << x << endl;
 
template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}
 
template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();    
    return 0;   
}
 
const int MOD = 1e9 + 7, MAXN = 5e5 + 10, INF = 1e18 + 10, BASE = 37; 

void solve() {
    int n;
    cin >> n;
    cout << ((n + 999) / 1000) * 1000 - n << endl;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int f[SIZE][19] = {};
int to[SIZE][19] = {};
int dp[SIZE] = {};
int n;

int next_l(int x){

  int l = x;
  int sum_f = 0;
  
  for(int j=18;j>=0;j--){
    if(to[l][j] == -1) continue;

    if((sum_f | f[l][j]) != (1 << 26) - 1){
      sum_f |= f[l][j];
      l = to[l][j];
    }
  }

  l++;
  
  return l;
}

int main(){
  string s;
  cin >> s;

  n = s.size();

  //debug(n);

  memset(f, 0, sizeof(f));
  memset(to, -1, sizeof(to));

  for(int i=0;i<n;i++){
    f[i][0] = 1 << (s[i] - 'a');
    to[i][0] = i+1;
  }

  for(int j=1;j<19;j++){
    for(int i=0;i<n;i++){
      if(to[i][j-1] != -1){
        to[i][j] = to[to[i][j-1]][j-1];
      
        f[i][j] = f[i][j-1] | f[to[i][j-1]][j-1];
      }
      //cerr << "to[" << i << "][" << j-1 << "] = " << to[i][j-1] << endl; 
    }
  }

  dp[n] = 0;
  dp[n+1] = -1;
  
  for(int i=n-1;i>=0;i--){
    int ret = next_l(i);
    dp[i] = dp[ret] + 1;

    //cerr << i << " : " << dp[i] << endl;
  }

  int len = dp[0] + 1;

  //debug(len);

  string ans;
  int l = 0;
  
  for(int i=0;i<len;i++){
    
    if(i + 1  == len){
      int t = 0;
      for(int j=l;j<n;j++){
        t |= 1 << (s[j]-'a'); 
      }
 
      for(int j=0;j<26;j++){
        if(!(t & (1 << j))){
          ans += "a";
          ans[ans.size()-1] += j;
          break;
        }
      }
 
      continue;
    }
 
    bool flag = false;
    
    for(int j=0;j<26;j++){
      
      for(int k=l;;k++){
        if(s[k] - 'a' == j){
          int res = dp[k+1];
          if(res + 2 + i == len){
            ans += "a";
            ans[ans.size()-1] += j;
            l = k + 1;
            flag = true;
          }
          break;
        }
      }
 
      if(flag) break;
    }
  }
 

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



Measured memory_bytes: 31108
#include <iostream>
#include <queue>
#include <vector>

using Graph = std::vector<std::vector<uint32_t>>;

int main() {
  uint32_t n = 0;
  std::cin >> n;
  Graph G(n + 1);
  for (size_t i = 1; i < n + 1; i++) {
    uint32_t k = 0;
    std::cin >> i >> k;
    if (k > 0) G[i] = std::vector<uint32_t>(k);
    for (auto&& g : G[i]) std::cin >> g;
  }

  std::vector<int32_t> dist(n + 1, -1);
  dist[1] = 0;
  std::queue<uint32_t> Q({1});
  while (!Q.empty()) {
    uint32_t node = Q.front();
    Q.pop();
    for (auto&& to : G[node]) {
      if (dist[to] != -1) continue;
      Q.push(to);
      dist[to] = dist[node] + 1;
    }
  }

  for (size_t i = 1; i < dist.size(); i++) {
    std::cout << i << " " << dist[i] << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3148
import java.util.*;

class Main{
    public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int i = 0;
    if(s.equals("SUN")){
        i=7;
    }else if(s.equals("SAT")){
        i=1;
    }else if(s.equals("FRI")){
        i=2;
    }else if(s.equals("THU")){
        i=3;
    }else if(s.equals("WED")){
        i=4;
    }else if(s.equals("TUE")){
        i=5;
    }else if(s.equals("MON")){
        i=6;
    }
    System.out.println(i);


    }
}

Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
      ll X,Y;
      cin>>X>>Y;
      if(Y%2!=0){
        cout<<"No"<<endl;
        return 0;
      }
      else{
        ll gg=Y/2;
        ll hh=ceil(Y/4.0);
        if(X>=hh&&X<=gg){
                cout<<"Yes"<<endl;
        }
        else{
                cout<<"No"<<endl;
        }
      }
      return 0;
}


Measured memory_bytes: 3748
def f(str,base,add)
n=str.size
a=[base]
h=base
n.times do |i|
	case str[i]
	when '\\'
		h-=add
	when '/'
		h+=add
	end
	a.push(h)
end
return a
end


# your code goes here
str=STDIN.gets.chomp

a=f(str,0,1)
n=a.size
b=f(str.reverse,a[n-1],-1)


h1=a[0]
h2=b[0]
c=[]
n.times do |i|
h1=[a[i],h1].max
h2=[b[i],h2].max
c.push(h1)
b[i]=h2
end
b.reverse!
hit=false
ans=[]
sum=0
n.times do |i|
d=[c[i],b[i]].min-a[i]
if d>0
	sum=sum+d
else
	if sum>0
		ans.push(sum)
	end
	sum=0
end
end

if ans.size==0
puts 0
puts 0
else
sum=0
ans.size.times do |i|
	sum+=ans[i]
end
puts sum
print ans.size
ans.size.times do |i|
	print " ",ans[i]
end

puts ""
end

Measured memory_bytes: 7540
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,l,a,b,c,t,m;
    cin>>k;
    c=0;
    for(i=1;i<=k;i++)
    {
        for(j=1;j<=k;j++)
        {
            for(l=1;l<=k;l++)
            {
                a=__gcd(i,j);
                b=__gcd(a,l);
                c+=b;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <sstream>
#include <array>
#include <cmath>

template <typename T, typename U>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
    os << p.first << ' ' << p.second;
    return os;
}
template <typename T, typename U>
inline std::istream& operator>>(std::istream& os, std::pair<T, U>& p) {
    os >> p.first >> p.second;
    return os;
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
    if (v.empty()) {
        return os;
    }
    if (v.begin() != v.end()) {
        os << v.front();
    }
    for (auto it = ++v.begin(); it != v.end(); ++it) {
        os << ' ' << *it;
    }
    return os;
}
template <typename T>
inline std::istream& operator>>(std::istream& is, std::vector<T>& v) {
    for (auto& i : v) {
        is >> i;
    }
    return is;
}

bool is_appropriate_number(int n, int forbidden[10]) {
    while (n > 0) {
        if (forbidden[n % 10]) {
            return false;
        }
        n /= 10;
    }
    return true;
}

void Solve(std::istream& is, std::ostream& os) {
    int n, k;
    is >> n >> k;
    int forbidden[10] = {0}, next;
    while (k--) {
        is >> next;
        forbidden[next] = true;
    }

    while (true) {
        if (is_appropriate_number(n, forbidden)) {
            os << n;
            return;
        }
        ++n;
    }
}

int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    Solve(std::cin, std::cout);
    return 0;
}


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

using namespace std;

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

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

	int mini = *min_element(a.begin(), a.end());
	int maxi = *max_element(a.begin(), a.end());
	int n_mini = count(a.begin(), a.end(), mini);
	int n_maxi = count(a.begin(), a.end(), maxi);

	bool ans = false;
	if (maxi - mini > 1) {
		ans = false;
	} else if (maxi == mini) {
		ans = (n == mini + 1 || n >= mini * 2);
	} else {
		int n_color = maxi;
		if (n_color <= n_mini) {
			ans = false;
		} else {
			ans = n_mini + (n_color - n_mini) * 2 <= n;
		}
	}

	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


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

int N;
int p[50+10];

int main()
{
    scanf("%d",&N);
    for(int i=1;i<=N;i++)
        scanf("%d",&p[i]);
    for(int i=1;i<=N;i++)
    {
        if(p[i]!=i)
        {
            p[p[i]]=p[i];
            p[i]=i;
            break;
        }
    }
    bool solved=true;
    for(int i=1;i<=N;i++)
        if(p[i]!=i)
          solved=false;
    if(solved)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
LR = [tuple(map(int,input().split())) for i in range(M)]
maxl = 0
minr = N+1
for l,r in LR:
    maxl = max(maxl, l)
    minr = min(minr, r)
print(max(0, minr-maxl+1))

Measured memory_bytes: 16620
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
void trace(int n, int arr[]){for(int i = 0; i < n; i++){cout << i << " " << arr[i] << endl;} cout << endl << endl;}
int main()
{
    Hello
    char a;
    cin >> a;
    if(a >= 'A' && a <= 'Z')
        cout << 'A';
    else
        cout << 'a';
    return 0;
}

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

int a[20];
int cnt;
int n;

bool solve(int m, int i)
{
    if (m == 0) return true;
    if (i >= n) return false;
    bool res = solve(m - a[i], i+1) || solve(m, i+1);
    return res;
}
int main()
{
    int q;
    cin >> n;
    rep(i,n) cin >> a[i];
    cin >> q;
    vector<int> m(q);
    rep(i,q) cin >> m[i];

    rep(i,q){
        cnt = 0;
        if (solve(m[i], 0) == true) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}


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

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; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<pint>>;

int N,M;
Graph G;
vector<int> dist(N,-1);

int main(){
    cin>>N>>M;
    G.resize(N);
    vector<int> L,R;
    rep(i,M){
        int l,r,d;
        cin>>l>>r>>d;
        l--;
        r--;
        L.push_back(l);
        R.push_back(r);
        G[l].push_back({r,d});
        G[r].push_back({l,-d});
    }
    dist.resize(N,2e9);
    
    rep(v,N){
        if(dist[v]!=2e9)continue;
        priority_queue<pint,vector<pint>,greater<pint>> Q;
        Q.push({0,v});
        dist[v] = 0;
        while(!Q.empty()){
            int now = Q.top().second;
            Q.pop();
            for(auto p:G[now]){
                int nv = p.first;
                int cost = p.second;
                // cout<<now<<" "<<nv<<" "<<dist[now]<<" "<<dist[nv]<<" "<<cost<<endl;
                if(dist[nv]==2e9){
                    dist[nv] = dist[now] + cost;
                    Q.push({dist[nv],nv});
                }else{
                    if(dist[nv]!=dist[now]+cost){
                        cout<<"No"<<endl;
                        return 0;
                    }
                }
            }
        }
    }
    // rep(i,N)cout<<dist[i]<<endl;
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 14876
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	int taro = 0, hanako = 0;
	rep(i, n) {
		string s, t;
		cin >> s >> t;

		if (s > t) taro += 3;
		else if (s == t) taro++, hanako++;
		else hanako += 3;
	}
	cout << taro << " " << hanako << endl;
}


Measured memory_bytes: 3168
def main():
    N, Y = map(int, input().split())
    for x in range(N+1):
        for y in range(N-x+1):
            z = N - x - y
            if 10000*x + 5000*y + 1000*z == Y:
                print(x, y, z)
                return
    print(-1, -1, -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38896
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int a, b, c;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    if (a == b && b == c && a == c)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn get_index(x: usize, y: usize, w: usize) -> usize {
    x + y * w
}

fn main() {
    let v = read_vec::<usize>();
    let (h, w) = (v[0], v[1]);
    let mut grid = vec![vec![]; h];
    for i in 0..h {
        let s = read::<String>().chars().collect::<Vec<_>>();
        grid[i] = s;
    }

    let mut edges = vec![vec![INF; w * h]; w * h];
    for y in 0..h {
        for x in 0..w {
            if grid[y][x] == '#' {
                continue;
            }
            let idx = get_index(x, y, w);
            for (adj_x, adj_y) in get_adjacents(x, y, w, h) {
                if grid[adj_y][adj_x] == '#' {
                    continue;
                }
                let adj_idx = get_index(adj_x, adj_y, w);
                edges[idx][adj_idx] = 1;
            }
        }
    }
    let cost = warshall_floyd(w * h, edges);
    let mut ans = 0;
    for i in 0..w * h {
        for j in 0..w * h {
            if cost[i][j] >= INF {
                continue;
            }
            ans = max(ans, cost[i][j]);
        }
    }
    println!("{}", ans);
}

const INF: i64 = 1000000;

fn warshall_floyd(n: usize, mut edges: Vec<Vec<i64>>) -> Vec<Vec<i64>> {
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                edges[i][j] = std::cmp::min(edges[i][j], edges[i][k] + edges[k][j]);
            }
        }
    }
    edges
}

fn get_adjacents(x: usize, y: usize, w: usize, h: usize) -> Vec<(usize, usize)> {
    let mut adjacents = vec![];
    if x > 0 {
        adjacents.push((x - 1, y));
    }
    if y > 0 {
        adjacents.push((x, y - 1));
    }
    adjacents.push((x, y));
    if y < h - 1 {
        adjacents.push((x, y + 1));
    }
    if x < w - 1 {
        adjacents.push((x + 1, y));
    }
    adjacents
}

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()
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

struct UnionFind{
  VI par; // par[i]:iの親の番号
  UnionFind(int n) : par(n){ // 最初は全てが根であるとして初期化
    rep(i,n) par[i] = i;
  }
  int root(int x){
    if(par[x]==x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y){
    int rx = root(x); int ry = root(y);
    if(rx==ry) return;
    par[rx] = ry;
  }
  bool same(int x, int y){
    int rx = root(x); int ry = root(y);
    return rx==ry;
  }
};

signed main(){
  int n,m; cin>>n>>m;
  int p[n];
  UnionFind tree(n);

  rep(i,n){cin>>p[i]; p[i]--;}

  rep(i,m){
    int x,y; cin>>x>>y; x--; y--;
    tree.unite(x,y);
  }
  cerr << endl;
  // ここまで入力処理

  int ans = 0;
  rep(i,n){ // 与えられたp_iについて順々にp_iとiが連結か調べていく
    if(tree.same(i,p[i])) ans++; // 連結ならansに加える
    cerr << tree.same(i,p[i]) << ' '; // 連結判断のデバック 連結(移動可能)なら1
  }
  cerr << endl;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
 
        String s = in.next();
        for(int i = 0; i < s.length(); i++) {
            if(i%2==0) System.out.print(s.charAt(i));
        }
        System.out.println();
    }
}

Measured memory_bytes: 31224
#include<iostream>
#include<climits>

using namespace std;

int main(){
   int n, k;
   cin >> n >> k;
   int* x = new int[n];
   int numL = 0;
   int numR = 0;
   for(int i=0;i<n;i++){
      cin >> x[i];
      if(x[i] < 0 ){
         numL++;
      }else if(x[i]==0){
         numL++;
         numR++;
      }else if(x[i] >= 0){
         numR++;
      }
   }

   int ans = INT_MAX;
   // orikaesi
   for(int i=0;i<n;i++){
      if(x[i] <= 0){
         if(numL - i >= k){
            // nasi
            if(ans > -x[i]){
               ans = -x[i];
            }
         }else {
            // orikaesi
            int remain = k - numL + i;
            if(numL + remain - 1 < n){
               int cost = -2 * x[i] + x[numL + remain - 1];
               if(ans > cost){
                  ans = cost;
               }
            }
         }
      }else if(x[i] > 0){
         int j = n - i - 1;
         if(numR - j >= k){
            if(ans > x[i]){
               ans = x[i];
            }
         }else{
            int remain = k - numR + j;
            if(n - numR - remain>= 0){
               int cost = x[i] * 2 - x[n - numR - remain];
               if(ans > cost){
                  ans = cost;
               }
            }
         }
      }
   }

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

Measured memory_bytes: 640
k,n = map(int,input().split())
lst = list(map(int,input().split()))
dst = []

for i in range(n-1):
  dst.append(lst[i+1]-lst[i])
dst.append(lst[0] + k-lst[n-1])

dst_rev = sorted(dst)

ans = 0

for i in range(n-1):
  ans += dst_rev[i]

print (ans)

Measured memory_bytes: 26444
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int a = o[0];
            int b = o[1];
            int c = o[2];

            int ans = 0;
            if (a == b) { ans = c; }
            else if (a == c) { ans = b; }
            else { ans = a; }
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11092
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [usize; n]

    }

    let mut res = 0;

    for hi in h {
        if hi >= k {
            res += 1;
        }
    }

    println!("{}", res)
}

Measured memory_bytes: 4352
#include<iostream>

using namespace std;

int main(){
	int a,b,c;
	cin >> a >> b >> c ;
	int box[3]={a+b,a+c,b+c};
	int min=20000;
	for(int i=0; i<3; i++){
		if(min>=box[i]){
			min = box[i];
		}
	}
	cout << min << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
int a,b;
int main() {
	//freopen("1.txt","r",stdin);
	read(a); read(b);
	for (int i=b-a+1;i<=b+a-1;i++)
		printf("%d ",i);
	printf("\n");
	return 0;
}

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

#define int long long
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; }

signed main(){
	int n;
	cin >> n;
	vector<int> p(n), q(n), v(n);
	iota(v.begin(), v.end(), 1);

	for(int i = 0;i < n;i++) cin >> p[i];
	for(int i = 0;i < n;i++) cin >> q[i];

	int pp;
	int qq;

	int i = 0;
	do{
		if(v == p) pp = i;
		if(v == q) qq = i;
		i++;
	}while(next_permutation(v.begin(), v.end()));

	cout << abs(pp-qq) << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
s = list(input())
t = list(input())
cnt = 0
if s==t:
    ans = N
    cnt = 1
elif N==1:
    ans = N*2
    cnt = 1
else:
    for i in range(N):
        if s[i:]==t[:-i]:
            cnt = 1
            ans = N*2 - (N-i)
print(ans) if cnt==1 else print(N*2)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a[1000];
    for(int i=0;i<n;i++){
        for(int j=0;j<n-1;j++){
            int k;
            cin>>k;
            k--;
            a[i].push_back(k);
        }
        reverse(All(a[i]));
    }
    vector<int> day(n,mod);
    queue<vector<int>> Q;
    for(int i=0;i<n;i++){
        int j=a[i].back();
        if(j>i&&a[j].back()==i)Q.push({i,j,1});
    }
    while(!Q.empty()){
        auto v=Q.front();Q.pop();
        int i=v[0],j=v[1],d=v[2];
        for(int v:{i,j}){
            a[v].pop_back();
            if(!a[v].empty()){
                int x=a[v].back();
                if(a[x].back()==v){
                    Q.push({x,v,d+1});
                }
            }
            else{
                day[v]=d;
            }
        }
    }
    int res=0;
    for(auto it:day){
        res=max(res,it);
    }
    if(res==mod)cout<<-1<<endl;
    else cout<<res<<endl;

}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acos(-1);

struct dat {
    int a, b, c, d;
};

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

    ll A, B, N;
    cin >> A >> B >> N;

    cout << (N >= B ? A * (B - 1) / B : (A * N / B) - A * (N / B)) << endl;

    return 0;
}


Measured memory_bytes: 3660
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7

N, K = map(int, read().split())

A = [0] * (K + 1)
for d in range(1, K + 1):
    A[d] = pow(K // d, N, MOD)

for d in range(K, 0, -1):
    for i in range(2, K // d + 1):
        A[d] -= A[d * i]

answer = sum(d * x for d, x in enumerate(A))
print(answer % MOD)


Measured memory_bytes: 69280
n = int(input())
num = list(map(int,input().split()))
ans = 0
for idx in range(n-2):
  if num[idx] < num[idx+1] and num[idx+1] < num[idx+2]:
    ans += 1
  elif num[idx+2] < num[idx+1] and num[idx+1] < num[idx]:
    ans += 1
  else:
    pass

print(ans)

Measured memory_bytes: 3064
N = int(input())
A = sorted(list(map(int,input().split())))

S = [A[0]] + [0 for _ in range(N-1)]
for i in range(1,N):
  S[i] = S[i-1] + A[i]

ans = 1
for i in range(N-2,-1,-1):
  if S[i]*2 >= A[i+1]:
    ans += 1
  else:
    break
print(ans)

Measured memory_bytes: 65640