akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var n = consoleReader.ReadLineInt64();
            var times = consoleReader.RepeatReadLinesInt64(5);

            var min = times.Min();

            return 5 + (n + min - 1) / min - 1;
        }

        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader)
        {
            this.consoleReader = consoleReader;
        }
        static void Main() => Console.WriteLine(new Program().Calc());
    }

    public class ConsoleReader
    {
        public virtual string ReadLine() => Console.ReadLine();
        public int ReadLineInt32() => int.Parse(ReadLine());
        public long ReadLineInt64() => long.Parse(ReadLine());
        public ulong ReadLineUInt64() => ulong.Parse(ReadLine());
        public double ReadLineDouble() => double.Parse(ReadLine());
        public string[] ReadLineSplit() => ReadLine().Split().ToArray();
        public int[] ReadLineSplitInt32() => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public long[] ReadLineSplitInt64() => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public ulong[] ReadLineSplitUInt64() => ReadLine().Split().Select(s => ulong.Parse(s)).ToArray();
        public double[] ReadLineSplitDouble() => ReadLine().Split().Select(s => double.Parse(s)).ToArray();

        public IEnumerable<string> RepeatReadLines(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLine();
        }
        public IEnumerable<int> RepeatReadLinesInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineInt32();
        }
        public IEnumerable<long> RepeatReadLinesInt64(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineInt64();
        }
        public IEnumerable<string[]> RepeatReadLinesSplit(int count)
        {
            for (int i = 0; i < count; i++)
                yield return ReadLineSplit();
        }
    }
    static class DicExt
    {
        public static V GetOrDefault<K, V>(this Dictionary<K, V> dic, K key)
        {
            V val;
            return dic.TryGetValue(key, out val) ? val : default(V);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<math.h>
using namespace std;
#define MAX 200005
#define MOD 998244353
#define EPS 0.00000000001
#define INF 998244353
int a[MAX];
int main()
{
    int n,i;
    scanf("%d",&n);
    int j;
    long long ans=0;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    ans=a[n-1];
    for(i=n-2,j=n-2;i>0;i--,j--)
    {
        ans=ans+a[j];
        i--;
        if(i==0) break;
        ans=ans+a[j];
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 4600
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define mod 1000000007
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int pr[1000007];
bool isnotprime(ll x){if(x==1)return 1;if(x==2)return 0;if(x%2==0)return 1;return(pr[x/64]&(1<<((x>>1)&31)));}
void sieve(ll n){for(ll i=3;i*i<=n;i+=2){if(!isnotprime(i))for(ll j=i*i,k=i<<1;j<n;j+=k)pr[j/64]|=(1<<((j>>1)&31));}}
ll fpow(ll x,ll y){x=x%MOD;ll res=1;while(y){if(y&1)res=res*x;res%=MOD;y=y>>1;x=x*x;x%=MOD;}return res;}
ll inv(ll a,ll m){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   ll n;
   cin>>n;
   ll a[n],b[n],c[n];
   for(int i=0;i<n;i++)
   {
   	cin>>a[i]>>b[i]>>c[i];
   }
   ll dp[n][3];
   dp[0][0]=a[0];
   dp[0][1]=b[0];
   dp[0][2]=c[0];
   for(int i=1;i<n;i++)
   {
   	dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
   	dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
   	dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
   }
   ll res=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
   cout<<res;

}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void){
  int n, x, ans;
  int i, j, k;

  while(1){
    scanf("%d%d", &n, &x);
    if(n == 0 && x == 0)  break;
    ans = 0;
    for(i = 1; i <= n-2; i++){
      for(j = i+1; j <= n-1; j++){
	for(k = j+1; k <= n; k++){
	  if(i+j+k == x){
	    ans++;
	    break;
	  }
	}
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

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


int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long test=1;
	
	while(test--)
	{
	    long a,b,c=0,k,d=0,i,n,j,ans,temp,p,m,ex1,ex2,ex3,ex4,x,y;
	    string s;
	    cin>>a>>b>>c;
	    if(a==b && b==c)
	    cout<<1;
	    else if(a==b || b==c || a==c)
        cout<<2;
        else cout<<3;
    }
    
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<ll, int> ll_i;

ll INF = LLONG_MAX / 10;

double f(ll x) {
	int y = 0;
	for (ll _x = x; _x; _x /= 10) y += _x % 10;
	return (double)x / y;
}

int main() {
	vector<ll> a;
	for (int x = 1; x <= 9999; x++)
		for (ll y = x; y <= 1e16; y = y * 10 + 9)
			a.pb(y);
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	int N = a.size();
	vector<double> b(N);
	rep(i, N) b[i] = f(a[i]);
	// rep(i, N) cout << a[i] << ' ' << b[i] << endl;
	for (int i = N - 2; i >= 0; i--) b[i] = min(b[i], b[i + 1]);
	vector<ll> ans;
	rep(i, N) if (abs(f(a[i]) - b[i]) <= 1e-10) ans.pb(a[i]);
	int K; cin >> K;
	rep(i, K) cout << ans[i] << endl;
}


Measured memory_bytes: 2420
N,A,B=list(map(int,input().split()))
S=list(input())
t=0
u=0
for i in range(N):
 if S[i]=='a':
     if t<A+B:
         t=t+1
         print("Yes")
     else:
         print("No")
 elif S[i]=='b':
     if t<A+B and B>u:
         t=t+1
         u=u+1
         print('Yes')
     else:
         print('No')
 else:
     print('No')

Measured memory_bytes: 9796
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#define maxn 105
#define LL long long
using namespace std;
LL a[maxn];
LL len[maxn];
LL dfs(long long level, long long length) {
	if (length <= 0) return 0;
	if (len[level] <= length) {
		return a[level];
	}
	if (length > len[level] / 2) {
		return 1 + a[level - 1] + dfs(level - 1, length - len[level - 1] - 2);
	}
	else if (length == len[level] / 2)	return a[level - 1];
	else return dfs(level - 1, length - 1);
}

int main() {
	a[0] = 1;
	len[0] = 1;
	for (int i = 1; i <= 50; i++) a[i] = 2 * a[i - 1] + 1;
	for (int i = 1; i <= 50; i++) len[i] = 2 * len[i - 1] + 3;
	LL n, k;	scanf("%lld%lld", &n, &k);
	LL ans = dfs(n, k);
	printf("%lld\n", ans);
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

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

    int r,c;
    cin>>r>>c;

    ll rsum[105]={};
    REP(i,r) {
        ll sum=0;
        REP(j,c){
            int v;
            cin>>v;
            sum+=v;
            rsum[j]+=v;
            cout<<v<<" ";
        }
        cout<<sum<<endl;
        rsum[c]+=sum;
    }

    REP(i,c+1){
        cout<<rsum[i];
        if(i<c) cout<<" ";
        else cout<<endl;
    }

    return 0;
}


Measured memory_bytes: 3124
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
    string a;
    string b;
    string c;
    int N;
    cin >> N;
    cin >> a;
    cin >> b;
    cin >> c;

    int ans=0;
    for(int i=0;i<N;i++){
        int p=2;
        if(a[i] == b[i]) p--;
        else if(a[i] == c[i]) p--;

        if(b[i] == c[i]) p--;
        
        ans += p;
    }

    cout << ans <<endl;
}

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

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

    int len = S.length();

    if (S[len-1] == 's'){
        cout << S << "es" << endl;
    }else{
        cout << S << "s" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<stdbool.h>

#define MIN(x,y) (((x)<(y))?(x):(y))

void solve(int m,int n);

int main(void){
  int m,n;
  while(scanf("%d%d",&m,&n) && m && n ) solve(m,n);
  return 0;
}

void solve(int m,int n){
  int t[100],out[100];
  int now,i,j,k,dt,incar=0,outcar=0;
  bool flg;
  struct p{
    int time,num;
  } park[10][2],minpark;
  
  for(i=0;i<n;i++) scanf("%d",&t[i]);
  for(i=0;i<10;i++) for(j=0;j<2;j++) park[i][j]=(struct p){0,0};
  
  for(now=0;outcar<n;now+=dt){
    //fprintf(stderr,"(t,in,out)=(%d,%d,%d)\n",now,incar,outcar);
    //for(i=0;i<m;i++) fprintf(stderr,"\t[%d,%d]\t[%d,%d]\n",park[i][0].time,park[i][0].num,park[i][1].time,park[i][1].num);
    if(now>1000) return;
			    
    while(now>=incar*10 && incar<n){
      if(incar-outcar<2*m){
	flg=true;
	for(i=0;i<m;i++){
	  if(park[i][0].num==0){
	    park[i][0]=(struct p){t[incar],incar+1};
	    flg=false;
	    break;
	  }
	}
	if(flg){
	  //fputs("in flg-if\n",stderr);
	  minpark=(struct p){1000,-1};
	  for(i=0;i<m;i++)
	    if(park[i][1].num==0 && park[i][0].time>=t[incar])
	      if(minpark.time>park[i][0].time-t[incar])
		minpark=(struct p){park[i][0].time-t[incar],i};
	  if(minpark.num!=-1) park[minpark.num][1]=(struct p){t[incar],incar+1};
	  else{
	    for(i=0;i<m;i++)
	      if(park[i][1].num==0 && minpark.time>t[incar]-park[i][0].time)
		minpark=(struct p){t[incar]-park[i][0].time,i};
	    park[minpark.num][1]=(struct p){t[incar],incar+1};
	    park[minpark.num][0].time=t[incar];
	  }
	}
	incar++;
      }else break;
    }
    
    dt=10;
    for(i=0;i<m;i++){
      if(park[i][1].num!=0 && park[i][1].time<dt) dt=park[i][1].time;
      else if(park[i][0].num!=0 && park[i][0].time<dt) dt=park[i][0].time;
    }
 
    for(i=0;i<m;i++){
      for(j=1;j>=0;j--){
	if(park[i][j].num!=0){
	  park[i][j].time-=dt;
	  if(park[i][j].time==0){
	    out[outcar++]=park[i][j].num;
	    park[i][j]=(struct p){0,0};
	  }
	}
      }
    }
    //fputc('\n',stderr);
  }

  for(i=0;i<outcar;i++) printf("%d%c",out[i],i==outcar-1?'\n':' ');
  
}

Measured memory_bytes: 600
// author -> LetsGoAC
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using    namespace std;
using    namespace __gnu_pbds; 
#define  ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef  long double ld;
#define  int long long
typedef  pair<int,int> pii;
#define  RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  rep(i,n) for(i=0; i <n; i++)
#define  repv(i,k,n) for(int i=k; i<=n; i++)
#define  pb push_back
#define  mp make_pair
#define  F  first
#define  S  second
#define  sz(x)  (int)x.size()
#define  all(v) v.begin(),v.end()
#define  endl '\n'
#define  deb(x) cout<<#x<<" = "<<x<<endl
#define  gcd   __gcd
#define  inf   LLONG_MAX
#define  minf  LLONG_MIN 
#define  gi  greater<int> 
#define  gpi greater<pii>  
#define  sp(n) fixed<<setprecision(n)
vector   <int> Fact(100005 , 0);
const int mod = (int)(1e9+7);
int power(int x,int n)
{   
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}
int mod_inverse(int n , int m)
{   //mod = m; // change const mod;
    int modi = power(n , m-2);
    return modi;
}
int  pct(int x)
{    return __builtin_popcountll(x);}
int  lcm(int a,int b){return a*b/gcd(a,b);}
bool is_power_2(int n){ return log2(n)==floor(log2(n));}
bool is_prime(int n){for(int i=2; i*i<=n; i++)if(n%i==0)return 0; return 1;}
void cal_fac()
{
     Fact[0] = Fact[1] = 1;
     for(int i=2; i<1e5; i++)
         Fact[i] = (Fact[i-1]*i)%mod;
}
int C(int n , int k)
{
    int res = Fact[n];
    res = (res * mod_inverse( Fact[k] , mod ))%mod;
    res = (res * mod_inverse( Fact[n-k] ,mod ))%mod;
    return res;
}
void db()
{   
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
void timeit()
{  
    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " <<sp(5)<< 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}
int     dx []    =  {-1 , 0 , 1 , 0 ,-1,-1, 1,  1};
int     dy []    =  { 0 , 1 , 0 ,-1 ,-1, 1, 1, -1};
char    dir[]    =  {'U','R','D','L'};
/* ---------------------- 1.cpp --------------------------------- */
const int maxn = 1e6+5;
void solve(int tc)
{
    //cout<<"Case #"<<tc<<": \n";
    int n,i,j,k,m,q,l,r,x,t;
    cin>>n>>x>>t;
    int ans = ceil(1.0*n /x)*t;
    cout<<ans;
}   
signed main()
{
    // 1.cpp
    RAGE;
  //  db();  
    int t=1;
    //  cin>>t;
    for(int i=1; i<=t; i++)
    {
        solve(i);
    }
  //  timeit();
    return 0;
}
/*
    1. To find 2's complement , reverse all the bits after 1st set bit. (right - >left.)
*/


Measured memory_bytes: 3808
n, k = map(int, input().split(' '))
p = list(map(int, input().split(' ')))
m = []
t = sum(p[:k])
idx = 0
m.append(t)
for i in range(1, n - k + 1):
    t -= p[i - 1]
    t += p[i + k - 1]
    m.append(t)
mi = m.index(max(m))
pp = p[mi: mi + k]
pp.sort()
sg = 0
tp = 1
r = 0
for i in pp:
    for j in range(tp, i + 1):
        sg += j
    tp = i + 1
    r += sg / i
print(r)


Measured memory_bytes: 25052
if __name__ == "__main__":
  inputstr = input()
  size = len(inputstr)
  isEasy = True

  for i in range(size):
    point = i + 1
    if point % 2 == 0:
      if inputstr[i] in ["L", "U", "D"]:
        pass
      else:
        isEasy = False
        break
    else:
      if inputstr[i] in ["R", "U", "D"]:
        pass
      else:
        isEasy = False
        break

  if isEasy == True:
    print("Yes")
  else:
    print("No")


Measured memory_bytes: 3060
#include<cstdio> 
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
//¿ª O2£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡ 
using namespace std;
#define fo(i,j,k) for(i=j;i<=k;i++)
#define fd(i,j,k) for(i=j;i>=k;i--)
#define cmax(a,b) (a=(a>b)?a:b)
#define cmin(a,b) (a=(a<b)?a:b)
typedef long long ll;
typedef long long LL;
typedef double db;
const int N=2e5+5,mo=10007;
int a[N],pos[N],f[N],i,n,ans;
int main()
{
	scanf("%d",&n);
	fo(i,1,n) 
	{	
		scanf("%d",a+i);
		pos[a[i]]=i;
	}
	fd(i,n,1)
	{
		f[i]=f[i+1]*(pos[i+1]>pos[i])+1;
		cmax(ans,f[i]);
	}
	printf("%d\n",n-ans);
}

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

int main(void) {
  int A, B, C;
  cin >> A >> B >> C;
  
  if(C-(A-B) >= 0)
    cout << C - (A-B) << endl;
  else
    cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9+3;
const ll INF = 1e18+3;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int H, W;
    cin >> H >> W;
    string S[H+2];
    S[0] = "";
    rep(i, W+2) S[0] += '#';
    S[H+1] = S[0];
    rep2(i, 1, H) cin >> S[i];
    rep2(i, 1, H) S[i] = '#'+S[i]+'#';
    int ans = 0;
    int d[H+2][W+2];
    rep2(p, 1, H) rep2(q, 1, W){
        if(S[p][q] == '#') continue;
        fill(d[0], d[H+2], inf);
        d[p][q] = 0;
        queue<pii> que;
        que.push(pii(p, q));
        while(!que.empty()){
            int x = que.front().first, y = que.front().second;
            que.pop();
            rep2(i, -1, 1) rep2(j, -1, 1){
                if(i*j != 0 || i+j == 0) continue;
                if(S[x+i][y+j] == '#') continue;
                if(chmin(d[x+i][y+j], d[x][y]+1)){
                    que.push(pii(x+i, y+j));
                }
            }
        }
        rep2(x, 1, H) rep2(y, 1, W) {
            if(d[x][y] != inf) chmax(ans, d[x][y]);
        }
    }
    cout << ans << endl;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> inp(h);
  rep(i,h)cin >> inp.at(i);
  string s(w+2,'#');
  cout << s << endl;
  rep(i,h){
  cout << '#' << inp.at(i) << '#' << endl;
  }
  cout << s << endl;

	return 0;
}


Measured memory_bytes: 256
def get_parent(num, parent):
    if parent[num] == num:
        return num
    else:
        return get_parent(parent[num], parent)

def calc_change_data(ans, parent, a_parent, b_parent, island_count):
    big_parent = max(a_parent, b_parent)
    min_parent = min(a_parent, b_parent)
    parent[big_parent] = min_parent
    ans -= island_count[big_parent] * island_count[min_parent]
    island_count[min_parent] += island_count[big_parent]
    return ans, parent, island_count

def main():
    island_num, bridge_num = map(int, input().split())
    bridge_data = [list(map(int, input().split())) for i in range(bridge_num)]
    parent = [i for i in range(island_num)]
    island_count = [1 for i in range(island_num)]

    ans = island_num * (island_num - 1) // 2
    ans_data = [ans]

    for num_a, num_b in bridge_data[::-1]:
        num_a -= 1
        num_b -= 1

        a_parent = get_parent(num_a, parent)
        b_parent = get_parent(num_b, parent)

        if a_parent != b_parent:
            ans, parent, island_count = calc_change_data(ans, parent, a_parent, b_parent, island_count)
        ans_data.append(ans)

    for i in range(bridge_num)[::-1]:
        print(ans_data[i])

if __name__ == '__main__':
    main()

Measured memory_bytes: 36000
for _ in[0]*int(input()):
 X,Y,z=input(),input(),[]
 for y in Y:
  s=i=0
  for k in z:
   t=X.find(y,s)+1
   if t<1:break
   if t<k:z[i]=t
   s=k;i+=1
  else:
   t=X.find(y,s)+1
   if t:z+=[t]
 print(len(z))


Measured memory_bytes: 5616
class UnionFind:
    """素集合を木構造として管理する"""
    def __init__(self, n):
        self.parent = [-1] * n
        self.cnt = n

    def root(self, x):
        """頂点xの根を求める"""
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]

    def merge(self, x, y):
        """頂点xを含む集合と頂点y含む集合を結合する"""
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.parent[x] > self.parent[y]:
            x, y = y, x
        self.parent[x] += self.parent[y]
        self.parent[y] = x
        self.cnt -= 1

    def is_same(self, x, y):
        """頂点xと頂点yが同じ集合に属するかどうかを返す"""
        return self.root(x) == self.root(y)

    def get_size(self, x):
        """頂点xを含む集合の要素数を返す"""
        return -self.parent[self.root(x)]

    def get_cnt(self):
        """集合の個数を返す"""
        return self.cnt


import sys
input = sys.stdin.readline


n, q = map(int, input().split())
info = [list(map(int, input().split())) for i in range(q)]

uf = UnionFind(n)
ans = []
for i in range(q):
    t, x, y = info[i]
    if t == 0:
        uf.merge(x, y)
        continue
    if uf.is_same(x, y):
        print(1)
    else:
        print(0)


Measured memory_bytes: 24372
#include "bits/stdc++.h" 
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rerep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;
int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int main(){
    string s,t;
    bool flag=true;
    cin>>s>>t;
    rep(i,0,s.size()){
        if(s[i]!=t[i]){
            flag=false;
            break;
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Q = sc.nextInt();
		String S = sc.next();

		int[] n = new int[N+1];
		n[0] = 0;
		for(int i=0; i<N; i++) {
			if(i+1 < N && S.charAt(i) == 'A' && S.charAt(i+1) == 'C') {
				n[i+1] = n[i];
				n[i+2] = n[i+1] + 1;
				i++;
			}else {
				n[i+1] = n[i];
			}
		}

		int[] ans = new int[Q];
		for(int i=0; i<Q; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();

			ans[i] = n[r]-n[l];
		}

		for(int i=0; i<Q; i++) {
			System.out.println(ans[i]);
		}
	}
}


Measured memory_bytes: 84524
#include<stdio.h>

int main()
{
    int k,count=0,i,o;
    scanf("%d",&k);
    for(i=1;i<=k;i++)
    {
        if(i%2==0)
            count=count+1;
    }
    o=k-count;
    printf("%d\n",o*count);
    return 0;
}


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

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

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

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



signed main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c < 22 ? "win" : "bust") << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.File;
import java.io.FileNotFoundException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\2010-input.txt"));

		while (scan.hasNext()) {

			String s = scan.next();
			Do(s);
		}
		System.out.println(stk[0]);

		scan.close();
		System.exit(0);
	}

	static int[] stk = new int[101];
	static int pt = -1;

	private static void Do(String s) {
		switch (s) {
		case ("+"):
			stk[pt - 1] += stk[pt];
			pt--;
			break;
		case ("-"):
			stk[pt - 1] -= stk[pt];
			pt--;
			break;
		case ("*"):
			stk[pt - 1] *= stk[pt];
			pt--;
			break;
		default:
			pt++;
			stk[pt] = Integer.valueOf(s);
		}

	}

}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

typedef long long ll;

const int MAX_A=50,LIM=100;

bool flg[LIM][LIM][LIM];

int A[3];

struct st{
	int a[3],c;
};

bool check(st s){
	if (s.a[0]==s.a[1] && s.a[1]==s.a[2]){
		return true;
	}else{
		return false;
	}
}

bool check2(st s){
	REP(i,3){
		if (s.a[i]>=LIM){
			return false;
		}
	}
	if (flg[s.a[0]][s.a[1]][s.a[2]]){
		return false;
	}
	flg[s.a[0]][s.a[1]][s.a[2]]=true;
	return true;
}

int main(){
	REP(i,3){
		cin>>A[i];
	}
	queue<st> que;
	st s;
	REP(i,3){
		s.a[i]=A[i];
	}
	s.c=0;
	que.push(s);
	while(1){
		st t=que.front();
		que.pop();
		if (check(t)){
			cout<<t.c<<endl;
			break;
		}
		st t2;
		REP(i,3){
			t2=t;
			t2.a[i]+=2;
			if (check2(t2)){
				t2.c++;
				que.push(t2);
			}
		}
		REP(i,3){
			t2=t;
			REP(j,3){
				if (i!=j){
					t2.a[j]++;
				}
			}
			if (check2(t2)){	
				t2.c++;
				que.push(t2);
			}
		}
	}
	return 0;
}

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

const int MAXN = 1e5;
const int INF = 1e9;

int vec[MAXN][3];
int dp[MAXN][3];
int n;

int solve(int n, int id, int act)
{
	
	if(id < 0) return 0;
	
	int ans = 0;
	if (dp[id][act] != -1) return dp[id][act];
	
	if(act == 0)
		ans = max(ans, max(vec[id][act]+solve(n, id-1, 1), vec[id][act]+solve(n, id-1, 2)));
	else if(act == 1)
		ans = max(ans, max(vec[id][act]+solve(n, id-1, 0), vec[id][act]+solve(n, id-1, 2)));
	else 
		ans = max(ans, max(vec[id][act]+solve(n, id-1, 0), vec[id][act]+solve(n, id-1, 1)));
	
	return  dp[id][act] = ans;
}


int main()
{
	cin >> n;
	
	for(int i = 0; i < n; i++)
		cin >> vec[i][0] >> vec[i][1] >> vec[i][2];
	
	
	int ans = 0;
	
	for(int i = 0; i < 3; i++)
	{
		memset(dp, -1, sizeof dp);
		ans = max(ans, solve(n-1, n-1, i));
	}
		
	cout << ans << '\n';
}

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

int main(){
  int n; 
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  rep(i,n-2) {
    if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
if n<=9:
  print(n)
else:
  n=str(n)
  x=n[0]
  x=int(x)-1
  if n[1:].count('9')==len(n)-1:
    print(x+1+(len(n)-1)*9)
  else:
    print(x+(len(n)-1)*9)


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

def pf(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

a, b = map(int, input().split())
pa = set(pf(a))
pb = set(pf(b))
s = pa & pb
print(len(s) + 1)

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

a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

num = 0

for i, b in enumerate(b):
    if b > a[i]:
        b -= a[i]
        num += a[i]
        if b > a[i+1]:
            num += a[i+1]
            a[i+1] = 0
        else:
            a[i+1] -= b
            num += b
    else:
        num += b

print(num)

Measured memory_bytes: 18624
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;

typedef long long ll;

int N, K;
vector<int> A;
vector<bool> need;
vector<int> elm;

int main(void) {
	cin >> N >> K;
	A.resize(N);
	need.resize(N, false);
	for (int i = 0; i < N; ++i)
		cin >> A[i];

	sort(A.begin(), A.end(), greater<int>());
	for (int i = 0; i < N; ++i) {
		ll sum = 0;
		elm.clear();
		for (int j = i; j < N; ++j) {
			elm.push_back(j);
			if (sum + A[j] >= K) {
				for (int k = 0; k < (int)elm.size(); ++k)
					need[elm[k]] = true;
				elm.clear();
			}
			else
				sum += A[j];
		}
	}

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (!need[i])
			++ans;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
package main

import . "fmt"

func main() {
  var s string
  slice := []string{"abc","bca","cab","acb","cba","bac"}
  Scan(&s)
  if contains(slice,s) {
    Println("Yes")
  } else {
    Println("No")
  }
}

func contains(slice []string,str string) bool {
  for _,s := range slice {
    if s == str {
      return true
    }
  }
  return false
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;

const int N = 1e5;
typedef long long LL;

int a[N * 3 + 5];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1 ; i <= 3 * n ; i++) scanf("%d",&a[i]);
	sort(a + 1 , a + 1 + 3 * n );
	LL sum1 = 0 , sum2 = 0;
	int cnt ;
	for(int i = n + 1  ; i <= 3 * n - 1 ; i += 2) sum1 += a[i] ;
	printf("%lld\n",max(sum1 , sum2));
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
//ofstream cout("output.out");

#define fast() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define o(a) { cout << #a << ":" << (a) <<" ";}
#define ov(a) { cout << "["; \
	for(int i = 0; i < (a).size(); ++i){ \
		cout << i <<":" << a[i] <<" "; \
		if(i % 10 == 9) cout <<"\n"; \
		} \
	cout << "]"; \
}
#define ovv(a) { cout << "["; \
	for(int i = 0; i < a.size(); ++i){ \
		for(int j = 0; j < a[i].size(); ++j){ \
			cout << "(" << i <<"," <<j <<")" <<":" << a[i][j] <<" "; \
		} \
		cout << "\n"; \
	} \
	cout << "]"; \
}
#define op(a) { cout <<"[" << #a << ".fi:"<<a.first; \
					cout << " "<< #a << ".se:" << a.second <<"]"; }

#define ll long long
//int n, m, k, q;

int main(){
	fast();
	ll n;
	cin >> n;
	ll t = 100;
	int cnt = 0;
	while(t < n){
		t = t + t / 100;
		cnt++;
	}
	cout << cnt;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T>
void inputVector(vector<T> &v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    int c[3][3];
    rep(y, 3) rep(x, 3) cin >> c[y][x];

    bool ok = false;
    REP(a1, 0, 100) {
        REP(a2, 0, 100) {
            REP(a3, 0, 100) {
                int b1 = c[0][0] - a1;
                int b2 = c[0][1] - a1;
                int b3 = c[0][2] - a1;
                if (b1 < 0 || b1 > 100) continue;
                if (b2 < 0 || b2 > 100) continue;
                if (b3 < 0 || b3 > 100) continue;
                if (c[1][0] != a2 + b1) continue;
                if (c[1][1] != a2 + b2) continue;
                if (c[1][2] != a2 + b3) continue;
                if (c[2][0] != a3 + b1) continue;
                if (c[2][1] != a3 + b2) continue;
                if (c[2][2] != a3 + b3) continue;
                ok = true;
                break;
            }
        }
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n;
li a[200200];

inline li inc(li x, li k, map<li, li>& m) {
    if (x <= 0) {
        return INF;
    }
    if (m.count(x) == 0) {
        m[x] = 1;
        return 1;
    }
    if (m[x] == k - 1) {
        m.erase(x);
        return inc(x - 1, k, m);
    }
    m[x]++;
    return m[x];
}


inline bool ok(li k) {
    if (k == 0)return false;
    map<li, li> m;
    li prev_len = 0;
    rin{
        if (a[i] <= prev_len) {
            auto it = m.upper_bound(a[i]);
            m.erase(it, m.end());
            if (inc(a[i], k, m) >= k) {
                return false;
            }
        }
        prev_len = a[i];
    }
    return true;
}

int main() {
    cin >> n;
    rin{
        cin >> a[i];
    }

    li left = 0;
    li right = n;
    while (left + 1 < right) {
        li mid = (left + right) / 2;
        if (ok(mid)) {
            right = mid;
        } else {
            left = mid;
        }
    }
    cout << right << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[100005];
int dp[100005];
int ans  = 1e9 ;
int n;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i=0;i<n+10;i++)
        dp[i]=1e9;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);

    for(int i = 2;  i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
    }
    cout<<dp[n-1]<<endl;


}













Measured memory_bytes: 4308
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n;
  cin >> n;
  vi x(n), y(n), h(n);
  rep(i,n) cin >> x[i] >> y[i] >> h[i];
  
  int H, Cx, Cy;
  rep(i,n) {
    rep(Cy,101) {
      rep(Cx,101) {
        H = h[i] + abs(x[i] - Cx) + abs(y[i] - Cy);
        if (H >= 1) {
          bool ok = true;
          rep(j,n) {
            if (h[j] != max(H - abs(x[j] - Cx) - abs(y[j] - Cy), 0)) {
              ok = false;
              break;
            }
          }
          if (!ok) continue;
          cout << Cx SP Cy SP H << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC172_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            var ans = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] != T[i])
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 18108
/**
 *    authur: Bao Trung <3
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>>z;
const int mod = 1e9+7;
int a,b,c,d;
void solve(){
	cin >> a >> b >> c >> d; // health  stength
	while(1){
		c -= b;
		if(c <= 0){
			cout << "Yes" << '\n';
			break;
		}
		a -= d;
		if(a <= 0){
			cout <<  "No" << '\n';
			break;
		}
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t = 1; //cin >> t;
	while(t--){solve();}
	return 0;
}

// Code By CodeWar :3

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define INF 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int x,n;
  cin >> x >> n;
  map<int,bool>ok;
  rep(i,n){
    int tmp;
    cin >> tmp;
    ok[tmp] = true;
  }
  ll ans = INF;
  for(int i = -100; i <= 200; i++){
    if(ok[i])continue;
    ans = min((int)ans,abs(i - x));
  }
  for(int i = -100; i <= 200; i++){
    if(ok[i])continue;
    if(ans == abs(i - x)){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 111111;
vector<int> tree[N];
map<pair<int, int>, int> mp;
int col[N];
int n, ans;

void dfs(int u, int p = 0, int pc = 0) {
    int cc = 1;
    rall(v, tree[u]) {
        if(v == p) continue;
        if(cc == pc) cc++;
        col[mp[{u, v}]] = cc;
        ans = max(ans, cc);
        dfs(v, u, cc);
        cc++;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 1, n - 1) {
        int u, v;
        cin >> u >> v;
        tree[u].pb(v); tree[v].pb(u);
        mp[{u, v}] = i;
        mp[{v, u}] = i;
    }
    dfs(1);
    cout << ans << endl;
    rep(i, 1, n - 1) {
        cout << col[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 19584
#include <iostream>
#include <cstring>
#include <cmath>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <vector>
#define LL long long
#define rg register
using namespace std;
const int MAXN=5000;
LL N,h,w,ans;

template<typename T>inline void in(T &a){
	T ch=getchar(),p=1;
	for(a=0;!isdigit(ch);ch=getchar()) if(ch=='-') p=-1;
	for(;isdigit(ch);ch=getchar()) a=a*10+ch-'0';
	a*=p;
}

template<typename T>inline void print(T x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+'0');
}

signed main(){
	in(N),in(h),in(w);
	
	LL lon,wid;
	for(rg int i=1;i<=N;i++){
		in(lon),in(wid);
		if(lon>=h&&wid>=w) ans++;
	}
	
	print(ans),puts("");
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#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 f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a_old;
	cin >> a_old;
	int64_t ans = 0;
	for (int i = 1; i < n; ++i) {
		int a;
		cin >> a;
		if (a < a_old) {
			ans += (a_old - a);
		} else {
			a_old = a;
		}
	}

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


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

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

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

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


int main() {
  string S, T;

  cin >> S >> T;

  cout << T << S << endl;

  return 0;
}


Measured memory_bytes: 256
iN,iA =[int(x) for x in input().split()]
#aX = [int(x) - iA for x in input().split()]
aX = [int(x) for x in input().split()]

#解法1

iMX = max(aX + [iA])
dp = [[[0]*(iN*iMX + 1) for _ in range(iN+1)] for _ in range(iN + 1)]

dp[0][0][0] = 1
for j in range(1,iN+1):
#   for k in range(0,iN+1):
    for k in range(0,j+1):
#       for s in range(0,iN*iMX + 1):
        for s in range(0,j*iMX + 1):
            if  s < aX[j-1]:
                dp[j][k][s] = dp[j-1][k][s]
            elif k >= 1 and  s >= aX[j-1]:
                dp[j][k][s] = dp[j-1][k][s]+dp[j-1][k-1][s- aX[j-1]]
            else:
                dp[j][k][s] = 0
iRet = 0
for k in range(1,iN+1):
    iRet += dp[iN][k][k*iA]
print(iRet)


Measured memory_bytes: 62960
#include<bits/stdc++.h>
#define int long long int
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

        int n,i,j,k; cin>>n>>k;
        int h[n];
        for(i=0;i<n;i++) cin>>h[i];

        vector<int> dp(n,INT_MAX);
        dp[0]=0;


        for(i=0;i<n;i++)
        {

            for(j=i+1;j<n && j<=i+k;j++)
            {
                //cout<<h[j]<<" ";
                dp[j]=min(dp[j], dp[i]+abs(h[i]-h[j]));
            }
            //cout<<endl;
            //dp[j]=min(dp[i], h[i]);

        }

        //for(i=0;i<n;i++)  cout<<dp[i]<<" ";

        cout<<dp[n-1]<<"\n";

    return 0;
}




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

using namespace std;

int main(void){
    int a, b;
    cin >> a >> b;
    int sum = 1;
    int ans = 0;
    while(sum < b){
        sum += a - 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define INTXT std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
#define INF 1e9

using namespace std;
typedef long long ll;
static const ll MOD = 1000000007LL;

signed main() {
  IOS
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  
  int z = (int)(2 * x == w) * (int)(2 * y == h);
  cout << (double)(w * h) / 2 << " " << z << endl;

}


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

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

    string s;
    ll q;
    cin >> s >> q;
    deque<char> ds(s.size());
    for (ll i = 0; i < s.size(); i++){
        ds[i] = s[i];
    }
    bool rev = true;

    for (ll i = 0; i < q; i++){
        ll t;
        cin >> t;
        if (t == 1){
            rev = !rev;
        }
        else{
            ll f;
            char c;
            cin >> f >> c;
            if (f == 1){
                if (rev){
                    ds.push_front(c);
                }
                else{
                    ds.push_back(c);
                }
            }
            else{
                if (rev){
                    ds.push_back(c);
                }
                else{
                    ds.push_front(c);
                }
            }
        }
    }

    if (!rev){
        reverse(ds.begin(), ds.end());
    }

    for (ll i = 0; i < ds.size(); i++){
        cout << ds[i];        
    }
    cout << endl;
    
}

Measured memory_bytes: 4040
#include <stdio.h>
int main() {int a[4][2]={0,-1,1,0,0,1,-1,0},N,M,i,j,k,w;char Tex[9];while (1) {scanf("%d %d",&M,&N);if (!N && !M) return 0;w=1,i=1,j=1;while (1) {scanf("%s",&Tex);if (Tex[0]=='F' || Tex[0]=='B') scanf("%d",&k); else k=0;if (Tex[0]=='S') break;if (Tex[0]=='B') k=-k;i+=k*a[w][0],j+=k*a[w][1];if (Tex[0]=='R') w=(w+1)&3; else if (Tex[0]=='L') w=(w+3)&3;if (i<=0) i=1;if (i>N) i=N;if (j<=0) j=1;if (j>M) j=M;}printf("%d %d\n",j,i);}}

Measured memory_bytes: 0