akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int mx=(1<<22)+10;
int dp[mx];
bool vi[mx];
int n;
int a[22][22];
void dfs(int d,long long s){
	long long ans=0;
	for(int i=1;i<=n;i++){
		if(a[d][i]==0)continue;
		if(s&(1<<i)){
			if(!vi[s-(1<<i)])
				dfs(d+1,s-(1<<i));
			ans+=dp[s-(1<<i)];
		}
	}
	vi[s]=true;
	dp[s]=ans%1000000007;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cin>>a[i][j];
	dp[0]=1;
	vi[0]=true;
	dfs(1,(1<<(n+1))-2);
	cout<<dp[(1<<(n+1))-2]%1000000007;
	return 0;
}

Measured memory_bytes: 20736
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

//vector<ll> a;

int main()
{
	ll n,a,b;
	cin >> n >> a >> b;
	if (a*n > b) {
		cout << b << endl;
	}
	else {
		cout << a * n << endl;
	}
	
	
	return 0;
}


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

n = N
check = 0
count = (N // 11)*2
n = N % 11
while(n > 0):
    count += 1
    if check % 2 == 0:
        n -= 6
    else:
        n -= 5
    check = (check + 1) % 2

print(count)

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
using ll = long long;
using ld = long double;
using str = string;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<str>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

// Constant variables
const ld PI = (acos(-1));
const ll MOD = 1000000007;

// I/O Asynchronizing
struct __io_async{
    __io_async(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};

int main() {
    int n;
    cin >> n;
    cout << ((n + 1) / 2) << "\n";

    return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  string S; cin >> S;
  if(S == "Sunny") cout << "Cloudy" << endl;
  else if(S == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

ll a[N];
bool vis[N];
int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        ll n;
        ll kk;
        Int(n,kk);

        for(int i=1;i<=n;++i)Int(a[i]);

        std::vector<ll> v;
        ll k=1;
        ll res;
        while(1){
            vis[k]=true;
            v.push_back(k);
            k=a[k];
            if(vis[k]){
                res=k;
                break;
            }
        }
        ll st;
        std::vector<ll> vv;
        ll i=0;
        for(;i<sz(v);++i){
            if(v[i]==res){
                while(i<sz(v)){
                    vv.push_back(v[i]);
                    ++i; 
                }
                break;
            }
        }

        if(kk<i){
            printf("%lld\n", v[kk]);
        }
        else{
            kk-=i;
            kk = kk%(ll)sz(vv);
            printf("%lld\n", vv[kk]);
        }


        //printf("Case %d: ",++te);
    }
    return 0;
}



Measured memory_bytes: 9360
n, m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]

for i in range(10**n):
    i = str(i)
    flag = True
    if len(i) == n:
        for j in range(m):
            if i[sc[j][0]-1] != str(sc[j][1]):
                flag = False
        if flag:
            print(i)
            quit()

print(-1)

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

int main() {
long long d,n;
cin >> d >> n;
if(d==0){
    if(n==100){cout << n+1<<endl;}
    else cout << n<<endl;}
if(d==1){
     if(n==100){cout << n*100+100<<endl;}
     else cout << n*100<<endl;}
if(d==2){ 
    if(n==100){cout << n*10000+10000<<endl;}
    else cout << n*10000<<endl;}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 100009
#define mk make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef pair<int,int> P;
multiset<int>st[maxn];
map<P,int>mp;
map<P,int>::iterator it;
multiset<int>::iterator jt;
int fa[maxn],sz[maxn];
queue<P>q;
vector<int>vec[maxn];
int find(int x){if(fa[x]!=x) fa[x]=find(fa[x]);return fa[x];}
int main(){
  int n,x,y;
  scanf("%d",&n);
  for(int i=1;i<n;i++){
    scanf("%d%d",&x,&y);
    st[x].insert(y),st[y].insert(x);
    mp[mk(x,y)]+=1,mp[mk(y,x)]+=1;
  }
  for(int i=1;i<n;i++){
    scanf("%d%d",&x,&y);
    st[x].insert(y),st[y].insert(x);
    mp[mk(x,y)]+=1,mp[mk(y,x)]+=1;
  }
  for(it=mp.begin();it!=mp.end();it++)
    if(it->se==2) q.push(it->fi);
  for(int i=1;i<=n;i++) fa[i]=i,sz[i]=1,vec[i].pb(i);
  for(int T=1;T<n;T++){
  tp:
    if(q.empty()) puts("NO"),exit(0);
    P u=q.front();q.pop();
    mp.erase(u);
    int x=find(u.fi),y=find(u.se);
    if(x==y) goto tp;
    if(sz[x]>sz[y]) swap(x,y);
    for(jt=st[x].begin();jt!=st[x].end();jt++){
      int k=find(*jt);if(k==y) continue;
      st[y].insert(k),st[k].insert(y),mp[mk(y,k)]+=1,mp[mk(k,y)]+=1;
      if(mp[mk(y,k)]==2) q.push(mk(y,k));
      if(mp[mk(k,y)]==2) q.push(mk(k,y));
      st[k].erase(st[k].find(x));
    }
    st[y].erase(x);
    fa[x]=y,sz[y]+=sz[x];
  }
  puts("YES");
  return 0;
}


Measured memory_bytes: 61440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int N;
  cin >> N;
  int cnt = 0;
  for (int i = 1; i <= N; i++) {
    int k = log10(i);
    if (k % 2 == 0) {
      cnt++;
    }
  }
  cout << cnt << "\n";
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> L(N+1), R(N+1);
    for(int i=0; i<N; i++) cin >> L[i] >> R[i];
    sort(L.rbegin(), L.rend());
    sort(R.begin(), R.end());
    int64_t ans = 0;
    for(int i=0; i<=N; i++) if(L[i] > R[i]) ans += 2*(L[i]-R[i]);
    cout << ans << endl;
}

Measured memory_bytes: 1024
import math


def main():
    n, d = map(int, input().split())
    Xs = [list(map(int, input().split())) for _ in range(n)]
    ans = 0

    for i, xi in enumerate(Xs):
        for xj in Xs[i+1:]:
            dis = 0
            for di in range(d):
                dis += (xi[di] - xj[di])**2

            if math.sqrt(dis) % 1 == 0:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9248
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define CLR(a) memset((a),0,sizeof(a))
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};

int n;

string sed(string s,string a,string b){
  string t;
  rep(i,SZ(s)){
    if(s.substr(i,SZ(a))==a){
      t += b;
      i += SZ(a)-1;
    }else t += s[i];
  }
  return t;
}

void solve(){
  vector<pair<string,string> > in(n);
  rep(i, n) cin >> in[i].F >> in[i].S;
  string a,b;
  cin >> a >> b;

  queue<pair<int,string> > q;
  q.push(mp(0,a));
  set<string> vis;
  while(!q.empty()){
    int cc=q.front().F;
    string cv=q.front().S;
    q.pop();
    if(SZ(cv)>SZ(b)) continue;
    if(cv==b) {
      cout << cc << endl;
      return;
    }
    if(vis.count(cv)) continue;
    vis.insert(cv);
    FOR(it,in) q.push(mp(cc+1,sed(cv,it->F,it->S)));
  }
  cout << -1 << endl;
}

int main(int argc, char *argv[])
{
  while(cin >> n && n) solve();
  return 0;
}

Measured memory_bytes: 1912
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define loop(q) for(auto it:q)
#define rloop(q) for(auto&it:q)
#define input(a) for(auto &t:a){cin>>t;}
#define maxe(a,b,c) max(a,max(b,c))
#define eb emplace_back
#define em emplace
#define print(x) cout<<x<<endl;
#define fill(a,val) memset(a,val,sizeof(a))
#define in(k) int k;cin>>k
#define edl cout<<"\n"
#define ll  long long
#define ld  long double
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define cyes cout<<"Yes"<<endl; 
#define cno cout<<"No"<<endl;
const ll mod=1e9+7;
signed main()
{
    //cout<<fixed<<setprecision(20);
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	/**************/
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans=0;
	if(k>=a && k>0)
	{
		ans+=a;
		k-=a;
	if(k>=b && k>0)
	{
		k-=b;
	if(k>=c && k>0)
	{
		ans-=c;
		k-=c;
	}
	else if(k<c && k>0)
	{
		ans-=k;
		k=0;
	}
	}
	else if(k<b && k>0)
	{
		k=0;
	}
	}
	else if(k<a && k>0)
	{
		ans+=k;
		k=0;
	}
	
	cout<<ans;
	/**************/
	#ifndef ONLINE_JUDGE
    printclock;
	#endif
    return 0;
}


Measured memory_bytes: 3596
K, A, B = map(int, input().split())
if K < A:
    print(K + 1)
else:
    if A + 1 < B:
        M = K - A + 1
        print((B - A) * (M // 2) + int(M % 2 != 0) + A)
    else:
        print(K + 1)




Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int W, a, b;
    cin >> W >> a >> b;
    cout << max({0, b - a - W, a - b - W}) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int i=0;
    char s[10000];
        scanf("%s",&s);
        i=strlen(s);
        for(i=i-1;i>=0;i--)
        {
            if(s[i]=='s')
            {
                s[i+3]=s[i+1];s[i+1]='e';s[i+2]='s';break;
            }
            else
            {
                s[i+2]=s[i+1];s[i+1]='s';break;
            }
        }
        printf("%s\n",s);
    return 0;
}

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

vector<long long> topological_sort(vector<vector<ll>> &graph,vector<ll> &in_degrees){
    stack<ll> st;
    for (ll i=1;i<graph.size();i++){
        if (in_degrees[i] == 0) st.push(i);
    }
    vector<ll> ans;
    while(st.size()>0){
        auto i = st.top();st.pop();
        ans.push_back(i);
        for (auto &j:graph[i]){
            in_degrees[j] --;
            if (in_degrees[j] == 0) st.push(j);
        }
    }
    return ans;
}


void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){
    //隣接リストを構築
    vector<vector<ll>> graph(N+1);    //グラフの頂点はN個    
    vector<vector<ll>> in_graph(N+1);
    vector<ll> in_degrees(N+1,0);
    for (ll i=0;i<A.size();i++){
        graph[A[i]].push_back(B[i]);
        in_graph[B[i]].push_back(A[i]);
        in_degrees[B[i]]+=1;
    }
    vector<ll> sorted_graph = topological_sort(graph,in_degrees);
    vector<ll> node_score(N+1);
    for (ll i=0;i<sorted_graph.size();i++){
        node_score[sorted_graph[i]] = i;
    }
    vector<ll> parents(N+1,0);
    for (ll i=1;i<=N;i++){
        ll maximum_node = 0;
        ll maximum_score = -1;
        for (const auto &j:in_graph[i]){
            if (maximum_score < node_score[j]){
                maximum_score = node_score[j];
                maximum_node = j;
            }
        }
        printf("%lld\n",maximum_node);
    }

    
}

// Generated by 1.1.6 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);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N-1+M);
    std::vector<long long> B(N-1+M);
    for(int i = 0 ; i < N-1+M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 16632
N=int(input())
a=list(map(int,input().split()))
cnt=1
val='0'
for n in range(1,N):
	if a[n-1]==a[n] or (val=='+' and a[n-1]<a[n]) or (val=='-' and a[n-1]>a[n]):
		pass
	elif val=='0':
		 if a[n-1]<a[n]:
		 	val='+'
		 elif a[n-1]>a[n]:
		 	val='-'
	else:
		val='0'
		cnt+=1
print(cnt)

Measured memory_bytes: 14228
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

n=int(input())
F=[list(map(int,input().split()))  for i in range(n)]
P=[list(map(int,input().split()))  for i in range(n)]
ans=-inf
for bit in range(1,2**10):
    count=[0]*n
    for k in range(10):
        if (bit>>k & 1):
            for i,Fi in enumerate(F):
                count[i]+=Fi[k]
    tmp=0
    for i,Pi in enumerate(P):
        tmp+=Pi[count[i]]
    ans=max(ans,tmp)
print(ans)




Measured memory_bytes: 3440
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

int main() {
    int a,b;
    cin >> a >> b;

    cout << max(0, a-2*b) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int sum(int x){
  int b=0;
  while(x>0){
    b+=x%10;
    x/=10;
  }
  return b;
} 
int main(){
  int a;
  cin>>a;
  if(a%10==0){
    cout<<10<<endl;
  }
  else
    cout<<sum(a)<<endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    AB = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var aa = parseInt(AB[0], 10);
    var bb = parseInt(AB[1], 10);
  //  console.log(aa,bb);
    
    function lcm(a,b) {
        var g = (n, m) => m ? g(m, n % m) : n
        return a * b / g(a, b)
    }
    
    console.log(lcm(aa,bb));
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22588
#include<iostream>
main(){int n,m,i,a,c[1<<20];for(std::string s;std::cin>>n>>m>>s,n;printf("%d\n",a))for(a=0,i=m;--i;a+=c[i]>=n)c[i]=s.substr(i,3)=="IOI"?c[i+2]+1:0;}

Measured memory_bytes: 5928
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;
char a[5000000];

int main()
{
    ll n;
    ll c=1;
    int m=0;
    cin>>n;
    while(n>0)
    {
        ll k=n%(26);
        if(k==0)
        {
            k=26;
            a[m++]='z';
        }
        else
        {
            a[m++]='a'+k-1;
        }
        n=(n-k)/26;

    }
    for(int i=m-1;i>=0;i--)
    {
        cout<<a[i];
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int m, d;
	cin>> m>> d;
  	int one, two, count = 0;
    while(d > 9)
    {
    	one = d % 10;
      	two = d / 10;
        for(int i = m; i > 0; i--)
        {
            if(one * two == i && one > 1 && two > 1)
          	    count++;
        }
        d--;
    }
  	cout<< count;
	return 0;
}

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


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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 gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};


int main(){
  int n; cin >> n;
  string s; cin >> s;
  if(n%2 == 1){
    std::cout << "No" << '\n';
    return 0;
  }
  int m = n/2;
  string t1, t2;
  rep(i, m) t1 += s[i];
  for (int i = m; i < n; i++) {
    /* code */
    t2 += s[i];
  }

  std::cout << (t1 == t2 ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 256
def resolve():
    A, V = [int(i) for i in input().split()]
    B, W = [int(i) for i in input().split()]
    T = int(input())
    if V <= W:
        print("NO")
    elif (V - W) * T < abs(A - B):
        print("NO")
    else:
        print("YES")

resolve()

Measured memory_bytes: 9184
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try(BufferedReader input = new BufferedReader(new InputStreamReader(System.in))){
 
			String[] l1 = input.readLine().split(" ");
			int N = Integer.parseInt(l1[0]);
			int M = Integer.parseInt(l1[1]);
            int C = Integer.parseInt(l1[2]);

            String[] l2 = input.readLine().split(" ");
            int[] B = new int[M];
            for (int i = 0; i < M; i++) {
                B[i] = Integer.parseInt(l2[i]);
            }

            int[][] data = new int[N][M];
            int cnt = 0;

            for (int i = 0; i < N; i++) {
                    int calc = 0;
                    String[] lines = input.readLine().split(" ");
                    for (int j = 0; j < M; j++) {
                        calc += Integer.parseInt(lines[j]) * B[j];
                    }
                    if (calc + C > 0)
                        cnt++;
            }

                System.out.println(cnt);
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}

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

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++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;


int main() {
	int N, C;
	cin >> N >> C;
	int c[35][35];
	VI d0(31), d1(31), d2(31);
	REP(i, C)REP(j, C)cin >> c[i + 1][j + 1];
	REP(i, N)REP(j, N) {
		int d;
		cin >> d;
		if ((i + j) % 3 == 1)  d1[d]++;
		else if ((i + j) % 3 == 2)d2[d]++;
		else d0[d]++;
	}
	int ans = INF;
	int da = d0.size(), db = d1.size(), dc = d2.size();
	FOR(i, 1, C + 1)FOR(j, 1, C + 1)FOR(k, 1, C + 1) {
		if (i != j && j != k && k != i) {
			int res = 0;
			REP(l, 31)res += c[l][i]*d0[l];
			REP(m, 31)res += c[m][j]*d1[m];
			REP(n, 31)res += c[n][k]*d2[n];
			ans = min(ans, res);
		}


	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define endl "\n"
#define fi first
#define se second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define sz size()
#define PQ priority_queue
#define len length()
#define mll map<ll,ll>
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define mp(x,y)  make_pair(x,y)
#define pb push_back
#define pf push_front
#define ALL(v) v.begin(),v.end()
#define LAPAK ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

const ll MOD = 1e9 +7;
const ll MAX = 1e5+5;

int main() {
	string s,t;
	cin>>s>>t;
	ll n = s.len,m = t.len;
	ll dp[n+1][m+1];
	For(i,0,n+1)dp[i][0]=0;
	For(j,0,m+1)dp[0][j]=0;
	For(i,1,n+1){
	    For(j,1,m+1){
	        if(s[i-1]==t[j-1]){
	            dp[i][j]=dp[i-1][j-1]+1;
	        }
	        else{
	            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
	        }
	    }
	}
	ll i = n,j = m;
	string ans="";
	while(i>=1 && j>=1){
	    if(s[i-1]==t[j-1]){
	        ans.pb(s[i-1]);
	        i--,j--;
	    }
	    else if(dp[i-1][j]==dp[i][j]){
	        i--;
	    }
	    else
	        j--;
	}
	reverse(ALL(ans));
	cout<<ans;
	
	return 0;
}

/*            *          *******        *       *    *
             * *            *          * *       *  *
coded by    *****           *         *****        *
           *     *      *   *        *     *       *
          *       *      * *        *       *      *
*/


Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 3e3+5;
ll n, arr[nax];

int main(){
	IOS
	cin >> n;
	ll ans=0;
	for(int i=0;i<n;i++){
		cin >> arr[i];
		ans+=arr[i]-1;
	}
	printf("%lld", ans);
}



Measured memory_bytes: 3796
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	string s;
	cin >> s;
	int a, b, ans;
	a = 0; b = 0;
	for (auto ch : s) {
		if (ch == '0') a++;
		else b++;
	}
	ans = min(a, b) * 2;
	cout << ans << "\n";

	return 0;
}

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

bool rangeCheck(int h,int w,int y,int x){
  if(y<0||x<0||y>=h||x>=w){
    return false;
  }
  return true;
}

int main(){
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(int i=0;i<h;i++){
    cin>>s[i];
  }
  int dirY[]={0,1,-1,0};
  int dirX[]={1,0,0,-1};
  vector<vector<bool>> flg(h,vector<bool> (w,false));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j]!='#'){
        continue;
      }
      for(int k=0;k<4;k++){
        int ny=dirY[k]+i;
        int nx=dirX[k]+j;
        if(rangeCheck(h,w,ny,nx)==false){
          continue;
        }
        if(s[ny][nx]=='#'){
          flg[i][j]=true;
          break;
        }
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(!flg[i][j]&&s[i][j]=='#'){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

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

int main(){
    int N, K, d, a;
    cin >> N >> K;
    vector<int> sun(N + 1);
    for(int i = 1; i <= N; i++){
        sun.at(i) = 0;
    }
    for(int i = 1; i <= K; i++){
        cin >> d;
        for(int j = 1; j <= d; j++){
            cin >> a;
            sun.at(a)++;
        }
    }
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(sun.at(i) == 0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(void) {
    string s;
    cin >> s;
    if (s.substr( 0, 4)=="YAKI") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    cout << endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

const int INF=1001001001001001001ll;
int f(int a,int b,int c){
    vint v={a,b,c};
    sort(all(v));
    int ans=0;
    rep(i,2){
        if((v[2]-v[i])&1)ans+=INF;
        else ans+=(v[2]-v[i])/2;
    }
    return ans;
}

signed main(){
    int a,b,c;
    cin>>a>>b>>c;

    int ans=INF;
    chmin(ans,f(a,b,c));
    chmin(ans,f(a+1,b+1,c)+1);
    chmin(ans,f(a,b+1,c+1)+1);
    chmin(ans,f(a+1,b,c+1)+1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

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

struct aa {
	int y;
	int x;
	bool black;
};

int main() {
	while (1) {
		int w, h; cin >> w >> h;
		if (!w)break;
		vector<vector<int>>field(h + 2, vector<int>(w + 2, 0));
		int sx, sy;
		for (int i = 0; i < h; ++i) {
			string st; cin >> st;
			for (int j = 0; j < w; ++j) {
				if (st[j] == '.') {
					field[i + 1][j + 1] = 1;
				}
				else {
					if (st[j] == '#') {
						field[i + 1][j + 1] = 2;
					}
					else {
						sx = j + 1;
						sy = i + 1;
						field[i + 1][j + 1] = 1;
					}
				}
			}
		}
		vector<aa>que;
		que.push_back(aa{ sy, sx, true });
		int ans = 1;
		vector<vector<bool>>used(h + 2, vector<bool>(w + 2, false));
		used[sy][sx] = true;

		while (!que.empty()) {
			aa atop(que.back());
			que.pop_back();
			for (int i = 0; i < 4; ++i) {
				const int ny = atop.y + dy[i];
				const int nx = atop.x + dx[i];
				if (atop.black) {
					if (field[ny][nx] == 1) {
						if (!used[ny][nx]) {
							used[ny][nx] = true;
							ans++;
							que.push_back(aa{ ny,nx,!atop.black });
						}
					}
				}
				else {
					if (field[ny][nx] == 1) {
						if (!used[ny][nx]) {
							used[ny][nx] = true;
							ans++;
							que.push_back(aa{ ny,nx,!atop.black });
						}
					}
				}

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

Measured memory_bytes: 3160
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int R = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();
        long[][] g = new long[R][C];
        for (int i = 0; i < K; i++) {
            int r = sc.nextInt()-1;
            int c = sc.nextInt()-1;
            long v = sc.nextLong();
            g[r][c] = v;
        }
        long[][][] dp = new long[R][C][4];
        for (int i = 0; i < R; i++) {
            for (int j = 0; j < C; j++) {
                if(0 < i){
                    long max = Math.max(dp[i-1][j][0], Math.max(dp[i-1][j][1], Math.max(dp[i-1][j][2], dp[i-1][j][3])));
                    dp[i][j][0] = max;
                }
                dp[i][j][1] = dp[i][j][0] + g[i][j];
                if(0 < j){
                    dp[i][j][0] = Math.max(dp[i][j-1][0], dp[i][j][0]);
                    dp[i][j][1] = Math.max(dp[i][j][1], Math.max(dp[i][j-1][1], dp[i][j-1][0] + g[i][j]));
                    dp[i][j][2] = Math.max(dp[i][j-1][2], dp[i][j-1][1] + g[i][j]);
                    dp[i][j][3] = Math.max(dp[i][j-1][3], dp[i][j-1][2] + g[i][j]);
                }
            }
        }
        System.out.println(Math.max(dp[R-1][C-1][0], Math.max(dp[R-1][C-1][1], Math.max(dp[R-1][C-1][2], dp[R-1][C-1][3]))));
        sc.close();

    }

}


Measured memory_bytes: 730164
#1本の路
#同じ高さはどうなんだこれ
n,m=map(int, input().split( ))

*h,=map(int, input().split( ))
flag = [1]*n
for _ in range(m):
    ai,bi=map(int, input().split( ))
    ai-=1;bi-=1
    if h[ai]<=h[bi]:
        flag[ai]=0
    if h[bi]<=h[ai]:
        flag[bi]=0
print(sum(flag))


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

int main()
{
    int N;
    cin >> N;
    if (N % 1000 == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << ((N / 1000 + 1) * 1000) - N << endl;
    }
}


Measured memory_bytes: 3632
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;

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

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1e9 + 7;

int main(void)
{
    string s;

    cin >> s;

    while (s.size())
    {
        cout << "x";
        s.pop_back();
    }

    cout << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	zeros, ones := 0, 0

	for _, r := range s {
		switch r {
		case '0':
			zeros++
		case '1':
			ones++
		}
	}

	min := zeros
	if min > ones {
		min = ones
	}
	fmt.Println(min*2)
}


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

using namespace std;

const int N = 100005;

int n;
int niz[N];
int cost[N];
vector <int> v;

void ispis () {
	for (int i = 0;i < n;i++) {
		cout << cost[i] << " ";
	}cout << endl;
}

int main () {
	
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> niz[i];
	}
	cost[0] = 0;
	cost[1] = abs(niz[1] - niz[0]);
	for (int i = 2;i < n;i++) {
		
			int v1 = cost[i - 1] + abs(niz[i] - niz[i - 1]);
		
		
			int v2 = cost[i - 2] + abs(niz[i] - niz[i - 2]);
		cost[i] = min(v1,v2);
	}


	cout << cost[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>

using namespace std;

int main()
{
  int N;
  cin >> N;
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    mp[a]++;
  }
  
  int ans = 0;
  for (const auto& e : mp) {
  	if (e.second > e.first) ans += e.second - e.first;
    else if (e.second < e.first) ans += e.second;
  }
  cout << ans << endl;
  
  return 0;
}
    

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int n, k;
    bool app = false;
    int count = 1;
    cin >> n >> k;
    int mink = 1;
    int maxk = k;
    while(!app) {
        if (n >= mink && maxk > n) {
            app = true;
        }
        else {
            count++;
            mink *= k;
            maxk *= k;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int par[100000];
int rank1[100000];
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rank1[i] = 0;
	}
}
int find1(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find1(par[x]);
	}
}
void unite1(int x, int y) {
	x = find1(x);
	y = find1(y);
	if (x == y)return;
	if (rank1[x] < rank1[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank1[x] == rank1[y])rank1[x]++;
	}
}
bool same(int x, int y) {
	return find1(x) == find1(y);
}
struct edge { int u, v;ll cost; };
//最大全域木にしたい場合は<を>にする
bool comp(const edge&e1, const edge&e2) {
	return e1.cost < e2.cost;
}
edge es[400000];
int V, E;
struct edge2 { int to; ll cost; };
vector<edge2> G[4000];
ll kruskal() {
	sort(es, es + E, comp);
	init(V);
	ll res = 0;
	for (int i = 0; i < E; i++) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite1(e.u, e.v);
			res += e.cost;
			G[e.u].push_back({ e.v,e.cost });
			G[e.v].push_back({ e.u,e.cost });
		}
	}
	return res;
}
ll d[4000][4000];
int main() {
	cin >> V >> E;
	rep(i, E) {
		int a, b; ll c; cin >> a >> b >> c; a--; b--;
		es[i] = { a,b,c };
	}
	ll sum = kruskal();
	rep(i, V) {
		int used[4000] = {}; used[i] = 1;
		d[i][i] = 0;
		queue<int> q; q.push(i);
		while (!q.empty()) {
			int x = q.front(); q.pop();
			int len = G[x].size();
			rep(j, len) {
				int v = G[x][j].to;
				if (used[v])continue;
				used[v] = true; q.push(v);
				d[i][v] = max(d[i][x], G[x][j].cost);
			}
		}
	}
	int q; cin >> q;
	rep(i, q) {
		int s, t; cin >> s >> t; s--; t--;
		cout << sum - d[s][t] << endl;
	}
	return 0;
}

Measured memory_bytes: 132992
import sys
from math import sqrt
from itertools import permutations as permi
input = sys.stdin.readline
N = int(input())
ps = []
for _ in range(N): 
  u, v = map(int, input().split())
  ps.append((u, v))
res = 0
c = 0
for p in permi([x for x in range(N)], N):
  t = 0
  c += 1
  for i in range(N - 1):
    x = p[i]
    y = p[i + 1]
    t += sqrt((ps[x][0] - ps[y][0]) ** 2 + (ps[y][1] - ps[x][1]) ** 2)
  #print(t, p)
  res += t
print(res / c)

Measured memory_bytes: 42476
lx = list(map(int,input().split(" ")))
la = []
cnt = 0

for i in range(0, lx[0]):
    la.append(list(map(int,input().split(" "))))

la = sorted(la)

coin = 0
bottle = lx[1]
i = -1
while (bottle > 0 and i < lx[0]-1):
    i += 1
    while (bottle > 0 and la[i][1] > 0):
        coin += la[i][0]
        bottle -= 1
        la[i][1] -= 1

print(coin)

Measured memory_bytes: 28656
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define MAX 510000
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    string s; cin >> s;
    ll n = s.size();
    vl alpha(26,0);
    vl shojun;
    rep(i,n){
        alpha[s[i]-'a']++;
        if(i<n-1){
            if(s[i] < s[i+1]) shojun.push_back(i);
        }
    }
    rep(i,26){
        if(alpha[i]==0){
            s.push_back((char)(i+'a'));
            cout << s << endl;
            return 0;
        }
    }
    if(shojun.size()==0){
        puts("-1");
        return 0;
    }else{
        ll index = shojun.back();
        char st = s[index];
        string ans = s.substr(0,index);
        vl alpha2(26,0);
        rep(i,ans.size()){
            alpha2[ans[i]-'a']++;
        }
        rep(i,26){
            if(alpha2[i] == 0 && char(i+'a') > st){
                ans.push_back((char)(i+'a'));
                cout << ans << endl;
                return 0;
            }
        }
        puts("-1");
    }
}

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

int main() {
    int N, K; cin >> N >> K;
    vector<int> A(N);
    for(auto &e : A) cin >> e;
    for(int i = 0;; ++i) {
        if(i * (K - 1) + 1 >= N) {
            cout << i << '\n';
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
o = list(input())
e = list(input())

len_o = len(o)
len_e = len(e)

if len_o == len_e:
    for i in range(len_o - 1):
        print(o[i], end = '')
        print(e[i], end = '')
    print(o[len_o - 1], end = '')
    print(e[len_e - 1])

else:
    for i in range(min(len_o, len_e)):
        print(o[i], end = '')
        print(e[i], end = '')
    if len_e > len_o:
        print(e[len(e) - 1])
    if len_o > len_e:
        print(o[len(o) - 1])


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<array>
#include<string>
#include<numeric>
#include<set>
#include<unordered_map>
typedef long long ll;
using namespace std;
int main()
{
    int x, n;
    cin>>x>>n;
    int a[102]={0};
    if(n==0){
        cout<<x<<"\n";
        return 0;
    }
    for(int i=0; i<n; i++){
        int m;
        cin>>m;
        a[m]=1;
    }
    if(a[x]==0){
        cout<<x<<"\n";
        return 0;
    }
    for(int i=1; i<=n; i++){
        if(x-i>=0){
            if(a[x-i]==0){
            cout<<x-i<<"\n";
            return 0;
        }
        }
        if(x+i<=101){
            if(a[x+i]==0){
            cout<<x+i<<"\n";
            return 0;
        }
        }
    }

    return 0;
}


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

using ll = long long;
using namespace std;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define YES(f) if((f)){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(f) if((f)){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(12)
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
#define MOD 1000000007
template<class T>
inline T GET() {
	T x;
	cin >> x;
	return x;
}
template<class T>
T GCD(T a, T b) {
	if (b == 0) return a;
	return GCD(b, a % b);
}
template<class T>
T LCM(T a, T b) {
	T t = a / GCD(a, b);
	return t * b;
}


void init();
void solve();

signed main()
{
	init();
	solve();
}

void init()
{
}

void solve()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (a - c) * (b - d) << endl;
}




Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INF 1000000000000 //10^12

int main(){
    ll n;
    vector<string> S;
    cin >>n;
    REP(i,n){
        string temp;
        cin >>temp;
        S.push_back(temp);
    }
    sort(S.begin(),S.end());
    string temp =*S.begin();
    
    ll count =1;
    REP(i,n){
        if(S[i] != temp){
            temp =S[i];
            count++;
        }
    }
    cout << count <<endl;
   }

Measured memory_bytes: 11660
#include <bits/stdc++.h> 
#define forn(i,a,b) for(int i=a; i<=b; i++)
#define ford(i,a,b) for(int i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
using namespace std;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	long long n,a,b,t,ans=0;
	cin>>n>>a>>b;
	forn(i,1,n){
		cin>>t;
		if(t<a || t>=b) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
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;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K; cin >> N >> K;
  int ans = 1;
  rep(i, N) {
    ans = min(ans*2, ans+K);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main() {
	int n, k, c = 0;
	cin >> n >> k;

	for (int i = 1; i <= n; i += 2) {
		c++;
	}
	if (c >= k) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def main():
    n, m = [int(i) for i in input().split()]
    x = [int(i) for i in input().split()]
    y = [int(i) for i in input().split()]
    dx = []
    dy = []
    for i in range(n-1):
        dx.append(x[i+1]-x[i])
    for i in range(m-1):
        dy.append(y[i+1]-y[i])

    alpha = [(i+1)*(n-i-1) for i in range((n+1)//2)]
    beta = [(i+1)*(m-i-1) for i in range((m+1)//2)]

    sum_dx = sum([dx[i] * alpha[min(i, n-i-2)] for i in range(n-1)])
    sum_dy = sum([dy[i] * beta[min(i, m-i-2)] for i in range(m-1)])

    print((sum_dx * sum_dy)%(10**9+7))

main()

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define erep(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef long long i64;

int n;
vi d;

bool func() {
  int MAX = 0;
  rep(i, 0, n) {
    if(MAX < i * 10) return false;
    MAX = max(MAX, i * 10 + d[i]);
  }
  return MAX >= (n - 1) * 10;
}

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

  cin >> n;
  d.resize(n);
  rep(i, 0, n) cin >> d[i];
  
  if(!func()) {
    cout << "no\n";
    return 0;
  }
  reverse(all(d));
  if(func()) cout << "yes\n";
  else cout << "no\n";
}



Measured memory_bytes: 4164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define int long long
#define uint unsigned
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
int a,b,c,A,B;
signed main(){
	a=read(); b=read(); c=read(); A=read(); B=read();
	a=min(a,2*c); b=min(b,2*c);
	if(2*c<a+b){
		int t=min(A,B);
		cout<<t*c*2+(A-t)*a+(B-t)*b<<endl;
	}else cout<<A*a+B*b<<endl;
}


Measured memory_bytes: 256