akhauriyash/Code-Regression huggingface dataset:
/*
 * Author : Sadi
 * Mon 20/07/2020
 * 16:39:14.89
 */
#include <bits/stdc++.h>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int A, B;
    cin >> A >> B;
    for(int i = 10; i <= 1000; ++i) {
        if((int) (i * .08) == A && (int) (i * .1) == B) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << -1 << "\n";
    // int low = 10, high = 1000;
    // int mid;
    // while(low <= high) {
    //     mid = low + (high - low) / 2;
    //     cout << mid << endl;
    //     if((mid * .08 > A) && (mid * .1 > B)) {
    //         high = mid - 1;
    //     }
    //     else if ((mid * .08 < A) && (mid * .1 < B)) {
    //         low = mid + 1;
    //     }
    // }

    // cout << low << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>
#define MAX 100000

int parent(int i) { return i/2; }
int left(int i) { return 2*i; }
int right(int i) { return 2*i+1; }

int main()
{
  int A[MAX+1], H, i;
  scanf("%d",&H);

  for(i=1;i<=H;i++) scanf("%d",&A[i]);

  for(i=1;i<=H;i++)
  {
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=H)printf("left key = %d, ",A[left(i)]);
    if(right(i)<=H)printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k,cnt=0;
    cin>>a>>b>>c;
    cin>>k;
    while(a>=b){
        cnt++;
        b=b*2;
    }
    while(b>=c){
        cnt++;
        c=c*2;
    }
    if(cnt<=k)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include <cstdio>
#include <algorithm>
#include <set>
#include <cstring>
using namespace std;

typedef long long i64;
const int MAX_N = 100005;
const i64 inf = 0x3f3f3f3f3f3f3f3fLL;

int N, K, L[MAX_N], R[MAX_N];

int mn[MAX_N * 30], ls[MAX_N * 30], rs[MAX_N * 30];

void update(int &x, int L, int R, int l, int r, int val) {
  static int tot;
  if (!x) x = ++tot, mn[x] = N + 1;
  if (l <= L && R <= r) {
    mn[x] = val;
    return;
  }
  int mid = (L + R) >> 1;
  if (mid >= l) update(ls[x], L, mid, l, r, val);
  if (mid < r) update(rs[x], mid + 1, R, l, r, val);
}

int query(int x, int L, int R, int pos) {
  if (!x) return N + 1;
  if (L == R) return mn[x];
  int mid = (L + R) >> 1;
  if (mid >= pos) return min(mn[x], query(ls[x], L, mid, pos));
  else return min(mn[x], query(rs[x], mid + 1, R, pos));
}

int add(int x, int y) {
  x = (x + y) % K;
  if (x < 0) x += K;
  return x;
}

typedef pair<int, int> pii;
set<pii> S;
set<pii>::iterator iter1, iter2;

bool check(int x) {
  iter1 = S.upper_bound(make_pair(x, K));
  if (iter1 == S.begin()) return true;
  --iter1;
  return iter1->second < x;
}

void insert(int l, int r) {
  iter1 = S.upper_bound(make_pair(l, K));
  if (iter1 != S.begin()) --iter1;
  iter2 = S.upper_bound(make_pair(r, K));

  for (; iter1 != iter2;) {
    if (!(iter1->second < l || iter1->first > r)) {
      l = min(l, iter1->first);
      r = max(r, iter1->second);
      S.erase(iter1++);
    } else {
      ++iter1;
    }
  }
  S.insert(make_pair(l, r));
}

int main() {
  static int A[MAX_N], B[MAX_N];
  static i64 sum[MAX_N], dp[MAX_N][2], tot;

  int rt = 0;
  scanf("%d%d", &N, &K);
  for (int i = 1; i <= N; ++i) {
    scanf("%d%d", &A[i], &B[i]);
    sum[i] = (sum[i - 1] + A[i]) % K;
    L[i] = (-sum[i] * 2 % K + K) % K;
    R[i] = (-sum[i - 1] * 2 % K + K) % K;
    tot += A[i];
    if (B[i] == 1 && A[i] * 2 > K) {
      puts("-1");
      return 0;
    }
  }

  for (int i = N; i; --i) {
    int p = query(rt, 0, K - 1, L[i]);
    if (p != N + 1)
      dp[i][0] = min(dp[p][0] + add(L[p], -L[i]), dp[p][1] + add(R[p], -L[i]));
    p = query(rt, 0, K - 1, R[i]);
    if (p != N + 1)
      dp[i][1] = min(dp[p][0] + add(L[p], -R[i]), dp[p][1] + add(R[p], -R[i]));
    if (B[i] == 1) {
      int l = add(L[i], 1), r = add(R[i], -1);
      if (l <= r) update(rt, 0, K - 1, l, r, i);
      else update(rt, 0, K - 1, l, K - 1, i), update(rt, 0, K - 1, 0, r, i);
    }
  }

  i64 res = inf;
  for (int i = 1; i <= N; ++i) {
    if (check(L[i])) res = min(res, dp[i][0]);//, printf("%lld\n", dp[i][0]);
    if (check(R[i])) res = min(res, dp[i][1]);//, printf("%lld\n", dp[i][1]);
    
    if (B[i] == 1) {
      int l = add(L[i], 1), r = add(R[i], -1);
      if (l <= r) insert(l, r);
      else insert(l, K - 1), insert(0, r);
    }
  }

  printf("%lld\n", res + tot * 2);
  return 0;
}


Measured memory_bytes: 39808
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i=0;i<N;i++) cin >> a[i];

  int cnt = 0;
  for(int i=0;i<N;i++){
    if(a[i] % 2 == 1) cnt++;
  }

  if(cnt % 2 == 1){
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }

  return 0;
}

Measured memory_bytes: 640
import java.io.PrintWriter
import java.util.*

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}


fun main() {
    val N = nextInt()
    val C = Counter<String>()
    repeat(N) {
        C.add(next())
    }
    println("AC x ${C.get("AC")}")
    println("WA x ${C.get("WA")}")
    println("TLE x ${C.get("TLE")}")
    println("RE x ${C.get("RE")}")
}

class Counter<T> {
    val map = HashMap<T, Long>()

    fun add(k: T, d: Int = 1): Long {
        val v = map.getOrPut(k) { 0L }
        map[k] = v + d
        return v + d
    }

    fun addAll(m: Map<T, Int>) {
        for ((k, v) in m.entries) {
            add(k, v)
        }
    }

    fun get(a: T) = map.getOrDefault(a, 0)

    override fun toString(): String {
        return map.toString()
    }
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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 long long ll;

const long long INF = 1LL << 60;

int main()
{
    int N, K;
    cin >> N >> K;
    
    vector<ll> x(N);

    rep(i, N) cin >> x[i];
    int len_m = 0, len_p = 0;

    rep(i, N) {
        if (x[i] < 0) len_m++;
    }
    len_p = N - len_m;
    vector<ll> minus(len_m), plus(len_p);

    int cnt = 0;
    for (int i = len_m - 1; i >= 0; i--) {
        minus[cnt] = abs(x[i]);
        cnt++;
    }
    /*
    cout << len_m << endl;
    cout << len_p << endl;
    rep(i, len_m) {
        cout << minus[i] << " ";
    }
    cout << endl;
    */
    for (int i = len_m; i < N; i++) {
        plus[i - len_m] = x[i];
    }
    /*
    rep(i, len_p) {
        cout << plus[i] << " ";
    }
    cout << endl;
    */

    ll ans = INF;
    repd(i, 1, min(len_m + 1, K)) {
        if (K - i - 1 >= len_p) continue;
        ll tmp = minus[i - 1] * 2 + plus[K - i - 1];
        ans = min(ans, tmp);
    }

    repd(i, 1, min(len_p + 1, K)) {
        if (K - i - 1 >= len_m) continue;
        ll tmp = plus[i - 1] * 2 + minus[K - i - 1];
        ans = min(ans, tmp);
    }

    if (len_p >= K) {
        ans = min(ans, plus[K - 1]);
    }
    if (len_m >= K) {
        ans = min(ans, minus[K - 1]);
    }

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//std::cout << std::setfill('0') << std::right << std::setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}


int main(){
  int A,B,C;
  cin>>A>>B>>C;
  cout << min(B/A,C);
}


Measured memory_bytes: 256
N = int(input())
s = input()
t = input()
cnt=0
for i in range(N+1):
    if(i==0):
        if(s==t):
            cnt=N
            break
    else:
        x = s+t[-i:]
        if(x[:N]==s and x[-N:]==t):
            cnt=len(x)
            break

print(cnt)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int a,b;
	cin >> a >> b;
	cout << ceil((double(a+b))/2.0) <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	ll a,b,c,k;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
	printf("%lld",a+b+c-max(a,max(b,c))+(max(a,max(b,c))<<k));
}

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

#define int long long

const int N = 1e6 + 5;

int f[N], dp[N];

void compute() {
	for (int i = 1; i < N; ++i) {
		if (f[i] > 0) {
			if (f[i] > 1)
				dp[i] = 1;

			for (int j = 2; i * j < N; ++j)
				dp[i * j] = 1;
		}
	}

	return;
}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n, res = 0;
	cin >> n;

	int a[N];
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		++f[a[i]];
	}

	compute();

	for (int i = 0; i < n; ++i)
		res += !dp[a[i]];

	cout << res;

	return 0;
}

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

int main() {
  string S;
  ll sum(0);
  cin>>S;
  int len=S.size()-1;
  for (int bit(0);bit<(1<<len);bit++){
    ll tmp(0);
    string tmpi(1,S[0]); //char -> string
    for (int i = 0; i < len; ++i) {
      if (bit & (1<<i)) { // i が bit に入るかどうか
        tmp+=stoll(tmpi.c_str());
        tmpi=S[i+1];
      }else{
        string aa(1,S[i+1]);
        tmpi+=aa;
      }
    }
    tmp+=stoll(tmpi.c_str());
    sum+=tmp;
  }
  cout << sum<<endl;
}


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

using namespace std;
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define forn(i,N) for(int i=0;i<N;i++)
using namespace std;
using ll = long long int;

int main() {
//freopen("input.txt","rt",stdin);
ios::sync_with_stdio(false);
cin.tie(nullptr);

int a,b;
cin>>a>>b;
cout<<a*b<<endl;
}


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

int main() {
	int N, a, ans = 0;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> a;
		while (a % 2 == 0) {
			a /= 2;
			++ans;
		}
	}
	cout << ans;
}

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

int main(){
    int N, i, temp;
    int l[1000], r[1000];
    int ans = 0;

    cin >> N;

    for (i=0; i<N; i++){
        cin >> l[i] >> r[i];
    }

    for (i=0; i<N; i++){
        temp = r[i] - l[i] + 1;
        ans = ans + temp;
    }

        cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int res = 0;

    for (int a = 0; a <= A; a++){
        for (int b = 0; b <= B; b++){
            for (int c = 0; c <= C; c++){
                int total = 500*a + 100*b + 50*c;
                if (X == total){
                    res++;
                }
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, cnt int
	var input_data []int
	done := false
	fmt.Scan(&n)
	
	for i := 0; i < n; i++ {
		var in int
		fmt.Scan(&in)
		input_data = append(input_data, in)
	}

	for !done {
		for i := 0; i < n; i++ {
			if v := input_data[i]; v == 0 || v % 2 != 0 {
				done = true
				break
			} else {
				input_data[i] /= 2
			}
		}

		if ! done {
			cnt++
		}
	}
	
	fmt.Println(cnt)
}

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

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

    int n, m;
    cin >> n >> m;

    int a[105];
    int total = 0;
    for(int i=1; i<=n; i++) cin >> a[i], total+=a[i];

    int x = 0;

    for(int i=1; i<=n; i++){
        if(4*m*a[i] >= total){
            x++;
        }
    }
    if(x >= m){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

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

  ll l;
  cin >> l;

  ll r;
  REP(i, 20) {
    if((1LL<<i) <= l) {
      r = i;
    }
  }

  ll n = r+1, m = 0;
  vector<vector<pair<ll,ll>>> g(n);
  REP(i, n-1) {
    g[i].push_back({i+1, 0});
    g[i].push_back({i+1, 1LL<<i});
    m += 2;
  }
  for(ll i=n-2; i>=0; --i) {
    if(l - (1LL<<i) >= (1LL<<r)) {
      g[i].push_back({n-1, l-(1LL<<i)});
      l -= 1LL<<i;
      m++;
    }
  }

  cout << n << " " << m << endl;
  REP(i, n) {
    for(auto j: g[i]) {
      cout << i+1 << " " << j.first+1 << " " << j.second << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <cstdint>
#include <algorithm>

size_t gcd(size_t m, size_t n) {
  while (n) std::swap(m%=n, n);
  return m;
}

size_t lcm(size_t m, size_t n) {
  return m/gcd(m, n)*n;
}

std::vector<int> parse(const std::string &s) {
  std::vector<int> res;
  for (size_t i=0; i<s.length(); i+=2) {
    int cur=(s[i]-'0');
    cur <<= 4;
    cur |= (s[i+1]-'0');
    res.push_back(cur);
  }
  return res;
}

void compress(std::vector<int> &res) {
  std::vector<int> on;
  for (size_t i=0; i<res.size(); ++i)
    if (res[i])
      on.push_back(i);

  if (on.empty()) {
    res.assign(1, 0);
    return;
  }

  size_t div=res.size();
  for (size_t i=0; i<on.size(); ++i)
    div = gcd(div, on[i]);

  if (div == 1)
    return;

  std::vector<int> tmp(res.size()/div);
  for (size_t i=0; i<tmp.size(); ++i) {
    tmp[i] = res[div*i];
  }
  res = tmp;
}

void or_seq(std::vector<int> &res, const std::vector<int> &in) {
  size_t mul=res.size()/in.size();
  for (size_t i=0; i<in.size(); ++i) {
    res[mul*i] |= in[i];
  }
}

int solve_testcase() {
  size_t N;
  scanf("%zu", &N);

  std::vector<std::string> R(N);
  std::vector<std::vector<int>> T(N);
  for (size_t i=0; i<N; ++i) {
    char buf[2048+1];
    scanf("%s", buf);
    R[i] = buf;
    T[i] = parse(R[i]);
    compress(T[i]);
    // for (size_t j=0; j<T[i].size(); ++j)
    //   fprintf(stderr, "%d%c", T[i][j], j+1<T[i].size()? ' ':'\n');
  }

  size_t len=1;
  for (size_t i=0; i<N; ++i) {
    len = lcm(len, T[i].size());
    if (len > 1024)
      return !printf("Too complex.\n");
  }

  std::vector<int> res(len);
  for (size_t i=0; i<N; ++i)
    or_seq(res, T[i]);

  for (size_t i=0; i<len; ++i)
    printf("%02X", res[i]);

  printf("\n");
  return 0;
}

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

  for (int i=0; i<T; ++i)
    solve_testcase();
}



Measured memory_bytes: 2780
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
    map <char,int> m;
    string S;
    cin >> S;
    int size=S.size();
    REP(i,size){
    char a;
    a = S[i];
    m[a]++;
    }

    bool fl=true;
    for(char c='a';c<'z';c++){
        
        if(m[c]%2!=0){
            fl = false;
        }
    }
    if(fl){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <fstream>
#include <climits>
#include <cstdio>
#include <vector>
#include <string>
#include <memory>
#include <queue>
#include <cmath>
#include <list>
#include <set>
#include <map>


using namespace std;

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


int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int res=a*100+b*10+c;
    if(res%4==0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
S = input()

A = int(S[0:2])
B = int(S[2:])

if A <= 12 and B <= 12 and A > 0 and B > 0:
    print("AMBIGUOUS")
elif (A > 12 or A == 0) and B <= 12 and B > 0:
    print("YYMM")
elif (B > 12 or B == 0) and A <= 12 and A > 0:
    print("MMYY")
else:
    print("NA")

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

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

#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define ferrari ios_base::sync_with_stdio(false); cin.tie(NULL)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ll n, k;
	cin >> n >> k;
	n %= k;
	cout << min(n, abs(n - k));
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int	N, M, C;
	int i, j, count = 0, total;
	int A[100][20], B[20];

	scanf("%d%d%d", &N, &M, &C);

	for (i = 0; i < M; i++) {
		scanf("%d", &B[i]);
	}

	for (i = 0; i < N; i++) {
		total = 0;
		for (j = 0; j < M; j++) {
			scanf("%d", &A[i][j]);
			total += B[j] * A[i][j];
		}
		if (total + C > 0) {
			count++;
		}
	}
	printf("%d", count);
	return 0;
}

Measured memory_bytes: 128
while true do
  input = STDIN.gets
  h_w = input.split(" ")
  h = h_w[0].to_i
  w = h_w[1].to_i
  if (h == 0) && (w == 0)
    break
  end
  for i in 1 .. h do
    for j in 1 .. w do
      if i % 2 == 0 && j % 2 == 0 then
        print "#"
      elsif i % 2 == 0 && j % 2 != 0 then
        print "."
      elsif i % 2 != 0 && j % 2 == 0 then
        print "."
      else
        print "#"
      end
    end
      print "\n"
  end
  print "\n"
end

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

int main() {
	char x, y;
	cin >> x >> y;
	if (x == y) {
		cout << "=" << endl;
	} else if (x < y) {
		cout << "<" << endl;
	} else if (x > y) {
		cout << ">" << endl;
	}
}


Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: f64,
        k: f64,
    }

    println!("{}", k * (k - 1.).powf(n - 1.))
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n;
    cin>>n;
    int p[n];
    rep(i,0,n-1) cin>>p[i];
    sort(p,p+n);
    p[n-1] = p[n-1]/2;
    int ans=0;
    rep(i,0,n-1) ans += p[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())

is_possible = False

for i in range(n+1):
    for j in range(n-i+1):
        k = n - i - j
        total = i*10000 + j*5000 + k*1000
        if total == y:
            is_possible = True
            print("{} {} {}".format(i, j, k))
            break
    if is_possible:
        break

if is_possible is False:
    print("-1 -1 -1")


Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0] * q
c = [0] * q
for i in range(q):
    b[i], c[i] = map(int, input().split())

num_dict = dict()
for i in a:
    if i in num_dict.keys():
        num_dict[i] += 1
    else:
        num_dict[i] = 1

ans = 0       
for k, v in num_dict.items():
  ans += k*v
 
for i in range(q):
    if b[i] in num_dict:
        if c[i] in num_dict:
            ans += (c[i] - b[i]) * num_dict[b[i]]
            num_dict[c[i]] += num_dict.pop(b[i])
        else:
            ans += (c[i] - b[i]) * num_dict[b[i]]
            num_dict[c[i]] = num_dict.pop(b[i])
    #print(num_dict)
    print(ans)

Measured memory_bytes: 26928
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){
    long long int a, b, m;
    cin >> a >> b >> m;
    vector<long long int> va(a), vb(b);
    long long int mina = linf, minb = linf, result = linf;
    REP(i,a){
        cin >> va[i];
        mina = min(va[i], mina);
    }
    REP(i,b){
        cin >> vb[i];
        minb = min(vb[i], minb);

    }
    result = min(result, mina + minb);
    long long int tmpx, tmpy, tmpc;
    REP(i,m){
        cin >> tmpx >> tmpy >> tmpc;
        result = min(result, va[tmpx - 1] + vb[tmpy - 1] - tmpc);
    }
    cout << result << endl;


    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int A, B;
  cin >> A >> B;

  int ans = 0;

  for (int a = 1; a < 10; a++){
    rep(b,10){
      rep(c,10){
        int x = 10001 * a + 1010 * b + 100 * c;
        if (x >= A && x <= B){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include <numeric>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a); '\n';


int main() {
	string s; cin >> s;
	int n = s.size();
	vector<int> arr(n + 1, 0);
	rep(i, n) {
		if (s[i] == '<') arr[i + 1] = max(arr[i] + 1, arr[i + 1]);
	}
	for (int i = n - 1; i > -1; --i) {
		if (s[i] == '>') arr[i] = max(arr[i], arr[i + 1] + 1);
	}
	ll ans = 0;
	rep(i, n + 1) {
		ans +=arr[i];
	}
	cout << ans;
}
	

Measured memory_bytes: 2820
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
string S;
cin >> S;
if (S.at(0) == S.at(1) && S.at(0) == S.at(2) && S.at(0) == S.at(3)) cout << "No" << endl;
else if (S.at(0) == S.at(1) && S.at(2) == S.at(3)) cout << "Yes" << endl;
else if (S.at(0) == S.at(2) && S.at(1) == S.at(3)) cout << "Yes" << endl;
else if (S.at(0) == S.at(3) && S.at(1) == S.at(2)) cout << "Yes" << endl;
else cout << "No" << endl;


return 0;
}


Measured memory_bytes: 256
from collections import deque

inf = float('inf')

N, M, S, T = map(int, input().split())
S -= 1
T -= 1

have = 10 ** 15

es = [[] for _ in range(N)]
# es[u]:=(u,a,b), 都市u(0-indexed)の隣接頂点v(0-indexed)とコストa,b

for _ in range(M):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    es[u].append((v, a, b))
    es[v].append((u, a, b))

cost_a = [inf] * N
cost_a[S] = 0

q = deque()
q.append((S, 0))
while q:
    u, c = q.popleft()
    for v, a, _ in es[u]:
        if cost_a[v] > (c + a):
            cost_a[v] = (c + a)
            q.append((v, c + a))
# print(cost_a)

cost_b = [inf] * N
cost_b[T] = 0

q = deque()
q.append((T, 0))
while q:
    u, c = q.popleft()
    for v, _, b in es[u]:
        if cost_b[v] > (c + b):
            cost_b[v] = (c + b)
            q.append((v, c + b))
# print(cost_b)

cost = [None for _ in range(N)]
t = inf
for i in reversed(range(N)):
    # 移動年i, 0-indexed
    # 都市番号i以上の都市で両替可能
    t = min(t, cost_a[i] + cost_b[i])
    cost[i] = t
    # 都市iで両替する場合の支払い合計
    # costを最小としたい

# print(cost)

for i in range(N):
    print(have - cost[i])


Measured memory_bytes: 58040
#include<bits/stdc++.h>
using namespace std;
#define  inf 2e18
#define  mod 1000000007
#define  bg begin()
#define  en end()
#define  ll long long int
#define  pb push_back
#define  mp make_pair
#define  vi vector<int>
#define  vll vector<long long int>
#define  vpll vector<pair<long long int,long long int> >
#define  vpii vector<pair<int,int> >
#define  vstr vector<string>
#define  mpii map<int ,int>
#define  mpll map<long long int,long long int >
#define  max3(a,b,c) max(a,max(b,c))
#define  min3(a,b,c) min(a,min(b,c))
#define  w(t) ll t; cin>>t; while(t--)
#define  vin(v,n) for(int i=0;i<n;i++){ll x;cin>>x; v.pb(x);}
#define  for0(i,n) for(int i=0;i<n;i++)
#define  for1(i,n) for(int i=1;i<=n;i++)
#define  forv(it,v) for(auto it=v.begin();it!=v.end();it++)
#define  mem(a,val) memset(a,val,sizeof(a))
#define  Sort(vec) sort(vec.begin(),vec.end())
#define  RSort(vec) sort(vec.rbegin(),vec.rend())
#define  eb emplace_back
#define  bs binary_search
#define  lb(v,a) lower_bound(v.begin(),v.end(),a)
#define  ub(v,a) upper_bound(v.begin(),v.end(),a)
#define  deb1(x) cerr<<#x<<": "<<x<<" "<<endl
#define  deb2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define  deb3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define  deb4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define  FIFO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define  yes "YES"
#define  no "NO"
#define  PI 3.141592653589793238462643383279502884L
ll Ceil(ll a, ll b) {return a / b + (a % b != 0);}
ll fastModExp(ll a, ll b) { ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
ll Logn(ll n, ll r)
{
    return (n > r - 1) ? 1 + Logn(n / r, r) : 0;
}
// 2- Dimensional vector:- vector<vector<int> > v(n, vector<int> (26, 0));

mpll mpx, mpx2;
int main()
{
    FIFO;
    ll x, n;
    cin >> x >> n;
    vll v;
    vin(v, n);
    Sort(v);
    int k;
    for0(i, n)
    {   mpx[v[i]] = 1;

    }
    ll a = x, b = x;
    while (true)
    {
        if (mpx[a] == 0)
        {
            break;
        }
        if (mpx[b] == 0)
            break;
        a++;
        b--;
    }
    if (mpx[a] == 0 && mpx[b] == 0)
    {
        if (abs(x - a) < abs(x - b))
            cout << a << endl;
        else if (abs(x - a) == abs(x - b))
            cout << min(a, b) << endl;
        else cout << b << endl;
    }
    else if (mpx[a] == 0)
        cout << a << endl;
    else if (mpx[b] == 0)
        cout << b << endl;

    return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long LL;

int n, k, r, s, p;

int func(char a, char b){
    if(a==b)
        return 0;
    
    if(a == 'r'){
        if(b == 's')
            return 0;
        if(b == 'p')
            return p;
    }
    
    if(a == 's'){
        if(b == 'p')
            return 0;
        if(b == 'r')
            return r;
    }
    
    if(a == 'p'){
        if(b == 's')
            return s;
        if(b == 'r')
            return 0;
    }
}

int main() {
    fastio
    
    cin >> n >> k >> r >> s >> p;
    string str;
    cin >> str;
    vector< vector<LL> > dp(n, vector<LL> (3, 0));
    int res=0;
    int j ;
    // cout<<func('r', 's')<<endl;
    // cout<<func('r', 'p')<<endl;
    // cout<<func('s', 'r')<<endl;
    // cout<<func('r', 'r')<<endl;
    for(int i = 0; i<k ; i++){
        
        j = i;
        
        dp[j][0] = func(str[j], 'r');
        dp[j][1] = func(str[j], 's');
        dp[j][2] = func(str[j], 'p');
        j += k;
        while(j<n){
            int rr , ss, pp;
            rr =  func(str[j], 'r');
            ss =  func(str[j], 's');
            pp =  func(str[j], 'p');
            dp[j][0] = max(dp[j-k][1], dp[j-k][2]) + rr;
            dp[j][1] = max(dp[j-k][0], dp[j-k][2]) + ss;
            dp[j][2] = max(dp[j-k][1], dp[j-k][0]) + pp;
            j = j+k;
        }
        j = j-k;
        res += max({ dp[j][0], dp[j][1], dp[j][2] });
        
    }
     
   cout<<res<<endl;
	return 0;
}






Measured memory_bytes: 5840
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    let b=read::<i32>();
    println!("{}",(a+b+1)/2)
}

Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<cmath>

int main() {
	double x1, y1, x2, y2;
	std::cin >> x1 >> y1 >> x2 >> y2;

	//std::cout << sqrt(pow((x2 - x1), 2) + pow((y2 - y1) ,2)) << std::endl;

	printf("%8f\n", sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)));
}


Measured memory_bytes: 3204
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

    public static void main(String[] args) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        City[] all = new City[M];
        ArrayList<ArrayList<City>> cities = new ArrayList<>();
        for (int i = 0; i <= N; i++) {
            cities.add(new ArrayList<>());
        }
        for (int i = 0; i < M; i++) {
            int P = Integer.parseInt(sc.next());
            int Y = Integer.parseInt(sc.next());
            all[i] = new City(Y, P);
            cities.get(P).add(all[i]);
        }
        for (int i = 0; i <= N; i++) {
            if (cities.get(i).isEmpty()) continue;
            Collections.sort(cities.get(i));
            for (int j = 0; j < cities.get(i).size(); j++) {
                cities.get(i).get(j).order = j + 1;
            }
        }
        PrintWriter writer = new PrintWriter(System.out);
        for (City c : all) {
            writer.printf("%06d%06d\n", c.pref, c.order);
        }
        writer.flush();
    }

    static class City implements Comparable<City> {
        int year;
        int pref;
        int order;

        public City(int year, int pref) {
            this.year = year;
            this.pref = pref;
        }

        @Override
        public int compareTo(City o) {
            return Integer.compare(this.year, o.year);
        }
    }
}


Measured memory_bytes: 114184
#include <iostream>
using namespace std;
int main()
{
int A,B;cin >> A >> B;
A = (A + 11)%13;
B = (B + 11)%13;
if (A > B)cout << "Alice" << endl;
if (A < B)cout << "Bob" << endl;
if (A == B)cout << "Draw" << endl;
system ("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    if (n * 2 <= m) {
        m -= n * 2;
        ans += n;
        ans += m / 4;
    } else ans += m / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int h,w;
    char s[51][51];
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++)scanf("%s",s[i]);
    int dx[]={-1,-1,-1,0,0,1,1,1};
    int dy[]={1,0,-1,1,-1,1,0,-1};
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='#')continue;
            int cnt=0;
            for(int k=0;k<8;k++){
                if(s[i-dy[k]][j-dx[k]]=='#')cnt++;
            }
            s[i][j]=cnt+48;
        }
    }
    for(int i=0;i<h;i++)printf("%s\n",s[i]);
    return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c,k,sum=0;
	cin>>a>>b>>c>>k;
	if(a>=k){
		sum+=k;
		k=0;
		cout<<sum<<endl;
		return 0;
	}else{
		k-=a;
		sum+=a;
	}
	if(b>=k){
		k=0;
		cout<<sum<<endl;
		return 0;
	}else{
		k-=b;
	}
	sum-=min(c,k);
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3632
n,m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort
d = Array.new(m){ gets.split.map(&:to_i) }.sort_by{|a|-a[1]}

solve = -> do
  i = 0
  d.each do |b,c|
    b.times do
      return if i >= n
      a[i] = c if a[i] < c
      i += 1
    end
  end
end

solve[]
puts a.inject(:+)

Measured memory_bytes: 20752
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else { return false; } }
const long long INF = 1LL << 60;

long long avoidmax(long long *a, int idx) {
  long long maxn = -INF;
  for (int i = 0; i < 3; i++) {
    if (i == idx) continue;
    maxn = max(maxn, a[i]);
  }
  return maxn;
}

int main() {
  int N; cin >> N;
  long long ary[110000][3];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> ary[i][j];
    }
  }

  long long dp[110000][3];
  for (int i = 0; i < 110000; i++){
    for (int j = 0; j < 3; j++) {
      dp[i][j] = -INF;
    }
  }
  for (int i = 0; i < 3; i++) {
    dp[0][i] = 0;
  }
  
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < 3; j++) {
      chmax(dp[i][j], avoidmax(dp[i - 1], j) + ary[i - 1][j]);
    }
  }

  long long ans = -INF;
  for (int i = 0; i < 3; i++) {
    ans = max(ans, dp[N][i]);
  }

  cout << ans << endl;
  
  //for (int i = 0; i <= N; i++) {
  //  for (int j = 0; j < 3; j++) {
  //    cout << dp[i][j] << " ";
  //  }
  //  cout << "\n";
  //}

  return 0;
}


Measured memory_bytes: 5376
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var n = parseInt(tmp[0], 10);
    var k = parseInt(tmp[1], 10);

    var H =[];
    for(i=1;i<=n;i++){
        var r = parseInt(input[i], 10);
        H[i]=r;
    }
 // console.log(H);
    H.shift();
    H.sort((a,b) =>(a-b))
    //console.log(H);

    
        var i=0; ii =i+k-1;
        var HH = H[ii]-H[i];var hbox=HH;
      //  console.log(HH);
        for(i=0;i<n-k+1;i++){
          var ii =i+k-1; 
          if( HH > H[ii]-H[i]){
            var  HH=H[ii]-H[i];
                             //     console.log(H[ii],H[i]);
                              //    console.log(hbox);
                                }

          }
          console.log(HH);

	
	
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 28996
#include <stdio.h>

int n,k;
int ans=1000000;
void dfs(int val,int cost){
    if(val==n){
        if(cost<ans)ans=cost;
        return;
    }
    dfs(val+1,cost*2);
    dfs(val+1,cost+k);
}
int main()
{
    scanf("%d",&n);
    scanf("%d",&k);
    dfs(0,1);
    printf("%d\n",ans);
}

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

int main() {
  vector<int> start(100);
  vector<int> number(100);
  for(int i = 0; i < 100; ++i) {
    start[i] = 5 * i;
    number[i] = (i % 5 == 1 ? 5 : 2);
    // t + 17*(i%2) + 3*(i%3) + 19;
  }
  vector<int> sheet(17, -1);
  vector<int> wait(100, -1);
  vector<int> end(100, -1);
  queue<int> que;
  for(int t = 0; ; ++t) {
    for(int i = 0; i < 100; ++i) {
      if(end[i] == t) {
        for(int j = 0; j < 17; ++j) {
          if(sheet[j] == i) sheet[j] = -1;
        }
      }
      if(start[i] == t) {
        que.push(i);
      }
    }
    while(!que.empty()) {
      int n = number[que.front()];
      int s = -1;
      for(int i = 0; i < 17; ++i) {
        int c = 0;
        for(int j = i; j < 17; ++j) {
          if(sheet[j] == -1) ++c;
          else break;
        }
        if(c >= n) {
          s = i;
          break;
        }
      }
      if(s != -1) {
        int k = que.front(); que.pop();
        for(int j = 0; j < n; ++j) {
          sheet[s + j] = k;
        }
        wait[k] = t - start[k];
        end[k] = t + 17*(k%2) + 3*(k%3) + 19;
      }
      else {
        break;
      }
    }
    bool f = true;
    for(int i = 0; i < 100; ++i) {
      if(end[i] == -1) f = false;
    }
    if(f) break;
  }
  for(int q; cin >> q; ) {
    cout << wait[q] << endl;
  }
}

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

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi					3.14159265359
ll INF=1e18+10;
ll MOD=1000000007;

int main()
{
    ll a,b;cin>>a>>b;
    ll k=(a+b)/2;
    if(a==b)cout<<0;
    else if(abs(a-k)==abs(b-k))cout<<k;
    else cout<<"IMPOSSIBLE\n";
}


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

using namespace std;

typedef long long ll;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
  
  ll n, k, q;
  cin >> n >> k >> q;
  
  vector<ll> v(n, k - q);
  rep(i, q){
    ll a;
    cin >> a;
    a--;
    v[a]++;
  }
  
  rep(i, n){
    if(v[i] > 0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }

}


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

int R=1,C=1,H[2000010]={0},N[2000010]={2100000000};

void hin(int a){
  int i=C++;
  for(N[R]=a;a>N[H[i/2]];i/=2)
  	H[i]=H[i/2];
  H[i]=R++;
}
int hout(){
  int rt=H[1],nt=1,i=0,k=H[--C];
  while(nt-i){
    H[i=nt]=k;
    if(i*2  <C&&N[  k  ]<N[H[i*2  ]])
		H[i]=H[nt=i*2  ];
    if(i*2+1<C&&N[H[nt]]<N[H[i*2+1]])
		H[i]=H[nt=i*2+1];
  }
  return rt;
}
void prih(){
  int i,j=0;
  for(i=0;i<C;i++){
    if(i==1<<j){
      printf("\n");
      j++;
    }
    printf("%d ",N[H[i]]);
  }
  printf("\n");
}
int main(){
  int a;
  char s[1000];
  while(scanf("%s",s),s[2]-'d'){
    if(s[0]=='i'){
      scanf("%d",&a);
      hin(a);
    }
    else printf("%d\n",N[hout()]);
  }    
  return 0;
}



Measured memory_bytes: 11496
#include<iostream>
using namespace std;
int main() {
   while (1) {
       int H, W;
       cin >> H >> W;
       if (H == 0 && W == 0) { break; }
       for (int i = 0; i<H; i++) {
           for (int j = 0; j<W; j++) {
               cout << "#";
           }
           cout << endl;
       }
       cout << endl;
   }
}


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

int n, s[205][205], mnlen, lay[205], mx, l[205], d[205][205];
char c;

void bye() {
    printf("-1\n");
    exit(0);
}

void f(int x, int y) {
    lay[x] = y;
    for ( int i = 1; i <= n; i++ ) {
        if ( s[x][i] ) {
            if ( lay[i] ) {
                if ( lay[i] % 2 == y % 2 ) bye();
            }
            else {
                f(i, y + 1);
            }
        }
    }
    return;
}

void g(int x, int y) {
    l[x] = y;
    mx = max(mx, y);
    for ( int i = 1; i <= n; i++ ) {
        if ( s[x][i] ) {
            g(i, y + 1);
        }
    }
    return;
}

int main() {
    scanf("%d", &n);
    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 1; j <= n; j++ ) {
            scanf("%c", &c);
            while ( c != '1' && c != '0' ) scanf("%c", &c);
            s[i][j] = c - '0';
        }
    }
    f(1, 1);
    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 1; j <= n; j++ ) {
            d[i][j] = 1e+9;
            if ( i == j ) d[i][j] = 0;
        }
    }
    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 1; j <= n; j++ ) {
            if ( s[i][j] ) d[i][j] = 1;
        }
    }
    for ( int k = 1; k <= n; k++ ) {
        for ( int i = 1; i <= n; i++ ) {
            for ( int j = 1; j <= n; j++ ) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                d[j][i] = d[i][j];
            }
        }
    }
    int mx = 0;
    for ( int i = 1; i <= n; i++ ) {
        for ( int j = 1; j <= n; j++ ) {
            mx = max(mx, d[i][j]);
        }
    }
    printf("%d\n", mx + 1);
    return 0;
}

Measured memory_bytes: 4160
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    int n=s.size();
    string t="AGCT";
    int ans=0,tans=0;
    rep(i,n) {
        bool flag=0;
        rep(j,4) {
            if (s[i]==t[j]) flag=1;
        }
        if (flag) {
            ++tans;
            ans=max(ans,tans);
        } else {
            tans=0;
        }
    }
    cout << ans << endl;

    return 0;   
}


Measured memory_bytes: 256
object Main{
  def main(args: Array[String]){
    val input=io.Source.stdin.getLines().mkString("\n");
    println(solve(input).trim());
  }

  def solve(input:String):String={
    val Array(a,b)=input.split(" ").map(_.toInt)
    List(a-2*b,0).max.toString
  }
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

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

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

int a[MAXN];
set<int> st;

void solve(){
	int n, k;
	scanf("%d%d", &n, &k);
	REP(i, 0,n) {
		scanf("%d", &a[i]);
	}
	int cnt = 0, last = 0;
	int ans = 1;
	REP(i, 0, k) {
		st.insert(a[i]);
		if (i && a[i] < a[i - 1]) {
			last = i;
		}
	}
	if (last == 0) {
		cnt = 1;
	}
	REP(i, k, n) {
		if (a[i] < a[i - 1]) {
			last = i;
		}
		bool changed = true;
		if (last <= i - k + 1) {
			cnt++;
			changed = false;
		}
		
		if (!changed) {
			if (cnt == 1) {
				ans++;
			}
		} else {
			int mn = *st.begin();
			int mx = *st.rbegin();
			if (!(mn == a[i - k] && mx < a[i])) {
				ans++;
			}
		}
		
		st.erase(a[i - k]);
		st.insert(a[i]);
	}
	
	/*if (cnt > 1) {
		ans -= (cnt - 1);
	}*/
	
	printf("%d\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 10368
k = int(input())
from queue import Queue

q = Queue()
for i in range(1,10):
    q.put(i)

for i in range(k):
    x = q.get()
    if x%10 != 0:
        q.put(10*x+x%10-1)
    q.put(10*x+x%10)
    if x%10 != 9:
        q.put(10*x+x%10+1)

print(x)

Measured memory_bytes: 12452