akhauriyash/Code-Regression huggingface dataset:
from bisect import bisect_left, bisect_right

N, M = map(int, input().split())
Ss = input()

OKs = []
for i, S in enumerate(Ss):
    if S == '0':
        OKs.append(i)
#print('OKs:', OKs)

dp = [0] * (N+1)
for i in range(N+1):
    j = bisect_left(OKs, i-M)
    dp[i] = OKs[j]
#print('dp:', dp)

anss = []
i = N
while True:
    iPrev = dp[i]
    if iPrev == i:
        anss = []
        break
    if iPrev < 0:
        iPrev = 0
    anss.append(i-iPrev)
    if iPrev == 0:
        break
    i = iPrev

if not anss:
    print(-1)
else:
    print(' '.join(map(str, anss[::-1])))


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

using namespace std;

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

	vector<int> d(n);
	for(auto& x : d) {
		cin >> x;
	}

	int result = 0;
	for(auto i = 0; i < n; ++i) {
		for(auto j = i + 1; j < n; ++j) {
			result += d[i] * d[j];
		}
	}

	cout << result << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,i,j;
	int a,b,c,d,e,f,g,h;
	int x[1001],y[1001],z[1001],w[1000];
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h);
			x[i]=(a*e)+(-1*f*b)+(-1*g*c)+(-1*h*d);
			y[i]=(a*f)+(e*b)+(h*c)+(-1*g*d);
			z[i]=(a*g)+(-1*h*b)+(e*c)+(f*d);
			w[i]=(a*h)+(g*b)+(-1*f*c)+(d*e);
		}	
		for(i=0;i<n;i++) printf("%d %d %d %d\n",x[i],y[i],z[i],w[i]);
	}
	return 0;
}	

Measured memory_bytes: 2592
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	
	public Main() {
		FastScanner scanner = new FastScanner();
		int D = scanner.nextInt();
		int T = scanner.nextInt();
		int S = scanner.nextInt();
		
		if ( (D+S-1) / S <= T){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private int readByte() {
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}
	
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 32508
let () =
  let rec game a b = function
      0 -> Printf.printf "%d %d\n" a b
    | i ->
      let x,y = Scanf.scanf "%s %s\n"
          (fun x y -> if x>y then 3,0 else if x<y then 0,3 else 1,1) in
      game (a+x) (b+y) (i-1)
  in
  let times = read_int () in
  game 0 0 times

Measured memory_bytes: 2636
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <regex>
#include <initializer_list>
#include <deque> 
#define DBL_MIN 0.000000000000001

#include <iostream>
using namespace std;

int main(void){
    long N,M;
    cin >> N >> M;
    
    if(M < N){
        N = M;
    }

    vector<long> point;
    vector<long> dis;

    for(int i =0; i < M; i++){
        long tmp;
        cin >> tmp;
        point.push_back(tmp);
    }

    sort(point.begin(), point.end());
    long sum = 0;
    for(int i =0; i < M-1; i++){
        long tmp_dis = point[i+1] - point[i];
        dis.push_back(tmp_dis);
        sum += tmp_dis;
    }
    sort(dis.begin(), dis.end(), std::greater<long>());
    long aima = 0;
    for(int i =0; i < N-1; i++){
        aima += dis[i];
    }
    cout << sum - aima << endl;
    return 0;
}



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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  if( A > B ) { puts("0"); return 0; }
  if( N == 1 ) {
    if( A == B ) puts("1");
    else         puts("0");
    return 0;
  }
  cout << ( A + B * ( N - 1LL ) ) - ( A * ( N - 1LL ) + B ) + 1LL << endl;
  
  compute();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define ret return
#define all(vl) vl.begin(),vl.end()
#define sor sort 
#define cl clear
#define m_p make_pair 
#define sz(a) a.size()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin>>s;
	string t;
	t = s;
	reverse(all(s));
	ll ans = 0;
	for(int i=0;i<s.size();i++)
		ans+=s[i]!=t[i];
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 3636
N = int(input())
x = list(map(int,input().split()))

left = min(x)
right = max(x)
ans = float('inf')

for p in range(left,right+1):
  summed = 0
  
  for xi in x:
    summed += (xi -p)**2
  ans = min(ans,summed)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char c1,c2;int cnt=0;
	cin>>c2;
	while(cin>>c1)
	{
		if(c1!=c2) ++cnt;
		c2=c1;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int n=a.length(),m=b.length();
    int dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(a[i-1]==b[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    // cout<<dp[n][m]<<endl;
    int x=n,y=m;
    string s="";
    while(x>0 && y>0)
    {
        if(a[x-1]==b[y-1])
        {
            s=a[x-1]+s;
            x--;
            y--;
        }
        else
        {
            if(dp[x][y]==dp[x][y-1])
            {
                y--;
            }
            else
            {
                x--;
            }
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 38824
package main

import "fmt"

func main() {
	var S, T string
	fmt.Scan(&S, &T)
	ans := 0
	if S[0] == T[0] {
		ans++
	}
	if S[1] == T[1] {
		ans++
	}
	if S[2] == T[2] {
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> T(N);
  vector<int> A(N);
  for(int i=0;i<N;i++)  cin >> T.at(i) >> A.at(i);

  long long Tsum=T.at(0);
  long long Asum=A.at(0);
  for(int i=0;i<N;i++){
    long long x=(Tsum+T.at(i)-1)/T.at(i);
    long long y=(Asum+A.at(i)-1)/A.at(i);
    long long z=max(x,y);
    long long Tnext=T.at(i)*z;
    long long Anext=A.at(i)*z;
    if(Tsum<=Tnext && Asum<=Anext){
      Tsum=Tnext;
      Asum=Anext;
    }
  }
  cout << Tsum+Asum << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver2.2.8
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,k) upper_bound(ALL(a),k)-lower_bound(ALL(a),k)
#define BIGGER(a,k) a.end()-upper_bound(ALL(a),k)
#define SMALLER(a,k) lower_bound(ALL(a),k)-a.begin()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(J,0,a.size()){if(!a[J].empty()){Verr(a[J]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 998244353
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n;
  cin >> n;
  Vi a(n);
  Vin(a);
  
  if(a[0]!=0) {cout<<0<<endl;return 0;}
  
  int maxx = *max_element(ALL(a));
  Vi are(maxx+1);
  
  rep(i,0,n){
    are[a[i]]++;
  }
  
  rep(i,0,maxx){
    if(are[i]==0) {cout<<0<<endl;return 0;}
  }
  
  if(are[0]>=2) {cout<<0<<endl;return 0;}
  
  //Vout(are);
  
  int ans = 1;
  rep(i,1,maxx+1){
    ans = ans*(mypow(are[i-1],are[i],MOD))%MOD;
  }
  ans %= MOD;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  P(min(n * a, b));
  return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
int Fib(int);
int F[45];
int main(){
  int n,x;
  scanf("%d",&n);
  x=Fib(n);
  printf("%d\n",x);
  return 0;
}

int Fib(int n){
  int m;
  if(n==0||n==1){
    F[n]=1;
    return F[n];
  }
  if(F[n]!=0)
    return F[n];
  F[n]=Fib(n-1)+Fib(n-2);
  return F[n];
}

Measured memory_bytes: 596
function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s[this._y++].split(" ");
    return f?s:s.map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};
var o=new gets(require("fs").readFileSync("/dev/stdin","utf8"));
function gcd(a,b){return b?gcd(b,a%b):a;}

console.log(main());
function main(){
  var n = o.a();
  var m = o.a();
  var s = o.a(1);
  var t = o.a(1);
  var g = gcd(n,m);
  var h = n * m / g;
  n /= g;
  m /= g;
  for(var i = 0; i < g; i++){
    if(s[i*n] !== t[i*m])return -1;
  }
  return h;
}

Measured memory_bytes: 21064
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
int h[120000];
int m[120000];
int ans;
int n;


int main()
{
    cin >> n;
    for (int i=0; i<n; ++i)
    {
        cin >> h[i];
        if (i!=0 && h[i]<=h[i-1])
            m[i] = m[i-1] + 1;
        else m[i] = 0;
        ans = max(ans, m[i]);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main(void)
{
    char a[128], b[128];
    scanf("%s %s", a, b);
    char *pa = a;
    char *pb = b;
    if (strlen(a) == strlen(b)) {
        while (*pa != '\0') {
            if (*pa > *pb) {
                puts("GREATER");
                return 0;
            } else if (*pa < *pb) {
                puts("LESS");
                return 0;
            }
            ++pa;
            ++pb;
        }
        puts("EQUAL");
        return 0;
    }
    if (strlen(a) > strlen(b)) {
        puts("GREATER");
        return 0;
    }
    puts("LESS");
    return 0;
}


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

int n, l[10], sum;

int main() {
    cin >> n;
    rep(i, n) cin >> l[i];
    sort(l, l + n);
    rep(i, n - 1) sum += l[i];
    cout << (sum > l[n-1] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import bisect
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
timea=[0]
timeb=[0]
time=0
ans=0
for i in range(N):
    time+=A[i]
    if time>K:
        break
    timea.append(time)
time=0
for i in range(M):
    time+=B[i]
    if time>K:
        break
    timeb.append(time)
for i in range(len(timea)):
    b=K-timea[i]
    if b<0:
        break
    num=bisect.bisect_right(timeb,b)
    num+=i-1
    ans=max(ans,num)
if ans==10**10:
    print(0)
else:
    print(ans)

Measured memory_bytes: 40496
def main():
    n = int(input())
    h = list(map(int, input().split()))
    res = [0]*n
    res[0] = 0
    res[1] = abs(h[0]-h[1])
    for i in range(2, n):
        res[i] = min(res[i-1]+abs(h[i]-h[i-1]), res[i-2]+abs(h[i]-h[i-2]))

    print(res[-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 84820
#include <iostream>
#include <vector>
#include <algorithm>
// #include <string>
// #include <map>
// #include <set>
// #include <cmath>

// #define MOD 1000000007

using namespace std;
// typedef unsigned long long ull;
typedef long long ll;

// void p() {
//     cout << "\n";
// }
// template<class Head, class... Body>
// void p(Head head, Body... body) {
//     cout << head << ",";
//     p(body...);
// }

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    for (const auto i : v) {
        os << i << " ";
    }
    os << "]";
    return os;
}

int N, K;

bool necessary(int idx, const vector<ll>& a) {
    if (a[idx] >= K) {
        return true;
    }

    vector<vector<bool>> dp(N+1);
    for (int i = 0; i < N+1; ++i) {
        dp[i].resize(K+1, false);
    }
    dp[0][0] = true;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= K; ++j) {
            if (i == idx || j < a[i]) {
                dp[i+1][j] = dp[i][j];
            } else {
                dp[i+1][j] = dp[i][j] || dp[i][j-a[i]];
            }
        }
    }

    bool ret = false;
    for (int j = K-a[idx]; j < K; ++j) {
        ret |= dp[N][j];
    }
    return ret;
}

int main(int argc, char const *argv[]) {
    cin >> N >> K;
    vector<ll> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    // for (int i = 0; i < N; ++i) {
    //     cout << i << " necessary:" << necessary(i, a) << endl;
    // }

    int l = -1;
    int u = N;
    while (u - l > 1) {
        int m = (u + l) / 2;
        if (necessary(m, a)) {
            u = m;
        } else {
            l = m;
        }
    }

    cout << l + 1 << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
 
int main(){
  int l,r;
  cin>>l>>r;
  int ans=2018;
  r=min(r,l+4038);
  for(ll i=l;i<=r;i++){
    for(ll j=i+1;j<=r;j++){
      int x=i*j%2019;
      ans=min(ans,x);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;

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

ll lcm(ll a,ll b){
    ll g =gcd(a,b);
    return a/g*b;
}

int main(){
    int N;
    cin>>N;
    ll t[110];
    rep(i,N) cin >>t[i];
    ll ans=t[0];
    rep(i,N){
        ans =lcm(ans,t[i]);
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var s = br.readLine().split(" ");
      final var n = Integer.parseInt(s[0]);
      final var r = Integer.parseInt(s[1]);

      System.out.println(n >= 10 ? r : r + (100 * (10 - n)));
    }
  }
}


Measured memory_bytes: 32700
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int hoge[31];

int main() {
	int n;
	int i;
	for(i=0;i<28;i++){
		n=in();
		hoge[n]=1;
	}
	for(i=1;i<31;i++){
		if(!hoge[i])cout<<i<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define repr(i, n) for(int i=(n-1); 0<=i; i--)
#define repr2(i, from, to) for(int i=(from-1); (int)(to)<=i; i--)
#define ALL(obj) (obj).begin(), (obj).end()
typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int to, cost; };
struct gNode { int from, to, cost; };
struct tNode { int value; int parent; vector<int> child; };


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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}
ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x*x % MOD, n/2);
	if(n & 1) res = res * x % MOD;
	return res;
}

int main(void){
	int m, d; cin >> m >> d;
	int ans = 0;
	for(int i=1; i<=m; i++){
		for(int j=1; j<=d; j++){
			if(j/10 == 0) continue;
			if(j/10 == 1) continue;
			if(j%10 == 1) continue;
			if((j/10) * (j%10) == i) ans++;
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL dp[101][100001]={0};
int main(void){
	int n,w;
	int i,j;
	int we,va;
	cin>>n>>w;
	for(i=0;i<n;i++){
		cin>>we>>va;
		for(j=0;j<=w;j++){
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			if(j+we<=w){
				dp[i+1][j+we]=max(dp[i+1][j+we],dp[i][j]+va);
			}
		}
	}
	/* for(i=0;i<=n;i++){
		for(j=0;j<=w;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	} */
	LL MAX=-1;
	for(i=0;i<=w;i++){
		MAX=max(dp[n][i],MAX);
	}
	cout<<MAX<<endl;
	return 0;
}
	

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

int main()
{
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

const int N = 1e5+5;

int n,q,t;
long long k;
int a[N];

int main()
{
	scanf("%d%I64d%d",&n,&k,&q);
	for (int i=1; i<=q; i++)
	{
		scanf("%d",&t);
		a[t]++;
	}
	for (int i=1; i<=n; i++)
	{
		if (a[i]>q-k)
			printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii              pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define __              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,b) 		for(int i=a;i<b;i++)
#define repb(i,a,b) 	for(int i=a;i>=b;i--)
#define endl			"\n"
#define m(a)		    memset(a,0,sizeof(a))
#define all(x)                          begin(x), end(x)


void file(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt" , "r" , stdin);
	freopen("out.txt" , "w" , stdout);
	#endif
}

int bs(int a[] , int s , int e, int x){
	if(s<=e){
		int m = (s+e)/2;
		if(a[m]==x)
			return m;
		else if(a[m] > x)
			return bs(a,s,m-1,x);
		else return bs(a,m+1,e,x);
	}
	return -1;
}

#define tr(x) cout<<x<<endl;
#define tr2(x,y) cout<<x<<" "<<y<<endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(w,x,y,z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define tr5(v,w,x,y,z) cout<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define tr6(u,v,w,x,y,z) cout<<u<<" "<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;

#define deb(x) cout<<#x<<"="<<x<<endl
#define deb2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
#define deb3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl
#define deba(a) for(auto &x:a) cout<<x<<" ";

#define sd(x) cin >> x;
#define sd2(x,y) cin >> x >> y;
#define sd3(x,y,z) cin >> x >> y >> z;
#define sd4(w,x,y,z) cin >> w >> x >> y >> z;

void solve(){
	int n; cin >> n;
		int ans[n+1];
		fill(ans , ans+n+1 , 0);
	for(int i=1 ; i<105 ; ++i){
		for(int j=1; j<105 ; ++j){
			for(int k=1; k<105 ; ++k){
				int val = i*i+j*j+k*k+i*j+i*k+j*k;
				if(val<=n){
					++ans[val];
				}
				else continue;
			}
		}
	}
	for(int i=1 ; i<n+1 ; ++i) cout << ans[i] << endl;
}

int32_t main(){	
	__;
	file();
	// w(t){
		solve();
	// }
	return 0;
}





Measured memory_bytes: 3592
//#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
/*#define fast ios_base::sync_with_stdio(0); cin.tie(0)*/
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
const double pi = acos(-1);
typedef long long ll;
int main()
{
	//fast;
	
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<min(a,b)+min(c,d);
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
#define ll long long
#define loop(a) for(long long i=0; i<a; i++)
 
using namespace std;

int main(){
	int n;
	ll ans=0;
	cin >> n;
	char c,pre;
	pre='0';
	loop(n){
		cin >> c;
		if(c==pre) continue;
		else{
			ans++;
			pre=c;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int N,L;
  scanf("%d %d",&N,&L);
  int min = abs(L);
  for(int i=0; i<N; i++){
    if(abs(min) > abs(L+i)){
      min = L+i;
    }
  }
  int sum=0;
  for(int i=0; i<N; i++){
    sum += L+i;
  }
  sum -= min;
  printf("%d\n",sum);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll n,x;
ll nums[2009];

ll calc(int wid){
    map<int,int> dic;
    int idx=0;
    for(;idx<wid;idx++) dic[nums[idx]]++;
    ll res=0;
    rep(i,n){
        dic[nums[idx]]++;
        res+=dic.begin()->first;
        dic[nums[i]]--;
        if(dic[nums[i]]<=0){
            dic.erase(nums[i]);
        }
        idx=(idx+1)%n;
    }
    res+=wid*x;
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>x;
    rep(i,n) cin>>nums[i];
    
    ll res=0;
    rep(i,n) res+=nums[i];
    
    rep(i,n){
        if(i*x>res) break;
        res=min(res,calc(i));
    }
    cout1(res);
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) { cin1(x[i]); }
#define ncin2(n, x, y)      REP(i, 0, n) { cin2(x[i], y[i]); }
#define ncin3(n, x, y, z)   REP(i, 0, n) { cin3(x[i], y[i], z[i]); }
#define ncinp(n, p)         REP(i, 0, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }
#define ncin1_1(n, x)       REPE(i, 1, n) { cin1(x[i]); }
#define ncin2_1(n, x, y)    REPE(i, 1, n) { cin2(x[i], y[i]); }
#define ncin3_1(n, x, y, z) REPE(i, 1, n) { cin3(x[i], y[i], z[i]); }
#define ncinp_1(n, p)       REPE(i, 1, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

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

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    string s;
    cin1(s);
    if (s == "SUN") {
        cout << 7 << endl;
    }
    else if (s == "MON") {
        cout << 6 << endl;
    }
    else if (s == "TUE") {
        cout << 5 << endl;
    }
    else if (s == "WED") {
        cout << 4 << endl;
    }
    else if (s == "THU") {
        cout << 3 << endl;
    }
    else if (s == "FRI") {
        cout << 2 << endl;
    }
    else
        cout << 1 << endl;
    
}


Measured memory_bytes: 256
int main(void) {
    int a1 = 0, b1 = 0, c1 = 0;
    char a[200], b[200], c[200], tmp = 'a';
    scanf("%s", a);
    scanf("%s", b);
    scanf("%s", c);
    while (1) {
        if (tmp == 'a') {
            tmp = a[a1];
            a1++;
        } else if (tmp == 'b') {
            tmp = b[b1];
            b1++;
        } else if (tmp == 'c') {
            tmp = c[c1];
            c1++;
        }
        if (a1 == strlen(a) && tmp == 'a') {
            puts("A");
            return 0;
        } else if (b1 == strlen(b) && tmp == 'b') {
            puts("B");
            return 0;
        } else if (c1 == strlen(c) && tmp == 'c') {
            puts("C");
            return 0;
        }
    }
    return 0;
}

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

"""
参考：https://img.atcoder.jp/arc074/editorial.pdf
・優先度付きキュー
"""

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)

from heapq import heappush, heappushpop

N = int(input())
aN = list(map(int, input().split()))

mids = aN[N:N*2]
L = []
R = []
for i in range(N):
    # とりあえず前後半確定の部分をキューに詰める
    heappush(L, aN[i])
    heappush(R, -aN[i+N*2])

# 未確定の真ん中1/3について調べていく
l_sum = [0] * (N+1)
l_sum[0] = sum(aN[:N])
for i in range(N):
    # ある値をpushして最小値をpopする
    num = heappushpop(L, mids[i])
    # それに合わせて合計値も更新
    l_sum[i+1] = l_sum[i] + mids[i] - num

# 後半部分は逆方向からやる
r_sum = [0] * (N+1)
r_sum[N] = sum(aN[N*2:])
for i in range(N-1, -1, -1):
    # 正負逆転させれば最大値にも使える
    num = -(heappushpop(R, -mids[i]))
    r_sum[i] = r_sum[i+1] + mids[i] - num

ans = -float('inf')
for i in range(N+1):
    ans = max(l_sum[i] - r_sum[i], ans)
print(ans)


Measured memory_bytes: 37212
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

const ll MOD = 1e9+7;
ll modpow(ll a , ll b, ll m){
  if (b == 0) return 1;
  ll ret;
  if (b%2 == 0){
    ll  t = modpow(a, b/2, m)%m;
    ret = t*t %m;
  }else{
    ll t = modpow(a, (b-1)/2,m)%m;
    ret = a*t %m * t % m;
  }
  ret %= m;
  return ret;
}
int main(){
  string s; cin >> s;
  ll n = SZ(s);
  reverse(ALL(s));
  //dp[i][j] = 下からi桁目まで見てあまりj
  vector<vector<ll>> dp(n+1, vector<ll>(13,0));
  dp[0][0] = 1;
  REP(i,n) REP(j,13){
    ll d = modpow(10,i,13);
    if(s[i]=='?'){
      REP(k,10){
        ll t = (d*k)%13;
        (dp[i+1][(j+t)%13] += dp[i][j]) %= MOD;
      }
      continue;
    }
    (d *= s[i] -'0') %= 13;
    (dp[i+1][(j+d)%13] += dp[i][j]) %= MOD;
  }
  cout << dp[n][5] << endl;
}



Measured memory_bytes: 13696
n, m = map(int, input().split())
l = [False] * n
c = [0] * n
ans = [0, 0]
for i in range(m):
  p, r = map(str, input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[int(p) - 1] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      ans[0] += c[int(p) - 1]
      ans[1] += 1
print(ans[1], ans[0])

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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
    } else if (a >= 6) {
        cout << b / 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <map>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int x, a;
    cin >> x >> a;

    cout << ( (x<a)? 0 : 10 ) << endl;
    return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(ll, n);
  ll ans = 0;
  while (n) {
    if (n < 0) {
      ll val = -2;
      ll sum = -2;
      while (sum > n) {
        val *= 4;
        sum += val;
      }
      dbg(n, val, sum);
      ans |= -val;
      n -= val;
    } else {
      ll val = 1;
      ll sum = 1;
      while (sum < n) {
        val *= 4;
        sum += val;
      }
      dbg(n, val, sum);
      ans |= val;
      n -= val;
    }
  }
  if (int clz = __builtin_clzll(ans); clz == 64) {
    out(0);
  } else {
    for (int i = 63 - clz; i >= 0; --i) {
      cout << ((ans >> i) & 1);
    }
    cout << endl;
  }
}

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

int main()
{

    int N,flag=-1;
    cin >> N;

    for (int i = 0; i < N;i++){
        for (int j = 0; j < N;j++){
            if(4*i+7*j==N){
                flag = 0;
            }
        }
    }
    if(flag==0){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
        
}


Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int H, A, hasil;
	
	scanf ("%d %d", &H,&A);
	
	int hasil1= H/A;
	int hasil2 = H/A+1;
	
	H%A==0 ? printf ("%d",hasil1) : printf ("%d",hasil2);
	
	return 0;
}

Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

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

    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  int d[n][3];
  cin >> d[0][0] >> d[0][1] >> d[0][2];
  for(int i=1; i<n; i++){
    cin >> d[i][0] >> d[i][1] >> d[i][2];
    d[i][0] = d[i][0]-d[i-1][0];
    d[i][1] = d[i][1]-d[i-1][1];
    d[i][2] = d[i][2]-d[i-1][2];
  }
  
  string b = "Yes";
  for(int i=0; i<n; i++){
    if(abs(d[i][0]%2) != abs(d[i][1]+d[i][2])%2 || abs(d[i][1])+abs(d[i][2])>abs(d[i][0])){ 
      b = "No"; break;
    }
  }
  
  cout << b;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
template<class T> inline void chmax(T &a,T b){if(a<b)a=b;}
template<class T> inline void chmin(T &a,T b){if(a>b)a=b;}


int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int R,G; cin >> R >> G;
    int ans = 1;
    REP(i,R){
        if(ans*2<=ans+G) ans <<= 1;
        else ans += G;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//Md Fahad
// CSE 18

#include<bits/stdc++.h>

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int fx[] = {+1,-1,+0,+0};                         // 4 X directions
const int fy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int fx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int fy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

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 trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int           ll;
typedef unsigned long long int  llu;





int main(void)
{
    //READ_IN;
    //READ_OUT;

    int h,a;
    cin >>  h >> a;

    int cnt=0;
    while(h>0)
    {
        h=h-a;
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Arr(n,()=>sc.Ia);
		Array.Sort(a,(u,v)=>u[1]-v[1]);
		long p=0;
		var ans="Yes";
		for(int i = 0;i<n;i++) {
			p+=a[i][0];
			if(p>a[i][1]){ans="No";break;}
		}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


Measured memory_bytes: 26536
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
public static class P {
  public static void Main() {
    var n = int.Parse(Console.ReadLine());
    var l = Console.ReadLine().Split().Select(int.Parse).OrderBy(x=>x).ToArray();
    var res = 0;
    foreach (int i in Enumerable.Range(1, l.Length - 1)) {
      foreach (int j in Enumerable.Range(0, i).Reverse()) {
        if (l[j] * 2 <= l[i]) continue;
        var ok = j;
        var ng = -1;
        while (ok - ng > 1) {
          var mid = (ok + ng) / 2;
          if (l[i] < l[mid] + l[j]) ok = mid;
          else ng = mid;
        }
        res += j - ok;
      }
    }
    Console.WriteLine(res);
  }
}


Measured memory_bytes: 31316
#include<bits/stdc++.h>
using namespace std;
main(){
long long int n;
cin>>n;
long long int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
long long int dp[n][n];
memset(dp,0,sizeof(dp));

long long int csum[n];
csum[0]=arr[0];
for(int i=1;i<n;i++)csum[i]=csum[i-1]+arr[i];
for(int i=0;i<n;i++)dp[i][i]=arr[i];
for(int i=1;i<n;i++)for(int j=0;j<n-i;j++){
int a=j;
int b=j+i;
//cout<<arr[a]+((csum[b]-csum[a+1]+arr[a+1])-dp[a+1][b])<<endl;


dp[a][b]=max(arr[a]+((csum[b]-csum[a+1]+arr[a+1])-dp[a+1][b]),arr[b]+(csum[b-1] -csum[a]+arr[a])-dp[a][b-1]);



//cout<<a<<" "<<b<<" "<<dp[a][b]<<endl;
}
cout<<2*dp[0][n-1]-csum[n-1];



}


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

using namespace std;
/*
#define ll long long
#define vi vector<ll>
vi primeFactors(ll N) { // remember: vi is vector<int>, ll is long long
vi factors;
ll PF_idx = 0, PF = primes[PF_idx]; // primes has been populated by sieve
while (PF * PF <= N) { // stop at sqrt(N); N can get smaller
while (N % PF == 0) { N /= PF; factors.push_back(PF); } // remove PF
PF = primes[++PF_idx]; // only consider primes!
}
if (N != 1) factors.push_back(N); // special case if N is a prime
return factors; // if N does not fit in 32-bit integer and is a prime
} // then ‘factors’ will have to be changed to vector<ll>
// inside int main(), assuming sieve(1000000) has been called before
vi r = primeFactors(2147483647); // slowest, 2147483647 is a prime
for (vi::iterator i = r.begin(); i != r.end(); i++) printf("> %d\n", *i);
r = primeFactors(136117223861LL); // slow, 104729*1299709
for (vi::iterator i = r.begin(); i != r.end(); i++) printf("# %d\n", *i);
r = primeFactors(142391208960LL); // faster, 2^10*3^4*5*7^4*11*13
for (vi::iterator i = r.begin(); i != r.end(); i++) printf("! %d\n", *i);
*/
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d",(b*2)-a);

    /*
    int n,coun=0,ans=0;
    long long unsigned int fac=1;
    scanf("%d",&n);
    int c=1;
        int m=pow(2,c);
        while(m<n){
            c++;
            coun=n/m;
            ans+=coun;
            m=pow(2,c);
        }
        printf("%d",ans);
        */

    return 0;
}


Measured memory_bytes: 256
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26
for i in range(d):
  s = list(map(int, input().split()))
  happy = - (10 ** 10)
  ans = -1
  # 各問題を出題した場合に得られる幸福度の最大値を計算
  for j in range(26):
    tmp = s[j] # j を出題した際に得られる幸福度
    if tmp > happy:
      happy = tmp
      ans = j
  prev[ans] = i
  print(ans+1)

Measured memory_bytes: 68660
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;


//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<char> deq;
//vector<ll> vll;
ll num[ten52];
ll num2[ten52];
ll ans[ten5];

int main(void)
{
    //double ans=0.0,d,d1,d2;
    //float f,g,h;
    long long int m,n,i,j,k=1;
    long long int a,a1,a2,a3,sum;
    string s,s1,s2;
    //char c,c1;
    sum=a=a1=a2=a3=0;
    cin>>n>>m;
    for(i=1;i<=n;i++) cin>>num[i];
    for(i=0;i<m;i++)
    {
        cin>>a1>>a2;
        if(num[a1]>num[a2]) ans[a2]++;
        else if(num[a1]<num[a2]) ans[a1]++;
        else
        {
            ans[a1]++;
            ans[a2]++;
        }
    }
    for(i=1;i<=n;i++)
        if(ans[i]==0) sum++;
    cout<<sum;
    return 0;
}





Measured memory_bytes: 5192
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    static Scanner sc=new Scanner(in);
    public static void main(String[] args) {
        int n=sc.nextInt();
        int[] d=new int[n];
        int ans=0;
        for (int i = 0; i < n; i++) {
            d[i]=sc.nextInt();
        }
        Arrays.sort(d);
        ans=max(0,d[n/2]-d[n/2-1]);
        out.println(ans);
    }
}

Measured memory_bytes: 50728