akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
 
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
using ll= long long;
const int mxN = 500;
const ll INF = 0x3f3f3f3f3f3f3f3fL;
// ll dist[mxN][mxN];
 
void dfs(ll u, vector<vector<ll>>& graph, vector<bool>& visited){
    if(visited[u])
        return;
    visited[u] = true;
    for(ll v: graph[u]){
        dfs(v, graph, visited);
    }
}

bool relax(vector<ll>& dist, vector<vector<ll>>& edges, vector<bool>& visited){
    bool changed = false;
    for(vector<ll>& edge: edges){
        ll u = edge[0];
        ll v = edge[1];
        ll w = edge[2];

        if(visited[u] && visited[v] && dist[u] != INF){
            if(dist[v] > dist[u] + w){
                dist[v] = dist[u] + w;
                // if(v ==  visited.size() - 1)
                    changed = true;
                // cout << u + 1 << " " << v + 1<< " " << dist[u] << " " << dist[v] << endl;
            }
        }
    }
    return changed;
}

void dijkstra(ll s, vector<ll>& dist, vector<vector<pair<ll,ll>>>& graph){
    priority_queue<pair<ll, int>, vector<pair<ll,int>>, greater<pair<ll,int>>> pq;
    pq.push({0,s});
    dist[s] = 0;
    while(!pq.empty()){
        pair<ll,int> top = pq.top(); pq.pop();
        ll u = top.second;
        ll d = top.first;
        if(d > dist[u])
            continue;

        for(pair<ll,ll>& next: graph[u]){
            ll v = next.first;
            ll w = next.second;
            if(dist[v] > d + w){
                dist[v] = d + w;
                pq.push({dist[v], v});
            }            
        }
    }
}

void solve() {
    int n, d; cin >> n >> d;

    int count = 0;
    for(int i = 0; i < n; i++){
        double x,y; cin >> x >> y;

        double dist = sqrt(x * x + y * y);
        if(dist <= d)
            count++;
    }

    cout << count << endl;

}
 
int main() {
    FAST_INPUT;
    
    solve();
    return 0;
}

Measured memory_bytes: 3772
#include<iostream>
#include<cstdio>
using namespace std;
int a[200010];
int main()
{
    int n,minh,maxh=-2000000000;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    minh=a[0];
    for(int i=1;i<n;i++)
    {
        maxh=max(maxh,a[i]-minh);
        minh=min(minh,a[i]);
    }
    printf("%d\n",maxh);
    return 0;
}

Measured memory_bytes: 4008
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl "\n";
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,bool> pllb;
typedef pair<pair<ll,ll>,ll> plll;
 
const ll N = 110;
const ll INF = 1e9;
const ll N2 = 3010;
const int MOD = 1e9+7;

string s,t;
int sz1,sz2;

int memo[N2][N2];

int dp(int idx1,int idx2)
{
    if(idx1==sz1||idx2==sz2)
        return 0;
    int &ret = memo[idx1][idx2];
    if(~ret)
        return ret;
    ret = 0;
    if(s[idx1]==t[idx2])
    {
        ret = dp(idx1+1,idx2+1)+1;
    }
    ret = max(ret,max(dp(idx1+1,idx2),dp(idx1,idx2+1)));
    return ret;
}

void build(int idx1,int idx2)
{
    if(idx1==sz1||idx2==sz2)
        return;
    
    if(memo[idx1][idx2]==dp(idx1+1,idx2))
    {
        //cout << s[idx1];
        build(idx1+1,idx2);
    }
    else if(memo[idx1][idx2]==dp(idx1,idx2+1))
    {
        //cout << s[idx1];
        build(idx1,idx2+1);
    }
    else if(memo[idx1][idx2]==dp(idx1+1,idx2+1)+1)
    {
        cout << s[idx1];
        build(idx1+1,idx2+1);
    }
}


int main()
{
	fastio
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("out.txt","w",stdout);
	#endif

    memset(memo,-1,sizeof memo);

    cin >> s >> t;

    sz1=s.size();
    sz2=t.size();
    dp(0,0);
    build(0,0);

}

Measured memory_bytes: 36096
#include <complex>
#include <cstdio>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std{
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
bool in_triangle(const P& p1,const P& p2,const P& p3,const P& p){
	return cross(p2-p1,p-p1)>0 && cross(p3-p2,p-p2)>0 && cross(p1-p3,p-p3)>0;
}
int main(){
	double x1,y1,x2,y2,x3,y3,x,y;
	for(;~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x,&y);){
		P p1(x1,y1),p2(x2,y2),p3(x3,y3),p(x,y);
		bool in=in_triangle(p1,p2,p3,p)||in_triangle(p2,p1,p3,p);
		puts(in?"YES":"NO");
	}
}

Measured memory_bytes: 1032
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

N, K = MI()
ans = 0

while N>0:
    N = N//K
    ans += 1
print(ans)


Measured memory_bytes: 58988
#include<iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int l[n];
    int max = 0, sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> l[i];
        max = (max < l[i]) ? l[i] : max;
        sum += l[i];
    }
    sum -= max;
    if (max < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    count = 0
    for ai in range(a + 1):
        for bi in range(b + 1):
            for ci in range(c + 1):
                if 500 * ai + 100 * bi + 50 * ci == x:
                    count += 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/o_o/MyCodes/pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  

void solve(){
	int d , t , s; 
	re(d,t,s);
	 cout << (d <= s * t ? "Yes" : "No") << '\n';
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
// __uint128_t



int main(){
    ll N; cin >> N;
    vector<ll> V(N); for(int i = 0; i < N; i++) cin >> V[i];
    sort(V.begin(), V.end());
    ll SUM = V[N-1], idx = N-1;
    for(int i = 0; i < N-1; i++) SUM-=V[i];
    ll ans = SUM;
    for(int i = N-2; i > 0; i--){
        SUM += 2*V[i];
        if(ans < SUM){
            ans = SUM;
            idx = i;
        }
    }
    cout << ans << endl;
    vector<ll> A;
    ll idx2 = idx-1;
    ll t = V[idx2];
    idx2--;
    while(idx < N-1){
        cout << t << " " << V[idx] << endl;; 
        t -= V[idx];
        idx++;
    }
    A.push_back(t);
    while(idx2 >= 0){
        A.push_back(V[idx2]);
        idx2--;
    }
    t = V[N-1];
    for(auto a : A){
        cout << t << " " << a << endl;
        t -= a;
    }


}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
//#include <ext/numeric>


using namespace std;
//using namespace __gnu_cxx;



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    int n, k;
    cin >> n >> k;

    double ans = 0;
    for (int i = 1; i <= n; ++i) {
        int p = 0;
        int j = i;
        while (j < k) {
            j *= 2;
            ++p;
        }
        ans += pow(0.5, p);
    }

    ans *= 1.0 / n;

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 4164
function Main(input) {
  input = input.split("\n");
  N=parseInt(input[0]);
  A = new Array(N);
  B = new Array(N);
  C = new Array(N);
  tmpa=input[1].split(" ");
  tmpb=input[2].split(" ");
  list=new Array();
  var s=0;
  var ans =0;
  for(var i=0;i<N;i++){
    A[i]=parseInt(tmpa[i]);
    B[i]=parseInt(tmpb[i]);
    if(A[i]-B[i]>0){
      list.push(A[i]-B[i]);
    }else if(A[i]-B[i]!=0){
      s+=Math.min(0,A[i]-B[i]);
      ans++;
    }
  }
  s=-s;
  list.sort(function(a,b){return(b - a);});
  var s2=0;
  if(ans!=0){
  for(var i=0;i<list.length;i++){
    s2+=list[i];
    if(s2>=s){
      ans+=i+1;
      break;
    }else if(i==list.length-1){
      ans=-1;
    }
  }
}



  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 31536
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


const int max_comb=110000;
vector<ll> fac(max_comb+1); //n! (mod M)
vector<ll> ifac(max_comb+1); //k!^(-1) (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll minv(ll x){
    return mpow( x, MOD-2 );
}

ll comb(int a, int b){     // C(a,b) = a! * b!^(-1) * (a-b)^(-1)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

ll perm(int a, int b){     // P(a,b) = a! * (a-b)!^(-1)
    if(b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(int i = 0; i<max_comb; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*minv(i+1) % MOD; // k!^(-1) (mod M)
    }
    return;
}

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int p,q;
    vector<int> save(n,-1);
    int i;
    for(i=0; i<n+1; i++) {
        int tmp;
        scanf("%d", &tmp);
        if(save[tmp-1]<0) save[tmp-1]=i;
        else {
            p=save[tmp-1]; q=i;
        }
    }
    pre_comb();

    for(i=1; i<=n+1; i++) {
        ll ans = comb(n+1,i);
        if(n-q+p>=i-1) {
            ans = (ans + MOD - comb(n-q+p,i-1))%MOD;
        }
        printf("%lld\n", ans);
    }
    


    return 0;
}


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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    ll x, y;
    cin >> x >> y;
    ll ans = 0;
    ll tmp = x;

    while(1) {
        if(tmp <= y) {
            ans++;
            tmp *= 2;
        } else {
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void){
    int x,y,z;cin>>x>>y>>z;
    swap(x,y);swap(x,z);
    cout << x << " " << y << " " << z << endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Stack;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if ((H | W) == 0) return;
			int[][] f = new int[H][W + 1];
			for (int i = 0; i < H; i++) {
				String row = sc.next();
				for (int j = 0; j < W; j++) {
					if (i == 0) f[i][j] = (row.charAt(j) == '.') ? 1 : 0;
					else        f[i][j] = (row.charAt(j) == '.') ? f[i - 1][j] + 1 : 0;
				}
			}

			long area = 0;
			for (int h = 0; h < H; h++) {
				Stack<Rect> st = new Stack<Rect>();
				for (int i = 0; i < f[h].length; i++) {
					if (st.isEmpty() || st.peek().height < f[h][i]) st.push(new Rect(i, f[h][i]));
					else if (st.peek().height > f[h][i]) {
						int lastPos = 0;
						while (!st.isEmpty() && st.peek().height > f[h][i]) {
							Rect use = st.pop();
							area = Math.max(area, (i - use.pos) * use.height);
							lastPos = use.pos;
						}
						st.push(new Rect(lastPos, f[h][i]));
					}
				}
			}
			System.out.println(area);
		}
	}

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

	class Rect {
		int pos;
		long height;

		public Rect(int pos, long height) {
			super();
			this.pos = pos;
			this.height = height;
		}
	}
}

Measured memory_bytes: 44696
#include<stdio.h>
int main()
{
    int n,a,b,c;
    while(scanf("%d",&n)!=EOF)
    {
        if(n>=100&&n<=999)
        {
            a=n/100;
            b=(n/10)%10;
            c=n%10;
            if(a==c)
            printf("Yes\n");
            else
            printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int x;
    cin >> x;
    int a = 0, b = 0;
    a = (x / 500);
    x -= a * 500;
    b = (x / 5);
    
    cout << a * 1000 + b * 5 << endl;

    return 0;
}


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

int main(){
  int a,b,tmp;
  while(cin >> a >> b){
    int tmp_a = a;
    int tmp_b = b;
    for(;;){
      if(b%a==0) break;
      tmp = a;
      a = b % a;
      b = tmp;
    }
    int GCD = a;
    int LCM = (tmp_b / a)*tmp_a;
    cout << GCD << " " << LCM<< endl;
  }
}

Measured memory_bytes: 3048
n=int(input())
wordset=set()
pw=input()
wordset.add(pw)
ans='Yes'
for _ in range(n-1):
  w=input()
  if pw[-1] != w[0] or w in wordset:
    ans='No'
    break
  wordset.add(w)
  pw=w
print(ans)

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

int main() {
	int n;
	cin >> n;
	int w[100];
	for(int i = 0; i < n; i++) {
		cin >> w[i];
	}
	int ans = 1<<25;
	for(int c = 0; c < n; c++) {
		int l = 0;
		int r = 0;
		for(int i = 0; i < c; i++) {
			l += w[i];
		}
		for(int i = c; i < n; i++) {
			r += w[i];
		}
		ans = min(ans,abs(l-r));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M=1e5+10;
struct st{
	int be,ye,x;
}p[M];
struct stt{
	int a,b,id;
}pp[M];
int comp(const stt &a,const stt &b){
	return a.a<b.a||a.a==b.a && a.b<b.b;
}
int n,m,a,b,cnt[M];
int main(){
	memset(cnt,0,sizeof(cnt));
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;++i){
		scanf("%d %d",&p[i].be,&p[i].ye);
	    pp[i].a=p[i].be;
	    pp[i].b=p[i].ye;
	    pp[i].id=i;
	}
	sort(pp+1,pp+1+m,comp);
	int kkksc03=1;
	p[pp[1].id].x=1;
	for(int i=2;i<=m;++i){
		if(pp[i].a!=pp[i-1].a){kkksc03=1;p[pp[i].id].x=kkksc03;}
		else{kkksc03++;p[pp[i].id].x=kkksc03;}
	}
	for(int i=1;i<=m;++i) printf("%06d%06d\n",p[i].be,p[i].x);
	return 0;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
const double PAI = acos(-1);
constexpr long double eps = 1e-9;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<ll> p2(200050);
    p2[0] =1;
    for(int i=1;i<200005;++i){
        p2[i] = p2[i-1]*2%mo;
    }
    int n;
    cin>>n;
    map<pair<ll,ll>,pair<ll,ll>> m;
    int zero = 0;
    for(int i=0;i<n;++i){
        ll a,b;
        cin>>a>>b;
        if(a == 0 and b == 0) zero++;
        else if(a == 0)m[{0,0}].first++;
        else if(b == 0)m[{0,0}].second++;
        else {
            if(b < 0)a=-a,b=-b;
            ll g = gcd(abs(a),abs(b));
            a/=g;
            b/=g;
            if(a < 0){
                m[{b,-a}].first++;
            }else m[{a,b}].second++;
        }
    }
    ll ret = 1;
    for(auto cur : m){
        ll now = p2[cur.second.first] + p2[cur.second.second] -1;
        (ret *= now)%=mo;
    }
    cout << (ret + zero + mo -1)%mo << endl;
    return 0;
}


Measured memory_bytes: 20228
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;


int main()
{
    int H,W,K;
    cin>>H>>W>>K;
    // vector<int> h(H),w(W);
    vector<string> S(H);
    rep(i,H)cin>>S[i];
    int sum=0;
    // rep(i,H)h[i]=0;
    // rep(i,W)w[i]=0;
    // rep(i,H)rep(k,W){
    //     if(S[i][k]=='#'){
    //         h[i]++;
    //         w[k]++;
    //         sum++;
    //     }
    // }

    int ans = 0;
    for(int i=0;i<(1<<H);i++){
        for(int k=0;k<(1<<W);k++){
            int cnt=0;
            for(int a=0;a<H;a++)for(int b=0;b<W;b++){
                int j=0;
                j+= i&(1<<a);
                j+= k&(1<<b);
                
                if(j==0&&S[a][b]=='#')cnt++;
                
            }

            if(cnt==K){
                //cout<<bitset<6>(i)<<" "<<bitset<6>(k)<<endl;
                ans++;
            }
            
        }
    }

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


Measured memory_bytes: 3600
import itertools

A = int(input())
B = int(input())
C = int(input())
X = int(input())

n = 0
for i,j,k in itertools.product(range(A+1),range(B+1),range(C+1)):
  if (i*500 + j*100 + k*50) == X:
  	n += 1

print(n)

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

void main_()
{
    ll N, K;
    cin >> N >> K;

    ll ans = pow(N / K, 3);
    if (K % 2 == 0)
    {
        ans += pow((N + K / 2) / K, 3);
    }
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N; cin >> N; int cnt[N+1] = {};
  rep(i, N){
    int a; cin >> a; cnt[a]++;
  }
  sort(cnt, cnt+N+1, greater<>()); int kazu[N+1] = {};
  rep(i, N+1){
    kazu[cnt[i]]++;
  }
  int cum[N+2] = {};
  for(int i=N; i>=0; i--){
    cum[i] = cum[i+1]+kazu[i];
  }
  int all=N; int ma = cnt[0];
  for(int i=1; i<=N; i++){
    while(ma>all/i){
      all-=cum[ma]; ma--; 
    }
    cout << all/i << endl;
  }  
}

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

using namespace std;
using ll = long long;

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

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int n,t;
	ll cnt = 0;
	V<int> v;

	cin >> n;
	REP(i,n+1) {
		cin >> t;
		v.push_back(t);
	}
	int tmp = 0;
	REP(i,n) {
		cin >> t;
		if(v[i] >= t+tmp) {
			cnt += t+tmp;
			tmp = 0;
		} else {
			cnt += v[i];
			if(v[i] <= tmp) {
				tmp = t;
			} else {
				tmp = t+tmp-v[i];
			}
		}
	}

	if(v[n] >= tmp) {
		cnt += tmp;
	} else {
		cnt += v[n];
	}

	cout << cnt << endl;
}




Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
	ll x, ans, p;

	scanf("%lld", &x);

	p = 100;

	ans = 0ll;
	while (p < x) {
		p += p / 100;
		ans++;
	}

	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007 //1000000000000000003
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int N;
  cin>>N;

  int a[N+1];

  a[0]=0;

  rep(i,N){
    cin>>a[i+1];
  }

  int now=1;
  int nnow=1;
  int ct=0;

  rep(i,N){
    nnow=a[now];
    a[now]=0;
    now=nnow;
    ct++;
    if(now==2){
      cout<< ct<<"\n";
      return;
    }

  }
  cout<< -1<<"\n";

}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>

using namespace std;

int main(void) {
  long N, M;
  cin >> N >> M;

  unordered_map<long, vector<long> > data;

  for (long i = 0; i < M; i++) {
    long A, B;
    cin >> A >> B;
    data[A].push_back(B);
    data[B].push_back(A);
  }

  queue<long> todo;
  unordered_map<long, long> hops;
  bool is_nibu_graph = true;

  todo.push(1);
  hops[1] = 1;

  while (is_nibu_graph and !todo.empty()) {
    long now = todo.front();
    todo.pop();
    long next_hop = hops[now] + 1;
    for (long next_node: data[now]) {
      if (hops[next_node] == 0) {
        hops[next_node] = next_hop;
        todo.push(next_node);
        continue;
      }
      if ((next_hop - hops[next_node]) % 2 == 0) {
        continue;
      }
      is_nibu_graph = false;
      break;
    }
  }

  if (is_nibu_graph) {
    long odd = 0;
    for (auto it = hops.begin(); it != hops.end(); it++) {
      if (it->second % 2 == 1) odd++;
    }
    long even = N - odd;
    cout << (odd * even) - M << endl;
  } else {
    cout << N * (N-1) / 2 - M << endl;
  }

  return 0;
}


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n,k;

    cin>>n>>k;

    string s;

    cin>>s;

    li cnt=0;

    f(i,0,n-2)
    {
        if(s[i]==s[i+1])
            cnt++;
    }
    
    cout<<min(n-1,cnt+2*k);

}

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

    li t=1;

    // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3772
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=100001;

int s[maxn],t[maxn],c[maxn];
P b[maxn];
int cha[5];
int main(){
  int n;
  cin>>n;
  for(int i=0;i<5;i++)cha[i]=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s[0]=='M')cha[0]++;
    if(s[0]=='A')cha[1]++;
    if(s[0]=='R')cha[2]++;
    if(s[0]=='C')cha[3]++;
    if(s[0]=='H')cha[4]++;
  }
  ll res=0LL;
  for(int i=0;i<5;i++){
    for(int j=i+1;j<5;j++){
      for(int k=j+1;k<5;k++){
        res+=(ll)cha[i]*(ll)cha[j]*(ll)cha[k];
      }
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	ll N, K; cin >> N >> K;
	ll tot = 0, ans = 0;
	map<ll, int> mp;
	mp[0]++;
	queue<ll> qu;
	qu.push(0);
	for (ll i = 1; i <= N; i++) {
		if (i >= K) {
			mp[qu.front()]--;
			qu.pop();
		}
		ll a; cin >> a; tot += a;
		ll temp = (tot - i) % K;
		//printf("i=%d temp=%lld mp[%lld]=%d\n", i, temp, temp, mp[temp]);
		ans += mp[temp];
		mp[temp]++;
		qu.push(temp);	
		
	}
	
	cout << ans << endl;
}




Measured memory_bytes: 17632
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(m),b(m);
    for(int i=0; i<m; i++) cin>>a[i]>>b[i];
    vector<vector<int>> G(n);
    for(int i=0; i<m; i++){
        G[a[i]-1].push_back(b[i]-1);
        G[b[i]-1].push_back(a[i]-1);
    }
    vector<int> color(n,1e9);
    vector<bool> seen(n,false);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front();
        q.pop();
        for(auto i:G[v]){
            if(seen[i]) continue;
            q.push(i);
            seen[i]=true;
            color[i]=v;
        }
    }
    for(int i=0; i<n; i++){
        if(!seen[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    for(int i=1; i<n; i++){
        cout<<color[i]+1<<endl;
    }
}

Measured memory_bytes: 11636
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a[100005];
ll b[100005];
ll c[100005];
ll x[100005];
ll y[100005];
vector<ll> vec;
ll cmp(ll x,ll y)
{
	return x<y;
}
int main()
{
	ll A,B,M;
	cin>>A>>B>>M;
	for(int i=1;i<=A;i++)
	 cin>>a[i];
	for(int i=1;i<=B;i++)
	 cin>>b[i];
	for(int i=1;i<=M;i++)
	 {
	 	cin>>x[i]>>y[i]>>c[i];
	 	vec.push_back(a[x[i]]+b[y[i]]-c[i]);
	 }
	sort(a+1,a+A+1,cmp);
	sort(b+1,b+B+1,cmp);
	vec.push_back(a[1]+b[1]);
	sort(vec.begin(),vec.end(),cmp);
	cout<<vec[0]<<endl;
 } 

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

int main() {
  int a,b,c,d,e,k;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  if(e-a<=k) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
n,m,x=map(int,input().split())
a=[]
ans=-1
t=[0]*(m+1)
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(2 ** n):
    for j in range(n):
        if (i >> j) & 1:
            for lnd,l in enumerate(a[j]):
                t[lnd]+=l
    if ans==-1 or ans > t[0]:
        if min(t[1:m+1]) >= x:
            ans = t[0]
    t=[0]*(m+1)
print(ans)

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "the " << #x << " -> "; err(x); } while (0)
void err() { cout << "" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    printf("%d\n",n-k+1);
}

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

using namespace std;

int main()
{
    int n , k ;
    cin>>n>>k ;
    int arr[n] ;
    vector<long long>v ;
    for(int i = 0 ; i < n ; ++i)
        cin>>arr[i] ;
    for(int i = 0 ; i < n ; ++i)
    {
        long long sum = 0 ;
        for(int j = i ; j < n ; ++j)
            sum += arr[j] * 1ll , v.push_back(sum);
    }
    sort(v.begin() , v.end());
    long long ans = 0 ;
    for(int i = 60 ; i >= 0 ; --i)
    {
        vector<long long>v1 ;
        for(auto &j : v)
            if((j >> i) & 1)
              v1.push_back(j) ;
        if(v1.size() >= k)
        {
            ans += (1ll << (i*1ll));
            v = v1 ;
        }
    }
    return cout<<ans , 0 ;
}


Measured memory_bytes: 6256
#include<iostream>
#include<queue>

using namespace std;
static const int N=100;
static const int INFTY =(1<<21);

int n,M[N][N];
int d[N];

void bfs(int s){
  int i,v;
  queue<int> q;
  q.push(s);
  for(i=0;i<n;i++) d[i]=INFTY;
  d[s]=0;
  int u;

  while(!q.empty()){
    u=q.front();q.pop();
    for(v=0;v<n;v++){
      if(M[u][v]==0) continue;
      if(d[v]!=INFTY) continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(i=0;i<n;i++){
    cout << i+1 << " " << ( (d[i]==INFTY) ? (-1) : d[i]) << endl;
  }
}

int main(){
int u,k,v,i,j;
 cin >> n;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }

  for(i=0;i<n;i++){
    cin >> u >> k;
    u--;
    for(j=0;j<k;j++){
      cin >> v;
      v--;
      M[u][v]=1;
    }
  }

  bfs(0);
  
  return 0;
}



Measured memory_bytes: 3132
h, w = map(int, input().split())
grid = []
for i in range(h):
    a = input()
    x = [j for j in a]
    grid.append(x)
grid_2 = []
for j in grid:
    if '#' in j:
        grid_2.append(j)

rotate = []
for i in range(w):
    r = [row[i] for row in grid_2]
    rotate.append(r)

rotate_2 = []
for j in rotate:
    if "#" in j:
        rotate_2.append(j)

re_rorate = []
z = len(rotate_2[0])
for i in range(z):
    r_r = [row[i] for row in rotate_2]
    re_rorate.append(r_r)

for i in range(z):
    y = re_rorate[i]
    j ="".join(y)    
    print(j)

Measured memory_bytes: 3316
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
 *
 * @author silviase
 */
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);
        CManagement solver = new CManagement();
        solver.solve(1, in, out);
        out.close();
    }

    static class CManagement {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] sub = new int[n];
            for (int i = 0; i < n - 1; i++) sub[in.nextInt() - 1]++;
            for (int s : sub) out.println(s);
        }

    }
}



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

int main() {
    int m[10];
    
    int i;
    for(i = 0; i < 10; i++){
    	int a;
    	cin >> a;
    	m[i] = a;
    }
    sort(m, m + 10);
    
    cout << m[9] << endl;
    cout << m[8] << endl;
    cout << m[7] << endl;
    
    return 0;
}

Measured memory_bytes: 3124
from collections import deque

K = int(input())

que = deque(list(range(1,10)))

for _ in range(K-1):
    x = que.popleft()
    p = x % 10
    if p == 0:
        que.extend([10*x, 10*x+1])
    elif p == 9:
        que.extend([10*x+8, 10*x+9])
    else:
        que.extend([10*x + p - 1, 10*x + p, 10*x + p + 1])
print(que.popleft())

Measured memory_bytes: 11980
import java.util.*;
 
public class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    String S=sc.nextLine();
    String T=sc.nextLine();
    int shortest=1001;
	int data=0;
    char[] Schar=S.toCharArray();
    char[] Tchar=T.toCharArray();
    for(int i=0;i<Schar.length-Tchar.length+1;i++){
      data=0;
      for(int j=0;j<Tchar.length;j++){
       	if(Schar[i+j]!=Tchar[j]){
          data++;
        }
      }
	  if(data<shortest){
        shortest=data;
      }
       
    }
 
   System.out.println(shortest);   
  
  }
}

Measured memory_bytes: 35648
#include<stdio.h>

int main (void) {
    int w, h, x, y, r;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

    int top = y + r;
    int bottom = y - r;

    int right = x + r;
    int left = x - r;

    if(top <= h && bottom >= 0 && right <= w && left >= 0) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
const int maxm=1e5+5;
const int mod=1e9+7;
vector<int>g[maxm];
int fac[maxm];
int inv[maxm];
int d[maxm];
int n,k;
int ppow(int a,int b,int mod){
    int ans=1%mod;a%=mod;
    while(b){
        if(b&1)ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
void dfs(int x,int fa){
    for(int v:g[x]){
        if(v==fa)continue;
        dfs(v,x);
        d[x]++;
    }
}
void init(){
    fac[0]=1;
    for(int i=1;i<maxm;i++)fac[i]=fac[i-1]*i%mod;
    inv[maxm-1]=ppow(fac[maxm-1],mod-2,mod);
    for(int i=maxm-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
}
int A(int n,int m){
    if(m<0||m>n)return 0;
    return fac[n]*inv[n-m]%mod;
}
signed main(){
    init();
    cin>>n>>k;
    for(int i=1;i<n;i++){
        int a,b;cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(1,1);
    int ans=k*A(k-1,d[1])%mod;
    for(int i=2;i<=n;i++){
//        cout<<d[i]<<endl;
        ans=ans*A(k-2,d[i])%mod;
    }
    cout<<ans<<endl;
    return 0;
}
/*

*/


Measured memory_bytes: 14884
// abc042_c
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool checkNum(set<int> D, int N) {
  while (N > 0) {
    int a = N%10;
    for (auto x : D) {
      if (x == a) return false;
    }
    N/=10;
  }
  return true;
}

int main() {
  int N, K;
  cin >> N >> K;
  set<int> D;
  rep(i, K) {
    int tmp;
    cin >> tmp;
    D.insert(tmp);
  }
  int ans = inf;
  for (int i = N; i < 100000; ++i) {
    if (checkNum(D, i)) ans = min(ans, i);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,m=LI()

  l=LI()

  cnt=0

  for i in range(n-2):
    if l[i]+l[i+1]<=m:
      continue
    else:
      if l[i]>m:
        a=l[i+1]
        b=max(0,l[i]+l[i+1]-m)
        cnt+=b
        l[i+1]=0
      else:
        b=max(0,l[i]+l[i+1]-m)
        cnt+=b
        l[i+1]-=b

  cnt+=max(0,l[-1]+l[-2]-m)

  return cnt

print(main())


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

int main() { 
  int n; cin >> n;
  int m = 0;

  vector<int> a(n);
  vector<int> b(n);

  for(int i=0;i<n;i++){
    cin >> a.at(i);
    m = max(m, a.at(i));
  }

  b = a;

  sort(a.begin(), a.end());
  int s = a.at(n-2);

 for(int i=0;i<n;i++){
    if(m > b.at(i)){
      cout << m << endl;
    }else if(m == b.at(i)){
      cout << s << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3200
#include <iostream>
using namespace std;
int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  int all, max_all{0};
  int suger, max_suger{0};
  double dens, max_dens{-1.0};
  double limit_dens{E / (100.0 + E)};
  for (int a{0}; a <= F; a += A * 100) {
    for (int b{0}; a + b <= F; b += B * 100) {
      for (int c{0}; a + b + c <= F; c += C) {
        for (int d{0}; a + b + c + d <= F; d += D) {
          suger = c + d;
          all = a + b + suger;
          dens = static_cast<double>(suger) / all;
          if (dens > limit_dens) break;
          if (max_dens < dens) {
            max_all = all;
            max_suger = suger;
            max_dens = dens;
          }
        }
      }
    }
  }

  cout << max_all << " " << max_suger << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int d;
  cin >> d;
  cout << "Christmas";
  for (int i = d; i < 25; i++)
    cout << " Eve";
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello{
    public static void Main(){
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        Array.Reverse(a);
        string ans = string.Join(" ",a);
        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 8188
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 4000;
int const modulo = 1000000007;

int dp[5 + nmax][5 + nmax];
int sum[5 + nmax][5 + nmax];

int main() {
  int n, m, k;
  std::cin >> n >> m >> k;
  for(int i = 1;i < k; i++)
    dp[1][i] = 1;
  for(int i = 1;i <= m;i++)
    sum[1][i] = sum[1][i - 1] + dp[1][i];
  for(int i = 2; i <= (n + m - 1) / (k - 1); i++) {
    for(int j = 1; j <= m; j++){
      dp[i][j] = sum[i - 1][j];
      if(k <= j)
        dp[i][j] -= sum[i - 1][j - k];
      if(dp[i][j] < 0)
        dp[i][j] += modulo;
    }
    for(int j = 1;j <= m; j++) {
      sum[i][j] = sum[i][j - 1] + dp[i][j];
      if(modulo <= sum[i][j])
        sum[i][j] -= modulo;
    }
  }
  int result = 0;
  for(int i = n; 1 <= i; i -= (k - 1))
    for(int j = m; 1 <= j; j -= (k - 1)) {
      result += dp[(i + j - 1) / (k - 1)][j];
      if(modulo <= result)
        result -= modulo;
    }
  std::cout << result;
  return 0;
}


Measured memory_bytes: 97912
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main (int argc, char const *argv[])
{
    int64_t N;
    char s[11];
    int64_t initial_b = 0, final_a = 0, both = 0, ans = 0, flag = 0;

    scanf("%"PRId64, &N);
    for (int i = 0; i < N; i++) {
        int p = 0;
        scanf("%s", s);
        while (s[p]) {
            if ((s[p] == 'A') && (s[p + 1] == 'B')) ans++;
            p++;
        }
        if ((s[p - 1] == 'A') && (s[0] == 'B')) both++;
        else if (s[0] == 'B') initial_b++;
        else if (s[p - 1] == 'A') final_a++;
    }

    if (both) {
        ans += both - 1;
        if (initial_b) {
            ans += 1;
            initial_b--;
        }
        if (final_a) {
            ans += 1;
            final_a--;
        }
    }
    ans += initial_b > final_a ? final_a : initial_b;
    
    printf("%"PRId64"\n", ans);
}


Measured memory_bytes: 128
/*input
2 3 4
..#
###
*/

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
 
using namespace std;
 
/*******  All Required define Pre-Processors and typedef Constants *******/
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define tests int t; cin >> t; while(t--)
#define MP make_pair
#define PI acos(-1)
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
#define godspeed ios_base::sync_with_stdio(false); cin.tie(NULL);

int main() {
	godspeed;
	int a[6][6];
	int h, w, k;
	cin >> h >> w >> k;
	string s;
	rep(i, h) {
		cin >> s;
		rep(j, w) {
			a[i][j] = s[j] == '#';
		}
	}
	int num = 0;
	int r[h], c[w];
	rep(i, 1 << (h + w)) {
		int curr = 0;
		memset(r, 0, sizeof(r));
		memset(c, 0, sizeof(c));
		rep(j, h) r[j] = (i >> j) & 1;
		rep(j, w) c[j] = (i >> (j+h)) & 1;
		rep(j, h) {
			rep(k, w) {
				if(r[j] | c[k]) continue;
				curr += a[j][k];
			}
		}
		if (curr == k) num++;
	}
	cout << num << endl;
}

Measured memory_bytes: 3568
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())

max = 101
#if a < b:
#    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[-c])

Measured memory_bytes: 3060