akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
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 (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    string N; cin >> N;
    if (N[0] == N[2]) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>
using namespace std;
long long gcd(long long a, long long b)
{
	long long tmp;
	while (a % b != 0)
	{
		tmp = b;
		b = a % b;
		a = tmp;
	}
	return b;
}

long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}

int main(int, char**)
{
	long long A, B, C, D;
	cin >> A >> B >> C >> D;
	long long E = lcm(C, D);
	cout << (B - A + 1)
			- (B / C - (A - 1) / C)
			- (B / D - (A - 1) / D)
			+ (B / E - (A - 1) / E)
	<< endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a[3],c7=0,c5=0;
	scanf("%d%d%d",&a[0],&a[1],&a[2]);
	for(int i=0;i<3;i++){
		if(a[i]==5){
			c5++;
		}else if(a[i]==7){
			c7++;
		}
	}
	if(c7==1 && c5==2)printf("YES\n");
	else printf("NO\n");
	return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll k_muls = 1;
  vector<ll> score(N, 0);
  for (int i = K; i < N; i++) {
    if (A[i - K] < A[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 6420
#include<iostream>

using namespace std;

int main()
{
	int n;
	while(cin>>n)
	{
		int count = 0;
		bool *flag = new bool[n+1]();
		for(int i=2;i<=n;++i)
		{
			if (flag[i])
			{
				continue;
			}
			for(int j=i*2;j<=n;j+=i)
			{
				flag[j] = true;
			}
		}
		flag[0]=true;
		flag[1]=true;
		for(int i=0;i<=n;++i)
		{
			if(!flag[i])
			{
				++count;
			}
		}
		cout<<count<<endl;
	}
}

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

int main() {
    int64_t X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vector<int64_t> A(X),B(Y),C(Z);
    for ( int64_t i = 0; i < X; ++i){
        cin >> A[i];
    }
    for ( int64_t i = 0; i < Y; ++i){
        cin >> B[i];
    }
    for ( int64_t i = 0; i < Z; ++i){
        cin >> C[i];
    }
    
    vector<int64_t> AB(X*Y);
    for ( int64_t i = 0; i < X; ++i){
        for ( int64_t j = 0; j < Y; ++j){
            int64_t ab = A[i] + B[j];
            AB[i*Y+j] = ab;
        }
    }
    sort(AB.begin(),AB.end(),greater<int64_t>());
    
    vector<int64_t> ABC(3000*Z);
    int64_t rep;
    if ( X * Y > 3000 ) rep = 3000;
    else rep = X * Y;
    for ( int64_t i = 0; i < rep; ++i){
        for ( int64_t j = 0; j < Z; ++j){
            int64_t abc;
            abc = AB[i] + C[j];
            ABC[i*Z+j] = abc;
        }
    }
    sort(ABC.begin(),ABC.end(),greater<int64_t>());
    
    for ( int64_t i = 0; i < K; ++i){
        cout << ABC[i] << endl;
    }
    
    
    return 0;
}


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

using namespace std;

const int inf = (int)1e9 + 7;

char c[2005][2005];
int b[2005][2005];
int he[2005][2005];

int get (int n, int a[]) {
    stack < int > left, right;
    int width[n + 1];
    for (int i = 0; i < n; i++) width[i] = 1;
    for (int i = 0; i < n; i++) {
        while (!left.empty() && a[i] <= a[left.top()]) left.pop();
        if (left.empty()) {
            width[i] += i;
        } else {
            width[i] += i - left.top() - 1;
        }
        left.push(i);
    }
    for (int i = n - 1; i >= 0; i--) {
        while (!right.empty() && a[i] <= a[right.top()]) right.pop();
        if (right.empty()) {
            width[i] += n - i - 1;
        } else {
            width[i] += right.top() - i - 1;
        }
        right.push(i);
    }
    int mx = -inf;
    for (int i = 0; i < n; i++) {
        mx = max(mx, (a[i] + 1) * min(n, (width[i] + 1)));
    }
    return mx;
}

main() {
    int h, w; scanf ("%d %d", &h, &w);
    bool p = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++)
            cin >> c[i][j];
    }
    for (int i = 0; i < h - 1; i++) {
        for (int j = 0; j < w - 1; j++) {
            int res = (c[i][j] == '#') + (c[i + 1][j] == '#') + (c[i + 1][j + 1] == '#') + (c[i][j + 1] == '#');
            if ((res & 1) ^ 1) {
                b[i][j] = 1;
            } else p = 0;
        }
    }
    if (p) {
        cout << h * w;
        return 0;
    }
    int ans = max(h, w);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (b[i][j] == 1) {
                if (i == 0) {
                    he[i][j] = 1;
                } else he[i][j] = he[i - 1][j] + 1;
            }
//            cout << he[i][j] << ' ';
        }
//        puts("");
        ans = max(ans, get(w, he[i]));
//        cout << ans << endl;
    }

    cout << ans;
}


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

def init():
    #set_val
    #for j in range(26):
    #  for i in range(n):
    #    seg[j][i+num-1]=init_val[i]    
    #built
    for j in range(26):
      for i in range(num-2,-1,-1) :
        seg[j][i]=max(seg[j][2*i+1],seg[j][2*i+2]) 
    
def update(k,x):
    K =k+num-1
    seg[SS[k]][K] = 0
    while K:
        K = (K-1)//2
        seg[SS[k]][K] = max(seg[SS[k]][K*2+1],seg[SS[k]][K*2+2])
    K =k+num-1
    seg[x][K]=1
    while K:
      K=(K-1)//2
      seg[x][K]=max(seg[x][K*2+1],seg[x][K*2+2])
    SS[k]=x
    
def query(p,q):
  a=0
  for i in range(26):
    P =p+ num-1
    Q =q+ num-1
    res=ide_ele
    while Q-P>1:
        if P&1 == 0:
            res = max(res,seg[i][P])
        if Q&1 == 1:
            res = max(res,seg[i][Q])
            Q -= 1
        P = P//2
        Q = (Q-1)//2
    if P == Q:
        res = max(res,seg[i][Q])
    else:
        res = max(max(res,seg[i][P]),seg[i][Q])
    a=a+res
  print(a)
  return a

n=int(input())
S=input()
q=int(input())


#####単位元######
ide_ele = 0

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[[ide_ele]*2*num for i in range(26)]


SS=[0]*num
for i in range(n):
  seg[ord(S[i])-97][i+num-1]=1
  SS[i]=ord(S[i])-97
#print(SS)
#print(seg)
init()
#print(seg)

for xx in range(q):
  SSS=list(input().split())
  #print(SSS)
  if SSS[0]=="1":
    #print(int(SSS[1])-1,ord(SSS[2])-97)
    update(int(SSS[1])-1,ord(SSS[2])-97)
  else:
    query(int(SSS[1])-1,int(SSS[2])-1)
#print(seg)

Measured memory_bytes: 266248
#include <bits/stdc++.h>
 using namespace std;
//
// int main() {
//   std::ios_base::sync_with_stdio(false);
//       std::cin.tie(NULL);
// int n;
// std::cin >>n;
// while (n>0) {
//    n-=1000;
// }
// std::cout << abs(n) << '\n';
// std::map<string, int> mapp;
// int n;
// std::cin >>n;
// mapp["AC"]=0;
// mapp["TLE"]=0;
// mapp["WA"]=0;
// mapp["RE"]=0;
// while (n--) {
//   string a;
//   std::cin >>a;
//   mapp[a]++;
// }
//
// std::cout <<"AC"<<" x"<< ' ';
// std::cout <<mapp["AC"] << '\n';
// std::cout <<"WA"<<" x"<< ' ';
// std::cout <<mapp["WA"] << '\n';
// std::cout <<"TLE"<<" x"<< ' ';
// std::cout <<mapp["TLE"] << '\n';
// std::cout <<"RE"<<" x"<< ' ';
// std::cout <<mapp["RE"] << '\n';
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

int h,w,k;
vector <string> grid;
bool check(int r,int c){
  int cnt = 0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(r & (1 << i) || c & (1 << j)){
          continue;
        }
        if(grid[i][j] == '#'){
          cnt++;
        }
      }
    }
    return cnt == k;
}

int main(){

  ios_base :: sync_with_stdio(false);
  cin.tie(NULL);

  cin >> h >> w >> k;

  grid.resize(h);

  for(int i=0;i<h;i++)
    cin >> grid[i];

  int ans  =0;
  for(int r=0;r<(1<<h);r++){
    for(int c=0;c<(1<<w);c++){
      if(check(r,c))
        ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
l_s = input()
sum = 0
for i in range(2**(len(l_s)-1)):
    m_s = list(l_s)
    countj = 0
    for j in range(len(l_s)-1):
        if  i & (1<<j):
            m_s.insert(j+1+countj,'+')
            countj += 1
    m_s = ''.join(m_s)
    sum += eval(m_s)
print(sum)


Measured memory_bytes: 40176
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi=acos(-1.0);

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int main(void){
    int x,y,z;
    cin>>x>>y;
    
    for(int i=0;i<=x;++i){
        z=y;
        z=y-i*4;
        if(z==(x-i)*2){cout<<"Yes"<<endl;return 0;}
        
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int n, m;
int ans = 0;

bool c ( int d ) {
    if ( m%d ) { return 0; }
    if ( m/d < n ) { return 0; }
    ans = max( ans, d );
}

int main () {
    cin >> n >> m;
    for ( int d = 1 ; d*d <= m ; d ++ ) {
        c( d );
        c ( m/d );
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=1005;
const int MOD=1e9+7;

int32_t main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n,k;
  cin>>n>>k;
  int arr[n];
  for(int i=0;i<n;i++)
  {
  	cin>>arr[i];
  }
  int sum=0;
  sort(arr,arr+n,greater<int> ());
  for(int i=k;i<n;i++)
  {
  	sum+=arr[i];
  }
  cout<<sum;
}




Measured memory_bytes: 1792
local m, k = io.read("*n", "*n")
local n = 2^m
if(k == 0) then
  io.write("0 0")
  for i = 1, n - 1 do
    io.write(" " .. i .. " " .. i)
  end
  io.write("\n")
elseif(n <= k) then
  print(-1)
elseif(m == 1 and k == 1) then
  print(-1)
elseif(n - 1 == k) then
  local rem = n - 2
  io.write(1)
  for i = n - 3, 0, -1 do
    if(i ~= 1) then
      io.write(" " .. i)
    end
  end
  io.write(" " .. n - 1 .. " " .. 1 .. " " .. rem .. " " .. n - 1)
  for i = 0, n - 3 do
    if(i ~= 1) then
      io.write(" " .. i)
    end
  end
  io.write(" " .. rem)
  io.write("\n")
else
  local rem = (n - 1) - k
  io.write(n - 1)
  for i = n - 2, 0, -1 do
    if(i ~= k and i ~= rem) then
      io.write(" " .. i)
    end
  end
  io.write(" " .. k .. " " .. n - 1 .. " " .. rem .. " " .. k)
  for i = 0, n - 2 do
    if(i ~= k and i ~= rem) then
      io.write(" " .. i)
    end
  end
  io.write(" " .. rem)
  io.write("\n")
end


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

int main() {
	int A,B,C;
	cin >> A >> B >> C;
  int mx = max({A,B,C});
  cout << mx*10 + A + B + C - mx << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;++i) cin>>A[i];
  sort(A.begin(), A.end(), greater<ll>());
  int index;
  ll max = inf;
  for(int i=1;i<N;++i) {
    if(max>abs(A[0]-2*A[i])) {
      max = abs(A[0]-2*A[i]);
      index = i;
    }
  }
  cout<<A[0]<<" "<<A[index]<<endl;
}


Measured memory_bytes: 3972
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main(){
int a,b,c;
char ans[100];
	while(cin>>a>>b){
		sprintf(ans,"%d",a+b);
	c=strlen(ans);
	cout<<c<<endl;
	}
return 0;
}

Measured memory_bytes: 3192
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    bool ispallindrome(string s)
    {
        int i=0,j=s.length()-1;
        while(i<j)
        {
            if(s[i]!=s[j])
                return false;
            ++i,--j;
        }
        return true;
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            string s;
            cin>>s;
            int n=s.length(),i,j;
            string s2="";
            if(!ispallindrome(s))
            {
                cout<<"No"<<endl;
                return 0;
            }
            for(i=0;i<(n-1)/2;++i)
                s2+=s[i];
            
            if(!ispallindrome(s2))
            {
                cout<<"No"<<endl;
                return 0;
            }
            s2="";
            for(i=(n+3)/2-1;i<n;++i)
                s2+=s[i];
            if(!ispallindrome(s2))
            {
                cout<<"No"<<endl;
                return 0;
            }
            cout<<"Yes"<<endl;
        }
        return 0;
    }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <limits>
#include <cmath>
#include <numeric>
#include <string>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
#define rep(i, a, b) for(int i = (a); i < (b); ++i )
#define rrep(i, a, b) for(int i = (a); i > (b); --i )
#define REP(i, a, b) for(int i = (a); i <= (b); ++i )
#define RREP(i, a, b) for(int i = (a); i >= (b); --i )
#define llrep(i, a, b) for(ll i = (a); i < (b); ++i )
#define llrrep(i, a, b) for(ll i = (a); i > (b); --i )
#define llREP(i, a, b) for(ll i = (a); i <= (b); ++i )
#define llRREP(i, a, b) for(ll i = (a); i >= (b); --i )
#define ullrep(i, a, b) for(ull i = (a); i < (b); ++i )
#define ullrrep(i, a, b) for(ull i = (a); i > (b); --i )
#define ullREP(i, a, b) for(ull i = (a); i <= (b); ++i )
#define ullRREP(i, a, b) for(ull i = (a); i >= (b); --i )



string S, T;

ull N;
ull A;
ull X[60];
ull dp[60][60][2510];

int main() {
    cin >> N >> A;
    rep(i, 0, N) cin >> X[i];

    REP(i, 0, N)
    REP(j, 0, N)
    REP(k, 0, A*N) {
        dp[i][j][k] = 0;
    }
    dp[0][0][0] = 1;

    ull cnt = 0;
    rep(i, 0, N) {
        REP(k, 0, N) {
            REP(j, 0, A*N) {
                dp[i+1][k][j] += dp[i][k][j];
                if(j >= X[i]) {
                    dp[i+1][k+1][j] += dp[i][k][j-X[i]];
                }
            }
        }
    }
    REP(k, 1, N) {
        cnt += dp[N][k][k*A];
    }
    cout << cnt << endl;
}


Measured memory_bytes: 61568
#include<bits/stdc++.h>
#define ll long long int
ll N, M, K, A[200100], B[200100], i, st, ans;
using namespace std;
int main()
{
    cin >> N >> M >> K;
    for(i=1;i<=N;i++)
    {
        cin >> st;
        A[i] = A[i-1]+st;
    }
    for(i=1;i<=M;i++)
    {
        cin >> st;
        B[i] = B[i-1]+st;
    }
    for(i=0;i<=N;i++)
    {
        if(A[i]>K)
            break;
        while(M>0 && A[i]+B[M]>K)
            M--;
        ans = max(ans, i+M);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6692
n,m=map(int,input().split())
x=[int(i) for i in input().split()]

if n>=m:
  print(0)
  exit()

x.sort()
d=[abs(x[i]-x[i+1]) for i in range(m-1)]
d.sort(reverse=True)
print(abs(x[m-1]-x[0])-sum([d[i] for i in range(n-1)]))

Measured memory_bytes: 13832
#include <iostream>
#include <queue>
#include <string.h>

using namespace std;

const int INF = 999999;

class Node{
public:
	int x, y, foot, cost;
	Node(int x, int y, int foot, int cost) : x(x), y(y), foot(foot), cost(cost) {}
	bool operator < (const Node &n) const { return cost > n.cost; }
};

int main(){
	int w, h;
	char b[60][30];
	bool visit[2][60][30];
	int dist[2][60][30];
	while(cin >> w >> h){
		if(!(w||h)) break;
		int ans = INF;
		priority_queue<Node> qu;
		memset(visit, false, sizeof(visit));
		memset(dist, INF, sizeof(dist));
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin >> b[i][j];
				if(isdigit(b[i][j])) b[i][j] -= '0';
				else if(b[i][j] == 'S'){
					qu.push(Node(j,i,0,0));
					qu.push(Node(j,i,1,0));
					dist[0][i][j] = 0;
					dist[1][i][j] = 0;
				}
			}
		}
		while(!qu.empty()){
			Node e = qu.top(); qu.pop();
			if(visit[e.foot][e.y][e.x]) continue;
			if(b[e.y][e.x]=='T'){
				ans = e.cost;
				break;
			}
			visit[e.foot][e.y][e.x] = true;
			for(int dx=1;dx<=3;dx++){
				for(int dy=dx-3;dy<=3-dx;dy++){
					int x = e.x + (e.foot ? -dx : dx);
					int y = e.y + dy;
					if(x<0||x>=w||y<0||y>=h||visit[(1+e.foot)%2][y][x]) continue;
					if(b[y][x]=='X'||b[y][x]=='S') continue;
					if(dist[(1+e.foot)%2][y][x] > e.cost + (b[y][x]!='T'?b[y][x]:0)){
						dist[(1+e.foot)%2][y][x] = e.cost + (b[y][x]!='T'?b[y][x]:0);
						qu.push(Node(x,y,(1+e.foot)%2,e.cost+(b[y][x]!='T'?b[y][x]:0)));
					}   
				}   
			}
		}
		cout << (ans == INF ? -1 : ans) << endl;  
	}
}

Measured memory_bytes: 944
#include<bits/stdc++.h>
using namespace std;
#define int long long
main(){
  int n,a[200001]={},t,k;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>t;
    a[t]++;
  }
  sort(a,a+200001);
  int ans=0;
  for(int i=0;i<200001-k;i++)ans+=a[i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <limits>
#include <algorithm>
#include <string>

int main()
{
    std::string str;
    std::cin >> str;

    int min_time = std::numeric_limits<int>::max();

    for (char ch = 'a'; ch <= 'z'; ch++) {
        int last_occ = -1;
        int max_len = 0;
        for (int i = 0; i < str.size(); i++) {
            if (str[i] == ch) {
                int len = i - last_occ - 1;
                max_len = std::max(max_len, len);
                last_occ = i;
            }
        }
        int len = str.size() - last_occ - 1;
        max_len = std::max(max_len, len);

        min_time = std::min(min_time, max_len);
    }

    std::cout << min_time << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;

int main() {
	int n, k, q;

	cin >> n >> k >> q;

	int a[n];
	memset(a, 0, sizeof(a));

	for(int i = 0; i < q; i++) {
		int tmp;
		cin >> tmp;

		a[tmp - 1]++;
	}

	for(int i = 0; i < n; i++) {
		if(q - a[i] >= k) cout << "No" << endl;
		else cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/

int main(){
    int mod=1000000007;
    vector<int> a(5);
    for(auto&e:a) {
        scanf("%d",&e);
    }
    sort(a.begin(),a.end());
    for(int i=4;i>0;i--) {
        printf("%d ",a[i]);
    }
    printf("%d\n",a[0]);
    return 0;
}

Measured memory_bytes: 3224
using System;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();
        var t = Console.ReadLine();
        var k = m1(s, t);

        if (k < 0)
        {
            Console.WriteLine("UNRESTORABLE");
            return;
        }

        var left = s.Substring(0, k).Replace('?', 'a');
        var right = s.Substring(k + t.Length).Replace('?', 'a');
        Console.WriteLine(left + t + right);
    }

    static int m1(string s, string t)
    {
        for (int i = s.Length - t.Length; i >= 0; i--)
        {
            var all = true;
            for (int j = 0; j < t.Length; j++)
            {
                all &= s[i + j] == '?' || s[i + j] == t[j];
            }

            if (all)
            {
                return i;
            }
        }

        return -1;
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>
#include <bitset>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 998244353;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

const int MAX = 510000; //nCrのr
//const ll INF = (ll)1e18 + 1;

#include <cassert>
long long fac[MAX], finv[MAX], inv[MAX], facn[MAX];
class mint {
public:
    long long x;
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    //mint operator-() const{ return mint(-x);}
    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;
    }

};

int main(){
  int N, S; cin >> N >> S;
  vector<int> a(N); rep(i, N) cin >> a[i];

  vector<vector<mint>> dp(N + 1, vector<mint>(S + 1));
  dp[0][0] = 1;
  for (int i = 0; i < N; ++i){
    for (int j = 0; j <= S; ++j){
      dp[i + 1][j] += dp[i][j] * 2;
      if (j + a[i] <= S) dp[i + 1][j + a[i]] += dp[i][j];
    }
  }
  cout << dp[N][S].x << endl;
}


Measured memory_bytes: 73660
import java.util.Scanner;

public class Main {
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt(), b = sc.nextInt();

		sc.close();

		if (a == b)
		{
			System.out.println("Draw");
			return;
		}

		if (a > b)
		{
			if (b == 1)
			{
				System.out.println("Bob");
				return;
			}

			System.out.println("Alice");
		}
		else
		{
			if (a == 1)
			{
				System.out.println("Alice");
				return;
			}

			System.out.println("Bob");
		}
	}
}


Measured memory_bytes: 21844
tanku=[5,7,5,7,7]
while True:
    n = int(input())
    
    if n == 0:
        break
    
    b = 0
    l = []
    wlen = 0
    for i in range(n):
        w = str(input())
        wlen = len(w)
        l.append(wlen)
        
    for i in range(len(l)):
        a = 0
        tan = 0
        for j in range(i,len(l)):
            a += l[j]
            
            if a > tanku[tan]:
                break
            
            elif a == tanku[tan]:
                if tan != 4:
                    tan += 1
                    a = 0
                elif tan == 4:
                    print(i+1)
                    b += 1
                    break
        if b != 0:
            break


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main()
{
    LL A,B,C;cin>>A>>B>>C;
    LL ans = 0;
    while(A%2==0&&B%2==0&&C%2==0){
        if(ans == 1000){
            ans=-1;
            break;
        }
        LL a=A,b=B,c=C;
        A = (c+b)/2;
        B = (a+c)/2;
        C = (a+b)/2;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    int n, m;
    cin>>n>>m;
    int x[100000], y[100000];
    for(int i=0; i<n; i++) cin>>x[i];
    for(int i=0; i<m; i++) cin>>y[i];
    long long int xt=0, yt=0;
    for(int i=1; i<=n; i++) xt=(xt+(long long int)(2*i-1-n)*x[i-1])%1000000007;
    for(int i=1; i<=m; i++) yt=(yt+(long long int)(2*i-1-m)*y[i-1])%1000000007;
    cout<<(xt*yt)%(1000000007)<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){int a=0,w=0,r=0,t=0,s;cin>>s;string d;
           for(int i=0;i<s;i++){cin>>d;if(d=="AC")a++;else if(d=="WA")w++;else if(d=="RE")r++;else t++;}
cout<<"AC x "<<a<<endl;cout<<"WA x "<<w<<endl;
           cout<<"TLE x "<<t<<endl;
           cout<<"RE x "<<r<<endl;}

Measured memory_bytes: 3628
import java.io.*;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			int sum = 0;
			String str = input.readLine();
			if (str.equals("0"))
				break;
			for (int i = 0; i < str.length(); i++) {
				sum += str.charAt(i) - '0';
			}
			System.out.println(sum);
		}
	}
}

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

using namespace std;

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

int pow10_[15];
int cnt[15];
// 1~midまでの桁数の和
int func(int mid) {
    string s = to_string(mid);
    int n = s.size();
    int sum = 0;
    FOR(i, 1, n) { sum += cnt[i] * i; }
    int rem = mid - pow10_[n - 1] + 1;
    sum += n * rem;
    return sum;
}
bool solve() {
    int N, K;
    cin >> N >> K;
    if (N == 0 && K == 0) return false;
    int ok = 0, ng = 1e9;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        int sum = func(mid);
        if (sum < N)
            ok = mid;
        else
            ng = mid;
    }
    // cerr << "ng:" << ng << endl;
    int rem = N - func(ng - 1);
    // cerr << "rem:" << rem << endl;
    string S;
    while (S.size() < 1000) {
        S += to_string(ng);
        ng++;
    }
    rem--;
    if (rem + K > S.size()) {
        cerr << "index out of range" << endl;
        cerr << N << " " << K << endl;
        cerr << "rem:" << rem << endl;
        cerr << S << endl;
    }
    FOR(i, rem, rem + K) cout << S[i];
    cout << endl;
    return true;
}
signed main() {
    int n = 1;
    REP(i, 15) {
        pow10_[i] = n;
        n *= 10;
    }
    FOR(i, 1, 14) { cnt[i] = pow10_[i] - pow10_[i - 1]; }
    while (solve())
        ;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL p(int x, int y){
	LL a=1;
	REP(i,y){
		a *= x;
	}
	return a%MOD;
}

void Main()
{
	int n;cin>>n;
	LL result = 0;
	
	VVI count(62);
	REP(i,62){
		count[i].resize(2);
	}

	REP(i,n){
		LL a; cin>>a;
		//LL t = a;
		//dump(a)

		for(int j=0;j<62;j++,a/=2){
			//dump(a)
			//dump(j)
			if(a%2 == 0){
				result += p(2,j) * count[j][1];
				//dump(0)
				//dump(count[j][1])
				//dump(p(2,j))
			}
			else{
				result += p(2,j) * count[j][0];
				//dump(1)
				//dump(count[j][0])
				//dump(p(2,j))
			}

			count[j][a%2] ++;
		}
		result %= MOD;
	}
	cout << result << endl;

	return;
}

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

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

int main()
{
	string s;
	cin >> s;
	int puni = 0, index = -1, n = s.size();
	for (int i = 2; i <= n - 2; i++)
	{
		if (s[i] == 'C')
		{
			puni++;
			index = i;
		}
	}
	bool f = true;
	for (int i = 1; i < n; i++)
	{
		if (i == index)
		{
			continue;
		}
		if (!('a' <= s[i] && s[i] <= 'z'))
		{
			f = false;
			break;
		}
	}
	cout << ((s[0] == 'A' && puni == 1 && f) ? "AC" : "WA") << endl;
	return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    priority_queue<int> q;
    rep(i,n){
        int a;
        cin >> a;
        q.push(a);
    }
    while(m-->0){
        int a = q.top();q.pop();
        a /= 2;
        q.push(a);
    }
    ll ans = 0;
    while(!q.empty()){
        int a = q.top();q.pop();
        ans += a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3832
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<bitset>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();++itr)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
#define spln(i,n) (i==n?'\n':' ')
#define fac_init(n){fac[0]=fac[1]=inv[1]=fi[0]=fi[1]=1;fz(i,2,n){fac[i]=1ll*fac[i-1]*i%mod;inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;fi[i]=1ll*fi[i-1]*inv[i]%mod;}}
using namespace std;
inline void read(int &x)
{
	char c;int f=1;
	while(!isdigit(c=getchar()))if(c=='-')f=-1;
	x=(c&15);while(isdigit(c=getchar()))x=(x<<1)+(x<<3)+(c&15);
	x*=f;
}
int n,m,i,j,ch[2100005][3],pw3[21],rev[2100005],id[2100005],cnt,ans[2100005];
string st;
int build(int dep,int l)
{
	int x=++cnt;
	if(dep==n){
		id[x]=l;
		return x;
	}
	int t=pw3[dep];
	ch[x][0]=build(dep+1,l);
	ch[x][1]=build(dep+1,l+t);
	ch[x][2]=build(dep+1,l+t+t);
	return x;
}
void upd(int x)
{
	rev[x]^=1;
	swap(ch[x][1],ch[x][2]);
}
void pushdo(int x)
{
	if(rev[x]){
		upd(ch[x][0]);
		upd(ch[x][1]);
		upd(ch[x][2]);
		rev[x]=0;
	}
}
void sft(int x,int d)
{
	if(d==n) return;
	pushdo(x);
	int tmp=ch[x][0];
	ch[x][0]=ch[x][2];
	ch[x][2]=ch[x][1];
	ch[x][1]=tmp;
	sft(ch[x][0],d+1);
}
void dfs(int dep,int x,int l)
{
	if(dep==n){
		ans[id[x]]=l;
		return;
	}
	pushdo(x);
	int t=pw3[dep];
	dfs(dep+1,ch[x][0],l);
	dfs(dep+1,ch[x][1],l+t);
	dfs(dep+1,ch[x][2],l+t+t);
}
int main()
{
	cin>>n;
	pw3[0]=1;
	fz1(i,n){
		pw3[i]=3*pw3[i-1];
	}
	int rt=build(0,0);
	cin>>st;
	fz0k(i,st.size()){
		if(st[i]=='S'){
			upd(rt);
		}
		else{
			sft(1,0);
		}
	}
	dfs(0,rt,0);
	fz0k(i,pw3[n]) printf("%d ",ans[i]);
	return 0;
}

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


Measured memory_bytes: 2128
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main(){
int a,b,c,d,e;cin>>a>>b>>c>>d>>e;
int k;cin>>k;

int sa=e-a;

if(sa>k) cout<<":("<<endl;
else cout<<"Yay!"<<endl;

}


Measured memory_bytes: 256
n, a, b = gets.chomp.split.map(&:to_i)
if a == b
  puts "1"
elsif a > b
  puts "0"
elsif n == 1
  puts "0"
else
  lb = a * (n - 1) + b
  ub = a + (n - 1) * b
  puts ub - lb + 1
end

Measured memory_bytes: 14356
n = int(input())
s = 1
ans = 1
for i in range(1, n+1):
  s *= i
for i in range(2, n+1):
  k = 1
  while s % i == 0:
    s = s // i
    k += 1
  ans *= k
print(ans % (10 ** 9 + 7))

Measured memory_bytes: 8820
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  s = input()
  ans = 'Good'
  for i in range(3):
    if s[i]==s[i+1]:
      ans ='Bad'
  print(ans)
  
  
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5076
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

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


Measured memory_bytes: 3536
N,M=map(int,input().split())
par=[0 for i in range(N)]
rnk=[0 for i in range(N)]
def init(n):
    for i in range(N):
        par[i]=i
        rnk[i]=0
def find(x):
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
def unite(x,y):
    x=find(x)
    y=find(y)
    if x==y:
        return
    if (rnk[x]<rnk[y]):
        par[x]=y
    else:
        par[y]=x
        if(rnk[x]==rnk[y]):
            rnk[x]+=1
def same(x,y):
    return find(x)==find(y)

p=[int(i)-1 for i in input().split()]
init(N)
for i in range(M):
    x,y=map(int,input().split())
    unite(x-1,y-1)
ans=0
for i in range(N):
    if same(i,p[i]):
        ans+=1
print(ans)


Measured memory_bytes: 15408
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int (i) = 0; i < (n); i++)
#define REP(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF LLONG_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
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 mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



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

  int n;
  cin >> n;
  cout << (n - 1) / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

for i in range(1, N):
    if h[i] - h[i - 1] >= 1:
        h[i] -= 1

for i in range(1, N):
    if h[i] - h[i - 1] < 0:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 14396
#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>

using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rep1(i,n) for(int i=1;i<=(int)n;++i)

int N;
int A[200010];
int counter[200010];
bool added[200010];

signed main()
{
	cin >> N;
	rep(i,N) {
		cin>>A[i];
		counter[A[i]]++;
	}

	int sum = 0;

	rep(i, N) {
		int n = counter[A[i]];
		//printf("counter[%lld]=%lld\n",A[i],counter[A[i]]);
		if (not added[A[i]]) {
			sum += n * (n - 1) / 2;
			added[A[i]] = true;
		}
	}
	
	if (0) {
		printf("sum=%lld\n", sum);
	}

	rep(i, N) {
		int n = counter[A[i]];
		if (n == 0) {
			cout << sum << endl;
		} else {
			sum -= n*(n-1)/2;
			cout << sum + (n-1) * (n-2) / 2 << endl;
			sum += n * (n-1)/2;
		}
	}
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


class Set {
    multiset<ll> s;

public:
    void insert(ll l) {
        s.insert(-l);
    }

    ll find(ll l) {
        auto it = s.upper_bound(-l);
        if (it == s.end()) return -1;
        return -(*it);
    }

    void erase(ll l) {
        s.erase(s.find(-l));
    }

};

int main() {
    Set s;

    int n;
    cin >> n;
    rep(i, 1 << n) {
        ll a;
        cin >> a;
        s.insert(a);
    }

    ll top = s.find(INF);
    multiset<ll, greater<ll>> used;
    used.insert(top);

    s.erase(top);

    rep(i, n) {
        vector<ll> next;
        for (ll u : used) {
            ll t = s.find(u);
            if (t == -1) {
                cout << "No" << endl;
                ret();
            }
            s.erase(t);
            next.push_back(t);
        }
        for (ll l : next) used.insert(l);
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 17148
#include <stdio.h>
#include <stdlib.h>
#define NIL -1
#define Binary 2

typedef struct{
    
    int parent;
    int l;
    int r;
}data; 

void PreOrder(data *Tree,int root){
    
    if(root == NIL)return;
    printf(" %d",root);
    PreOrder(Tree,Tree[root].l);
    PreOrder(Tree,Tree[root].r);
}

void InOrder(data *Tree, int root){
    
    if(root == NIL)return;
    InOrder(Tree,Tree[root].l);
    printf(" %d",root);
    InOrder(Tree,Tree[root].r);
}

void PostOrder(data *Tree, int root){
    
    if(root == NIL)return;
    PostOrder(Tree,Tree[root].l);
    PostOrder(Tree,Tree[root].r);
    printf(" %d",root);
}
int main(int argc, char** argv) {

    int n, val, lc, rc,parent, rootnode;
    scanf("%d",&n);
    data Tree[n];
    
    for(int i = 0; i < n; i++)Tree[i].parent = NIL;
    for(int i = 0 ;i < n; i++){
        
      scanf("%d %d %d",&parent,&lc,&rc);
      Tree[parent].l = lc;
      Tree[parent].r = rc;
      
      if(lc != NIL)Tree[lc].parent = parent;
      if(rc != NIL)Tree[rc].parent = parent;
      
      //printf("node %d leftc %d rightc %d\n",Tree[i].parent,Tree[i].l,Tree[i].r);
    }
    for(int i = 0; i < n ;i++){
        if(Tree[i].parent == NIL)rootnode = i;
    }

    printf("Preorder\n");
    PreOrder(Tree,rootnode);
    printf("\n");
    printf("Inorder\n");
    InOrder(Tree,rootnode);
    printf("\n");
    printf("Postorder\n");
    PostOrder(Tree,rootnode);
    printf("\n");
    return 0;
}


Measured memory_bytes: 2112
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, A: "List[int]"):
    counts = {}
    for v in A:
        if not v in counts:
            counts[v] = 0
        counts[v] += 1
    cnts = list(counts.values())
    s = 0
    for c in cnts:
        s += (c * (c - 1)) // 2
    for v in A:
        ret = s
        if counts[v] > 1:
            ret -= counts[v] - 1
        print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 86096
#include<bits/stdc++.h>
using namespace std;
void dfs(int u, vector<vector<int>> &graph, bool visited[])
{
    visited[u] = true;
    for (auto v : graph[u])
    {
        if (!visited[v])
            dfs(v, graph, visited);
    }
}
int main()
{

    int n, m;
    cin >> n >> m;
    bool visited[n + 1];
  	for(int i=0; i<n+1; i++)
      visited[i]=false;
    vector<vector<int>> graph(n + 1);
    for (int i = 1; i <= m; i++)
    {
        int u, v;
        cin >> u >> v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (!visited[i])
        {
            dfs(i, graph, visited);
            count++;
        }
    }
    cout << count - 1 << '\n';
}

Measured memory_bytes: 9856
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<50
#define fst first
#define sec second
#define pb push_back
#define int long long
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(int itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(int itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define debug(x)  cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<ll,ll> P;

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

  char c;
  cin >> c;
  
  if(c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o')
    cout << "vowel" << endl;
  
  else cout << "consonant" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=1e9+7; 
vector<int>tree[200005];
int n;
ll ans,sz[200005],d[200005];
ll pow_mod(ll a, ll b, ll p){//a的p-2次方求余p； p为mod； 
    ll ret = 1;
    while(b){
        if(b & 1) ret = (ret * a) % p;
        a = (a * a) % p;
        b >>= 1;
    }
    return ret;
}
void cint(){
	sc(n);
	rep(i,1,n-1){
		int u,v;sc(u);sc(v);
		tree[u].push_back(v);tree[v].push_back(u);
	}d[1]=1;
	rep(i,1,n)(d[1]*=i)%=mod;
}
void dfs1(int u,int fa){
	sz[u]=1;
	for(int i=0;i<tree[u].size();i++){
		int v=tree[u][i];
		if(v==fa)continue;
		dfs1(v,u);
		sz[u]+=sz[v];	
	}(d[1]*=pow_mod(sz[u],mod-2,mod))%=mod;
}
void dfs2(int u,int fa){
	for(int i=0;i<tree[u].size();i++){
		int v=tree[u][i];
		if(v==fa)continue;
		d[v]=d[u]*sz[v]%mod*pow_mod(n-sz[v],mod-2,mod)%mod;
		dfs2(v,u);
	}
}
void anser(){
	rep(i,1,n){
		pf("%lld\n",d[i]);
	}
}
int main(){
  	cint();
  	dfs1(1,0);
  	dfs2(1,0);
  	anser();
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if(a > b) {
    for(int i=0; i<a; i++)
      cout << b;
    cout << endl;
  }
  else {
    for(int i=0; i<b; i++)
      cout << a;
    cout << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int a, b;
    cin >> a >> b;
    cout << (500 * a >= b ? "Yes" : "No") << endl;
    return 0;
}


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

int numSwap(vector<int> a,vector<int> b){
	int ret = 0;
	int x = 0;
	for(int i=0;i<a.size();i++){
		if(a[i]){
			for(int j=x;j<a.size();j++){
				if(b[j]){
					ret += abs(i-j);
					x = j+1;
					break;
				}
			}
		}
	}
	return ret;
}

int main(void){
	int N,M;
	cin >> N >> M;
	vector<int> b(N),p(M);
	int cnt = 0;
	for(int i=0;i<N;i++){
		cin >> b[i];
		if(b[i])cnt++;
	}
	for(int i=0;i<M;i++)
		cin >> p[i];

	vector<int> a1,a2;
	bool bit = 1;
	int cnt1=0,cnt2=0;
	for(int i=0;i<M;i++){
		for(int j=0;j<p[i];j++){
			a1.push_back(bit);
			cnt1 += bit;
			a2.push_back(!bit);
			cnt2 += (!bit);
			//cout << !bit << " ";
		}
		bit = !bit;
	}
/*
	for(int i=0;i<a1.size();i++){
		cout << a1[i] << " ";;
	}
	cout << endl;
	for(int i=0;i<a2.size();i++){
		cout << a2[i] << " ";;
	}
	cout << endl;
*/
	if(cnt1 == cnt && cnt2 == cnt){
		cout << min(numSwap(a2,b),numSwap(a1,b)) << endl;
	}else if(cnt1 == cnt){
		cout << numSwap(a1,b) << endl;
	}else{
		cout << numSwap(a2,b) << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846264338327950288
#define mt make_tuple


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

	int tmp, ans = 0;
	for(int i = 0; i<n; i++) {
		cin>>tmp;
		if(tmp >= k) ans++;
	}
	cout<<ans<<endl;
}

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

Measured memory_bytes: 256