akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int n;
int cnt[2][26];
bool g[26][26];
bool done[26];

int main() {
	while (cin >> n, n) {
		
		memset(cnt, 0, sizeof(cnt));
		memset(g, 0, sizeof(g));
		
		REP(i, n) {
			string str; cin >> str;
			int u = *(str.begin()) - 'a';
			int v = *--str.end() - 'a';
			
			cnt[0][u]++; cnt[1][v]++;
			g[u][v] = true;
		}
		
		bool ans = true;
		REP(i, 26) if (cnt[0][i] > 0) {
			memset(done, 0, sizeof(done));
			
			queue<int> que;
			que.push(i);
			done[i] = true;
			
			while (!que.empty()) {
				int now = que.front(); que.pop();
				REP(j, 26) if (g[now][j] && !done[j]) {
					done[j] = true;
					que.push(j);
				}
			}
			
			REP(j, 26) if (cnt[0][j] > 0 && !done[j]) ans = false;
			
		}
		
		REP(i, 26) if (cnt[0][i] != cnt[1][i]) ans = false;
		
		puts(ans ? "OK" : "NG");
		
	}
	return 0;
}

Measured memory_bytes: 3012
// atcoder/abc043/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    string t;
    each (c, s) {
      if (c != 'B') t += c;
      else if (t.size()) t.pop_back();
    }
    cout << t << endl;
  }

  return 0;
}


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

# from numba import njit

# input = stdin.readline

def countProcedure(string):
  res = 0
  strCount = 1
  prev = "" # 1つまえの文字
  for i in range(len(string)):
    if string[i] == prev:
      strCount += 1
    else:
      res += strCount // 2
      strCount = 1
    prev = string[i]

  if strCount != 1:
    res += strCount // 2
  return res

def solve(s,k):
  if s[0] != s[-1]:
    return countProcedure(s)*k
  if all(x == s[0] for x in s):
    return len(s)*k//2
  else:
    leftLength = max(i for i in range(1,len(s)) if s[:i]== s[0]*i)
    left = s[0]*leftLength
    right = s[leftLength:]
    ans = countProcedure(left) + countProcedure(right) + countProcedure("".join([right,left]))*(k-1)
    return ans


def main():
  S = input()
  K = int(input())
  # N,M = map(int,input().split())
  # a = list(map(int,input().split()))
  print(solve(S,K))
  
  
if __name__ == '__main__':
  main()


Measured memory_bytes: 9124
import java.util.*;

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();
		Arrays.sort(A);
		
		final int MAX = 1000000;
		boolean[] used = new boolean[MAX+1];

		int ans = 0;
		for(int i=0; i<N; i++) {
			if(!used[A[i]]) {
				if(i==N-1 || A[i]!=A[i+1]) {
					ans++;
				}
				for(int j=1; j*A[i]<=MAX; j++) {
					used[j*A[i]]=true;
				}
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}


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

int main() {
    string s, t;
    cin >> s >> t;

    int counter = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == t[i]) {
            counter++;
        }
    }

    cout << counter << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
using ll = long long;
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() {
    ll a, b, t;
    cin >> a >> b >> t;
    cout << (t / a) * b << endl;
}


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

int N, M;
vector<int> G[10100];
vector<int> rG[10100];
bool used[10100];
vector<int> vs;
int cmp[10100];

void dfs(int v) {
    used[v] = true;
    rep(i, G[v].size()) {
        if (!used[G[v][i]]) dfs(G[v][i]);
    }
    vs.pb(v);
}

void rdfs(int v, int k) {
    used[v] = true;
    cmp[v] = k;
    rep(i, rG[v].size()) {
        if (!used[rG[v][i]]) rdfs(rG[v][i], k);
    }
}

int scc() {
    memset(used, 0, sizeof(used));
    vs.clear();
    rep(v, N) if (!used[v]) dfs(v);
    memset(used, 0, sizeof(used));
    int k = 0;
    for (int i=vs.size()-1; i>=0; i--) {
        if (!used[vs[i]]) rdfs(vs[i], k++);
    }
    return k;
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> M;
    rep(i, M) {
        int s, t; cin >> s >> t;
        G[s].pb(t);
        rG[t].pb(s);
    }
    
    scc();
    int Q; cin >> Q;
    rep(i, Q) {
        int u, v; cin >> u >> v;
        if (cmp[u]==cmp[v]) cout << 1 << endl;
        else cout << 0 << endl;
    }
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int n;
int v[110000];
pint ap0[110000],ap1[110000];
signed main() {
    cin>>n;
    for(int i=0;i<110000;i++)ap0[i]=ap1[i]=pint(0,i);
    for(int i=0;i<n;i++){
        cin>>v[i];
        if(i%2==0)ap0[v[i]].first++;
        else ap1[v[i]].first++;
    }
    sort(ap0,ap0+110000);reverse(ap0,ap0+110000);
    sort(ap1,ap1+110000);reverse(ap1,ap1+110000);
    if(ap0[0].second==ap1[0].second){
        cout<<n-max(ap0[0].first+ap1[1].first,ap1[0].first+ap0[1].first)<<endl;
    }else{
        cout<<n-(ap0[0].first+ap1[0].first)<<endl;
    }
}


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

int main()
{
    int n, k;

    cin >> n >> k;
    vector<int> d(k);
    set<int> a;
    int tmp;

    for (int i = 0; i < k; i++)
    {
        cin >> d[i];
        for (int j = 0; j < d[i]; j++)
        {
            cin >> tmp;
            a.insert(tmp);
        }
    }
    int ans = 0;
    vector<int> count(n, 0);

    for (auto v : a)
    {
        count[v-1]++;
    }

    for (int i = 0; i < n; i++)
    {
        if (count[i] == 0)
            ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n==25) printf("Christmas\n");
    if(n==24) printf("Christmas Eve\n");
    if(n==23) printf("Christmas Eve Eve\n");
    if(n==22) printf("Christmas Eve Eve Eve\n");
    return 0;
}


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

int main(){
  long long a,b,c,d;
  cin>>a;
  cin>>b;
  cin>>c;
  cin>>d;
  
  long long max=a*c;
  if(max<a*d){
    max=a*d;
  }
  if(max<b*c){
    max=b*c;
  }
  if(max<b*d){
    max=b*d;
  }
  
  cout<<max<<endl;
}

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

vector<vector<int>> Graph;
vector<int> GCounter(200000, 0);

void count(int v, int parent, int increment){
    GCounter[v] += increment;
    for(auto p: Graph[v]){
        if(p == parent)continue;
        count(p, v, GCounter[v]);
    }
}

int main(void){

    int N, Q;
    int abuf, bbuf;
    int pbuf, xbuf;
    cin >> N >> Q;
    Graph.assign(N, vector<int>());
    for(int i=0; i<N-1; i++){
        cin >> abuf >> bbuf;
        abuf--;
        bbuf--;
        Graph[abuf].push_back(bbuf);
        Graph[bbuf].push_back(abuf);
    }
    for(int i=0; i<Q; i++){
        cin >> pbuf >> xbuf;
        GCounter[pbuf-1] += xbuf;
    }

    count(0, -1, 0);

    bool firstoutput = true;
    for(int i=0; i<N; i++){
        if(firstoutput){
            firstoutput = false;
        }else{
            cout << " ";
        }
        cout << GCounter[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 23424
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
#define int long long
using namespace std;
const int Maxn=100005,L=100005;
const double PI = acos(-1.0);
__int128 a,b,c,ans1,ans2;
/*
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
inline void write(int a)
{
	if(a<0)
	{
		putchar('-');
		write(-a);
	}
	else
	{
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
	}
}
*/
inline __int128 read()
{
	__int128 x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}

inline void write(__int128 x)
{
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	if(x>9)
		write(x/10);
	putchar(x%10+'0');
}
signed main()
{
	a=read(),b=read(),c=read();
	ans1=c-a-b;
	if(ans1>0)
	{
		ans1=ans1*ans1;
		ans2=4*a*b;
//	cout<<ans1<<' '<<ans2;
		if(ans2<ans1)
			puts("Yes");
		else
			puts("No");
	}
	else
	{
			puts("No");
	}
	return 0;
}



Measured memory_bytes: 256
import sys

for s in sys.stdin:
  i=s.find("+")
  j=s.find("=")
  A=[s[0:i],s[i+1:j],s[j+1:-1]]
  f=0
  for e in A:
    if e!=e[0]=="X": f=1; break
  s="NA"
  for c in "0123456789"[f:]:
    x,y,z=map(int,[e.replace("X",c) for e in A])
    if x+y==z: s=c; break
  print s

Measured memory_bytes: 4260
#include <stdio.h>
#include <stdlib.h>

struct pair {
        long a;
        int b;
};

int compare(const void *x, const void *y) {
        return ((struct pair *) x)->a - ((struct pair *) y)->a;
}

int main() {
        int N, M;
        scanf("%d %d", &N, &M);

        struct pair AB[N];
        for (int i = 0; i < N; i++)
                scanf("%ld %d", &AB[i].a, &AB[i].b);
        qsort(AB, N, sizeof(struct pair), compare);

        struct pair ab = {0, M};
        for (int i = 0; i < N; i++) {
                if (ab.b >= AB[i].b) {
                        ab.a += AB[i].a * AB[i].b;
                        ab.b -= AB[i].b;
                } else {
                        ab.a += AB[i].a * ab.b;
                        break;
                }
        }
        printf("%ld\n", ab.a);

        return 0;
}

Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) cerr << #v << ":"; rep(i, v.size()) cerr << " " << v[i]; cerr<<endl
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 = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    ll n;
    cin >> n;
    int x = 1;
    while(n > pow(26, x)) {
        n -= pow(26, x);
        x++;
    }
    n--;
    string name = "";
    rep(i, x) {
        int idx = n % 26;
        name += 'a' + idx;
        n /= 26;
    }
    reverse(all(name));
    cout << name << endl;
}

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


Measured memory_bytes: 4064
N,M=list(map(int,input().split(" ")))
sw=[]
for z in range(M):
  buf=list(map(int,input().split(" ")))
  k=buf[0]
  mask=0
  for x in range(1,k+1):
    mask|=2**(buf[x]-1)
  sw.append(mask)


p=list(map(int,input().split(" ")))

cnt=0

for z in range(2**N):
  flag=True
  for i,x in enumerate(sw):
    y=z&x
    bitcount=0
    while y!=0:
      if y&1==1:
        bitcount+=1
      y=y>>1

    if bitcount%2!=p[i]:
      flag=False
  if flag:
    cnt+=1

print(cnt)

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

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

const int INF = 1001001001;

bool is_prime(ll x){
    if(x <= 1) return false;
    for(ll i = 2;i*i <= x; ++i){
        if(x % i == 0) return false;
    }
    return true;
}


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

    ll k;
    cin >> k;
    ll ans = k;
    while(!is_prime(ans)) ans++;
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=3e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

lf dp[MAXn][MAXn];
lf p[MAXn];
int main(){
  IOS();
  cout << fixed << setprecision(15);
  ll n;
  cin >> n;
  REP1 (i,n) cin >> p[i];

  dp[0][0] = 1.0;
  REP1 (i,n) REP (j,i+1) {
    dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
  }
  lf ans = 0.0;
  for (ll i=(n+1)/2;i<=n;i++) ans += dp[n][i];
  cout << ans << endl;
}


Measured memory_bytes: 69120
# include <iostream>
using namespace std; 
int main(){
  long long int n, k,i; 
  cin>>n>>k; 
  long long int ar[n];
  for(i=0;i<n;i++){
    cin>>ar[i];
  }
  for(i=k;i<n;i++){
    if(ar[i]>ar[i-k]){
      cout<<"Yes";
    }
    else{
      cout<<"No";
    }
    cout<<"\n";
  }
  return 0;
}

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

typedef long long int   ll;
#define int             ll
#define PI              3.1415926535897932384626433832795

#define pb              push_back
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]

#define hell            freopen("input.txt","r", stdin);freopen("output.txt", "w", stdout);freopen("error.txt", "w",stderr);
#define fastasF_boi()   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
//#define cerr            if(false)cerr

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mulmod(int a,int b){return ((a%mod)*(b%mod))%mod;}
int addmod(int a,int b){return (((a%mod)+(b%mod))+mod)%mod;}

int ar[200005];

bool fun(int mid,int n,int k){
	int res=0;
	for(int i=0;i<n;i++){
        if(ar[i]>mid)
            res+=ar[i]/mid;
	}
	if(res<=k) return true;
	else return false;
}

void solve(){
    int n,k;cin>>n>>k;
	inputar0(ar);
	int l = 1,r=0,ans=-1;
	for(int i=0;i<n;i++){
        r=max(r,ar[i]);
	}
	while(l<=r){
		int mid = l+(r-l)/2;
		if(fun(mid,n,k)){
			r = mid-1;
			ans = mid;
		}
		else l = mid+1;
	}
	cout << ans;
}

signed main(){
//    hell;

    fastasF_boi();
    int t=1;
//    cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
}



Measured memory_bytes: 5168
#include <bits/stdc++.h>
using namespace std;
template<class T> T gcd(T a,  T b) {return b ? gcd(b, a % b) : a;}
template<class U> U lcm( U m, U n ){if((0 == m )||( 0 == n ))return 0; return ((m / gcd(m, n)) * n); }
template<typename T>
vector<T> primeFactors(T n) {
    vector<T> v;
    T i = 2;
    while (i * i <= n) {
        if (n % i == 0) {
            v.push_back(i);
            n /= i;
        } else {
            i++;
        }
    }
    if(n != 1)v.push_back(n);
    return v;
};
template<typename T>
set<T> primeCompress(const vector<T>& vec){
    set<T> res;
    for(auto e : vec){
        res.insert(e);
    }
    return res;
}
int main(){
    long long A,B;
    cin >> A >> B;
    long long gd = gcd(A, B);
    cout << primeCompress(primeFactors(gd)).size() + 1 << endl;
}


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

int main() {
    
    string s1, s2, s3;
    cin >> s1 >> s2;
    int a, b;
    cin >> a >> b;
    cin >> s3;
    if(s3==s1) cout << a-1 << " " << b << endl;
    else cout << a << " " << b-1 << endl;
    
    
    
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    
    if (s=="a" || s=="i" || s=="u" || s=="e" || s=="o") puts ("vowel");
  else puts ("consonant");
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
        cout<<a[n-1]-a[0]<<endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod             1000000007
#define w(x)            int x; cin>>x; while(x--)
#define int             long long
#define mk(arr,n,type)  type *arr=new type[n];
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
int32_t main() {
	int n;
	cin >> n;
	map<int, int>m;
	int *arr = new int[n];
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		sum += arr[i];
		m[arr[i]]++;
	}
	int q;
	cin >> q;
	for (int z = 0; z < q; z++) {
		int b, c;
		cin >> b >> c;
		int temp = m[b];
		sum = sum + (c - b) * temp;
		m[b] = 0;
		m[c] = m[c] + temp;
		cout << sum << endl;
	}
	return 0;
}


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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

    int N,M,Q;
    vector<int> a,b,c,d;
    ll ans=0;
void dp(vector<int> v,int i){
    if(i==N){
        // rep(j,N) cout<<v[j]<<",";
        // cout<<endl;
        ll s=0;
        rep(j,Q){
            if(v[b[j]]-v[a[j]]==c[j]) s+=d[j];
        }
        ans=max(ans,s);
        return;
    }
    for(int j=(i==0? 1 : v[i-1]);j<=M;j++){
        v[i]=j;
        dp(v,i+1);
    }
}

int main(){
    cin>>N>>M>>Q;
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);
    rep(i,Q){ 
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
        b[i]--;
        c[i];
        d[i];
    }
    vector<int> v(N);
    dp(v,0);
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 3600
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int gcd(int x,int y){
	
	if(x%y==0){
		return y;
	}else{
		return gcd(y,x%y);
	}
	
}

int par[100001];
int size[100001];

int find(int x){           //親探し
	if(par[x]==x){
		return x;
	}else {
		int z= find(par[par[x]]);
		par[x]=z;
		return z;
	}
}

bool  unit(int x, int y){
	
	int xpar=find(x);
	int ypar=find(y);
	
	if(xpar==ypar){return false;}   //すでに結合済み
	
	par[ypar]=xpar;
	size[xpar]+=size[ypar];
	//par[x]=ypar;
	
	return true;
}


int main() {
	
	ll N,M;
	cin>>N>>M;
	pairs(Ms)
	fx(M){
		pairsp(Ms)
	}
	fx(N+1){
		par[x]=x;
		size[x]=1;
	}
	
	vector<ll> A(M);
	A.at(M-1)=N*(N-1)/2;
  if(M-1!=0){
	A.at(0)=0;
  }

	for(int x=M-2;x>=0;x--){
      ll ypar=size[find(Ms.at(x+1).second)];
      ll xpar=size[find(Ms.at(x+1).first)];
		if(unit(Ms.at(x+1).first,Ms.at(x+1).second)){
			A.at(x)=A.at(x+1)-xpar*ypar;
		}else{
			A.at(x)=A.at(x+1);
		}
	}

	
	fx(M){
		ce(A.at(x))
	}
	
}

Measured memory_bytes: 3828
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();

            double ret = 0;
            for (int current = 1; current <= N; current++) {
                double temp = 1;
                int score = current;
                while (score < K) {
                    score *= 2;
                    temp *= 0.5;
                }
                ret += ((1 / (double) N) * temp);
            }
            out.printf("%.12f", ret);
        }

    }
}



Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <iterator>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
using namespace std; 
  
typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 

#define IOS ios_base::sync_with_stdio(false);\
        cin.tie(0);\
        cout.tie(0);
#define endl "\n"  
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a)) 
#define FOREACH(a, b) for (auto&(a) : (b)) 
#define rep(i, n) FOR(i, 0, n) 
#define repn(i, n) FORN(i, 1, n) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALLA(arr, sz) arr, arr + sz 
#define all(c) c.begin(),c.end()
#define SORT(v) sort(all(v)) 
#define REVERSE(v) reverse(all(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define w(x)   int x; cin>>x; while(x--)
#define sz(a) int((a).size())
#define ps(x,y)         fixed<<setprecision(y)<<x
int main()
{
	IOS;
	int n,k;
	cin>>n;
	cin>>k;
	vi v(n);
	rep(i,n)
	{
		cin>>v[i];
	}
	vi dp(n,1000000005);
	dp[0]=0;
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			if(i-j>=0)
			{
				dp[i]=min(dp[i],dp[i-j]+abs(v[i-j]-v[i]));
			}
		}
	}
	cout<<dp[n-1];
	return 0;
}



Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>

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

bool is_sorted(int a[], int n) {
	REP(i, n - 1) {
		if(a[i] > a[i + 1]) {
			return false;
		}
	}
	return true;
}

int main() {
	int n;
	int h[100000];
	scanf("%d", &n);
	REP(i, n) { scanf("%d", &h[i]); }

	int result;
	REP(i, n - 1) {
		if(i == 0) {
			if(i >= 2) {
				h[i]--;
			}
		}

		if(h[i] <= h[i + 1] - 1) {
			h[i + 1]--;
		}
	}
	printf(is_sorted(h, n) ? "Yes\n" : "No\n");

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int mat[500][500];
ll dist[MAX];
vector<int>ans[MAX];
int find_dis(int x,int x1,int y,int y1)
{
    return abs(x-x1)+abs(y-y1);
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int h,w,d;
    cin>>h>>w>>d;
    map<int,pair<int,int> >mp;
    for(int i=1; i<=h; i++)
        for(int j=1; j<=w; j++)
        {
            cin>>mat[i][j];
            mp[mat[i][j]]= {i,j};
        }
    int n=h*w;
    for(int i=1; i<=d; i++)
    {
        int last=i;
        for(int j=i+d; j<=n; j+=d)
        {
            int cur=find_dis(mp[last].first,mp[j].first,mp[last].second,mp[j].second);
           // cout<<last<<" "<<j<<" "<<cur<<endl;
            dist[j]=dist[last]+cur;
            last=j;
        }
    }
    int q;
    cin>>q;
    while(q--)
    {
        int l,r,z;
        cin>>l>>r;
        cout<<dist[r]-dist[l]<<endl;
    }

    return 0;
}


Measured memory_bytes: 33904
#include <stdio.h>
#include <string.h>
 
#define MAX 244140625
 
int Hash[MAX];
char s[13];
 
int getChar(char);
int getKey();
int find();
void insert();
 
int main(){
  int n;
  char com[7];
 
  scanf("%d" ,&n);
  while(n--){
    scanf("%s %s" ,com ,s);
 
    if(com[0] == 'i'){
      insert();
    }else{
      if(find()){
    puts("yes");
      }else{
    puts("no");
      }
    }
  }
 
  return 0;
}
 
int getChar(char ch){
  if(ch == 'A'){
    return 1;
  }else if(ch == 'C'){
    return 2;
  }else if(ch == 'G'){
    return 3;
  }
  return 4;
}
 
int getKey(){
  int sum = 0, p = 1, i;
 
  for(i = 0 ; i < strlen(s) ; i++){
    sum += p*(getChar(s[i]));
    p *= 5;
  }
  return sum;
}
 
int find(){
  int key = getKey();
 
  if(Hash[key]){
    return 1;
  }
 
  return 0;
}
 
void insert(){
  Hash[getKey()] = 1;
}


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

int main(){
    int x, y;
    cin >> x >> y;

    for(int cranes = 0; cranes <= x; cranes++){
        if(y - cranes * 2 == (x - cranes)*4){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#define ll long long int
#define N 1000001

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

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

using namespace std;

const int N = 2e5 + 5;
long long n, m, k, u, v;
vector<long long> a, b;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m >> k;
    for (long long i = 0; i < n; i++) {
        cin >> u;
        a.push_back(u);
        if (a.size() > 1)
            a[a.size() - 1] += a[a.size() - 2];
    }
    for (long long i = 0; i < m; i++) {
        cin >> v;
        b.push_back(v);
        if (b.size() > 1)
            b[b.size() - 1] += b[b.size() - 2];
    }
    auto it = upper_bound(b.begin(), b.end(), k);
    auto il = upper_bound(a.begin(), a.end(), k);
    long long ans = max((long long) abs(it - b.begin()), (long long) abs(il - a.begin()));
    for (long long i = 0; i < a.size() && k >= a[i]; i++) {
        long long t = k - a[i];
        auto it = upper_bound(b.begin(), b.end(), t);
        if (it == b.end()) {
            ans = max(i + 1 + (long long) b.size(), ans);
        } else {
            ans = max(i + 1 + (long long) abs(it - b.begin()), ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7940
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

long long n, m, q;
long long a[100005], b[100005], c;

int main()
{
    //freopen("input.txt", "r", stdin);
    scanf("%lld%lld%lld", &n, &m, &q);
    for(long long i = 1; i <= n; i++)
    {
        scanf("%lld", &a[i]);
    }
    a[0] = -2e18;
    a[n + 1] = 2e18;
    for(long long i = 1; i <= m; i++)
    {
        scanf("%lld", &b[i]);
    }
    b[0] = -2e18;
    b[m + 1] = 2e18;
    for(long long i = 1; i <= q; i++)
    {
        long long mn = 9e18;
        scanf("%lld", &c);
        long long t1 = lower_bound(a, a + n + 2, c) - a;
        long long t2 = lower_bound(b, b + m + 2, c) - b;
        for(long long ii = t1 - 1; ii <= t1; ii++) for(long long jj = t2 - 1; jj <= t2; jj++)
        {
            mn = min(mn, abs(c - a[ii]) + abs(b[jj] - a[ii]));
            mn = min(mn, abs(c - b[jj]) + abs(a[ii] - b[jj]));
        }
        printf("%lld\n", mn);
    }
    return 0;
}


Measured memory_bytes: 2816
N=input()

hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]

for i in range(5):
  if(N[-1] == str(hon[i])):
    print("hon")

for i in range(4):
  if(N[-1] == str(pon[i])):
    print("pon")

if(N[-1] == str(bon[0])):
  print("bon")


Measured memory_bytes: 9028
#include <iostream>
#include <vector>

using lint = long long;
constexpr lint INF = 1LL << 62;

void solve() {
    int n, q;
    lint t;
    std::cin >> n >> t >> q;

    std::vector<lint> xs(n);
    std::vector<int> ds(n);
    for (int i = 0; i < n; ++i) {
        std::cin >> xs[i] >> ds[i];
    }
    xs.insert(xs.begin(), -INF);
    xs.push_back(INF);
    ds.insert(ds.begin(), 1);
    ds.push_back(2);

    while (q--) {
        int i;
        std::cin >> i;
        if (ds[i] == 1) {
            int j = i;
            while (ds[j + 1] == 1) ++j;
            lint dst = (xs[j] + xs[j + 1]) / 2;
            std::cout << std::min(dst, xs[i] + t) << std::endl;
        } else {
            int j = i;
            while (ds[j - 1] == 2) --j;
            lint dst = (xs[j] + xs[j - 1]) / 2;
            std::cout << std::max(dst, xs[i] - t) << std::endl;
        }
    }
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}



Measured memory_bytes: 4492
s = list(input())
m = list('zyxwvutsrqponmlkjihgfedcba')
if len(s) < 26:
    for i in m[::-1]:
        if not i in s:
            s.append(i)
            break
    print(''.join(s))
else:
    x = s[-1]

    for i in range(25)[::-1]:
        if x > s[i]:
            y = m.index(s[i])
            s = s[:i]
            for j in range(y)[::-1]:
                if not m[j] in s:
                    s.append(m[j])
                    break
            break
        else:
            x = s[i]
        if i == 0:
            print(-1)
            exit(0)
    print(''.join(s))


Measured memory_bytes: 8992
/******************************\
*  Everyone has a different way of thinking, so God Created us
Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Murad   *
\******************************/
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define MP make_pair
#define ff first
#define ss second
#define INF 2147483647
#define _INF -2147483647
#define pq priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
int main()
{
	El3zba;
	int n;
	cin >> n;
	cout << n*n*n << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]string, N)
	A2 := make([]string, N)
	src := make([]string, N)
	for i := range A {
		fmt.Scan(&A[i])
	}
	copy(A2, A)
	copy(src, A)
	bS := bubbleSort(A, N)
	sS := selectionSort(A2, N)
	fmt.Println(strings.Trim(fmt.Sprint(bS), "[]"))
	fmt.Println(isStable(src, bS))
	fmt.Println(strings.Trim(fmt.Sprint(sS), "[]"))
	fmt.Println(isStable(src, sS))
}

func bubbleSort(A []string, N int) []string {
	for i := 0; i < N; i++ {
		for j := N - 1; j > i; j-- {
			if A[j][1] < A[j-1][1] {
				A[j], A[j-1] = A[j-1], A[j]
			}
		}
	}
	return A
}

func selectionSort(A []string, N int) []string {
	for i := 0; i < N; i++ {
		minj := i
		for j := i; j < N; j++ {
			if A[j][1] < A[minj][1] {
				minj = j
			}
		}
		if A[i][1] != A[minj][1] {
			A[i], A[minj] = A[minj], A[i]
		}
	}
	return A
}

func isStable(in []string, out []string) string {
	N := len(in)
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			for a := 0; a < N; a++ {
				for b := a + 1; b < N; b++ {
					if in[i][1] == in[j][1] && in[i] == out[b] && in[j] == out[a] {
						return "Not stable"
					}
				}
			}
		}
	}
	return "Stable"
}



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

using namespace std;

int main()
{
	int ans = 0;
	string s;

	cin >> s;

	int length = s.size();

	char color = s[0];

	for (int i = 1;i < length;i++)
	{
		if (color != s[i])
		{
			ans++;
			color = color == 'W' ? 'B' : 'W';
		}
	}

	cout << ans << endl;

	    return 0;
}



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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);


    int n;
    cin>>n;

    vector<pair<int, int> > inp(n);

    vector<pair<int, int> > ranges(n);

    for(int i = 0; i < n; i++) {
        cin>>inp[i].first>>inp[i].second;
        ranges[i].first = inp[i].first + inp[i].second;
        ranges[i].second = i;
    }

    sort(ranges.begin(), ranges.end());

    int removed = 0;

    int st = inp[ranges[0].second].first - inp[ranges[0].second].second;
    int en = ranges[0].first;

    for(int i = 1; i < ranges.size(); i++) {
        int st2 = inp[ranges[i].second].first - inp[ranges[i].second].second;
        int en2 = ranges[i].first;

        if(st2 < en) {
            removed++;
        } else {
            st = st2;
            en = en2;
        }
    }

    cout<<n-removed<<endl;



}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  string s;
  cin >> s;
  int a = 10 * (s[0] - '0') + (s[1] - '0');
  int b = 10 * (s[2] - '0') + (s[3] - '0');

  if (1 <= a && a <= 12){
    if (1 <= b && b <= 12)
      cout << "AMBIGUOUS" << endl;
    else
      cout << "MMYY" << endl;
  }
  else {
    if (1 <= b && b <= 12)
      cout << "YYMM" << endl;
    else
      cout << "NA" << endl;
  }

  return 0;
}


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

int main(int argc, char const *argv[]) {
    int N;
    cin >> N;
    map<long long, long long> m;
    vector<int> key_v;
    int key, value;
    for(int i = 0; i < N; i++) {
        cin >> value >> key;
        if(m.find(key) != m.end()) {
            m[key] += value;
        } else {
            key_v.push_back(key);
            m[key] = value;
        }
    }
    sort(key_v.begin(), key_v.end());
    int time = 0;
    for(int i = 0; i < key_v.size(); i++) {
        time += m[key_v[i]];
        if(time > key_v[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 13556
#include<bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;

const int MOD = 1e9 + 7;

ll f(ll x, ll y){
	return (x + x + y) * y / 2;
}

int main(){
	ios_base::sync_with_stdio(NULL); cin.tie(); cout.tie();
	ll n, k, ans = 0; 
	cin >> n >> k;
	for(int i = k; i <= n + 1; i ++){
		ans = (ans + (f(n + 1 - i, i) - f(0, i) + 1)) % MOD;
	}
	cout << ans << endl;
}
/**

*/

Measured memory_bytes: 3656
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;



public class Main {

	public static class pair implements Comparable<pair> {
		int id;
		int ans;
 
		pair(int x, int y) {
 
			id = x;
			ans = y;
 
		}
 
		public pair() {
 
		}
 
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
 
			return this.id - o.id;
		}
	}
 
//	static int mod = (int) 998244353.;
	static ArrayList<Integer> gr[];
	static int[] ar;
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();
 
	//static long dp[];
 
	public static void main(String[] args) throws IOException {
		int t =1;//sc.nextInt();
		
		while (t-- > 0) {
 
			int n=sc.nextInt();
			int a=sc.nextInt();
			int b=sc.nextInt();
			if(a%n==0 || b%n==0) {
				out.append("OK\n");
				continue;
			}
			if(a/n!=b/n ) {
				out.append("OK\n");
				continue;
			}
			out.append("NG\n");
			

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

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

using namespace std;

typedef long long ll;

int max_N = 100005;
int N;
vector<int> A(max_N, 0);

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

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

	cin >> N;
	rep(i, N) cin >> A[i];

	int l[N];
	l[0] = A[0];
	rep(i, N-1){
		l[i+1] = gcd(l[i], A[i+1]);
	}

	int r[N];
	r[N-1] = A[N-1];
	for(int i = N-2; i >= 0; i--){
		r[i] = gcd(r[i+1], A[i]);
	}

	int ans = r[1];
	for(int i = 1; i <= N - 2; i++){
		ans = max(ans, gcd(l[i-1], r[i+1]));
	}

	ans = max(ans, l[N-2]);

	cout << ans << endl;
}


Measured memory_bytes: 1536
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

//Find the Multiples
public class Main{

	Map<Integer, Integer> cnt;
	void inc(int m){
		if(cnt.containsKey(m))cnt.put(m, cnt.get(m)+1);
		else cnt.put(m, 1);
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt(), S = sc.nextInt(), W = sc.nextInt(), Q = sc.nextInt();
			if((n|S|W|Q)==0)break;
			int[] a = new int[n];
			int g = S;
			for(int i=0;i<n;i++){
				a[i] = (g/7) % 10;
				if((g&1) == 0)g>>=1;
				else g = (g>>1) ^ W;
			}
			int res = 0;
			if(Q==2){
				int e = 0;
				for(int i=n-1;i>=0;i--){
					if((a[i]&1)==0)e++;
					if(a[i]!=0)res+=e;
				}
			}
			else if(Q==5){
				int f = 0;
				for(int i=n-1;i>=0;i--){
					if(a[i]==0||a[i]==5)f++;
					if(a[i]!=0)res+=f;
				}
			}
			else{
				cnt = new HashMap<Integer, Integer>();
				inc(0);
				int ten = 1, m = a[n-1]%Q;
				inc(m);
				if(m==0 && a[n-1]!=0)res++;
				for(int i=n-2;i>=0;i--){
					ten = (ten*10)%Q;
					m = (a[i]*ten+m)%Q;
					if(a[i]!=0 && cnt.containsKey(m))res+=cnt.get(m);
					inc(m);
				}
			}
			System.out.println(res);
		}
	}

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

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

int main(){
    int n;
    cin >> n;
    vector <pair <int, int> > a(n);
    for (int tsumugi = 0; tsumugi < n; tsumugi++){
        int tmp;
        cin >> tmp;
        a[tsumugi] = make_pair(tmp, tsumugi + 1);
    }
    
    sort(a.begin(), a.end());
    for (int karen = 0; karen < n; karen++){
        cout << a[karen].second << " ";
    }

    return 0;    
}

Measured memory_bytes: 1536
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if a <= 8 and b <= 8:
        print("Yay!")
    else:
        print(":(")
    return

#B
def B():
    d, n = LI()
    print(str(n * (n != 100) or n + 1) + "00" * d)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := newScanner()
	S := sc.next()
	if len(S) < 4 {
		fmt.Println("No")
		return
	}
	if S[:4] == "YAKI" {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) nextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}
	return result
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define INF 10000000000000000LL
#define ll  long long 
const long long  inf =1e18+44;
const int MAX=3e5+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=1e6+9;
const int MAX_A=71;
const int LN=20;
const double eps=1e-1;
using namespace std;
int dp[2000][2000];
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n;
    cin>>n;
    queue<string>q;
    q.push("a");
    while(!q.empty()){
        string now = q.front();
        q.pop();
        if(now.size()==n){
            cout<<now<<endl;
            continue;
        }
        char mx = now[0];
        for (int i=0;i<now.size();i++)
            mx= max(mx, now[i]);
        for(char c= 'a';c<=mx+1;c++){
            now.push_back(c);
            q.push(now);
            now.pop_back();
        }
    }

}


Measured memory_bytes: 6780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return (a/g*b);
}
int main() {
    int n,cnt1 = 0,cnt2 = 0,cnt3 = 0;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if(a[i] %2 == 1) cnt1++;
        else if(a[i] %2 == 0 && a[i] %4 != 0) cnt2++;
        else if(a[i] %4 == 0) cnt3++;
    }
    int sum = cnt1 - 1;
    if(cnt2 > 0) sum++;
    if(cnt3 >= sum){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640