akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pl;

#define FST first
#define SND second

// const int MAX_N = 1000;                  // 10^5
// const int MAX_N = 100000;                  // 10^5
// const int MAX_N = 100000;                  // 10^5
// const int MAX_N = 1000000000;              // 10^9
// const ll  MAX_N = 1000000000000000000;     // 10^18
// const int BASE  = 1000000000 + 7;          // 10^9 + 7
// const int INFI  = 1000000000 + 7;          // 10^9 + 7
// const ll INFL  = 1000000000000000000 + 7; // 10^18 + 7

int N, CNT[26];
string S;

void solve() {
  for (int i = 0; i < 26; i++) CNT[i] = 0;

  for (int i = 0; i < N; i++) {
    int c = S[i] - 'a';
    CNT[c]++;
  }

  int ans = N;
  for (int c = 0; c < 26; c++) {
    if (CNT[c] > 0) {
      char d = c + 'a';
      int l = 0, t = 0;
      for (int i = 0; i < N; i++) {
        if (S[i] == d) {
          t = max(t, i - l);
          l = i + 1;
        }
      }
      t = max(t, N - l);
      ans = min(ans, t);
    }
  }

  cout << ans << endl;
}

int main() {
  cin >> S;
  N = S.size();

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n;
	int a[13],b[13],z;
	int i;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		z=0;
		for(i=1;i<=12;i++) scanf("%d %d",&a[i] ,&b[i]);
		for(i=1;i<=12;i++){
			z+=a[i]-b[i];
			if(z>=n) break;
		}
		
		if(i==13) printf("NA\n");
		else printf("%d\n",i);
	}
return 0;
}

Measured memory_bytes: 612
N,Y = map(int, input().split())

Flag=False
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 10000*x+5000*y+1000*z==Y and 0<=z<=2000:
            print(x,y,z)
            Flag=True
            break
    if Flag:
        break


if Flag==False:
    print(-1,-1,-1)

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

int main() {   
    int a, b;
    cin >> a >> b;
    string text = "a == b";

    if (a < b) {
        text = "a < b";
    } else if (a > b) {
        text = "a > b";
    }
    
    cout << text << endl;
}


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

typedef struct NodeKey {
    int board[16];
    int space;
    int est;
} NodeKey;

int get_uint() ;
void put_uint(int n);
int dfs(const int,const int,const int,const NodeKey *,const int,const int L1[][16]);
int iterative_deepening(NodeKey *);

int main(int argc, char **argv)
{
  NodeKey initial;
  int i,x;
  
  for(i=0;i<16;++i) {
    x = get_uint();
    initial.board[i] = x;
    if(x == 0) initial.space = i;
  }
  put_uint(iterative_deepening(&initial));
  putchar_unlocked('\n');
  return 0;
}

int get_uint()
{
  int n=0;
  int c=getchar_unlocked();
  
  if(c < 48 || 57 < c) return c;
  while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
  return n;
}

void put_uint(int n)
{
  char buf[11];
  int i;
  
  if(!n) {
    putchar_unlocked('0');
    return;
  }
    i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}


int dfs(const int lim, const int depth, const int prev, const NodeKey *node, const int M, const int L1[][16])
{
  if(node->est == 0) return 1;
  if(depth + node->est > lim) return 0;

  static const int dx[] = {-1, 0, 1, 0};
  static const int dy[] = {0, -1, 0, 1};
  const int x = node->space % M;
  const int y = node->space / M;
  NodeKey next_node;
  int i;

  for(i=0;i<4;++i) {
    const int nx = x + dx[i];
    const int ny = y + dy[i]; 
    if(nx < 0 || M <= nx || ny < 0 || M <= ny) continue;
    if(abs(prev - i) == 2) continue;

    const int next_space = nx + ny * M;
    next_node = *node;
    next_node.est -= L1[next_space][next_node.board[next_space] - 1];
    next_node.est += L1[next_node.space][next_node.board[next_space] - 1];
    next_node.board[next_node.space] = next_node.board[next_space];
    next_node.board[next_space] = 0;
    next_node.space = next_space;
    if(dfs(lim, depth + 1, i, &next_node, M, L1)) return 1;
  }
  return 0;
}

int iterative_deepening(NodeKey *node)
{
  const int N = 16;
  const int M = 4;
  int L1[N][N];
  int i,j,min=0;
  
  for(i=0;i<N;++i)
    for(j=0;j<N;++j) L1[i][j] = abs(i % M - j % M) + abs(i / M - j / M);

  for(i=0;i<N;++i)
    if(i != node->space) min += L1[i][node->board[i] - 1];
  node->est = min;
  for(const int lim = 46; min < lim; ++min)
    if(dfs(min, 0, 9, node, M, L1)) return min;
  return -1;
}



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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {


  int64 S;
  cin >> S;

  const int64 LIM = (int) 1e9;

  int64 X[3], Y[3];
  X[0] = 0, Y[0] = 0;


  int64 sa = infll, pos = 0;
  for(int64 X1 = 1; X1 <= LIM; X1 += 15) {
    int64 Y2 = (S + X1 - 1) / X1;
    if(Y2 <= LIM && chmin(sa, (X1 * Y2) - S)) {
      pos = X1;
    }
  }
  for(int64 X1 = LIM; X1 >= 1; X1 -= 15) {
    int64 Y2 = (S + X1 - 1) / X1;
    if(Y2 <= LIM && chmin(sa, (X1 * Y2) - S)) {
      pos = X1;
    }
  }


  X[1] = pos;
  Y[2] = (S + X[1] - 1) / pos;

  int64 rest = X[1] * Y[2] - S;

  Y[1] = 1;
  X[2] = rest;


  for(int i = 0; i < 3; i++) {
    if(i) cout << " ";
    cout << X[i] << " " << Y[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    // #include <iostream>
    #include <string>
    #include <queue>
    #include <set>
    #include <list>
    #include <chrono>
    #include <random>
    #include <iostream>
    #include <algorithm>
    #include <cmath>
    #include <string>
    #include <vector>
    #include <map>
    #include <unordered_map>
    #include <stack>
    using namespace std;
    #define frn(i,a,b) for(ll i=a;i<b;i++)
    #define forn(i,a,b) for(ll i=a;i<=b;i++)
    #define frt(i,a,b) for(auto it=a;it!=b;it++)
    #define MP make_pair
    #define F first
    #define S second
    #define PB push_back
    #define SQ(a) (a)*(a)
    #define SUM(n) ((n)*(n+1))/2
    #define SqSUM(n) ((n)*(n+1)*(2*n+1))/2
    #define GMSUM(a,r,n) (a*pow(r,n)-a)/(r-1)
    // to sort vector of any kind string or any sorting form sort(v.begin(),v.end()); and for reverse use rbegin and rend
    const long long int md = 998244353;
    typedef long long ll;
    typedef long double ld;
    typedef pair<ll, ll> pi;
    typedef vector<ll> vi;
    typedef vector<vector<ll, ll> > vvi;
    // typedef bitset<5> bst;
    const ll MAX = LONG_MAX;
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a,b;
        cin>>a>>b;
        cout<<max(a+b,max(a-b,a*b));
        return 0;
    } 

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

// #define amari(x) ((x) % 1000000007)
#define amari(x) ((x) % 998244353)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(long i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

std::vector<ll> enum_div(ll n)//nの約数を列挙
{
	std::vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

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

  string s;

  cin >> s;

  if (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0') {
    cout << "NA" << endl;
  } else if (s[0] == '0' && s[1] == '0' && atoi(s.substr(2, 2).c_str()) > 12) {
    cout << "NA" << endl;
  } else if (s[0] == '0' && s[1] == '0') {
        cout << "YYMM" << endl;
  } else if (s[2] == '0' && s[3] == '0' && atoi(s.substr(0, 2).c_str()) > 12) {
    cout << "NA" << endl;
  }  else if (s[2] == '0' && s[3] == '0') {
        cout << "MMYY" << endl;
  } else if (atoi(s.substr(0, 2).c_str()) <= 12 && atoi(s.substr(2, 2).c_str()) <= 12) {
    cout << "AMBIGUOUS" << endl;
  } else if (atoi(s.substr(0, 2).c_str()) <= 12) {
        cout << "MMYY" << endl;
  }else if (atoi(s.substr(2, 2).c_str()) <= 12) {
        cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;

signed main(){
    int H,N;
    cin >> H >> N;
    
    int A,sum=0;
    for(int i=0;i<N;i++){
        cin >> A;
        sum += A;
    }
    if(sum>=H) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  for (int i = 0; i < W+2; i++) cout << "#";
  cout << endl;
  for (int j = 0; j < H; j++) {
  string N;
  cin >> N;
  cout << "#" << N << "#" << endl;
  }
     for (int i = 0; i < W+2; i++) cout << "#";
  cout << endl;
}

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

int main()
{
  int n, i, j, k, xlen, ylen;
  char x[1003], y[1003];
  int c[1001][1001];
  scanf("%d\n", &n);
  for (k=0; k<n; k++) {
    fgets(x, 1002, stdin);
    xlen = strlen(x);
    if (x[xlen-1]=='\n') x[xlen-- -1]='\0';
    fgets(y, 1002, stdin);
    ylen = strlen(y);
    if (y[ylen-1]=='\n') y[ylen-- -1]='\0';

    for (i=0; i<=xlen; i++) for (j=0; j<=ylen; j++) c[i][j]=0;
    
    for (i=0; i<xlen; i++) {
      for (j=0; j<ylen; j++) {
        if (x[i]==y[j]) 
          c[i+1][j+1] = c[i][j]+1;
        else
          c[i+1][j+1] = c[i][j+1] > c[i+1][j] ? c[i][j+1] : c[i+1][j];
      }
    }
    printf("%d\n", c[xlen][ylen]);
  }
  return 0;
}


Measured memory_bytes: 5692
from collections import defaultdict
import sys
input = sys.stdin.buffer.readline


class UF_tree:
    def __init__(self, n):
        self.root = [-1] * (n + 1)  # -1ならそのノードが根,で絶対値が木の要素数
        self.rank = [0] * (n + 1)

    def find(self, x):  # xの根となる要素番号を返す
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.rank[x] < self.rank[y]:
            self.root[y] += self.root[x]
            self.root[x] = y
        else:
            self.root[x] += self.root[y]
            self.root[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def getNodeLen(self, x):
        return -self.root[self.find(x)]


if __name__ == "__main__":
    N, M, K = map(int, input().split())
    friend = UF_tree(N)
    d = defaultdict(int)

    for _ in range(M):
        A, B = map(int, input().split())
        friend.unite(A, B)
        d[A] += 1
        d[B] += 1

    for _ in range(K):
        C, D = map(int, input().split())
        if friend.isSame(C, D):
            d[C] += 1
            d[D] += 1

    ans = [friend.getNodeLen(i) - d[i] - 1 for i in range(1, N + 1)]
    print(*ans)


Measured memory_bytes: 23724
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  vector<string> s(n);
  map<string, ll> cnt;
  for(int i = 0; i < n; i++) cin >> s[i], sort(begin(s[i]), end(s[i])), cnt[s[i]]++;
  ll ans = 0;
  for(auto p : cnt) {
    ans += p.second * (p.second - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int sum = 0;
    rep(i, N){
        cin >> A[i];
        sum += A[i];
    }

    int mean = sum / N ;

    int ans = INF;
    for(int y = mean; y <= mean + 1; y++){
        int tmp = 0;
        rep(i, N){
           tmp += (A[i] - y) * (A[i] - y);
        }
        ans = min(ans, tmp);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pll >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll inf=1e18+1e17;
const ll mod =inf;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}

const ll N =2e5 + 6;

//(a – b)(a4 + a3b + a2b2 + ab3 + b4)
// ( a-b)( (a3+b3)( a+b)+ a2b2)
void solve(){
	ll x;

	cin>>x;

	//cout<<powm( 1e3,5);//-powm( 1e3-1,5)<<'\n';
	for ( int i=-1e3;i<=1e3;i++){
		ll val=powm(i,5)-x;
		//cout<<val<<'\n';
		ll lb=-1e3,ub=1e3;
		int t=30;
		while ( t--&&lb<=ub){
			ll mid=(lb+ub)/2;
			ll val1=abs( mid);
			ll val2=powm( val1,5);
			if ( mid<0)
				val2=-val2;
			//cout<<lb<<' '<<ub<<' '<<mid<<' '<<val2<<' '<<val<<'\n';
			if ( val2==val){
			//	cout<<"HERE\n";
				if ( powm( i,5)-powm( mid,5)==x){
				cout<<i<<' '<<mid<<'\n';
				return;
			}
			}
		//	cout<<val2<<' '<<val<<'\n';
			if ( val2<val){
				lb=mid+1;
			}
			else
			{
				ub=mid-1;
			}
		}
	}
}


int main(){
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif	*/
    ll t=1;
	//cin>>t;
    for (ll i=1;i<=t;i++){
    //	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main(void){
    
    
    int h,r;
    cin>>h>>r;
    
    if(h+r==0){
        cout<<0<<endl;
    }
    else if(h+r>0){
        cout<<1<<endl;
    }
    else{
        cout<<-1<<endl;
    }
    
}



Measured memory_bytes: 3100
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define N 200000
#define ll long long
using namespace std;

int main(){
    ll n;
    cin>>n;
    ll p=n%10;
    if (p==3) cout<<"bon"<<endl;
    else if (p==0 || p==1 || p==6 || p==8) cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
}

Measured memory_bytes: 3632
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others

//Hang in there!
//LOVE Ayane Sakura
//LOVE Nyantako_GG

using namespace std;


int main() {
	string S;
	cin >> S;
	int ans = INT_MAX;
	for (int i = 0; i < S.size() - 2; i++) {
		int check = (int)(S[i] - 48) * 100 + (int)(S[i + 1] - 48) * 10 + (int)(S[i + 2] - 48);
		ans = min(ans, abs(753 - check));
	}
	cout << ans << endl;
}


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

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int ans = 0;
            if (n % 2 == 0) {
                ans = n / 2;
            } else {
                ans = n / 2 + 1;
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;


    void calc()
    {
        cin = new Scanner();
        int[] ABCD = cin.ArrayInt(4,0);
        int ans=Math.Min(ABCD[1],ABCD[3])-Math.Max(ABCD[0],ABCD[2]);
        if(ans>=0)Console.WriteLine(ans);
        else Console.WriteLine(0);
    }


}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int dp[101][10101];

int main() {
    int n, W;
    cin >> n >> W;
    
    for (int i = 0; i < n; i++) {
        int v, w;
        cin >> v >> w;
        for (int j = 0; j < 10101; j++) {
            if (j - w >= 0) {
                dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w] + v);
            } else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }
    int ans = 0;
    for (int j = 0; j <= W; j++) {
        ans = max(ans, dp[n][j]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 7044
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mmax(a,b,c) max(a,max(b,c))
#define mmin(a,b,c) min(a,min(b,c))
#define M 1000000007
#define V vector
#define F(a,b,c) for (a=b;a<=c;++a)
#define I cin
#define O cout
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

int main() {
    I.sync_with_stdio(false);
    I.tie(0);
    ll ls,lt,i,j;
    string s,t;
    I>>s>>t;
    ls=s.size();
    lt=t.size();
    vector<vector<ll>> dp(lt+1, vector<ll> (ls+1,0));
    string a;
    F(i,1,lt)
    {
        F(j,1,ls)
        {
            if (s[j-1]==t[i-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    i=lt;
    j=ls;
    while (1)
    {
        while (1)
        {
            if (s[j-1]==t[i-1])
            {
                a=s[j-1]+a;
                --i;
                --j;
            }
            else if (dp[i][j-1] > dp[i-1][j])
            {
                --j;
            }
            else if (dp[i][j-1] <= dp[i-1][j])
            {
                --i;
            }
            if (j==0||i==0)
                break;
        }
        if (j==0||i==0)
            break;
    }
    O<<a<<'\n';
    // O<<dp[lt][ls]<<'\n';
    return 0;
}

Measured memory_bytes: 70784
#include<iostream>
#include<map>
#include<queue>
#include<vector>
#define MAX 100000000
using namespace std;
typedef pair<int,int> p;
typedef pair<int,p> P;
//G@ê@à
struct edge{
	int to,cost,enem;
};
int main(){
	int n,m,l;
	while(cin>>n>>m>>l,n||m||l){
		vector<edge> tab[110];
		for(int i=0;i<m;i++){
			int a,b,d,e;
			cin>>a>>b>>d>>e;
			a--;
			b--;
			edge pre;
			pre.cost=d;
			pre.enem=e;
			pre.to=b;
			tab[a].push_back(pre);
			pre.to=a;
			tab[b].push_back(pre);
		}
		int d[110][110];
		//d[ê][à]=G;
		for(int i=0;i<n;i++)
		for(int j=0;j<=l;j++){
			d[i][j]=MAX;
		}
		d[0][l]=0;
		priority_queue<P,vector<P>,greater<P> > que;
		que.push(P(0,p(0,l)));
		while(!que.empty()){
			P now=que.top();
			que.pop();
			int nowplace=now.second.first;
			int nowenem=now.first;
			int nowmoney=now.second.second;
			if(d[nowplace][nowmoney]<nowenem)
				continue;
			d[nowplace][nowmoney]=nowenem;
			for(int i=0;i<(int)tab[nowplace].size();i++){
				edge e=tab[nowplace][i];
				if(e.cost<=nowmoney&&d[e.to][nowmoney-e.cost]>nowenem){
					d[e.to][nowmoney-e.cost]=nowenem;
					que.push(P(nowenem,p(e.to,nowmoney-e.cost)));
				}
				if(d[e.to][nowmoney]>nowenem+e.enem){
					d[e.to][nowmoney]=nowenem+e.enem;
					que.push(P(nowenem+e.enem,p(e.to,nowmoney)));
				}
			}
		}
		int ans=MAX;
		for(int i=0;i<=l;i++)
		ans=min(ans,d[n-1][i]);
		cout<<ans<<endl;
		
		
	}
	return 0;
}

Measured memory_bytes: 1456
#include <stdio.h>
#include <string.h>
 
int main(void){
 
    int i;
    int al[26];
    char c;
 
    for(i=0;i<26;i++)al[i]=0;
 
    while(scanf("%c",&c)!=EOF){
 
        if(c>='a'&&c<='z')al[c-'a']++;
        else if(c>='A'&&c<='Z')al[c-'A']++;
 
    }
 
    for(i=0;i<26;i++){
        printf("%c : %d\n",'a'+i,al[i]);
    }
 
    return 0;
 
}

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

#define N 1000100

int main(void){
  bool eratos[N];
  eratos[0] = eratos[1] = false;
  for(int i = 2; i < N; i++){ eratos[i] = true; }
  for(int i = 2; i * i < N; i++)
    if(eratos[i])
      for(int j = i + i; j < N; j += i)
        eratos[j] = false;
  
  while(true){
    int a, d, n;
    cin >> a >> d >> n;
    if(a == 0 && d == 0 && n == 0){ break; }
    
    int ans = 0;
    int count = 0;
    for(int i = a; count < n; i += d){
      if(eratos[i]){
        ++count;
        ans = i;
      }
    }
    
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3988
import java.util.Scanner;

/**
 * @author yoshida3203
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		char[]cube=sc.next().toCharArray();
		sc.close();

		int zero=0;
		int ichi=0;
		for(int i=0;i<cube.length;i++){
			if(cube[i]=='0'){
				zero++;

			}else{
				ichi++;
			}
		}

		int ans=Math.min(zero, ichi);
		System.out.println(ans*2);
		/*
		int ans=Math.min(zero, ichi);
		System.out.println(ans*2);
*/
	}



}


Measured memory_bytes: 38680
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n, m;
ll a[100100];

int main() {
	while (cin >> n >> m&&n + m) {
		rep(i, n) {
			cin >> a[i];
		}
		ll ans = -1;
		rep(i, n) {
			FOR(j, i + 1, n) {
				if (a[i] + a[j] <= m)ans = max(ans, a[i] + a[j]);
			}
		}
		if (ans != -1)cout << ans << endl;
		else cout << "NONE" << endl;
	}
}


Measured memory_bytes: 3056
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let v : Vec<i64> = get_vec();
    let n = v[0];
    let mut k = v[1];
    let mut a : Vec<i64> = get_vec();
    a.sort();
    let mut ans = 0;
    for x in a {
        if x > k {
            break;
        }
        k -= x;
        ans += 1;
    }
    println!("{}", if k > 0 && ans == n {ans-1} else {ans});
}


Measured memory_bytes: 4352
#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--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    int a[n], b[200010] = {}, ans = 0;
    rep(i, n) cin >> a[i];

    for (int j = n; j > 0; j--){
        int tmp = j, cnt = 0;
        while (tmp <= n){
            cnt += b[tmp];
            tmp += j;
        }
        b[j] = (a[j - 1] + cnt) % 2;
        if(b[j] != 0) ans ++;
    }

    cout << ans << endl;

    if (ans == 0) return 0;

    rep(i, n + 1) if (b[i] == 1) cout << i << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>

using namespace std;

void solve(int n, int d, int x) {
	vector<vector<int>> prices(n, vector<int>(d, 0));

	for (int i = 0; i < d; i++) {
		for (int j = 0; j < n; j++) {
			cin >> prices[j][i];
		}
	}

	vector<int> dp(100010, -1);

	for (int i = 0; i < d - 1; i++) {
		for (int j = 0; j <= x; j++) {
			dp[j] = j;
		}
		for (int j = 0; j < n; j++) {
			for (int k = 0; k <= x; k++) {
				if (k >= prices[j][i]) {
					int prev = dp[k];
					int next = dp[k - prices[j][i]] + prices[j][i + 1];
					dp[k] = max(prev, next);
				}
			}
		}
		int y = 0;
		for (int j = 0; j <= x; j++) {
			y = max(y, dp[j]);
		}
		x = y;
	}

	cout << x << endl;
}

int main() {
	int n, d, x;
	cin >> n >> d >> x;
	solve(n, d, x);
}

Measured memory_bytes: 3156
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ a, b ] :: [Integer] <- map read . lines <$> getContents
	putStrLn $ tostr $ compare a b

tostr LT = "LESS"
tostr EQ = "EQUAL"
tostr GT = "GREATER"


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

int main(int argc, char const* argv[])
{
    std::string in_str;
    std::cin >> in_str;

    int head, tail;

    bool is_wait_for_head = true;
    for(int i=0; i< in_str.length(); ++i)
    {
        if(is_wait_for_head)
        {
            if(in_str[i] == 'A')
            {
                head = i;
                is_wait_for_head = false;
            }
        }
        else
        {
            if(in_str[i] == 'Z')
            {
                tail = i;
            }
        }
    }
    auto s = in_str.substr(head, tail - head + 1);
    /* std::cout << head << " " << tail << std::endl; */
    /* std::cout << s << std::endl; */
    std::cout << s.length() << std::endl;
}

Measured memory_bytes: 772
import java.util.*;

public class Main{
  public static void main(String[] args){
    ArrayList<Integer> list = new ArrayList<Integer>();
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b=0;
    for(int i = 0; i < a; i++){
      b = scan.nextInt();
      list.add(b);
    }
    Collections.sort(list);
    int ans=0;
    for(int i = 0;i<a;i++){
      if(i==(a-1)) ans+=list.get(i)/2;
      else ans+=list.get(i);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
s = input()

sf = int(s[:2])
sb = int(s[2:4])

ans = ""

if 1 <= sf <= 12:

    if 1 <= sb <= 12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"

else:

    if 1 <= sb <= 12:
        ans = "YYMM"
    else:
        ans = "NA"

print(ans)

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

using namespace std;

#define INF ((1<<30)-1)  //int32_t
#define MOD 1000000007
#define MOD2 

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

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

int main(){

    bool flag=true;

    ll ans=0,sum=0;
    
    int n,m;
    cin >>n;
    if(n%2 == 1){
        cout <<fixed<<setprecision(16)<< (double)((n/2) + 1)/n<< endl;
    }else{
        cout <<fixed<<setprecision(16)<< (double)(n/2)/n<< endl;
    }

    //cout <<fixed<<setprecision(16)<< (double)(n/2)/2<< endl;
    //cout << (double)(n/2)/2 << endl;

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


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

const int N = 1e5+7, INF = 1e9+7;
int dp[N][3];

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

    int n;
    cin>>n;
    for (int i=1; i<=n; i++) {
        int cc[3];
        cin>>cc[0]>>cc[1]>>cc[2];

        int temp[3] = {-INF, -INF, -INF};
        for (int j=0; j<3; j++)
            for (int k=0; k<3; k++)
                if (j!=k) {
                    temp[j] = max(dp[i-1][k] + cc[j], temp[j]);
                }

        for (int j=0; j<3; j++)
            dp[i][j] = temp[j];

//        cout<<i<<" "<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
    }

    int ans = max(dp[n][0], dp[n][1]);
    ans = max(ans, dp[n][2]);
    cout<<ans<<endl;
}


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

using namespace std;
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
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...);
}

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for (int i = 0; i < (int)(n); ++i)
#define fore(i,a,b) for (int i = a; i < (int)(b); ++i)
#define forin(i, n) for (auto& i : (n))
#define make_unique(x) (x).erase(unique(all((x))), (x).end())
#define hbar ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<class T> T gcd(T a, T b) {return b ? gcd (b, a % b) : a;}

const int INF = 1 << 29;
const int MOD = 1e9 + 7;


int main() {
  hbar;
  int n, m, sz;
  cin >> n >> m;
  vi cost(m), mask(m);
  forn(i, m) {
    cin >> cost[i] >> sz;
    while(sz--){
      int x;
      cin >> x;
      --x;
      mask[i] |= 1 << x;
      // trace(x,mask[i]);
    }
  }
  vi d(1<<n, INF), e(1<<n);
  d[0]=0;
  forn(i,m){
    copy(all(d),e.begin());
    forn(j,1<<n){
      int kp = j | mask[i];
      uin(e[kp],d[j]+cost[i]);
    }
    swap(d,e);
  }
  int ans = d[(1<<n)-1];
  cout << (ans == INF ? -1 : ans);
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

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


ll gcd(ll a,ll b){
    if(b>a) swap(a,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;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}


int main(){
    int n;
    cin >> n;
    vector<ll>x(n);
    vector<ll>y(n);
    rep(i,n) {
        cin >> x[i];
        y[i] = x[i];
    }

    sort(all(x));
    ll a = x[n/2-1];
    ll b = x[n/2];

    rep(i,n){
        if(y[i] <= a){
            cout  << b << endl;
        }
        else if(y[i] >= b){
            cout << a << endl;
        }
        else{
            cout << a << endl;
        }
    }






    return 0;
}


Measured memory_bytes: 6244
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()
/* --- */
int main() {
	int h, a;
	cin >> h >> a;
	cout << (h - 1) / a + 1 << '\n';
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint
    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll H,A;
        cin>>H>>A;
        cout<<(H+A-1)/A<<endl;
    }

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)

int main() {
    int N;
    cin >> N;
    vector<int> ans(10001);
    for (int x = 1; x <= 100; x++) {
        for (int y = 1; y <= 100; y++) {
            for (int z = 1; z <= 100; z++) {
                int a = x * x + y * y + z * z + x * y + y * z + z * x;
                if (a <= 10000) ans[a]++;
            }
        }
    }
    for (int i = 1; i <= N; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int all = H*W;
		all-=h*W;
		all-=w*(H-h);
		System.out.println(all);
	}
}

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

double rdp(const uint32_t N, vector<vector<vector<double>>>& dp, const uint32_t ac[3]) {	
	// already memo
	if(dp[ac[2]][ac[1]][ac[0]] > 0) return dp[ac[2]][ac[1]][ac[0]];
	
	uint asum = ac[0] + ac[1] + ac[2];
	if(asum == 0) return 0;
	
	double ans = 0;
	
	if(ac[0] > 0) {
		uint32_t nac[] = {ac[0]-1, ac[1], ac[2]};
		ans += ac[0] * rdp(N, dp, nac);
	}
	if(ac[1] > 0) {
		uint32_t nac[] = {ac[0]+1, ac[1]-1, ac[2]};
		ans += ac[1] * rdp(N, dp, nac);
	}
	if(ac[2] > 0) {
		uint32_t nac[] = {ac[0], ac[1]+1, ac[2]-1};
		ans += ac[2] * rdp(N, dp, nac);
	}
	// new memo
	dp[ac[2]][ac[1]][ac[0]] = (ans + N) / asum;
	//cout << ac[0] << " " << ac[1] << " " << ac[2] << " " << dp[ac[2]][ac[1]][ac[0]] << endl;
	return dp[ac[2]][ac[1]][ac[0]];
}

int main() {
	uint32_t N;
	cin >> N;
	
	uint32_t ac[3] = {0};
	for(uint32_t i=0; i<N; i++) {
		uint32_t a;
		cin >> a;
		ac[a-1]++;
	}
	
	vector<vector<vector<double>>> dp(ac[2] + 1,
		vector<vector<double>>(ac[2] + ac[1] + 1,
		vector<double>(ac[2] + ac[1] + ac[0] + 1)));
	
	double ans = rdp(N, dp, ac);
	cout << setprecision(10) << ans;
	
	return 0;
}

Measured memory_bytes: 216960
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int H, W, c, a[9][9], b[9][9], g[6][9][9], v[9][9];
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
int rec1(int x, int y) {
	int ret = 1; v[y][x] = 1;
	for (int i = 0; i < 4; i++) {
		int tx = x + dx[i], ty = y + dy[i];
		if (0 <= tx && tx < W && 0 <= ty && ty < H && b[y][x] == b[ty][tx] && !v[ty][tx]) ret += rec1(tx, ty);
	}
	return ret;
}
void rec(int x, int y, int e) {
	int w = b[y][x]; b[y][x] = e;
	for (int i = 0; i < 4; i++) {
		int tx = x + dx[i], ty = y + dy[i];
		if (0 <= tx && tx < W && 0 <= ty && ty < H && b[ty][tx] == w) rec(tx, ty, e);
	}
}
inline void cpy(int d, int m) {
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			switch (m) {
			case 0: g[d][i][j] = b[i][j]; break;
			case 1: b[i][j] = g[d][i][j]; break;
			case 2: v[i][j] = 0; break;
			}
		}
	}
}
int solve(int d) {
	int ret = 0; cpy(d, 0);
	if (b[0][0] != c) rec(0, 0, c);
	cpy(0, 2), ret = rec1(0, 0), cpy(d, 1);
	if (d < 4) {
		for (int i = 1; i <= 6; i++) {
			if (b[0][0] == i) continue;
			cpy(d, 0), rec(0, 0, i);
			ret = max(ret, solve(d + 1)), cpy(d, 1);
		}
	}
	return ret;
}
int main() {
	while (scanf("%d%d%d", &H, &W, &c), H) {
		memset(g, 0, sizeof(g));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) scanf("%d", &a[i][j]), b[i][j] = a[i][j];
		}
		printf("%d\n", solve(0));
	}
	return 0;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

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

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  int X;
  cin >> X;
  int num = X;
  while (!IsPrime(num)) {
    num++;
  }
  cout << num << endl;
};


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int fa[100001];
int find(int x){return (fa[x]==x)?fa[x]:fa[x]=find(fa[x]);}
int a[100001],b[100001],c[100001];
signed main()
{
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	int num=n;
	for(int i=1;i<=n;i++)
		fa[i]=i;
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		if(c[i]==0)
		{
			int f1=find(a[i]),f2=find(b[i]);
			if(f1!=f2)
			{
				fa[f1]=f2;
				num--;
			}
		}
	}
	for(int i=1;i<=q;i++)
	{
		if(c[i]==1)
		{
			if(m<n||num<=2||find(a[i])==find(b[i]))
			{
				printf("No");
				return 0;
			}
		}
	}
	if(m-(n-num)>1ll*(num-1)*num/2)
	{
		printf("No");
		return 0;
	}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
 
int num,h,m,s;
scanf("%d",&num);
 
s = num % 60;
num = num / 60;
m = num % 60;
h = num / 60;
 
printf("%d:%d:%d\n",h,m,s);
 
return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    long long a,s=0,k=0;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        if(i>0 && a<k)
        {
            s+=k-a;
        }
        k=max(k,a);
    }
    cout<<s;

}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int h, w, x, y;
    cin >> h >> w >> x >> y;
    cout << (h - x) * (w - y) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
typedef long long LL;

int main() {
  std::string S; std::cin >> S;

  int l = 0, r = S.length()-1;
  int cnt = 0;
  while(l<r) {
    if (S[l] != S[r]) ++cnt;
    ++l;
    --r;
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 10
#define T 3

int main(){
	int m[N],i,j,k,l;
	for(i=0;i<N;i++)scanf("%d",&m[i]);
	for(j=0;j<T;j++){
		k=0;
		for(i=0;i<N-j;i++){
			if(k<m[i+j]){
				k=m[i+j];
				l= i+j;
			}
		}
		i=m[j];
		m[j]=k;
		m[l]=i;
		printf("%d\n",m[j]);
	}	
	return 0;
}

Measured memory_bytes: 600