akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n, z, w;
	cin >> n >> z >> w;
	vi a(1);
	int ans = 0;
	rep(i, n) {
		int t;
		cin >> t;
		a.push_back(t);
	}

	if (n > 1) {
		ans = max(abs(a[n] - w), abs(a[n - 1] - a[n]));
	}
	else
	{
		ans = abs(a[1] - w);
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}

const int mod=998244353;


int dp[3005][3005];

signed main()
{

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

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  


    int a,b,c,d;
    cin>>a>>b>>c>>d;
    dp[a][b]=1;

    for(int i=a;i<=c;i++)
    {
        for(int j=b;j<=d;j++)
        {
            if(i==a && j==b)
                continue;
            dp[i][j]=(dp[i-1][j]*j+dp[i][j-1]*i-dp[i-1][j-1]*(i-1)*(j-1)%mod+mod)%mod;
        }
    }

    cout<<dp[c][d];

} 
    
 


Measured memory_bytes: 74036
#include <bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

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

Measured memory_bytes: 256
#include <stdio.h>
#include <memory.h>

int main(void){
    int map[4],line[5],sign,i,o;
    for(;sign=0,memset(map,0,sizeof(map)),memset(line,0,sizeof(line)),scanf("%d",&line[0]),map[line[0]]++,line[0];){
        for(i=1;i<5;i++){
            scanf("%d",&line[i]);
            map[line[i]]++;
        }
        map[0]=map[1]+map[2]+map[3];
        for(i=1;i<4;i++){
            if(map[i] == 0 && map[1] != 5 && map[2] != 5 && map[3] != 5){
                sign++;
                for(o=0;o<5;o++){
                    if((i+1==4?1:i+1) == line[o])
                        puts("1");
                    else
                        puts("2");
                }
            }
        }
        if(sign == 0)
            for(i=0;i<5;i++)
                puts("3");
    }
    return 0;
}

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


void solve(long long N, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C){
    long long sat =0 ;
    for(int i=0; i<N; i++){
        sat += B[A[i]-1];
    }
    for(int i=0; i<N-1; i++) {
        if(A[i+1] == A[i] + 1){
            sat += C[A[i]-1];
        }
    }
    cout << sat << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&B[i]);
    }
    std::vector<long long> C(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(A), std::move(B), std::move(C));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};
    
bool check(int a, int b){
    if((a<=0 && b>0) || (a>=0 && b<0)) return true;
    return false;
}
    
int32_t main(){
    int n;
    cin >> n;
    vector<int> v(n);
    
    REP(i, n){
        cin >> v[i];
    }

    int sum=0, cnt=0;
    REP(i, n){
        sum+=v[i];

        if(i%2){
            if(sum<=0){
                cnt+=(1-sum);
                sum+=(1-sum);
            }
        }
        else{
            if(sum>=0){
                cnt+=(sum+1);
                sum-=(sum+1);
            }
        }
    }

    int sum2=0, cnt2=0;
    REP(i, n){
        sum2+=v[i];

        if(!(i%2)){
            if(sum2<=0){
                cnt2+=(1-sum2);
                sum2+=(1-sum2);
            }
        }
        else{
            if(sum2>=0){
                cnt2+=(sum2+1);
                sum2-=(sum2+1);
            }
        }
    }

    cout << min(cnt, cnt2) << endl;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
#include<map>
#include <cassert>
#include<sstream>
#include<fstream>
#include <cstring>
using namespace std;
typedef pair<int, string>p;
map< int64_t, int > prime_factor(int64_t n) {
	map< int64_t, int > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}
const int MAX =1;
const int MOD = 998244353;

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

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 0; i <= n; i++) {
		if ((i % 3) != 0 && (i % 5) != 0)ans += i;
	}
	cout << ans;
}



Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
const int N=3005,mo=998244353;
int f[N];
int main(){
	int n,x,s;scanf("%d%d",&n,&s);
	f[0]=1;
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		for(int i=s;i>=x;i--)(f[i]+=(f[i-x]+f[i])%mo)%=mo;
		for(int i=x-1;~i;i--)f[i]=f[i]*2%mo;
	}
	printf("%d",f[s]);
	return 0;
}

Measured memory_bytes: 3828
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 
 
void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}
 
double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}
 
ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}
 
ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
 
vec modncrlistp,modncrlistm;
 
ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]/*modncrlistm[r]%mod*modncrlistm[n-r]*/%mod;
}
 
ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}
 
ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}
 
ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
 
int main(){
  ll i,N,cnt=0,f=1;
  cin>>N;
  vec v(N);
  rep(i,N){
    cin>>v[i];
  }
  vsort(v);
  if(v[0]==v[N-1]){
    if(v[0]==N-1||v[0]*2<=N){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
    return 0;
  }
  while(v[cnt]==v[0])cnt++;
  if(v[0]<cnt||v[N-1]>(N-cnt)/2+cnt||N-cnt==1){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1024
S = input().strip()

T = "keyence"

found = False
if len(S) < len(T):
    print("NO")
else:
    for start in range(len(T)):
        if S.startswith(T[:start]) and S.endswith(T[start:]):
            found = True
            break

    if S.startswith(T):
        found = True

    if found:
        print("YES")
    else:
        print("NO")


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

using namespace std;
int main()
{
    long long  n;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vector<pair<long long ,int>> v;
    for (long long  i=2;i*i<=n;++i){
        int cnt=0;
        while (n % i == 0){
            n /= i;
            cnt ++;
        }
        if (cnt != 0) v.emplace_back(i,cnt);
    }
    if (n!=1) v.emplace_back(n,1);

    int res=0;
    for (auto c:v){
        int x= c.second;
        int a=1;
        while(x >= a){
            res++;

            x -=a;
            a++;
        }
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define INF 800000000
#define MAX 1000

int main(){
  string S;
  cin>>S;
  ll N=S.size();
  vector<vector<ll>> dp(N,vector<ll>(13,0));
  if(S.at(N-1)=='?'){
    for(int i=0;i<10;i++){
      dp.at(0).at(i)=1;
    }
  }else{
    dp.at(0).at((S.at(N-1)-'0')%13)=1;
  }
  ll res=1;
  for(ll i=1;i<N;i++){
    res*=10;
    res%=13;
    if(S.at(N-1-i)=='?'){
      for(ll j=0;j<10;j++){
        for(ll k=0;k<13;k++){
          dp.at(i).at((k+j*res)%13)+=dp.at(i-1).at(k);
        }
      }
    }else{
      ll x=S.at(N-1-i)-'0';
      for(ll j=0;j<13;j++){
        dp.at(i).at((j+x*res)%13)+=dp.at(i-1).at(j);
      }
    }
    for(ll j=0;j<13;j++){
      dp.at(i).at(j)%=MOD;
    }
  }
  cout<<dp.at(N-1).at(5)<<endl;
}


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

using namespace std;

using int64 = long long;
const int mod = 1000003;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

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

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  string S;
  cin >> S;
  int op = 0;
  int64 ret = 0;
  for(int i = 0; i + 1 < S.size(); i++) {
    if(S[i] == 'B' && S[i + 1] == 'C') {
      ret += op;
      i++;
    } else if(S[i] == 'A') {
      op++;
    } else {
      op = 0;
    }
  }
  cout << ret << endl;
}





Measured memory_bytes: 720
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	static FastScanner sc = new FastScanner();
	static PrintWriter out = new PrintWriter(System.out);

	static void solve() {
		int N = sc.nextInt();
		char[] name = sc.next().toCharArray();
		char[] old;
		int ans = 0;
		for (int i = 0; i < N; i++) {
			old = sc.next().toCharArray();
			j: for (int j = 0; j < old.length; j++) {
				if (name[0] == old[j]) {
					for (int k = j + 1; k < old.length; k++) {
						if (name[1] == old[k]) {
							boolean frag = true;
							for (int l = 2; l < name.length; l++) {
								int m = (l - 1) * (k - j) + k;
								if (m >= old.length || name[l] != old[m]) {
									frag = false;
									break;
								}
							}
							if (frag) {
								ans++;
								break j;
							}
						}
					}
				}
			}
		}
		out.println(ans);
		out.flush();
	}

	public static void main(String[] args) {
		solve();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	private static boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public int nextInt() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		int n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

}

Measured memory_bytes: 25216
/*
   * * * * *       *        * * * * * * * * * * * * * * * * * * * * * * * *     * * * * * * *               * *               * * * * * * * * * *
   * * * * *      * *       * * * * * * * * * * * * * * * * * * * * * *    *    * * * * * * *              * * *             * ** * * * * * * * * *
   * *           * * *            * *     * *     * *      * *          * * *   * * *       *             * * * *           * * * *       * *    * *
   * * * * *    * * * *           * *     * *     * *       * * * * * * *  * *  * * * * * * *            * * * * *         * *  * *       * * * * *
   * * * * *   * * * * *          * *     * *     * *        * * * * ** *   * * * * * * * * *           * * * * * *       * *   * * * *   * * * *
         * *  * * * * * *   * *   * *     * *     * *       * * * * * * *    * ** *     * * *          * * * * * * *     * *    * * * *   * *  * *
         * * * *       * *  * *   * *     * *     * *      * *          *     * * *     * * *         * *       * * *   * *     * *       * *   * *
   * * * * ** *         * * * * * * * * * * * * * * * * * * * * * * * * *      *  * * * * * * * * * ** *         * * * * *      * * * * * * *    * *
   * * * * * *           * ** * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * * * * *           * * * *       * * * * * * *     * *
*/

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <set>
#define ll long long
using namespace std;

ll dp[1000005],A[1000005]={-1,1,-1,3,-1,-1,-1,1,-1,9,-1};
int main()
{
    ios::sync_with_stdio(0);
    ll n,i,c=0;
    cin>>n;
    string s;
    cin>>s;
    for(i=0;i<n;i++)
    {
        if(s[i]=='R')
        c++;
    }
    int ans=c;
    for(i=0;i<c;i++)
    {
        if(s[i]=='R')
        ans--;
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 3516
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
MOD = 10**9 + 7
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    n, k = LI()

    if n - k >= 0:
        dp = [[0] * (k + 1) for _ in range(n - k + 1)]
        for i in range(k + 1):
            dp[0][i] = 1

        for i in range(n - k):
            for j in range(k):
                if i - j >= 0:
                    dp[i+1][j+1] = dp[i+1][j] + dp[i-j][j+1]
                else:
                    dp[i+1][j+1] = dp[i+1][j]
                dp[i+1][j+1] %= MOD

        print(dp[-1][-1])
    else:
        print(0)

if __name__ == '__main__':
    resolve()



Measured memory_bytes: 14840
n = int(input())
a = [int(x)-i-1 for i,x in enumerate(input().split())]
a.sort()
if len(a)%2==1:
    md = a[len(a)//2]
    ans = 0
    for i in a:
        ans += abs(i-md)
    print(ans)
else:
    md1 = a[len(a)//2]
    md2 = a[len(a)//2-1]
    ans1 = 0
    ans2 = 0
    for i in a:
        ans1 += abs(i-md1)
        ans2 += abs(i-md2)
    print(min(ans1,ans2))

Measured memory_bytes: 88532
#include <cstdio>
using namespace std;
int a,b,c,k;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&k);
	int i=0;
	while(a>=b){
		++i;
		b*=2;
	}
	while(b>=c){
		++i;
		c*=2;
	}
	if(i<=k){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1620
class ModCombination
  attr_reader :fac, :inv, :finv, :mod

  def initialize(n, mod: MOD)
    @mod = mod
    @fac = [1, 1]
    @inv = [1, 1]
    @finv = [1, 1]

    (2..n).each do |i|
      @fac[i] = fac[i - 1] * i % mod
      @inv[i] = mod - inv[mod % i] * (mod / i) % mod
      @finv[i] = finv[i - 1] * inv[i] % mod
    end
  end

  def combination(n, k)
    return 0 if n < k
    return 0 if n < 0 || k < 0

    fac[n] * (finv[k] * finv[n - k] % mod) % mod
  end

  def repeated_combination(n, k)
    combination(n + k - 1, k)
  end
end

MOD = 10 ** 9 + 7
X, Y = gets.split.map(&:to_i)
N = [X, Y].max

mc = ModCombination.new(10 ** 6)
ans = 0

(0..N).each do |one_x_cnt|
  two_x_cnt = (X - one_x_cnt) / 2

  n = two_x_cnt + one_x_cnt
  # p [n, one_x_cnt, two_x_cnt]

  break if two_x_cnt < 0
  next if (one_x_cnt + 2 * two_x_cnt) != X
  next if (2 * one_x_cnt + two_x_cnt) != Y

  ans = (ans + mc.combination(n, two_x_cnt)) % MOD
end

puts ans


Measured memory_bytes: 28676
def ispalindrome(str): return 1 if str == str[::-1] else 0
S = input()
N = len(S)

i1 = int((N-1)/2)
i2 = int((N+3)/2)-1
strong = True
if not ispalindrome(S):
  strong = False
if not ispalindrome(S[:i1]):
  strong = False
if not ispalindrome(S[i2:]):
  strong = False

if strong:
  print('Yes')
else:
  print('No')
    

Measured memory_bytes: 3064
from sys import exit
num = ["0","1","2","3","4","5","6","7","8","9"]
A, B = map(int,input().split())
S = input()
for i in range(A + B + 1):
  if i == A:
    if S[i] != "-": 
      print("No")
      exit()
  else: 
    if S[i] not in num:
      print("No")
      exit()
print("Yes")      

Measured memory_bytes: 38384
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $ans = [];
  $ans["AC"] = 0;
  $ans["WA"] = 0;
  $ans["TLE"] = 0;
  $ans["RE"] = 0;
  for ($i=0; $i<$n; $i++) {
    list($s) = explode(" ", trim(fgets(STDIN)));
    $ans[$s]++;
  }

echo 'AC x '.$ans["AC"].PHP_EOL;
echo 'WA x '.$ans["WA"].PHP_EOL;
echo 'TLE x '.$ans["TLE"].PHP_EOL;
echo 'RE x '.$ans["RE"].PHP_EOL;


Measured memory_bytes: 16224
import java.io.PrintWriter;
import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int[] A = new int[N + 2];
        for (int i = 1; i <= N; i++)
            A[i] = sc.nextInt();
        int sum = 0;
        for(int i = 0; i <= N; i++)
            sum += Math.abs(A[i + 1] - A[i]);
        try (final PrintWriter pw = new PrintWriter(System.out, false)) {
            for (int i = 1; i <= N; i++)
                if ((A[i + 1] - A[i]) * (A[i] - A[i - 1]) < 0)
                    pw.println(sum - Math.abs(A[i + 1] - A[i]) - Math.abs(A[i] - A[i - 1]) + Math.abs(A[i + 1] - A[i - 1]));
                else
                    pw.println(sum);
        }
    }
}
public class Main {
    public static void main(String...args) {
        A.main();
    }
}


Measured memory_bytes: 53896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();

		for (int i = 0; i < n; i++) {
			System.out.print(s.charAt(i));
			System.out.print(t.charAt(i));
		}

		sc.close();
	}
}


Measured memory_bytes: 35596
import Text.Printf
import System.IO

sign x = if x == 0.0 then 0.0 else x

floatFormat :: Float -> String
floatFormat x = printf "%.3f" x

main = do
    end <- isEOF
    if end then return ()
    else
        do
            line <- getLine
            let [a, b, c, d, e, f] = map read . words $ line
                x = sign $ (c * e - b * f) / (a * e - b * d)
                y = sign $ (c * d - a * f) / (b * d - a * e)
                in putStrLn $ floatFormat x ++ " " ++ floatFormat y
            main

Measured memory_bytes: 4488
import java.util.Scanner;

public class Main {

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

		int x = sc.nextInt();

		if(x == 0) {
			System.out.print(1);
		}else {
			System.out.print(0);
		}
		sc.close();
	}

}


Measured memory_bytes: 35528
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

int main(){

	int N,p,q,limit,tmp;
	bool FLG;

	scanf("%d",&N);

	for(int loop = 0; loop < N; loop++){
		scanf("%d %d",&p,&q);

		limit = sqrt(p*p+q*q);

		FLG = false;

		for(int m = -1*limit; m <= limit; m++){
			for(int n = -1*limit; n <= limit; n++){
				tmp = m*m+n*n;
				if(tmp>limit){
					if(n > 0)break;
					else{
						continue;
					}
				}else if(tmp <= 1){
					continue;
				}



				if((m*p+n*q)%tmp == 0 && (m*q-n*p)%tmp == 0){
					if((m == p && n == q) || (m == -q && n == p) || (m == -p && n == -q)
							|| (m == q && n == -p)){
						//Do nothing
					}else{
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}

		if(FLG){
			printf("C\n");
		}else{
			printf("P\n");
		}
	}

	return 0;
}

Measured memory_bytes: 2492
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 
#define ALL(a)  (a).begin(),(a).end()



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  int N;
  cin>>N;
  int L[N*2];
  for(int i=0;i<N*2;i++){
    cin>>L[i];
  }
  sort(L,L+N*2);
  int sum=0;
  for(int i=2*N-2;i>=0;i-=2){
    sum+=L[i];
    



  }
  cout<<sum<<endl;

}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
const ll mod=1e9+7;
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    int t;
    cin>>t;
    if(t>=30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;






}

























































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

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


int main()
{
    long long M, N, K;
    cin >> N >> M >> K;
    vector<long long> A(N+1, 0), B(M+1, 0);
    FOR(i, 1, N+1) cin >> A[i];
    FOR(i, 1, M+1) cin >> B[i];

    REP(i, N) A[i+1] += A[i];
    REP(i, M) B[i+1] += B[i];
    
    int ans = 0;
    REP(i, N+1){
        if(A[i] > K) break;
        int j = lower_bound(B.begin(), B.end(), K-A[i]) - B.begin();
        if(B[j] == K-A[i]) ans = max(ans, i+j);
        else ans = max(ans, i+j-1);
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
  string S;
  cin >> S;
  string A,B;
  REP (i,S.size()) {
    if ( i%2>0 ) {
      A.push_back('0');
      B.push_back('1');
    }
    else {
      A.push_back('1');
      B.push_back('0');
    }
  }
  int P = 0;
  int Q = 0;
  REP (i,S.size()){
    if ( A[i] != S[i] ) {
      P++;
    }
    else {
      Q++;
    }
  }
  cout << min(P,Q) << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//cout<<""<<endl;
int main(){
  int n,m;cin>>n>>m;
  cout<<(n-1)*(m-1)<<endl;
  
  
}







Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: usize,
        p: [usize; n],
    }
    println!("{}",if p.into_iter().enumerate().filter(|&(i, j)| i + 1 != j).count() <= 2 { "YES" } else { "NO" });
}


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

#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  // int64_t a, ans;
  // mp::cpp_dec_float_50 b;
  // cin >> a >> b;

  // b *= a;
  // ans = (int64_t)b;

  int64_t a, ans;
  double b;
  cin >> a >> b;
  // cerr << (int)(b * 100) << '\n';
  // cerr << floor(b * 100) << '\n';
  // cerr << round(b * 100) << '\n';
  ans = (a * (int64_t)round(b * 100)) / 100;

  cout << ans << '\n';

  return 0;
}


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

using namespace std;

int main()
{
    string s;
    cin >> s;
    int conA=0, conB=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A')
            conA++;
        if(s[i]=='B')
            conB++;
    }
    if(conA==1 && conB==2)
        cout <<"Yes";
    else if(conA==2 && conB==1)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


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

int main()
{
    std::string N;
    int K;
    std::cin >> N >> K;
    std::string D[K];
    int i;
    for (i = 0; i < K; i++) {
    std::cin >> D[i];
    }
    
    for (i = 0; i < K; ) {
        
        if (N.find(D[i]) != std::string::npos) {
            i = 0;
            int n = std::stoi(N) + 1;
            N.clear();
            N = std::to_string(n);
        } else i++;
        
    }


    std::cout << N;
    return 0;
}

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

struct Problem {

	ULL f(ULL x) {
		if (x == 1) return 1;
		return 1 + 2 * f(x / 2);
	}

	void Solve() {
		ULL h; cin >> h;
		cout << f(h) << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
import java.util.Scanner;

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


Measured memory_bytes: 25300
#include<cstdio>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;

int n, used[100000];
pair<int, int> w[100000], s[100000];
int check[2][100000];

bool ok(int d){
  memset(check, 0, sizeof(check));
  

  check[0][w[0].second] = 2;
  int upper = w[0].first, under = w[n - 1].first;
  for(int i = 0;i < n;i++){
    if(abs(upper - w[i].first) > d && abs(under - w[i].first) > d){
      return false;
    }
    if(abs(upper - w[i].first) > d ){
      check[0][w[i].second] = 1;
    }
    if(abs(under - w[i].first) > d){
      check[0][w[i].second] = 2;
    }
  }
  
  check[1][s[0].second] = 2;
  upper = s[0].first;
  under = s[n - 1].first;
  for(int i = 0;i < n;i++){
    if(abs(upper - s[i].first) > d && abs(under - s[i].first) > d){
      return false;
    }
    if(abs(upper - s[i].first) > d){
      check[1][s[i].second] = 1;
    }
    if(abs(under - s[i].first) > d){
      check[1][s[i].second] = 2;
    }
  }
  int differ = 0, both = 0;
  for(int i = 0;i < n;i++){
    if(check[0][i] == 0 || check[1][i] == 0)both++;
    else if(check[0][i] != check[1][i])differ++;
  }
  return (differ == 0 || both + differ == n);
  
}

int main(){
  scanf("%d", &n);
  for(int i = 0;i < n;i++){
    int x, y;
    scanf("%d%d", &x, &y);
    w[i] = make_pair(x + y, i);
    s[i] = make_pair(x - y, i);
  }
  sort(w, w + n);
  sort(s, s + n);
  int up = 1 << 20, down = 0;
  while(up - down > 5){
    int mid = (up + down) / 2;
    if(ok(mid)){
      up = mid;
    }
    else{
      down = mid;
    }
  }
  while(ok(--up));
  printf("%d\n", up + 1);
  return 0;
}

Measured memory_bytes: 3384
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;
const ll inf = 1LL << 60;

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

    ll A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A), t(B), x(Q);
    Rep (i, A) cin >> s[i];
    Rep (i, B) cin >> t[i];
    Rep (i, Q) cin >> x[i];

    Rep (i, Q) {
        ll sw = -inf, se = inf, tw = -inf, te = inf;
        auto itr = upper_bound(s.begin(), s.end(), x[i]);
        if (itr != s.end()) se = *itr;
        if (itr != s.begin()) {
            itr--;
            sw = *itr;
        }

        itr = upper_bound(t.begin(), t.end(), x[i]);
        if (itr != t.end()) te = *itr;
        if (itr != t.begin()) {
            itr--;
            tw = *itr;
        }

        ll ans = inf;
        ans = min(ans, (x[i] - min(sw, tw)));
        ans = min(ans, (max(se, te) - x[i]));
        ans = min(ans, te - sw + min(abs(x[i]-te), abs(x[i]-sw)));
        ans = min(ans, se - tw + min(abs(x[i]-se), abs(x[i]-tw)));
        cout << ans << "\n";
    }
}

Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

vector<int> g[100005];
int main() {
  int n,u,v;
  cin >> n >> u >> v;
  --u; --v;
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  map<int,int> du, dv;
  queue<P> q;
  q.emplace(u,0);
  while(!q.empty()){
    P p = q.front(); q.pop();
    du.emplace(p.first,p.second);
    for(int nv:g[p.first]){
      if(du.count(nv)==0) q.emplace(nv,p.second+1);
    }
  }
  q.emplace(v,0);
  while(!q.empty()){
    P p = q.front(); q.pop();
    dv.emplace(p.first,p.second);
    for(int nv:g[p.first]){
      if(dv.count(nv)==0) q.emplace(nv,p.second+1);
    }
  }
  int ans = 0;
  rep(i,n){
    if(du[i]>=dv[i])continue;
    ans = max(ans,dv[i]-1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 15232
use std::cmp::min;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn dfs(
    g: &Vec<Vec<usize>>,
    s: usize,
    t: usize,
    parents: &mut Vec<usize>,
    seen: &mut Vec<bool>,
) -> bool {
    seen[s] = true;
    if s == t {
        true
    } else {
        let n = g.len();
        for v in 0..n {
            if !seen[v] && g[s][v] > 0 && dfs(g, v, t, parents, seen) {
                parents[v] = s;
                return true;
            }
        }
        false
    }
}
fn calc_maxflow(g: &Vec<Vec<usize>>, s: usize, t: usize) -> usize {
    let n = g.len();
    let mut ret = 0;
    let mut parents = vec![0; n];
    let mut seen = vec![false; n];
    let mut rg = g.clone();
    while dfs(&rg, s, t, &mut parents, &mut seen) {
        let mut d = std::usize::MAX;
        let mut v = t;
        while v != s {
            let u = parents[v];
            d = min(d, rg[u][v]);
            v = u;
        }
        ret += d;
        let mut v = t;
        while v != s {
            let u = parents[v];
            rg[u][v] -= d;
            rg[v][u] += d;
            v = u;
        }
        seen = vec![false; n];
    }
    ret
}
fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let (n, m): (usize, usize) = parse!(it, 2);
    let mut g: Vec<Vec<usize>> = vec![vec![0; n]; n];
    for _ in 0..m {
        let (u, v, c): (usize, usize, usize) = parse!(it, 3);
        g[u][v] = c;
    }
    println!("{}", calc_maxflow(&g, 0, n - 1));
}



Measured memory_bytes: 5052
#include<iostream>                                                                                                                
#include<cstdio>                                                                                                                  
#include<string>                                                                                                                  
#include<set>                                                                                                                     
using namespace std;                                                                                                              
int main(void) {                                                                                                                  
  int n;                                                                                                                          
  string query, word;                                                                                                             
  set<string> dict;                                                                                                               
  cin >> n;                                                                                                                       
  while (n--) {                                                                                                                   
    cin >> query >> word;                                                                                                         
    if (query=="insert") {                                                                                                        
      dict.insert(word);                                                                                                          
    } else {                                                                                                                      
      if (dict.find(word)==dict.end()) {                                                                                          
        puts("no");                                                                                                               
      } else {                                                                                                                    
        puts("yes");                                                                                                              
      }                                                                                                                           
    }                                                                                                                             
  }                                                                                                                               
}                                                                                                                                 
                     

Measured memory_bytes: 32536
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll a;
    long double b;
    cin>>a>>b;
    ll x;
    x=100*b+0.1;
    cout<<a*x/100<<endl;
    return 0;
}




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

#define MOD 1000000007

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a(M+1,-1);
  for(int i=0;i<M;i++){
    cin>>a.at(i);
  }

  vector<int> sum(N+1,0);
  sum.at(0)=1;
  int m=0;
  if(a.at(m)==1){
    m++;
  }else{
    sum.at(1)=1;
  }
  for(int i=2;i<=N;i++){
    if(i==a.at(m)){
      m++;
      continue;
    }
    sum.at(i)=sum.at(i-1)+sum.at(i-2);
    sum.at(i)%=MOD;
  }
  cout<<sum.at(N)<<endl;

}


Measured memory_bytes: 1024