akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define nil -100
#define max 100000
void printData(void);
void HowDepth(int, int);
struct Node{
  int prev;
  int left;
  int right;
  int k;
  int Depth;
};
typedef struct Node Node;
Node data[max];
int n;
int main()
{
  int i, j, id, keep, in;

  scanf("%d",&n);
  
  for(i = 0 ; i < n ; i++) data[i].prev = -1;
  for(i = 0 ; i < n ; i++){
    data[i].left = nil;
    data[i].right = nil; }
  
  for(i = 0 ; i < n ; i++){
    scanf("%d",&id);
    scanf("%d",&data[id].k);

    keep = nil;
    for(j = 0 ; j < data[id].k ; j++){
      keep = in;
      scanf("%d",&in);
      if(j == 0){
	data[id].left = in;
	data[data[id].left].prev = id; }
      if(j > 0){
	data[keep].right = in;
	data[data[keep].right].prev = id; }
    }
  }

  for(i = 0 ; i < n ; i++){
    if(data[i].prev == -1){
      HowDepth(i,0);
      break; }
  }
  
  printData();  
    
  return 0;
}

void HowDepth(int i, int count)
{
  data[i].Depth = count;
  if(data[i].right != nil) HowDepth(data[i].right, count);
  if(data[i].left != nil) HowDepth(data[i].left, ++count);
}

void printData(void)
{
  int i, j, keep;
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, ",i,data[i].prev,data[i].Depth);
    if(data[i].prev == -1) printf("root, ");
    else if(data[i].k == 0) printf("leaf, ");
    else printf("internal node, ");

    if(data[i].k != 0){
      printf("[%d",data[i].left);
      keep = data[i].left;
      for(j = 0 ; j < data[i].k-1 ;j++){
	printf(", %d",data[keep].right);
	keep = data[keep].right; }
      printf("]\n"); }
    else printf("[]\n");
  }
	
}


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

using namespace std;

typedef long long ll;

const int N = 1e8;
const int INF = 1e9;
const int MOD = 998244353;


int main() {
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200)
        cout << s;
    else
        cout << "red";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int c, a, n;
    cin >> c >> a >> n;
    int ans = 0;
    for (int i = 0; i <= 500; i++) {
      for (int j = 0; j <= 333; j++) {
        int nc = c - 2 * i - 3 * j, na = a - i;
        if (nc < 0 || na < 0) continue;
        ans = max(ans, i + j + min({nc, na, n}));
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3148
using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;

//namespace _1_A
//{
    class Program
    {
    static void Main(string[] args)
    {
        string a = Console.ReadLine();

        string[] array = a.Split(' ');

        int c = int.Parse(array[0]);
        int d = int.Parse(array[1]);
        int menseki = c * d;
        int syu = (c + d) * 2;

        Console.WriteLine(menseki + " " + syu);
    }
    }
//}

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

using namespace std;
static const int INF = 1e9;
static const int SIZE = 1001;

struct edge
{
	int from;
	int to;
	int cost;
};

vector<edge> Edge;
int d[SIZE];

void solve()
{
	int V, E, r;
	cin >> V >> E >> r;
	if (V == 0 || E == 0)
	{
		cout << 0 << endl;
		return;
	}
	for (int i = 0; i < E; ++i)
	{
		edge e;
		cin >> e.from >> e.to >> e.cost;
		Edge.push_back(e);
	}
	for (int i = 0; i < V; ++i)
	{
		d[i] = INF;
	}
	d[r] = 0;
	int count = 0;
	bool update = true;
	while (update)
	{
		update = false;
		for (int i = 0; i < Edge.size(); ++i)
		{
			edge e = Edge[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost)
			{
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		++count;
		if (count == V)
		{
			cout << "NEGATIVE CYCLE" << endl;
			return;
		}
	}
	for (int i = 0; i < V; ++i)
	{
		if (d[i] == INF)
		{
			cout << "INF" << endl;
		}
		else
		{
			cout << d[i] << endl;
		}
	}
}

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

Measured memory_bytes: 1268
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<double,int> Pdi;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
priority_queue<Pdi,vector<Pdi>,greater<Pdi>> que;
vector<Pli> v[18];
P2 xy[MAX_N]={};
ll dp[1<<18]={};
string str[100000];
int main() {
	int a,b;
	cin>>a>>b;
	if(a%2==0||b%2==0)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	
	return 0;
}


Measured memory_bytes: 1664
import sys
sys.setrecursionlimit(10**9)
def dfs(a,adjl,visited,dp):
  for i in adjl[a]:
    if visited[i]==0:
      visited[i]=1
      dfs(i,adjl,visited,dp)
 
    dp[a]=max(dp[a],1+dp[i])
n,m=map(int,input().split())
li=[]
for i in range(m):
  li.append([int(k) for k in input().split()])
adjl=[[] for j in range(n+1)]
for k in range(len(li)):
  adjl[li[k][0]].append(li[k][1])
visited=[0]*(n+1)
dp=[0]*(n+1)
for a in range(1,n+1):
  if visited[a]==0:
    visited[a]=1
    dfs(a,adjl,visited,dp)
print(max(dp))

  
  


Measured memory_bytes: 74776
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

class UnionFind {
public:
    // 親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<ll> Parent;

    UnionFind(ll N) {
        Parent = vector<ll>(N, -1);
    }

    // Aがどのグループに属しているか調べる
    ll root(ll A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }

    // 自分のいるグループの頂点数を調べる
    ll size(ll A) {
        return -Parent[root(A)];//親をとってきたい]
    }

    // AとBをくっ付ける
    bool connect(ll A, ll B) {
        // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }

        // 大きい方(A)に小さいほう(B)をくっ付ける
        // 大小が逆だったらひっくり返す
        if (size(A) < size(B)) {
            swap(A, B);
        }

        // Aのサイズを更新する
        Parent[A] += Parent[B];
        // Bの親をAに変更する
        Parent[B] = A;

        return true;
    }
};

int main() {
    
    ll n,m;
    cin>>n>>m;
    vll ans;
    vll a(m),b(m);
    ll tmp=n*(n-1)/2;
    UnionFind uni(n);
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
    }
    for(ll i=m-1;i>=0;i--) {
        ans.pb(tmp);
        if(uni.root(a[i])==uni.root(b[i])){
            continue;
        }
        tmp-=max(0LL,uni.size(uni.root(a[i]))*uni.size(uni.root(b[i])));
        uni.connect(a[i],b[i]);
    }
    drep(i,ans.size()){
        fin(ans[i]);
    }
}


Measured memory_bytes: 4596
//I Guds namn
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n; cin >> n;
	int minn = 1001, maxx = 0;
	while(n--)
	{
		int a; cin >> a;
		minn = min(minn, a);
		maxx = max(maxx, a);
	}
	cout << maxx - minn << endl;
	return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
long long n, a, b, s, x, c, v[55], d[55][55]={1};
int main() {
	int i, j;
	cin>>n>>a>>b;
	for(i=0; i<n; i++) cin>>v[i];
	sort(v, v+n);
	for(i=n-1; i>=n-a; i--) s += v[i];
	x = upper_bound(v, v+n, v[n-a]) - lower_bound(v, v+n, v[n-a]);
	for(i=1; i<=x; i++) {
		d[i][0] = 1;
		for(j=1; j<=x; j++) d[i][j] = d[i-1][j-1] + d[i-1][j];
	}
	if(v[n-a] < v[n-1]) {
		i = upper_bound(v+n-a, v+n, v[n-a]) - lower_bound(v+n-a, v+n, v[n-a]);
		c = d[x][i];
	} else {
		for(i=a, c=0; i<=b; i++) c += d[x][i];
	}
	printf("%.9f\n%lld", 1.*s/a, c);
	return 0;
}

Measured memory_bytes: 256
inf = 10 ** 9
h,n = map(int, input().split())
a = []
b = []
for i in range(n):
    aa,bb = map(int, input().split())
    a.append(aa)
    b.append(bb)

dp = [0] * (h + 1)

for i in range(1, h + 1):
    x = inf
    for j in range(n):
        p = max(0, i - a[j])
        x = min(x, b[j] + dp[p])
    dp[i] = x

print(dp[h])

Measured memory_bytes: 42220
#include<iostream>
#include<cstring>

using namespace std;

const int MOD = 1e9 + 7;
int N;
char *M;

void init(int n = 8) {
    M = new char[(n + 7) / 8];
    memset(M, 0, (n + 7) / 8);
}

void set(int n) {
    M[n >> 3] |= (0x80 >> (n & 0x07));
}

bool test(int n) {
    return M[n >> 3] & (0x80 >> (n & 0x07));
}

void prime_set(int n) {
    set(0); set(1);
    for (int i = 2; i * i <= n; i++)
        if( !test(i) )
            for (int j = i * i; j <= n; j += i)
                set(j);
}

int main() {
    cin >> N;
    long long ans = 1;
    init(N);
    prime_set(N);
    for (int i = 2; i <= N; i++) {
        if(!test(i)) {
            long long res = 0;
            for (int temp = i; temp <= N; temp *= i)
                res += N / temp;
            ans *= (res + 1) % MOD;
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll t;
	cin>>t;
	set<pll> s;
	int v=200;
	range(i,-v, v)range(j,-v, v){
		if((i or j) and (i*i+j*j)<20000){
			s.emplace(i,j);
		}
	}
	// puta(gcd(169,0));
	rep(i,t){
		ll p,q; cin>>p>>q;
		int cnt=0;
		for(auto&z:s){
			ll m,n; tie(m,n) = z;
			// if(m==0 and n==13)puta(m,n,m*p+n*q,gcd(m*p+n*q, m*q-n*p),m*m+n*n);
			int g=abs(gcd(m*p+n*q, m*q-n*p));
			for(int c=1; c*c<=g;c++){
				if(g%c)continue;
				if(c == m*m+n*n){
					cnt++;
				}
				if(c!=g/c and g/c == m*m+n*n){
					cnt++;
				}
			}
			if(cnt>8)break;
		}
		if(cnt>8)puta("C"); else puta("P");
	}
	return 0;
}


Measured memory_bytes: 6888
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,\
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input()) - 1])

Measured memory_bytes: 38384
#include <iostream>

int a, b;

int main() {
    int res;
    std::cin >> a >> b;
    if ((a+b)%2 == 0) {
        res = (a+b)/2;
    } else {
        res = (a+b)/2 + 1;
    }
    std::cout << res << std::endl;
    return 0;
}


Measured memory_bytes: 256
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  int n,a,b;cin>>n>>a>>b;
  cout<<min(n*a,b)<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
V = list(map(int, input().split()))

V.sort(reverse=True)

ans = 0
for i, v in enumerate(V):
    if i == len(V) - 1:
        ans += v / (2 ** i)
    else:
        ans += v / (2 ** (i + 1))

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T inf = numeric_limits<T>::max();
    using P     = pair<T, int>;
    int n       = G.size();
    vector<T> d(n, inf);
    priority_queue<P, vector<P>, greater<P>> q;
    d[s] = 0;
    q.emplace(d[s], s);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (auto &e : G[v]) {
            int u = e.first;
            T c   = e.second;
            if (d[u] > d[v] + c) {
                d[u] = d[v] + c;
                q.emplace(d[u], u);
            }
        }
    }
    return d;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, x, y;
    cin >> n >> x >> y;
    x--, y--;
    vector<vector<pair<int, lint>>> edges(n);
    for (int i = 1; i < n; ++i) {
        edges[i].emplace_back(i - 1, 1);
        edges[i - 1].emplace_back(i, 1);
    }
    edges[x].emplace_back(y, 1);
    edges[y].emplace_back(x, 1);
    vector<lint> ret(n);
    for (int i = 0; i < n; ++i) {
        auto dist = dijkstra(i, edges);
        for (auto &d : dist) {
            ret[d]++;
        }
    }
    for (int i = 1; i < n; ++i) {
        cout << ret[i] / 2 << "\n";
    }
    return 0;
}

Measured memory_bytes: 384
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var nx = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long X = nx[1];
        //ちゅーごくじょーよてーり
        //オーダーによってSの終端が決定する
        //まず影響するのは降順のみなことは自明に分かって、
        //で、「次」を選ぶことができる順番は
        //「確率」「期待値」
        //aを取り除いた場合、その後に適用できるのはそれ以前全て。

        List<int> s = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToList();
        ModInt[] dp = new ModInt[X + 1];
        dp[X] = 1;
        int remain = s.Count - 1;
        foreach (var mod in s)
        {
            ModInt[] newDP = new ModInt[X + 1];

            for (int i = 0; i < dp.Length; i++)
            {
                newDP[i % mod] += dp[i];
                newDP[i] += dp[i] * remain;
            }
            remain--;
            dp = newDP;
        }
        ModInt res = 0;
        for (int i = 0; i < dp.Length; i++)
        {
            res += dp[i] * i;
        }
        Console.WriteLine(res);
    }
}


struct ModInt
{
    const int MOD = 1000000007;
    long Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ModInt(long data) { Data = data; Eval(); }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private long Eval() => (Data %= MOD) < 0 ? Data += MOD : Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator long(ModInt modInt) => modInt.Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator ModInt(long val) => new ModInt(val);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, ModInt b)
    {
        long res = a.Data + b.Data;
        return new ModInt() { Data = res >= MOD ? res - MOD : res };
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, ModInt b)
    {
        long res = a.Data - b.Data;
        return new ModInt() { Data = res < 0 ? res + MOD : res };
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt a, ModInt b) => new ModInt(a.Data * b.Data);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator /(ModInt a, ModInt b) => a * Power(b, MOD - 2);

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static ModInt Power(ModInt n, long m)
    {
        ModInt res = 1;
        while (m > 0)
        {
            if ((m & 1) == 1) res *= n;
            n *= n;
            m >>= 1;
        }
        return res;
    }
}


Measured memory_bytes: 31712
/*	Don’t Quit
	
	When things go wrong as they sometimes will;
		When the road you’re trudging seems all uphill;
			When the funds are low, and the debts are high;
				And you want to smile, but you have to sigh;
					When care is pressing you down a bit
						Rest if you must, but don’t you quit.
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
	int n,m;
	cin>>n>>m;
	int cnt=0;
	while(1)
	{
		n=n*2;
		if(n>m)
			break;
		cnt++;

	}
	cout<<cnt+1<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

     public static void main(String []args){
 
		Scanner scan = new Scanner(System.in);
		String[] strArray = scan.nextLine().split(" ");

        int H = Integer.parseInt(strArray[0]);
        int A = Integer.parseInt(strArray[1]);
        int lastCount = 0;
        
        for (int i = 1; H > 0; i++) {
            H = H - A;
            lastCount = i;
        }

        System.out.println(lastCount);

     }
}


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

//#define fr first
#define sc second
#define mk make_pair

using namespace std;

int n, m, ar[301][301], sz[1000], u[10001];
set <pair<int, int> > st;
vector<int> vec[301];

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            scanf("%d", &ar[i][j]), sz[i] = 2;

    int mn = 1e9;

    for(int i = 1; i <= n; i++)
        vec[ar[i][1]].push_back(i);

    for(int i = 1; i <= m; i++)
        st.insert(mk(-1 * vec[i].size(), i));

    int k = st.begin() -> first;

    mn = min(mn, k * -1);

    //cout << "*" << mn << endl;

    for(int i = 1; i < m; i++)
    {
        int ind = st.begin() -> second;
        st.erase(mk(vec[ind].size() * -1, ind));
        u[ind] = 1;
        //cout << ind << endl;
        for(int j = 0; j < vec[ind].size(); j++)
        {
            int to = vec[ind][j];
            while(u[ar[to][sz[to]]])
                sz[to]++;

            st.erase(mk(vec[ar[to][sz[to]]].size() * -1, ar[to][sz[to]]));
            vec[ar[to][sz[to]]].push_back(to);
            st.insert(mk(vec[ar[to][sz[to]]].size() * -1, ar[to][sz[to]]));
        }
        int k = st.begin() -> first;
        mn = min(mn, k * -1);
    }
    cout << mn;
    return 0;
}





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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef long double ld;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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





int main(){

    bool flag=false;
    ll ans=0,sum=0;

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

    vector<ll> a(n),sa(n);
    vector<ll> b(m),sb(m);

    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];

    sa[0] = a[0];
    sb[0] = b[0];

    rep1(i,1,n){
        sa[i] = sa[i-1] + a[i];
    }
    rep1(i,1,m){
        sb[i] = sb[i-1] + b[i];
    }

    auto st = upper_bound(all(sa),k);
    if(st == sa.begin()){
    }else{

    --st;

    while(1){
        int nA = st - sa.begin() + 1;

        ll t = *st;

        auto st2 = upper_bound(all(sb),k-t);--st2;
        int nB = st2 - sb.begin() + 1;

        //db2(nA,t);
        //db2(nB,k-t);
        //ln;

        --st;
        chmax(ans,nA+nB);

        if(nA == 1)break;
    }

    }



    int allB = upper_bound(all(sb),k) - sb.begin();
    chmax(ans,allB);

    cout<<ans<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

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

void solve(){
    int N;
    cin >> N;

    int T, A;
    cin >> T >> A;
    T *= 1000;
    A *= 1000;

    vi H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }

    int ans=0;
    int mindiff = 1000000000;
    for (int i = 0; i < N; i++) {
        if (mindiff > abs(A - T + H[i]*6)) {
            mindiff = abs(A - T + H[i]*6);
            ans = i;
        }
    }

    cout << ans+1 << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M - 1);
    rep(i, M)
    {
        cin >> a[i];
    }
    if (N >= M)
    {
        cout << 0 << endl;
    }
    else
    {
        sort(a.begin(), a.end());
        rep(i, M - 1)
        {
            b[i] = abs(a[i + 1] - a[i]);
        }
        sort(b.begin(), b.end());
        reverse(b.begin(), b.end());

        rep(i, N - 1)
        {
            b[i] = 0;
        }
        int sum = 0;
        rep(i, M - 1)
        {
            sum += b[i];
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 1024
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		int res=S.chars().boxed().reduce(new ArrayList<Integer>(),
				(arr, val)->{
					if(arr.size() > 0 && arr.get(arr.size()-1)==val){
						return arr;
					}else{
						arr.add(val);
						return arr;
					}
		},
		(a,b)->{
			a.addAll(b);
			return a;
		}).size();
		System.out.println(res);
	}
}


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

using namespace std;

int main() {
    double w;
    while (scanf("%lf", &w) != EOF) {
        string ans;
        if (w <= 48.00) ans = "light fly";
        else if (w <= 51.00) ans = "fly";
        else if (w <= 54.00) ans = "bantam";
        else if (w <= 57.00) ans = "feather";
        else if (w <= 60.00) ans = "light";
        else if (w <= 64.00) ans = "light welter";
        else if (w <= 69.00) ans = "welter";
        else if (w <= 75.00) ans = "light middle";
        else if (w <= 81.00) ans = "middle";
        else if (w <= 91.00) ans = "light heavy";
        else ans = "heavy";

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3300
#include<iostream>
using namespace std;
main()
{
	long long int a, b, c ,d;
	cin >> a >> b >> c >> d;
	long long int x = c/b;
	if(c%b!=0)
	x++;
	long long int y = a/d;
	if(a%d!=0)
	y++;
	if(x>y)
	cout << "No";
	else
	cout << "Yes";
		return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
using namespace std;

int main(void){
  int n, ans=0;
  cin>>n;
  for(int i=1;i<=n;i+=2){
    int count=0;
    for(int j=1;j<=i;j++){
      if(i%j==0)count++;
    }
    if(count==8)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
long n,m,M,sum,c,d;
m=1000000;
M=-1000000;
sum=0;
scanf("%ld",&n);
for(c=1;c<=n;c++){
scanf("%ld",&d);
if(d<m){
	m=d;
}
if(d>M){
	M=d;
}
sum=sum+d;
}

printf("%ld %ld %ld\n",m,M,sum);
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long H,W;
  cin >> H >> W;
  if ( H==1 || W==1) {
    cout << 1 << endl;
  }
  else if( H * W % 2 == 0){
    cout << H * W/2 << endl;
  }
  else if ( H*W % 2 == 1){
    cout << H * W / 2 + 1 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
void no(){
  cout<<"NO"<<endl;
  exit(0);
}
VI a;
VVI egs;
in dfs(in u, in pr){
  if(sz(egs[u])==1)
    return a[u];
  in tt=0;
  in s;
  in mx=0;
  forv(i,egs[u]){
    if(egs[u][i]==pr)
      continue;
    s=dfs(egs[u][i],u);
    tt+=s;
    mx=max(mx,s);
  }
  mx=tt-mx;
  mx=min(mx,tt/2);
  in prs=tt-a[u];
  if(tt<a[u])
    no();
  if(prs>mx)
    no();
  tt-=2*prs;
  return tt;
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  a.resize(n);
  egs.resize(n);
  forn(i,n){
    cin>>a[i];
  }
  in ta,tb;
  forn(z,n-1){
    cin>>ta>>tb;
    --ta;
    --tb;
    egs[ta].PB(tb);
    egs[tb].PB(ta);
  }
  if(n==2){
    if(a[0]==a[1])
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
    return 0;
  }
  in rt=0;
  while(sz(egs[rt])==1)
    ++rt;
  if(dfs(rt,rt)==0)
    cout<<"YES"<<endl;
  else
    no();
  return 0;
}


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

using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  double q = 2.0,y=1.0;
   double ans=0.0;
  for(int i=1;i<=a;i++){
       double b1 = y/a;
      int cnt = 0;
      int t = i;
      while(t < b){
          t*=2;
          cnt++;
      }
      while(cnt--){
          b1 = b1/q;
      }
    ans+= b1;    
  }
 cout << fixed << setprecision(12) << ans;
    
}

Measured memory_bytes: 256
n = gets.chomp.to_i
l = gets.chomp.split.map {|a| a.to_i }

l.sort! {|a, b| b <=> a }

count = 0

n.times do |i|
  a, b = l[2 * i], l[2 * i + 1]
  count += [a, b].min
end

p count


Measured memory_bytes: 1912
/* ----------------------- reclone_rk -------------------------*/ 
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mod=1e9+7;
#define re return
#define rep(i, n) for (int i = 0; i < (n); i++)
int gcd(int a, int b){ if(a == 0) return b; return gcd(b%a, a);}
int MOD(int n){ return ((n%mod)+mod)%mod;}
int power(int a,int b){ if(b==0)return 1LL;int s=power(a,b/2LL);s*=s;s%=mod;if(b&1LL)return (s*a)%mod;return s;}
int inv(int a){return power(a,mod-2);}
int nCr(int n,int r){if(r>n)return 0LL;if(n-r<r)r=n-r;int ans=1;for(int i=0;i<r;i++){ans*=(n-i);ans=MOD(ans);ans*=inv(i+1);ans=MOD(ans);}return ans;}

signed main()
{
	int x;
	cin>>x;
	int ans = 0;
	int val = x / 500;
	ans =  1000*val;
	int rem = x%500;
	ans =  ans + (rem)/5*5;

	cout<<ans<<endl;
	re 0;
}



Measured memory_bytes: 256
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int n;
	cin>>n;
	int c=0;
	loop(i,1,n+1){
		string s=to_string(i);
		if(s.size()%2)c++;
	}
	cout<<c<<endl;
}


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;
const int INF = 1e9;

int main() {
  ll k, ans = 0, t = 0;
  unordered_set<ll> st;
  cin >> k;
  rep(i, k) {
    t = t * 10 + 7;
    t %= k;
    if (st.count(t))
      break;
    else
      st.insert(t);
    ans++;
    if (t == 0) {
      cout << ans << endl;
      return 0;
    }
  }

  cout << "-1" << endl;
  return 0;
}


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

vector<int> arr;
vector<int> dp;
int mn;

int main() {
    int n,k;
    cin>>n>>k;
    arr.resize(n);
    dp.resize(k+1,0);
    for(int i=0;i<n;i++) cin>>arr[i];
    mn= *min_element(arr.begin(),arr.end());

    for(int i=0;i<mn;i++) dp[i]=0;

    for(int i=0;i<=k;i++) {
        for(int j: arr) {
            if(i+j<=k) {
                dp[i+j]= max(dp[i]^1,dp[i+j]);
            }
        }
    }

    if(dp[k]) cout<<"First";
    else cout<<"Second";
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n; cin >> n;
  if (n < 105) cout << 0 << endl;
  else {
    ll res = 1;
    for (ll i = 107; i <= n; i += 2) {
      ll count = 0;
      for (ll j = 1; j*j <= i; j++) {
        if (i%j == 0) {
          count++;
          if (i/j != j) count++;
        }
      }
      if (count == 8) res++;
    }
    cout << res << endl;
  }
}

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

using namespace std;

constexpr long long INF64 = 1e18;

int main() {
  int n, ma, mb;
  cin >> n >> ma >> mb;
  vector<tuple<int, int, int>> v;
  vector<vector<int>> lt(201, vector<int>(201, 1e5));
  for (int i = 0; i < n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    v.push_back(make_tuple(a, b, c));
  }
  int m = n / 2;
  for (int i = 0; i < (1 << m); ++i) {
    int a = 0, b = 0, c = 0;
    for (int j = 0; j < m; ++j) {
      if ((i >> j) & 1) {
        a += get<0>(v[j]);
        b += get<1>(v[j]);
        c += get<2>(v[j]);
      }
    }
    lt[a][b] = min(lt[a][b], c);
  }
  int p = n - m, ans = 1e9;
  for (int i = 0; i < (1 << p); ++i) {
    int a = 0, b = 0, c = 0;
    for (int j = 0; j < p; ++j) {
      if ((i >> j) & 1) {
        a += get<0>(v[m + j]);
        b += get<1>(v[m + j]);
        c += get<2>(v[m + j]);
      }
    }
    for (int t = 0; t <= 200; ++t) {
      if ((t + b) % mb)
        continue;
      int s = ((t + b) / mb) * ma - a;
      if (s < 0 || s > 200)
        continue;
      if (a + s == 0 || b + t == 0) {
        continue;
      }
      ans = min(ans, lt[s][t] + c);
    }
  }
  if (ans >= 1e4) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 384
use std::cmp;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let k: usize = sc.read();
    let mut vs = Vec::new();
    let mut xs = Vec::new();
    let mut ys = Vec::new();
    for _ in 0..n {
        let x: i64 = sc.read();
        let y: i64 = sc.read();
        vs.push((x, y));
        xs.push(x);
        ys.push(y);
    }
    xs.sort();
    ys.sort();
    let mut ans = std::i64::MAX;

    for x1 in 0..n {
        for x2 in x1..n {
            for y1 in 0..n {
                for y2 in 0..n {
                    let lx = xs[x1];
                    let rx = xs[x2];
                    let ly = ys[y1];
                    let ry = ys[y2];

                    let mut count = 0;
                    for t in &vs {
                        let (x, y) = *t;
                        if lx <= x && x <= rx && ly <= y && y <= ry {
                            count += 1;
                        }
                    }
                    if count >= k {
                        ans = cmp::min(ans, (rx - lx) * (ry - ly));
                    }
                }
            }
        }
    }

    println!("{}", ans);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}



Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define fi                      first
#define se                      second
#define pb                      push_back
#define pbb                     pop_back
#define mp                      make_pair
#define pii     	            pair<int,int>
#define all(x)                  x.begin(), x.end()
#define mem(array, value)       memset(array, value, sizeof(array))
#define endl                    "\n"
#define fastRead 	            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#ifdef Lollipop
    #define line                    cout << "\n===================\n"
    #define trace(...)              __f( #__VA_ARGS__ , __VA_ARGS__ )
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " = " << arg1 << "\n";
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " = " << arg1 << " , ";
    __f(comma + 1, args...);
    }
#else
    #define line
    #define trace(...)
#endif


int main ()
{
    #ifdef Lollipop
        //freopen ("input.txt", "r", stdin);
        //freopen ("output.txt", "w", stdout);
    #endif
    fastRead;
    int day, n;
    cin >> day >> n;
    int sum = 0;
    for (int i = 0; i < n; i++){
        int x;
        cin >> x;
        sum += x;
    }
    int res = day - sum;
    if (res < 0){
        cout << -1 << endl;
    }
    else{
        cout << res << endl;
    }
    return 0;
}




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

using namespace std;

char *p1, *p2, buf[100000];

#define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1 ++ )

int rd() {
	int x = 0, f = 1;
	char c = nc();
	while (c < 48) {
		if (c == '-')
			f = -1;
		c = nc();
	}
	while (c > 47) {
		x = (((x << 2) + x) << 1) + (c ^ 48), c = nc();
	}
	return x * f;
}

int main() {
	int n = rd(), m = rd(), a = rd(), b = rd();
	for (int i = 1; i <= b; i ++ ) {
		for (int j = 1; j <= a; j ++ ) {
			putchar('1');
		}
		for (int j = a + 1; j <= m; j ++ ) {
			putchar('0');
		}
		puts("");
	}
	for (int i = b + 1; i <= n; i ++ ) {
		for (int j = 1; j <= a; j ++ ) {
			putchar('0');
		}
		for (int j = a + 1; j <= m; j ++ ) {
			putchar('1');
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;      
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

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, Q;
  string S;
  cin >> N >> Q >> S;
  
  vi c_sum(N+1,0);
  rep(i,N) {
    c_sum.at(i+1) = c_sum.at(i);
    if(i!=N-1 && S.at(i)=='A' && S.at(i+1)=='C') {
      c_sum.at(i+1)++;
    }
  }

//0 1 2 3 4 5 6 7 7+1
//0 1 1 2 2 2 3 3 3
// 0 1 2 3 4 5 6 7
// A C A C T A C G

  rep(i,Q) {
    int l, r; cin >> l >> r;
    l--; r--;

    cout << c_sum.at(r) - c_sum.at(l) << endl;
  }
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

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

ll dp[110][100100] = {};

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

    for (int i = 0; i < 110; i++) {
        for (int j = 0; j < 100100; j++) {
            dp[i][j] = inf;
        }
    }

    ll w[N], v[N];
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
    //for (int i = 0; i < N; i++) cout << w[i] << v[i] << endl;

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 100100; j++) {
            if (j >= v[i]) {
                //cout << dp[i][j-w[i]] << endl;
                chmin(dp[i+1][j], dp[i][j-v[i]] + w[i]);
                //cout << dp[i+1][j] << endl;
            }
            chmin(dp[i+1][j], dp[i][j]);
            //cout << dp[i+1][j] << endl;
        }
    }
    ll ans = 0;
    for (int i = 0; i < 100100; i++) {
        //cout << dp[N][i] << endl;
        if (dp[N][i] <= W) ans = i;
    }
    
    cout << ans << endl;
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  int s = 0;
  int r[n];
  for(int i = 0; i < n; i++){
    cin >> r[i];
    s += r[i];
  }
  bool b = 1;
  for(int i = 0; i < n; i++){
    if(r[i] >= s - r[i]){
      b = 0;
      break;
    }
  }
  if(b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
//# define FLAG
///delet....................................
# include <iostream>
# include <cstring>
# include <cstdlib>
# include <cstdio>
# include <cmath>
# include <ctime>
# include <set>
# include <map>
# include <queue>
# include <stack>
# include <vector>
# include <fstream>
# include <algorithm>
using namespace std;
# define eps 1e-8
# define pb push_back
# define pi acos(-1.0)
# define bug puts("H")
# define mem(a,b) memset(a,b,sizeof(a))
# define IOS ios::sync_with_stdio(false)
# define FO(i,n,a) for(int i=n; i>=a; --i)
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define INF 0x3f3f3f3f
# define MOD 1000000007
///           123456789
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef unsigned long long ULL;
typedef long long LL;
inline LL Scan(){
    LL x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
///coding...................................

int main()
{
    IOS;
#ifdef FLAG
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif /// FLAG
    int n,m;
    cin>>n>>m;
    cout<<(n-1)*(m-1)<<endl;
    return 0;
}
///delete # define FLAG......................




















Measured memory_bytes: 256
#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<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;




int main(){
    int h,w,a,b;cin >> h >> w >> a >> b;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ((i<b) ^ (j<a));
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
/**
 *  @author: pr4shan7 (प्रशांत)
 */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_set;

// #define _DEBUG

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

#ifdef _DEBUG
  ifstream cin("input.txt");
  // ofstream cout("output.txt");
#endif

  int a, b;
  cin >> a >> b;
  cout << max(0, a - (2 * b)) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>

using namespace std;

#define NUMMAX (7*100*10+1)
int main(){
 
    int m;
	int a,b;
	int g;
	int n;
	int dp[2][NUMMAX];

	while(1){
		cin>>m;
		if(m==0) break;

		for(int i=0;i<NUMMAX;i++) dp[0][i]=0,dp[1][i]=0;
		dp[0][0]=1;

		for(int i=0;i<m;i++){
			cin>>a>>b;
			for(int j=0;j<b;j++){
				for(int k=0;k<NUMMAX-a*(j+1);k++){
					if(dp[0][k]!=0) dp[1][k+a*(j+1)]+=dp[0][k];
				}
			}
			for(int j=0;j<NUMMAX;j++) dp[0][j]+=dp[1][j],dp[1][j]=0;
		}

		cin>>g;

		for(int i=0;i<g;i++){
			cin>>n;
			cout<<dp[0][n]<<endl;
		}
	}
    return 0;
}

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

const int N = 11;
typedef long long ll;

char s[N];
int ans[N];

bool query(ll n){
	printf("? %lld\n", n);
	fflush(stdout);
	scanf("%s", s);
	return s[0] == 'Y';
}

ll power[N];

int main(){
	power[0] = 1;
	for (int i = 1; i < N; ++ i){
		power[i] = power[i - 1] * 10;
	}
	bool flag = query(power[N - 1]);
	int sit = 0;
	for (int i = 1; i < N; ++ i){
		if (flag && sit){
			break;
		}
		if (query(power[i - 1]) && query(power[i] - 1)){
			sit = i;
		}
	}
	for (int i = 0; i < sit - 1; ++ i){
		ll x = 0;
		for (int j = 0; j < i; ++ j){
			x += ans[j] * power[i - j];
		}
		int left = !i, right = 9;
		for (int mid = left + right + 1 >> 1; left < right; mid = left + right + 1 >> 1){
			if (query(x + mid)){
				left = mid; 
			}
			else{
				right = mid - 1;
			}
		}
		ans[i] = left;
	}
	ll x = 0;
	for (int i = 0; i < sit - 1; ++ i){
		x += ans[i] * power[sit - i];
	}
	int left = sit == 1, right = 9;
	for (int mid = left + right >> 1; left < right; mid = left + right >> 1){
		if (query(x + mid * 10)){
			right = mid; 
		}
		else{
			left = mid + 1;
		}
	}
	ans[sit - 1] = left;
	printf("! ");
	for (int i = 0; i < sit; ++ i){
		printf("%d", ans[i]);
	}
	return printf("\n"), 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
#define all(a) a.begin(),a.end()
int main()
{
	const int M=1000000;
	vector<int> pri;
	bool flag[M]={};
	for(int i=2;i<M;i++)
	{
		if(flag[i]==false)
		{
			pri.push_back(i);
			for(int j=i;j<M;j+=i)
			{
				flag[j]=true;
			}
		}
	}
	int n;
	while(cin>>n&&n)
	{
		int x=0;
		for(int i=0;i<n;i++)
		{
			int p,m;cin>>p>>m;
			auto l=lower_bound(all(pri),p-m);
			auto r=upper_bound(all(pri),p+m)-1;
			x+=(r-pri.begin())-(l-pri.begin());
		}
		cout<<x<<endl;
	}
}

Measured memory_bytes: 4236