akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  string w;
  cin>>w;
  int n[26]={};
  for(int i=0;i<w.size();i++){
    n[w[i]-97]++;
  }
  for(int i=0;i<26;i++){
    if(n[i]%2==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#include<bitset>
#define mod 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
void solve()
{
    int n,cap;
    cin>>n>>cap;
    int w[n],val[n];
    for(int i=0;i<n;++i)
    {
        cin>>w[i]>>val[i];
    }
    int dp[n+1][cap+1];
    for(int i=0;i<n+1;++i)
    {
        for(int j=0;j<cap+1;++j)
        {
            if(i==0 or j==0)
            {
                dp[i][j]=0;
            }
            else if(w[i-1]<=j)
                {
                    dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-w[i-1]]);
                }
            else dp[i][j]=dp[i-1][j];

        }
    }
    cout<<dp[n][cap];
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
//    #ifndef ONLINE_JUDGE
//    freopen("C:\\Users\\himan\\Desktop\\Hackercup\\input.txt", "r", stdin);
//    freopen("C:\\Users\\himan\\Desktop\\Hackercup\\output.txt", "w", stdout);
//    #endif
    int tc = 1;
    //cin >> tc;
    for(int i=1;i<=tc;++i) {
        //cout<<"Case #"<<i<<": ";
        solve();
        //cout<<"\n";
    }
}


Measured memory_bytes: 82556
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){ // 1つ値を取り出す
  top++;
  S[top] = x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int a, b;
  top = 0;
  char s[100];
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a+b);
    }
    else if(s[0] == '-'){
      a = pop();
      b = pop();
      push(b-a);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a*b);
    }
    else{
      push(atoi(s));
    }
  }
   printf("%d\n",pop());
  return 0;
}



Measured memory_bytes: 2128
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
    string u;
    double x,sum=0;
    int n;
    cin >> n;
    while(n--){
        cin >> x >> u;
        if(u=="JPY"){
            sum+=1.0*x;
        }
        else{
            sum+=x*380000;
        }
    }
    printf("%.9f" ,sum);
    return 0;
}


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

zoro = 0
ans = False

for i in range(n):
	d1, d2 = map(int, input().split())
	if d1 == d2:
		zoro += 1
	else:
		zoro = 0
	if zoro == 3:
		ans = True

if ans == True:
	print('Yes')
	
else:
	print('No')

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
//cout << fixed << setprecision(10);
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

int main () {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  int ans = 0;
  rep(si,h)rep(sj,w) {
    if (s[si][sj] == '#') continue;
    vvi dist(h,vi(w,INF));
    queue<pii> q;
    auto update = [&](int i, int j, int x) {
      // dist[i][j]をxで更新し、qにpii(i,j)を追加
      if (dist[i][j] != INF) return;
      dist[i][j] = x;
      q.push(pii(i,j));
    };
    update(si,sj,0);
    while (!q.empty()) {
      int i = q.front().fi;
      int j = q.front().se; q.pop();
      rep(dir,4) {
        int ni = i+dy[dir], nj = j+dx[dir];
        if (ni<0||ni>=h||nj<0||nj>=w) continue;
        if (s[ni][nj] == '#') continue;
        update(ni,nj,dist[i][j]+1);
      }
    }
    rep(i,h)rep(j,w) {
      if (dist[i][j] == INF) continue;
      ans = max(ans, dist[i][j]);
    }
  }
  cout << ans << endl;
  return 0;
}

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long

const int MX = 1e5 + 5;

int N, W;
int weight[MX];
LL value[MX];
LL dp[MX];

int main() {

	cin >> N >> W;
	for(int i=0;i<N;i++) 
		cin >> weight[i] >> value[i];

	for(int i=0;i<N;i++) {
		for(int j=W;j>=0;j--) {
			if(j + weight[i] <= W) {
				dp[j + weight[i]] = max(dp[j + weight[i]], dp[j] + value[i]);
			}
		}
	}

	LL ans = 0;
	for(int i=0;i<=W;i++)
		ans = max(ans, dp[W]);

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


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N;
	scanf("%d", &N);
	int odd=0, four=0;
	for (int i = 0; i < N; i++) {
		int a;
		scanf("%d", &a);
		if (a % 4 == 0) four++;
		else if(a%2!=0) odd++;
	}
	if (four >= odd||(N==four+odd&&four>=odd-1)) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mp  make_pair
#define ss  second
#define ff  first
#define all(x) x.begin(),x.end()
const lli mod = 1e9+7;

lli p2(lli n){lli ans=0;while(n>=1){n=n/2;ans++;}return ans;}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli add(lli a,lli b){return(a+b)%mod;}
lli mul(lli a,lli b){return (a*b)%mod;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
vll setprime(lli n)
{
    vll prime;
    if(n%2==0)
    {
        prime.pb(2);
        while(n%2==0){n/=2;}
    }
    for(lli i=3;i<=sqrt(n);i+=2)
    {
        if(n%i==0)
        {
            while(n%i==0){n=n/i;}
            prime.pb(i);
        }
    }
    if(n>1)prime.pb(n);
    return prime;
}
///-----------------------TEMP TSF99--------------------------------------------------------------------------------------///

void solve()
{
    lli l,r,n;cin>>l>>r>>n;
    lli sum=0;
    for(lli i=l;i<=r;i++)
    {
        if(i%n==0)sum++;
    }
    cout<<sum<<endl;
}
int main()
{
    int t=1;//cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
 
 
const ll N = 100005;
const ll mod = 1000000007;
const long long int inf = 2*(1e16);
#define pp pair<ll,ll>

typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
 
 
 
void fastIO(void);
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);



ll dist[N][2];
vector<ll> g[N];
void DFS(ll node)
{
    ll n = g[node].size();
    //cout<<"node = "<<node<<endl;
    if(n==0){
        dist[node][0] = 0;
        dist[node][1] = 0;
       // cout<<"node = "<<node<<" dist = "<<dist[node][0]<<" "<<dist[node][1]<<endl;
        return;
    }
    rep(i,n){if(dist[g[node][i]][0]==-1) DFS(g[node][i]);}
    if(n==1){
        dist[node][0] = dist[g[node][0]][1]+1;
        dist[node][1] = dist[g[node][0]][1]+1;
      //  cout<<"node = "<<node<<" dist = "<<dist[node][0]<<" "<<dist[node][1]<<endl;
        return;
    }
    ll m1 = dist[g[node][0]][1],m2 = dist[g[node][1]][1];
    if(m1<m2) swap(m1,m2);
    rep1(i,n){
        if(dist[g[node][i]][1]>m2){
            m2 = dist[g[node][i]][1];
            if(m1<m2) swap(m1,m2);
        }
    }
    dist[node][1] = 1+m1;
    dist[node][0] = 1+m1;
   // cout<<"node = "<<node<<" dist = "<<dist[node][0]<<" "<<dist[node][1]<<endl;
    return;
}
int main()
{
    
    ll n,m;
    cin>>n>>m;
    ll u,v;
    rep(i,m){
        cin>>u>>v;
        g[u].push_back(v);
    }
    rep(i,n+1) dist[i][0]=-1;
    rep1(i,n+1){
        if(dist[i][0]==-1) DFS(i);
    }
    ll ans = 0;
    rep1(i,n+1) ans = max(ans,dist[i][0]);
    cout<<ans<<endl;
   // rep(i,n+1) cout<<dist[i][0]<<" "<<dist[i][1]<<endl;
    
    



}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
const ll mod=1e9+7;
ll mpow(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0) return mpow(x*x%mod,n/2);
    else return x*mpow(x,n-1)%mod;
}
int main(void){
    ll n;
    cin>>n;
    vector<ll>a(n);
    ll tmp1=0,tmp2=0;
    rep(0,i,n){
        cin>>a[i];
        tmp1=(a[i]+tmp1)%mod;
        tmp2=(tmp2+a[i]*a[i]%mod)%mod;
    }
    cout<<(tmp1*tmp1%mod-tmp2+mod)%mod*mpow(2,mod-2)%mod;
}


Measured memory_bytes: 4772
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

int arr[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int x, y, z, t;
    cin >> x >> y >> z >> t;
    x--;
    z--;
    if (arr[x] == y) {
        cout << 1;
    } else {
        cout << 0;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String A = scan.next();
		String B = scan.next();
		String C = scan.next();
		char a = A.charAt(A.length()-1);
		char bf = B.charAt(0);
		char bl = B.charAt(B.length()-1);
		char c = C.charAt(0);
		if (a == bf && bl == c) {
			System.out.println("YES");			
		}else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

ll ngcd(vector<ll> a){
    ll res;
    res = a.at(0);
    for(ll i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a.at(i), res);
    }
    return res;
}

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A.at(i);
    sort(all(A));
    if(K <= A.at(N-1) && K % ngcd(A) == 0){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int[] ans = new int[90001];
	int L;
	int R;
	int d;
	int[] x = new int[900001];
	int[] y = new int[900001];
	void run() {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		d = sc.nextInt();

		for(int i = 0; i < h; i++) {
			for(int j = 0; j < w; j++) {
				int tmp = sc.nextInt();
				x[tmp] = i;
				y[tmp] = j;
			}
		}
		int q = sc.nextInt();
		
		for(int i = d+1; i <= h*w; i++) {
			ans[i] = ans[i-d] + Math.abs(x[i]-x[i-d])+Math.abs(y[i]-y[i-d]);
		}

		for(int i = 0; i < q; i++) {
			L = sc.nextInt();
			R = sc.nextInt();
			System.out.println(ans[R]-ans[L]);
		}
		sc.close();
	}
	
//	int dfs(int L) {
//		if(ans[L] != 0 || L == R) {
//			return ans[L];
//		}else {
//			return ans[L] += Math.abs(x[L]-x[L+d])+Math.abs(y[L]-y[L+d])+dfs(L+d);
//		}
//	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	long combination(int n, int r, int m) { //nCr mod m
		long[][] Combination = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			Combination[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				Combination[i][j] = (Combination[i - 1][j - 1] + Combination[i - 1][j]) % m;
			}
		}
		return Combination[n][r];
	}

	int gcd(int a, int b) {
		if (a < b) {
			int c = a;
			a = b;
			b = c;
		}
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n, m;
	cin >> n >> m;
	
	int max_l = 1, min_r = n;
	while(m--)
	{
		int l, r;
		cin >> l >> r;
		max_l = max(max_l, l);
		min_r = min(min_r, r);
	}
	
	cout << max(0, min_r - max_l + 1);
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;

class UnionFind
{
public:
    UnionFind(int N) : par(N)
    {
        for (ll i = 0; i < N; i++)
        {
            par[i] = i;
        }
    }

    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

private:
    vector<int> par;
};

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return b;
    }
    return gcd(b, a % b);
}

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

map<ll, ll> sosuu(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i] += 1;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n] += 1;
    }
    return res;
}

struct Dish
{
    ll time;
    ll taste;
};

int main()
{
    ll H, W;
    cin >> H >> W;
    vector<vector<char>> mp(H, vector<char>(W));
    for (ll i = 0; i < H; i++)
    {
        string s;
        cin >> s;
        for (ll j = 0; j < s.size(); j++)
        {
            mp[i][j] = s[j];
        }
    }
    for (ll i = 0; i < H; i++)
    {
        for (ll j = 0; j < W; j++)
        {
            if (mp[i][j] == '#')
                continue;

            vector<pair<ll, ll>> dir = {
                {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};

            ll cnt = 0;
            for (auto &&e : dir)
            {
                if (e.first + i < 0 || e.first + i >= H) {
                    continue;
                }
                if (e.second + j < 0 || e.second + j >= W){
                    continue;
                }
                if (mp[i + e.first][j + e.second] == '#') {
                    cnt += 1;
                }
            }
            mp[i][j] = '0' + cnt;
        }
    }

    for (ll i = 0; i < H; i++)
    {
        for (ll j = 0; j < W; j++)
        {
            cout << mp[i][j];
        }
        cout << endl;
    }
    
}

Measured memory_bytes: 3616
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int [] a=new int [n];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		for(int j=0;j<n;j++) {
				if(j==0) {
				System.out.print(a[j]);
				}
				else {
					System.out.print(" "+a[j]);
				}
			}
		System.out.println();
		for(int i=1;i<n;i++) {
			int q=a[i];
			for(int j=i-1;j>=0;j--) {
				if(q<a[j]) {
					a[j+1]=a[j];
				}
				else {
					a[j+1]=q;
					break;
				}
				if(j==0) {
					a[0]=q;
				}
			}
			for(int j=0;j<n;j++) {
				if(j==0) {
				System.out.print(a[j]);
				}
				else {
					System.out.print(" "+a[j]);
				}
			}
			System.out.println();
		}
		sc.close();
	}
}



Measured memory_bytes: 31200
primes = [2]
for c in range(3,10**5+1,2):
    isPrime = True
    for p in primes:
        if p*p>c: break
        if c%p==0:
            isPrime=False
            break
    if isPrime: primes.append(c)

primeset = set(primes)

like2017s = set([p for p in primes if (p+1)//2 in primeset])

k = [0]*(10**5+10)
for x in range(1, 10**5+10):
    if x in like2017s:
        k[x]=k[x-1]+1
    else:
        k[x]=k[x-1]
	
Q = int(input())
for _ in range(Q):
    l, r = list(map(int, input().split()))
    print(k[r]-k[l-1])

Measured memory_bytes: 5188
using System;
class Program
{
	static void Main(string[] args)
	{
           string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
 			int num = 0;
      		int ans = 0;	//0 NO, 1 YES
		    
      		for(int c = 1; c <= 3 ; c++)
            {
              	num = a * b * c;
            	if((num % 2) == 1)
                {
                  ans = 1;
                }
            }
      		if(ans == 1)
            {                  
              Console.WriteLine("Yes");  //き数
            }
      		else
            {
              Console.WriteLine("No");  //き数
            }
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	vector<double>v;//入力
	double x;
	int n;
	int i = 0, j = 0; //内部で使用;
	double ans = 0,d; //出力

	cin >> n;
	while (cin >> x) {
		v.push_back(x);
	}
	sort(v.begin(),v.end());
	d = (v[0] + v[1]) / 2; //first renkin

	rep(i,v.size()-2){
		d =( d +v[i+2])/ 2;
	}
	
	cout << d << "\n";
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;

//static const ll MOD = 1000000007;

int main() {
    ll N, answer = 0;
    string S;

    // input
    cin >> S;

    // process
    if (S == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (S == "Cloudy") {
        cout << "Rainy" << endl;
    } else if (S == "Rainy") {
        cout << "Sunny" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import combinations, permutations

import sys
def input():
	return sys.stdin.readline().strip()


N, M = list(map(int, input().split()))
default = 100000000000000000000000

graph = [[] for _ in range(N)]
dist = [default for _ in range(N)]

for i in range(M):
	L, R, D = list(map(int, input().split()))
	L -= 1
	R -= 1
	graph[L].append([R, D])
	graph[R].append([L, -D])

loc = 0
while loc < N:
	if dist[loc] == default:
		dist[loc] = 0
		que = deque([])
		que.append(loc)
		while len(que) > 0:
			node = que.popleft()
			if len(graph[node]) > 0:
				for edge in graph[node]:
					if dist[edge[0]] == default:
						dist[edge[0]] = dist[node] + edge[1]
						que.append(edge[0])
					elif dist[edge[0]] != dist[node] + edge[1]:
						print("No")
						exit()
	loc += 1
print("Yes")

Measured memory_bytes: 99248
from collections import *
N,W = map(int,input().split())
dp = defaultdict(int)
dp[0] = 0

for n in range(N):
  w1,v1 = map(int,input().split())
  for w2,v2 in dp.copy().items():
    if w1+w2<=W:
      dp[w1+w2] = max(dp[w1+w2],v1+v2)

print(max(dp.values()))

Measured memory_bytes: 9704
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int n=s.size();
  if(s.at(n-1)=='s'){
  cout << s << "es" << endl;;
  }
  else{
  cout << s << 's' << endl;
  }  
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;
#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif


namespace Solver{
using namespace std;
struct UnionFind{
    vector<int> par; //par: -1*elements(root) number of par(not root)
    UnionFind(int n){par = vector<int>(n,-1);}
    int root(int x){return par[x]<0?x:(par[x]=root(par[x]));}
    void unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x!=y){
            if(par[x]<par[y]) swap(x,y);
            par[y] += par[x];
            par[x] = y;
        }
    }
    bool is_root(int x){return root(x)==x;}
    bool same(int x,int y){return root(x) == root(y);}
    int size(int x){return -par[root(x)];}
};
struct Problem{
    int n,m;
    vector<LL> a;
    LL ans;
    vector<vector<LL>> st,st2;
    UnionFind uf;
    Problem(LL n, LL m):n(n),m(m),a(n),ans(0),st(n),uf(n){};

    void solve(){
        for(int i=0; i<n; ++i){
            cin >> a[i];
            st[i].push_back(a[i]);
        }
        for(int i=0; i<m; ++i){
            int x,y;
            cin >> x >> y;
            uf.unite(x,y);
        }
        for(int i=0; i<n; ++i){
            int r = uf.root(i);
            if(r!=i){
                st[r].push_back(st[i][0]);
                st[i].pop_back();
            }
        }
        for(auto&&v: st){
            if(!v.empty())st2.push_back(v);
        }
        swap(st,st2);
        vector<priority_queue<LL,vector<LL>,greater<LL>>> Q((int)st.size());
        for(int i=0; i<(int)st.size(); ++i){
            for(int j=0; j<(int)st[i].size(); ++j){
                Q[i].push(st[i][j]);
            }
        }
        int cnt = 0;
        for(auto &&v: st){
            cnt+=((int)v.size()-2);
        }
        DBG(st)

        if((int)st.size()==1){
            cout << 0 <<"\n";
            return;
        }
        if(cnt<-2){
            cout << "Impossible"<<"\n";
            return;
        }
        int edge =0;
        for(auto &&s : Q){
            ans+=s.top();
            s.pop();
            edge++;
        }
        priority_queue<LL,vector<LL>,greater<LL>> pq;
        for(auto &&s :Q){
            while(!s.empty()){
                pq.push(s.top());
                s.pop();
            }
        }
        while(edge<(n-1-m)*2){
            ans+=pq.top();
            pq.pop();
            edge++;
        }
        cout << ans <<"\n";
    }
};
}

int main(){
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    long long n=0,m;
    std::cin >> n >> m;
    Solver::Problem p(n,m);
    p.solve();
    return 0;
}



Measured memory_bytes: 19376
import java.util.Scanner;

public class Main {

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

    private static void solve(Scanner in) {
        while (in.hasNext()) {
            int a = in.nextInt(), b = in.nextInt();
            String s = (a + b) + "";
            System.out.println(s.length());
        }
    }
}

Measured memory_bytes: 26408
#include<stdio.h>
int main()
{
    int sum,sum1,sum2,sum3;
    char ara[5];
    while(scanf("%s",ara)==1)
    {
        sum=ara[0]-'0';
        sum1=ara[1]-'0';
        sum2=ara[2]-'0';
        sum3=ara[3]-'0';
        if(sum+sum1+sum2+sum3==7)printf("%d+%d+%d+%d=7\n",sum,sum1,sum2,sum3);
        else if(sum+sum1+sum2-sum3==7)printf("%d+%d+%d-%d=7\n",sum,sum1,sum2,sum3);
        else if(sum+sum1-sum2+sum3==7)printf("%d+%d-%d+%d=7\n",sum,sum1,sum2,sum3);
        else if(sum+sum1-sum2-sum3==7)printf("%d+%d-%d-%d=7\n",sum,sum1,sum2,sum3);
        else if(sum-sum1+sum2+sum3==7)printf("%d-%d+%d+%d=7\n",sum,sum1,sum2,sum3);
        else if(sum-sum1+sum2-sum3==7)printf("%d-%d+%d-%d=7\n",sum,sum1,sum2,sum3);
        else if(sum-sum1-sum2+sum3==7)printf("%d-%d-%d+%d=7\n",sum,sum1,sum2,sum3);
        else if(sum-sum1-sum2-sum3==7)printf("%d-%d-%d-%d=7\n",sum,sum1,sum2,sum3);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

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

int main() {
  std::string s;
  std::cin >> s;
  if (s[2] == s[3] && s[4] == s[5])
    std::cout << "Yes" << '\n';
  else
    std::cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main() {
	int n, ans = 0, tmp;
	cin >> n;
	tmp = n;
	while (n) {
		ans += n % 10;
		n /= 10;
	}
	if (tmp % ans) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))
C = [0] + list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
    ans += B[A[i]]
    if i >= 2 and A[i - 1] + 1 == A[i]:
        ans += C[A[i - 1]]
print(ans)


Measured memory_bytes: 61892
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);    
    
    int K, X; cin >> K >> X;
    X -= (K-1);
    FOR(i, X, X+2*K-1) {
		cout << i << " ";
	} cout << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <list>
#include <stack>
#include <set>
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <cstdlib>
#include <typeinfo>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll n, a, b, c = 0, ans = 0;
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) {
		string s = to_string(i);
		for (int i = 0; i < s.size(); i++) {
			c += s[i] - '0';
		}
		if (a <= c && c <= b)ans += i;
		c = 0;
	}
	cout <<ans << endl;
	return 0;
}

Measured memory_bytes: 256
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)

N, M = map(int, input().split())
xys = [list(map(int, input().split())) for _  in range(M)]

children = [[] for _ in range(N)]
for x, y in xys:
    children[x-1].append(y-1)

has_no_parent = [True] * N
has_no_child = [True] * N
for x, y in xys:
    has_no_child[x-1] = False
    has_no_parent[y-1] = False

lp = [None] * N
for node in range(N):
    if has_no_child[node]:
        lp[node] = 0

def dp(node):
    if lp[node] is not None:
        return lp[node]
    result = max([dp(child) + 1 for child in children[node]])
    lp[node] = result
    return result

for node in range(N):
    if lp[node] is None:
        dp(node)

print(max(lp))


Measured memory_bytes: 194564
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#define R register
#define EN std::puts("")
#define LL long long
inline LL read(){
	LL x=0,y=1;
	char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=0;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return y?x:-x;
}
int n,fir;
LL k;
LL a[200006],b[200006];
inline int finda(int i,LL ans){
	R int l=1,r=n,mid,ret=0;
	while(l<=r){
		mid=(l+r)>>1;
		if(a[mid]*a[i]<ans) ret=mid,l=mid+1;
		else r=mid-1;
	}
	return ret>=i?(ret-1):ret;
}
inline int findb(int i,LL ans){
	R int l=1,r=n,mid,ret=0;
	while(l<=r){
		mid=(l+r)>>1;
		if(b[mid]*a[i]<ans) ret=mid,l=mid+1;
		else r=mid-1;
	}
	return (ret+i>n)?(ret-1):ret;
}
inline int check(LL ans){
	LL nowk=0;
	for(R int i=1;i<fir;i++) 
		nowk+=findb(i,ans);
	for(R int i=fir;i<=n;i++)
		nowk+=finda(i,ans);
	nowk/=2;
	return nowk>=k;
}
inline int cmp(int x,int y){
	return x<y;
}
int main(){
	n=read();k=read();
	for(R int i=1;i<=n;i++) a[i]=read(); 
	std::sort(a+1,a+1+n,cmp);
	fir=n+1;
	for(R int i=1;i<=n;i++)
		if(a[i]>=0){fir=i;break;}
	for(R int i=1;i<=n;i++) b[n-i+1]=a[i];
	R LL l=-1e18,r=1e18,mid,ans;
	while(l<=r){
		mid=(l+r)/2;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	std::printf("%lld",ans-1);
	return 0;
}

Measured memory_bytes: 3328
def main():
    n = int(input())
    a = list(map(int,input().split()))

    s = 0
    for i in range(n-1):
        s += (-1)**(i+1)*a[i]
    x = (a[n-1]-s)//2
    ans = [x]
    for i in range(n-1):
        ans.append(a[i]-ans[i])
    print(' '.join(list(map(str,list(map(lambda x:2*x,ans))))))

if __name__ == "__main__":
    main()

Measured memory_bytes: 22072
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;
const long long MINF = LLONG_MIN;

// -------------------------------------------------------

const int MAX_N = 1e7 + 1000;

int nth_prime[MAX_N];
int is_prime[MAX_N];
int min_factor[MAX_N];

void sieve() {
  int n = MAX_N;
  int p = 0;
  for (int i = 0; i <= n; ++i) {
    is_prime[i] = true;
  }

  is_prime[0] = is_prime[1] = false;

  for (int i = 2; i <= n; ++i) {
    if (is_prime[i]) {
      nth_prime[p] = i;
      ++p;
      min_factor[i] = i;

      for (int j = 2 * i; j <= n; j += i) {
        if (is_prime[j]) {
          is_prime[j] = false;
          min_factor[j] = i;
        }
      }
    }
  }

  // n以下の素数の個数が必要な場合はpをreturn
  // return p;
}

map<int, int> fast_prime_factorize(int n) {
  map<int, int> res;
  while (n > 1 && n % min_factor[n] == 0) {
    ++res[min_factor[n]];
    n /= min_factor[n];
  }
  return res;
}

int main() {
  ll N;
  cin >> N;
  sieve();
  ll ans = 0;
  repe(i, 1, N) {
    map<int, int> res = fast_prime_factorize(i);
    ll sum = 1;
    for (auto e : res) {
      sum *= (ll(e.second) + 1LL);
    }
    // cout << i << " " << sum << endl;
    ans += ll(i) * sum;
  }

  cout << ans;
}


Measured memory_bytes: 84372
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int m, k;
    cin >> m >> k;

    int n = 1 << m;

    if (m == 1) {
        if (k == 0) {
            cout << "0 0 1 1" << endl;
        } else {
            cout << -1 << endl;
        }
    } else {
        if (k < n) {
            for (int i = n - 2; i >= 0; i--) {
                cout << i + (i >= k) << ' ';
            }
            cout << k << ' ';
            for (int i = 0; i < n - 1; i++) {
                cout << i + (i >= k) << ' ';
            }
            cout << k << endl;

        } else {
            cout << -1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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

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

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	LL x;
	cin>>x;
	LL money=100;
	LL ans=0;
	while(true){
		money *= 1.01;
		ans++;
		if(money>=x)break;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string ans = "";
    rep(i, n) {
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

N, A, B, C = map(int, input().split())
target = [A, B, C]
ls = []
for i in range(N):
    ls.append(int(input()))

def mp(assigns):
    counts = [-1, -1, -1]
    totals = [0, 0, 0]
    for i in range(N):
        a = assigns[i]
        if a < 0:
            continue
        totals[a] += ls[i]
        counts[a] += 1
    if any([count < 0 for count in counts]):
        return A + B + C
    return sum([abs(totals[i] - target[i]) + 10 * counts[i] for i in range(3)])

min_mp = A + B + C
for p in itertools.product([-1, 0, 1, 2], repeat=N):
    min_mp = min(min_mp, mp(p))
print(min_mp)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(1e9+7)
#define pb push_back
#define mp make_pair
string s;
int alph[26],ch[26];
int main()
{
	cin>>s;
	//if(s=="zyxwvutsrqponmlkjihgfedcba")
	//{
	//	puts("-1");
	//	return 0;
	//}
	for(int i=0;i<s.size();i++)
		alph[s[i]-'a']++;
	for(int i=0;i<26;i++)
		if(alph[i]==0)
		{
			cout<<s<<char(i+'a');
			return 0;
		}
	int j=0;
	for(int i=s.size()-1;i>=0;i--)
	{
		j++;
		string t=s;
		t.erase(i,j);
		memset(ch,0,sizeof(ch));
		for(int k=0;k<t.size();k++)
			ch[t[k]-'a']++;
		for(int k=0;k<26;k++)
			if(ch[k]==0)
			{
				string u=t;
				u+=(char)k+'a';
				//cout<<u<<endl;
				if(u>s)
				{
					cout<<u;
					return 0;
				}
			}
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 256
N=input()
N=N.split()
N=int(N[0])

if 1<=N and N<=9:
    output=N
elif 10<=N and N<=99:
    output=9
elif 100<=N and N<=999:
    output=N-99+9
elif 1000<=N and N<=9999:
    output=900+9
elif 10000<=N and N<=99999:
    output=N-9999+900+9
else:
    output=90000+900+9
print(output)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2") 
#pragma GCC optimization ("unroll-loops")

using namespace std;
using ll = long long;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ff first
#define ss second
#define Ceil(x, y) ((x+y-1)/y)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x);
const int mod = (int) 1000000007;


void solve()
{
	ll a, b, c, d;
	cin>>a>>b>>c>>d;
	ll res = a * c;
	res = max(res, a*d);
	res = max(res, b*c);
	res = max(res, b*d);
	cout<<res;
}

int main(int argc, char *argv[])
{
	clock_t clk_start = clock();
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
 
	int cases = 1;
	// cin>>cases;
	for(int i=1; i<=cases; i++)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	cerr<<"Execution Time: "<<fixed<<double(clock() - clk_start)/double(CLOCKS_PER_SEC)<<setprecision(6)<<" sec\n"; 
}

Measured memory_bytes: 3800
using System;

namespace _20190629_ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC.Fifty_Fifty();
        }
    }
    class ABC
    {
        public static void Fifty_Fifty()
        {
            var S = Console.ReadLine();
            if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3]) Console.WriteLine("No");
            else if (S[0] == S[1] && S[2] == S[3] || S[0] == S[2] && S[1] == S[3] || S[0] == S[3] && S[1] == S[2]) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
a,b,c,x,y = map(int, input().split())

ans = 0
if a+b < 2*c:
    if x <= y:
        ans += x*(a+b)
        if b < 2*c:
            ans += b*(y-x)
        else:
            ans += 2*c*(y-x)
    else:
        ans += y*(a+b)
        if a < 2*c:
            ans += a*(x-y)
        else:
            ans += 2*c*(x-y)
else:
    if x <= y:
        ans += 2*c*x
        if b < 2*c:
            ans += b*(y-x)
        else:
            ans += 2*c*(y-x)
    else:
        ans += 2*c*y
        if a < 2*c:
            ans += a*(x-y)
        else:
            ans += 2*c*(x-y)

print(ans)

Measured memory_bytes: 9064
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s, t;
    cin >> n >> s >> t;
    string ans = "";
    for(int i = 0; i < n; i++) {
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
ans = min(a) + min(b)
for i in range(M):
    x,y,c = map(int,input().split(" "))
    tmp = a[x-1]+b[y-1]-c
    ans = min(tmp,ans)
print(ans)

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

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

  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }

  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());

  int count = 0;
  int max = 101;
  for (int i = 0; i < N; i++) {
    if (d.at(i) < max) count++;
    max = d.at(i);
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define all(x) x.begin(),x.end()
#define rep(i,N) for(int i=0;i<(int)N;++i)
using namespace std;
using ll = long long;
using vint = vector<int>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
const ll INF = (1LL << 30);
const ll LINF = (1LL << 60);
const ll MOD = 1e9 + 7;

struct Line {
   int from, to;
   int h;
   int id;

   bool operator<(const Line& r) const {
      return h < r.h;
   }
};

int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   using P = pair<ll, ll>;

   while (true) {
      int n, m, h, k; cin >> n >> m >> h >> k;
      if (n == 0 && m == 0 && h == 0 && k == 0) break;
      vll s(n); rep(i, n) cin >> s[i];
      vector<vector<Line>> g(n);
      rep(i, m) {
         int a, b; cin >> a >> b, a--;
         g[a].emplace_back(Line{ a, a + 1, b, i });
         if (a + 1 < n) g[a + 1].emplace_back(Line{ a + 1, a, b, i });
      }

      rep(i, n) sort(all(g[i]));
      vll score(n);
      vll2 user(m);

      rep(i, n) {
         int idx = i;
         int h = 0;
         while (true) {
            auto itr = upper_bound(all(g[idx]), Line{ -1, -1, h, -1 });
            if (itr == g[idx].end()) {
               score[i] = s[idx];
               break;
            }

            user[itr->id].emplace_back(i);
            idx = itr->to;
            h = itr->h;
         }
      }

      auto sum = score;
      for (int i = 1; i < n; ++i) sum[i] += sum[i - 1];

      ll ans = sum[k - 1];
      rep(i, m) {
         int v1 = user[i][0], v2 = user[i][1];
         if (v1 > v2) swap(v1, v2);
         if (v1 >= k || v2 < k) continue;
         ans = min(ans, sum[k - 1] - score[v1] + score[v2]);
      }
      cout << ans << endl;
   }
}



Measured memory_bytes: 12444
N = int(input())
tasklist = []
for _ in range(N):
    task = list(map(int,input().split()))
    tasklist.append(task)

tasklist.sort(key=lambda x:x[1])

now = 0
msg = 'Yes'
for task in tasklist:
    if now + task[0] > task[1]:
        msg = 'No'
        break
    else:
        now += task[0]

print( msg )

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 9; i++)
            {
                for (int k = 1; k <= 9; k++)
                {
                    Console.WriteLine(i + "x" + k + "=" + i * k);
                }
            }
        }
    }
}

Measured memory_bytes: 5524
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    for(ll a = -300; a <= 300; a++) {
        ll A = a * a * a * a * a;
        ll B = A - x;
        if(B < 0) {
            ll now = -1;
            while(now * now * now * now * now > B) {
                now--;
            }
            if(now * now * now * now * now == B) {
                print(a, now);
                return 0;
            }
        } else {
            ll now = 0;
            while(now * now * now * now * now < B) {
                now++;
            }
            if(now * now * now * now * now == B) {
                print(a, now);
                return 0;
            }
        }
    }
}

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

int main() {
  string S;
  int count = 0;
  cin >> S;
  for (int i=0; i<S.length(); i++){
    if(S.at(i) != S.at(S.length()-i-1))
      count++; 
  }
  cout << count/2 << endl;
}

Measured memory_bytes: 256