akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define repp(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define popcnt __builtin_popcount
#define all(v) v.begin(),v.end()
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
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;}
template<class T> T gcd(T a, T b){return b?GCD(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/GCD(a,b);}

int main(){
   // int a,b; cin >> a >> b;
    int n; cin >> n;
   // string s; cin >> s;

    int k[] = {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};

    cout << k[n-1] << endl;

    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.util.Arrays; 
import java.util.ArrayList; 
import java.util.Collections; 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    



    public static void main(String[] args) {
        try (PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            FastScanner in = new FastScanner(System.in);
            int n = in.nextInt();
            long[] array = in.nextLongArray(n);
            long count = 0;

            for(int i = 1; i < n; i++) {
                if(array[i] < array[i-1]) {
                    count += array[i-1] - array[i];
                    array[i] = array[i-1];
                }
            }

            out.println(count);



        } finally {
            //out.close();
        }
        
           
    }
}




class FastScanner {
   private final BufferedReader br;
   private StringTokenizer st;
 
    FastScanner(InputStream InputStream) {
        br = new BufferedReader(new InputStreamReader(InputStream));
    }
    
    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    
    int nextInt() {
        return Integer.parseInt(next());
    }
    
    long nextLong() {
        return Long.parseLong(next());
    }
    
    double nextDouble() {
        return Double.parseDouble(next());
    }


    
    ArrayList<Integer> nextIntList(int count) {
        ArrayList<Integer> array = new ArrayList<>();
        for (int n = 0; n < count; n++) {
            int number = nextInt();
            array.add(number);
        }
        return array;
    }
    
    int[] nextIntArray(int count) {
        int[] array = new int[count];
        for (int n = 0; n < count; n++) {
            array[n] = nextInt();
        }
        return array;
    }

    long[] nextLongArray(int count) {
        long[] array = new long[count];
        for (int n = 0; n < count; n++) {
            array[n] = nextLong();
        }
        return array;
    }
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()

{

    ll n;
    cin >> n;
    vector<ll> v;
    for(ll i = 0; i < n; i++)
    {

        ll x;
        cin >> x;
        v.pb(x);
    }
    sort(v.begin(), v.end());
    cout << abs(v[0]-v[n-1]);
}


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

int main(){
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int outlet = 1;
  while(outlet < b){
    outlet--;
    outlet += a;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,x,t;
        cin>>n>>x>>t;
        cout<<(t)*(((n+x-1)/x))<<"\n";
    }
}

Measured memory_bytes: 3628
#include <iostream>

int main(){
    int a, b, inter_rate;

    // 入力
    std::cin >> a >> b;

    if(a < 10) inter_rate = b + 100*(10-a);
    else if(a >= 10) inter_rate = b;

    std::cout << inter_rate << std::endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	long long int n, t;
	cin >> n >> t;
	long long int h_pre = 0, pos, rem;
	for(int i = 0; i < n; i++){
		long long int h;
		cin >> h;
		if(t <= 0){
			cout << 1 << endl;
			continue;
		}
		if(h_pre <= h){
			h_pre = h;
			pos = t / h + 1;
			cout << pos << endl;
			rem = h - t % h;
		}else{
			rem += h;
			if(rem > h_pre){
				rem -= h_pre;
				pos -= 1;
			}
			cout << max(1LL, pos) << endl;
		}
		t -= h;
	}
	return 0;
}



Measured memory_bytes: 3124
#include <stdio.h>
int main(void){
int N;
scanf("%d",&N);
int H[N],i,cnt=0,max=0;
for(i=0;i<N;i++){
scanf("%d",&H[i]);
if(H[i]>=max) cnt++;
if(max<H[i]) max=H[i];
}
 printf("%d\n",cnt);
return 0;
}

Measured memory_bytes: 128
def hoge(x):
  return (int(x)+1)/2

n,k = map(int,input().split())
p_list = list(map(hoge,input().split()))
p_set = [0,p_list[0]]
t = 0
for i in range(1,n):
  p_set.append(p_set[i]+p_list[i])
for j in range(k,n+1):
  t = max(t,p_set[j]-p_set[j-k])
print(t)

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

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)


// #define printf(a,...) if(0){}
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);


int main () {
  ios::sync_with_stdio(0); cin.tie(0);
  int TT = 1;
  // cin >> TT;
  while (TT--) {
    int h,w,k,x1,y1,x2,y2;
    cin >> h >> w >> k >> y1 >> x1 >> y2 >> x2;
    --y1;
    --y2;
    --x1;
    --x2;
    // x1 = w - x1;
    // x2 = w - x2;
    vector<vector<bool>> M(h, vector<bool>(w));
    for (int y = 0; y < h; ++y) {
      for (int x = 0; x < w; ++x) {
        char c;
        cin >> c;
        M[y][x] = c == '.';
      }
    }
    queue<pair<int,int>> q;
    q.emplace(y1, x1);
    M[y1][x1] = 0;
    int dist = 1;
    bool found = false;
    int dirs[5] = {0,-1,0,1,0};
    int ans = -1;
    unordered_map<int,unordered_set<int>> added;
    while (q.size() && !found) {
      added.clear();
      for (int iq = q.size()-1; iq >= 0 && !found; --iq) {
        auto [y,x] = q.front(); q.pop();
        for (int d = 0; d < 4 && !found; ++d) {
          int dy = dirs[d], dx = dirs[d+1];
          for (int ik = 1; ik <= k; ++ik) {
            int ty = y + ik*dy, tx = x + ik*dx;
            if (ty >= 0 && ty < h && tx >= 0 && tx < w && M[ty][tx]) {
              if (added[ty].emplace(tx).second) {

                if (ty == y2 && tx == x2) {
                  found = true;
                  ans = dist;
                  break;
                }
                q.emplace(ty,tx);
              }
            } else {
              break;
            }
          }
        }
      }
      for (auto [y,xs] : added) {
        for (auto x : xs) M[y][x] = false;
      }
      ++dist;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 9932
#include<cstdio>
#define RI register int
#define CI const int&
using namespace std;
const int N=1000000,mod=998244353;
int n,x,ans,sum,ct[N+5],prime[N+5],cnt,mu[N+5],g[N+5]; bool vis[N+5];
inline void inc(int& x,CI y)
{
	if ((x+=y)>=mod) x-=mod;
}
inline void dec(int& x,CI y)
{
	if ((x-=y)<0) x+=mod;
}
#define Pj prime[j]
inline void init(CI n)
{
	RI i,j; for (vis[1]=mu[1]=1,i=2;i<=n;++i)
	{
		if (!vis[i]) prime[++cnt]=i,mu[i]=-1;
		for (j=1;j<=cnt&&i*Pj<=n;++j)
		{
			vis[i*Pj]=1; if (i%Pj) mu[i*Pj]=-mu[i]; else break;
		}
	}
	for (i=1;i<=n;++i) if (mu[i]) for (j=i;j<=n;j+=i)
	if (~mu[i]) inc(g[j],i); else dec(g[j],i);
}
#undef Pi
int main()
{
	RI i,j; for (init(N),scanf("%d",&n),i=1;i<=n;++i)
	scanf("%d",&x),++ct[x],inc(sum,x); for (i=1;i<=N;++i)
	{
		int ret=0; for (j=i;j<=N;j+=i) inc(ret,1LL*(j/i)*ct[j]%mod);
		ret=1LL*ret*ret%mod; inc(ans,1LL*ret*i%mod*g[i]%mod);
	}
	return dec(ans,sum),printf("%d",1LL*ans*(mod+1>>1)%mod),0;
}

Measured memory_bytes: 14720
import itertools
n,m,k=map(int,input().split())
l=[[int(i) for i in input().split()] for l in range(n)]
min_price=10**8
min_list=[]
a=itertools.product([True,False],repeat=n)
for x in a:
    li=[0]*(m+1)
    for i,y in enumerate(x):
        if y:
            for z in range(m+1):
                li[z]+=l[i][z]
    if min_price>li[0]:
        f=True
        for o in li[1:]:
            if o<k:f=False
        if f:min_price=li[0]
print(min_price if min_price!=10**8 else -1)

Measured memory_bytes: 9216
#include <iostream>
using namespace std;
int main()
{
    int n, a[100005], i, ans=1, f=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }

    for(i=1;i<n;i++){
        if(a[i]<a[i-1] && (f==0 || f==2)) f=2;
        else if(a[i]>a[i-1] && (f==0 || f==1)) f=1;
        else if(a[i]!=a[i-1] && f != 0){
            ans++;
            f=0;
        }  
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

#define ll long long
#define pb push_back
#define for(i,a,b) for(ll i=a;i<b;i++)

using namespace std;


int main(void)
{
    ll x,y,a,b,c,s=0;
    scanf("%lld %lld %lld %lld %lld",&x,&y,&a,&b,&c);
    ll R[a],G[b];
    vector<ll>C;
    for(i,0,a) {scanf("%lld",&R[i]);}
    for(i,0,b) {scanf("%lld",&G[i]);}
    for(i,0,c) {ll z; scanf("%lld",&z); C.pb(z);}
    sort(R,R+a,greater<ll>()); sort(G,G+b,greater<ll>());
    for(i,0,x) {C.pb(R[i]); }
    for(i,0,y) {C.pb(G[i]); }
    sort(C.rbegin(),C.rend());
    for(i,0,x+y) s+=C[i];
    printf("%lld",s);
}


Measured memory_bytes: 7920
def dist(p, X, Y):
    s = 0
    for x, y in zip(X, Y):
        s += abs(x - y)**p
    return s**(1/p)
N = int(input())
*X, = map(int, input().split())
*Y, = map(int, input().split())
print(dist(1, X, Y))
print(dist(2, X, Y))
print(dist(3, X, Y))
print(max(abs(x - y) for x, y in zip(X, Y)))



Measured memory_bytes: 5644
#include<stdio.h>
int main(void){
	long long int n,a[5],min,t;
	scanf("%lld",&n);
	for (int i = 0; i < 5; i++)
	{
		scanf("%lld\n",&a[i]);
	}
	
	min = 1000000000000000;
	for (int i = 0; i < 5; i++)
	{
		if (a[i]<min)
		{
			min = a[i];
		}
	}
	if(n%min==0){
		t = 4 + n/min;
	}else{
		t = 5 + n/min;
	}
	
	printf("%lld\n", t);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll,ll> pll;
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define rep(i, n) for (ll i = 0; i < ll(n); i++)

const ll mod = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

vector<int> adj[200200];

mint dfs(ll from){
    mint res(1);
    for (ll to : adj[from]) {
        res *= dfs(to);
    }
    return res + 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pll> p(n);
    rep(i, n) cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());
    set<pll> s;
    for (int i = n - 1; i >= 0; --i){
        ll x = p[i].first;
        ll d = p[i].second;
        while(s.size() && s.begin()->first < x+d){
            adj[i].pb(s.begin()->second);
            s.erase(s.begin());
        }
        s.emplace(x, i);
    }
    mint ans(1);
    for (auto x : s) {
        ll v = x.second;
        ans *= dfs(v);
    }
    cout << ans.x << endl;
}

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

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int A, B;
        cin >> A >> B;

        Int left = max((100 * A + 7) / 8, 10 * B);
        Int right = min((100 * (A + 1) + 7) / 8, 10 * (B + 1));
        if (left >= right) {
            cout << -1 << endl;
            return;
        }
        cout << left << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int A, B;
  string S;
  cin >> A >> B >> S;
  for (int i = 0; i < A; i++) {
    if ((int)'0' > S[i] || (int)'9' < S[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  if ((char)S[A] != '-') {
    cout << "No" << endl;
    return 0;
  }
  for (int i = A + 1; i < A + B - 1; i++) {
    if ((int)'0' > S[i] || (int)'9' < S[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
module ABC126

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public  :: task_C
  private :: calculate_probability_win

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_C

    ! variables for this <subroutine>
    integer(INT32) :: num_sides_dice
    integer(INT32) :: val_limit_win

    ! STEP.01
    ! read out ...
    ! 1. the number of sides of the given dice
    ! 2. the minimum points to win
    read(unit=INPUT_UNIT, fmt=*), num_sides_dice, val_limit_win

    ! STEP.02
    ! calculate and output the probability of winning this game under given conditions
    write(unit=OUTPUT_UNIT, fmt='(ES23.15e3)', advance='yes') calculate_probability_win (num_sides_dice, val_limit_win)

    ! STEP.END
    return

  end subroutine task_C

  pure function calculate_probability_win (num_sides_dice, val_limit_win) result(prbl_win)

    ! arguments for this <function>
    integer(INT32), intent(in) :: num_sides_dice
    integer(INT32), intent(in) :: val_limit_win

    ! return value of this <function>
    real(REAL128) :: prbl_win

    ! variables for this <function>
    integer(INT32)   :: points
    real   (REAL128) :: prbl_dice_simple_event
    real   (REAL128) :: prbl_coin_simple_event
    real   (REAL128) :: prbl_unit

    ! support variables for this <function>
    integer(INT32) :: itr_side

    ! STEP.01
    ! calculate & store the probability of simple event
    prbl_coin_simple_event = 5.0e-001_REAL128
    prbl_dice_simple_event = 1.0e+000_REAL128 / num_sides_dice

    ! STEP.02
    ! initialize the variable to store the total probability that points will reach the winning condition
    prbl_win = 0.0e+000_REAL128

    ! STEP.03
    ! calculate the total probability that points will reach the winning condition
    do itr_side = 1_INT32, num_sides_dice, 1_INT32

      ! STEP.03.01
      ! initialize the variable to store ...
      ! 1. the current points
      ! 2. the probability that points will reach the winning condition under a side of dice
      points    = itr_side
      prbl_unit = prbl_dice_simple_event

      ! STEP.03.02
      ! calculate the probability that points will reach the winning condition under a side of dice
      do while (points .lt. val_limit_win)
        points    = points    * 2_INT32
        prbl_unit = prbl_unit * prbl_coin_simple_event
      end do

      ! STEP.03
      ! update the total probability that points will reach the winning condition
      prbl_win = prbl_win + prbl_unit

    end do

    ! STEP.END
    return

  end function

end module ABC126


program main

  ! <module>s to import
  use, non_intrinsic :: ABC126

  ! require all variables to be explicitly declared
  implicit none

  call task_C

end program main

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

#define tc(t) int t; cin>>t; while(t--)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    if (s == "SUN") cout << "7" << endl;
    else if (s == "MON") cout << "6" << endl;
    else if (s == "TUE") cout << "5" << endl;
    else if (s == "WED") cout << "4" << endl;
    else if (s == "THU") cout << "3" << endl;
    else if (s == "FRI") cout << "2" << endl;
    else cout << "1" << endl;


}






Measured memory_bytes: 3644
N = int(input())
A = list(map(int, input().split()))
sw = 0
for i in range(N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if (i != minj):
        sw += 1
        A[i], A[minj] = A[minj], A[i]
    
print(" ".join(map(str, A)))
print(sw)


Measured memory_bytes: 5596
N=int(input())
S=[input() for _ in range(N)]

cnt1=0
B_Start=0
A_End=0
ALL=0

for i in range(N):
    cnt1 += S[i].count("AB")
    if S[i][0] == "B":
        B_Start += 1
    if S[i][-1] == "A":
        A_End += 1
    if S[i][0] == "B" or S[i][-1] == "A":
        ALL += 1

hosei=0
        
if B_Start == A_End == ALL and ALL != 0:
  hosei=1
        
print(cnt1 + min(B_Start,A_End) - hosei)

Measured memory_bytes: 3700
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc173/tasks/abc173_a
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin >> n;
    if(n%1000 == 0) cout << 0;
    else
        cout << 1000 - n%1000;

	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int K = stdIn.nextInt();
		int h[] = new int[N];
		int ans = 0;
		for(int i = 0; i < N; i++){
			h[i] = stdIn.nextInt();
			if(h[i] >= K){
				ans++;
			}
		}
		System.out.println(ans);

		stdIn.close();
	}
}


Measured memory_bytes: 59052
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=0,cnt=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
      cnt++;
    }
    else{
      cnt=0;
    }
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <cstdio>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()

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

const int INF = 1<<29;

int num[101];
int main(void){
	int n;
	while(cin >> n, n){
		rep(i, n) cin >> num[i];
		int x;
		cin >> x;

		int lb = 0, ub = n-1;
		int ans = 0;
		while(ub >= lb){
			int mid = (ub+lb)/2;
			ans++;
			if(num[mid] == x) break;
			if(num[mid] < x) lb = mid+1;
			else ub = mid-1;
		}

		cout << ans << endl;
	}

    return 0;
}

Measured memory_bytes: 1160
let popcnt x =
  let x = (x land 0x5555555555555555) + ((x lsr 1) land 0x5555555555555555) in
  let x = (x land 0x3333333333333333) + ((x lsr 2) land 0x3333333333333333) in
  let x = (x land 0x0f0f0f0f0f0f0f0f) + ((x lsr 4) land 0x0f0f0f0f0f0f0f0f) in
  let x = (x land 0x00ff00ff00ff00ff) + ((x lsr 8) land 0x00ff00ff00ff00ff) in
  let x = (x land 0x0000ffff0000ffff) + ((x lsr 16) land 0x0000ffff0000ffff) in
  (x land 0x00000000ffffffff) + ((x lsr 32) land 0x00000000ffffffff)

let () = Scanf.scanf "%d %d %d\n" @@ fun h w k ->
  let ss = Array.init h @@ fun _ -> Scanf.scanf "%s\n" @@ fun s -> s in
  let ops = ref 0 in
  let cursor = ref 0 in
  let blocks = Array.make h 0 in
  let current = Array.make h 0 in
  Printf.printf "%d\n" @@
  Array.fold_left min max_int @@
  Array.init (1 lsl (h - 1)) @@ fun bits ->
    try
      for i = 0 to h - 1 do
        blocks.(i) <- 0;
      done;
      ops := 0;
      for i = 0 to w - 1 do
        for i = 0 to h - 1 do
          current.(i) <- 0;
        done;
        cursor := 0;
        for j = 0 to h - 1 do
          if ss.(j).[i] = '1' then
            current.(!cursor) <- current.(!cursor) + 1;
          if 0 < bits land (1 lsl j) then incr cursor
        done;
        if
          Array.fold_left ( && ) true @@
          Array.init h @@ fun i -> blocks.(i) + current.(i) <= k
        then begin
          for i = 0 to h - 1 do
            blocks.(i) <- blocks.(i) + current.(i)
          done
        end else begin
          incr ops;
          for i = 0 to h - 1 do
            if k < current.(i) then raise Not_found;
            blocks.(i) <- current.(i)
          done
        end
      done;
      !ops + popcnt bits
    with Not_found -> max_int


Measured memory_bytes: 2560
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long k = sc.nextLong();
        n -= k*(n/k);
        System.out.println(Math.min(n, Math.abs(n-k)));
    }

}


Measured memory_bytes: 21844
#include <cstdio>
const int Maxn=1000000;
const int Mod=1000000007;
int po[Maxn<<1|5];
int frac[Maxn<<1|5],inv_f[Maxn<<1|5];
int ksm(int a,int b){
	int ans=1;
	while(b){
		if(b&1){
			ans=1ll*ans*a%Mod;
		}
		b>>=1;
		a=1ll*a*a%Mod;
	}
	return ans;
}
int C(int n,int m){
	return 1ll*frac[n]*inv_f[m]%Mod*inv_f[n-m]%Mod;
}
int work(int n,int m){
	if(n>m){
		n^=m^=n^=m;
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		ans=(ans+C(i+1+m,m))%Mod;
	}
	return ans;
}
int main(){
	frac[0]=inv_f[0]=1;
	for(int i=1;i<=(Maxn<<1)+1;i++){
		frac[i]=1ll*frac[i-1]*i%Mod;
	}
	inv_f[Maxn<<1|1]=ksm(frac[Maxn<<1|1],Mod-2);
	for(int i=(Maxn<<1);i>0;i--){
		inv_f[i]=1ll*inv_f[i+1]*(i+1)%Mod;
	}
	int r_1,r_2,c_1,c_2;
	scanf("%d%d%d%d",&r_1,&c_1,&r_2,&c_2);
	printf("%d\n",(((work(r_2,c_2)-work(r_1-1,c_2)+Mod)%Mod-work(r_2,c_1-1)+Mod)%Mod+work(r_1-1,c_1-1))%Mod);
	return 0;
}


Measured memory_bytes: 16512
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        long N = cin.Nextlong, M = cin.Nextlong;
        long ans = 0;
        if(N * 2 <= M)
        {
            M -= N * 2;
            ans = N;
            ans += M / 4;
        }
        else
        {
            ans = M / 2;
        }
        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 11092
def partition(a, p, r):
  x = a[r]
  i = p-1
  for j in range(p, r):
    if a[j] <= x:
      i = i+1
      a[i], a[j] = a[j], a[i]
  a[i+1], a[r] = a[r], a[i+1]
  return i+1

n = int(input())
a = [int(i) for i in input().split()]
q = partition(a, 0, n - 1)
a[q] = f"[{a[q]}]"
print(*a)


Measured memory_bytes: 16376
import sys
from collections import deque
sys.setrecursionlimit(20000000)
input = sys.stdin.readline


def main():
    N, Q = map(int, input().split())
    ans = [[0, deque()] for _ in range(N)]

    for _ in range(N - 1):
        p, c = map(int, input().split())
        ans[p-1][1].append(c-1)
        ans[c-1][1].append(p-1)

    for _ in range(Q):
        p, v = map(int, input().split())
        ans[p-1][0] += v

    def add_value(node, parent):
        val = ans[node][0]
        children = ans[node][1]
        for child in children:
            if child == parent:
                continue
            ans[child][0] += val
            add_value(child, node)

    add_value(0, -1)

    print(' '.join([str(x[0]) for x in ans]))


if __name__ == '__main__':
    main()



Measured memory_bytes: 394440
#include <bits/stdc++.h>
using namespace std;
    
int main() {
    int x, y;
    cin >> x >> y;
    long long ans = 0;
    if (x <= 3) {
        ans += 4 - x;
    }
    if (y <= 3) {
        ans += 4 - y;
    }
    if (x == 1 && y == 1) {
        ans += 4;
    }
    cout << ans * 100000;
}


Measured memory_bytes: 256
//=======================//
// coder: Andy - Tohrumi //
//=======================//

#include <bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(__typeof(b) i = a; i < b; i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i > b; i--)

typedef vector<int> vi;		typedef vector<ll> vl;
typedef pair<int, int> ii; 	typedef vector<ii> vii;

// code start here //

ld dp[3000][3000];

signed main() {
	fastio;
	int n; cin >> n;
	ld p[n];
	rep(i, 0, n) cin >> p[i];
	dp[1][1] = p[0];
	ld temp;
	rep(i, 0, n + 1) {
		temp = 1.0;
		rep(j, 0, i) {
			temp *= (1 - p[j]);
		}
		dp[i][0] = temp;
	}
	rep(i, 1, n + 1) {
		Rep(j, i, 0) {
			if(i == j) {
				dp[i][j] = dp[i - 1][j - 1] * p[i - 1];
				continue;
			}
			dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1];
		}
	}
	ld ans = 0;
	rep(i, n / 2 + 1, n + 1) {
		ans += dp[n][i];
	}
	cout << setprecision(10) << fixed << ans;
}


Measured memory_bytes: 85724
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int ans = (a - b) > c ? 0 : c - (a - b);
		System.out.println(ans);
	}
}


Measured memory_bytes: 20820
A,B,C=map(int,input().split())
K=int(input())
M=K
for i in range(K):
    if A>=B:
        B=B*2
        M=K-(i+1)
    if A<B:
        break
C=C*(2**M)
if C>B and A<B:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9184
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let a: Vec<usize> = rep(n, || scan(tokens));
    let b: Vec<usize> = rep(n, || scan(tokens));
    let mut c = Vec::with_capacity(2 * n - 1);
    let mut d = Vec::with_capacity(n);
    for i in 0..n - 1 {
        c.push(a[i] ^ a[i + 1]);
        d.push(b[i] ^ b[i + 1]);
    }
    c.push(a[n - 1] ^ a[0]);
    d.push(b[n - 1] ^ b[0]);
    for i in 0..n - 1 {
        let tmp = c[i];
        c.push(tmp);
    }
    let r = {
        let mut r = vec![0; n + 1];
        let mut i = 0;
        let mut j = 1;
        while j < n {
            if d[i] == d[j] {
                i += 1;
                j += 1;
                r[j] = i;
            } else if i > 0 {
                i = d[i];
            } else {
                j += 1;
            }
        }
        r
    };
    let mut i = 0;
    let mut j = 0;
    while j < 2 * n - 1 {
        if d[i] == c[j] {
            i += 1;
            j += 1;
            if i == n {
                println!("{} {}", j - n, a[j - n] ^ b[0]);
                i = r[i];
            }
        } else if i > 0 {
            i = d[i];
        } else {
            j += 1;
        }
    }
}


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

using namespace std;
#define ll long long int
#define pb push_back
#define rep(i, a, v) for(int i = a; i <= v; ++i)
#define vi vector<int>
#define vll vector<ll>
#define maxi 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
const double pie = 3.1415926535;
const string spaces = "    ";

vector<vector<int>> grid, dp;
int h, w;

ll FindAns(int i = 0, int j = 0){
    if(i >= h || j >= w)
        return 0;
    if(grid[i][j] == 0)
        return 0;
    if(i == h - 1 && j == w - 1)
        return 1;
    if(dp[i][j] != -1)
        return dp[i][j];
    ll ans = (FindAns(i + 1, j) + FindAns(i, j + 1)) % maxi;
    dp[i][j] = ans;
    return ans;
}

int main(){
    cout.tie(0);
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin >> h >> w;
    for(int i = 0; i < h; ++i){
        char a;
        vector<int> row(w), row_dum(w, -1);
        for(int j = 0; j < w; ++j){
            cin >> a;
            if(a == '.')
                row[j] = 1;
            else
                row[j] = 0;
        }
        grid.pb(row);
        dp.pb(row_dum);
    }

    ll ans = FindAns();
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8320
#include <cstdio>
#include <map>
#include <queue>

using namespace std;

int h, w, n;

char field[1010][1010];

using pos = pair<int, int>;

pos pass[10];

int distance(pos start, pos goal) {
    bool visited[1010][1010];
    for (int i = 0; i < 1010; i++) {
        for (int j = 0; j < 1010; j++) {
            visited[i][j] = false;
        }
    }
    queue<pair<int, pos>> q;
    q.push(make_pair(0, start));

    while (!q.empty()) {
        auto s = q.front();
        q.pop();
        if (s.second.first < 0 || s.second.second < 0 || s.second.first >= h || s.second.second >= w) { continue; }
        if (field[s.second.first][s.second.second] == 'X') { continue; }
        if (visited[s.second.first][s.second.second]) { continue; }
        if (s.second == goal) {
            return s.first;
        }
        visited[s.second.first][s.second.second] = true;
        q.push(make_pair(s.first + 1, make_pair(s.second.first, s.second.second + 1)));
        q.push(make_pair(s.first + 1, make_pair(s.second.first, s.second.second - 1)));
        q.push(make_pair(s.first + 1, make_pair(s.second.first + 1, s.second.second)));
        q.push(make_pair(s.first + 1, make_pair(s.second.first - 1, s.second.second)));
    }
}

int main() {
    scanf("%d", &h);
    scanf("%d", &w);
    scanf("%d", &n);
    for (int i = 0; i < h; i++) {
        scanf("%s", field[i]);
        for (int j = 0; j < w; j++) {
            if (field[i][j] == 'S') {
                pass[0] = make_pair(i, j);
            } else if (field[i][j] >= '1' && field[i][j] <= '9') {
                pass[field[i][j] - '0'] = make_pair(i, j);
            }
        }
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += distance(pass[i], pass[i + 1]);
    }
    printf("%d\n", sum);
}

Measured memory_bytes: 4748
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

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

    if(S == "Sunny") cout << "Cloudy" << endl;
    else if(S == "Cloudy") cout << "Rainy" << endl;
    else if(S == "Rainy") cout << "Sunny" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll x,y,z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = false;
ll MOD = 1000000007;

const ll MAX = 1100000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){

    ll x, y;
    cin >> x >> y;

    if( (x + y) % 3  != 0){
        cout << 0 << endl;
        return 0;
    }

    //移動回数
    ll N = (x + y) / 3;

    // 2, 1の移動回数
    ll N_x = (x - N) ;

    if(N_x + 2 * (N - N_x) != y){
        cout << 0 << endl;
        return 0;
    }

    COMinit();
    //cout << N << N_x << endl;
    cout << COM(N, N_x) << endl;

}

Measured memory_bytes: 25984
#include<iostream>
#define DN 200005
using namespace std;
long long n,a[DN],mi,t,rez,dp[DN];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        dp[a[i]]=dp[a[i]-1]+1;
    mi=n;
    for(int i=1;i<=n;i++)
        mi=min(mi,n-dp[a[i]]);
    cout<<mi;
}


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

using namespace std;

const int N_MAX = 200002;

const int MOD = 1e9+7;

int pwr (int a, int b)
{
    if(b == 0)
        return 1;
    if(b & 1)
        return 1LL * a * pwr(a, (b ^ 1)) % MOD;
    int aux = pwr(a, (b >> 1));
    return 1LL * aux * aux % MOD;
}

int inv (int val)
{
    return pwr(val, MOD - 2);
}

int fact[N_MAX];
int ifact[N_MAX];

int comb (int n, int k)
{
    return 1LL * fact[n] * ifact[k] % MOD * ifact[n - k] % MOD;
}

int n;

vector <int> edges[N_MAX];

int parent[N_MAX];
int sub[N_MAX];

void dfs (int node)
{
    sub[node] = 1;
    for(int u : edges[node])
        if(u != parent[node])
        {
            parent[u] = node;
            dfs(u);
            sub[node] += sub[u];
        }
}

int down[N_MAX];
int up[N_MAX];

void fdown (int node)
{
    down[node] = 1;
    int val = 1;
    int cnt = sub[node] - 1;
    for(int u : edges[node])
        if(u != parent[node])
        {
            fdown(u);
            down[node] = 1LL * down[node] * down[u] % MOD;
            val = 1LL * val * comb(cnt, sub[u]) % MOD;
            cnt -= sub[u];
        }
    down[node] = 1LL * down[node] * val % MOD;
}

void fup (int node)
{
    int val = 1LL * up[node] * comb(n - 1, n - sub[node]) % MOD;
    int cnt = sub[node] - 1;
    for(int u : edges[node])
        if(u != parent[node])
        {
            val = 1LL * val * down[u] % MOD;
            val = 1LL * val * comb(cnt, sub[u]) % MOD;
            cnt -= sub[u];
        }
    for(int u : edges[node])
        if(u != parent[node])
        {
            up[u] = val;
            up[u] = 1LL * up[u] * inv(comb(n - 1, sub[u])) % MOD;
            up[u] = 1LL * up[u] * inv(down[u]) % MOD;
            fup(u);
        }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    fact[0] = 1;
    ifact[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        fact[i] = 1LL * fact[i - 1] * i % MOD;
        ifact[i] = inv(fact[i]);
    }
    dfs(1);
    fdown(1);
    up[1] = 1;
    fup(1);
    for(int i = 1; i <= n; i++)
        cout << 1LL * up[i] * down[i] % MOD * comb(n - 1, n - sub[i]) % MOD << "\n";
    return 0;
}


Measured memory_bytes: 18676
n = int(input())
d = [[0]*10 for _ in range(10)]
ans = 0
for i in range(1, n+1):
    s = str(i)
    if s[0] == '0' or s[-1] == '0':
        continue
    d[int(s[0])][int(s[-1])] += 1
for i in range(1, 10):
    for j in range(1, 10):
        ans += d[i][j] * d[j][i]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	double cap = 100000.0;
	int n;
	cin >> n;
	for (int i=0;i<n;i++){
		cap *= 1.05;
		cap /= 1000;
		cap = ceil(cap);
		cap *= 1000;
	}
	cout << int(cap) << endl;
}


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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	char a;
	cin >> a;
	if(a<= 90) cout << "A" << endl;
	if(a>=97) cout << "a" << endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
  int H,A;
  scanf("%d", &H);
  scanf("%d", &A);

  int I=0;
  for(; H>0;)
  { 
    H=H-A;
    I=I+1;
  }
  printf("%d",I);
  return 0;
}

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

using namespace std;

int main() {
	string a;
	while (cin >> a) {
		int counter = 0;
		int counter2 = 0;
		int i = 0;
		while (a.find("JOI", i) != string::npos) {
			counter++;
			i = a.find("JOI", i)+1;
		}
		i = 0;
		while (a.find("IOI", i) != string::npos) {
			counter2++;
			i = a.find("IOI", i)+1;
		}
		cout << counter << endl << counter2 << endl;
	}
	return 0;
}

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

int main() {
	string s,a;
	cin>>s>>a;s+=s;
	for(int i=0;i<=s.length()-a.length();i++)
	{
		if(s.substr(i,a.length())==a)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

using namespace std;

#define td typedef
td long long ll;

ll in()
{
    ll a;
    scanf("%lld",&a);
    return a;
}

bitset <2005*2005> ase;

int main()
{
    int n=in(),a[2005],sum=0;
    for(int i=0;i<n;i++){
        a[i]=in();
        sum+=a[i];
    }
    ase.set(0);
    for(int i=1;i<=n;i++)
        ase=ase|(ase<<a[i-1]);
    for(int i=(sum+1)/2;i<=2005*2005;i++)
    {
        if(ase[i])
        {
            printf("%d\n",i);
            return 0;
        }
    }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,W;
    cin>>n>>W;
    int w[100001];
    long long int v[100001];
    for(int i=0;i<n;i++)
    {
        cin>>w[i];
        cin>>v[i];
    }
    long long int dp[n+1][W+1];
   
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if(i==0||j==0)
            dp[i][j]=0;
            else if(w[i-1]<=j)
            dp[i][j]=max(dp[i-1][j-w[i-1]]+ v[i-1], dp[i-1][j]);
            else
            dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][W]<<"\n";
}

Measured memory_bytes: 79104
import qualified Data.ByteString.Lazy.Char8 as B
import Data.List
import Data.Maybe

solve :: [Int] -> Int
solve ns = sum $ map toBeReduced $ group $ sort ns
  where
    toBeReduced grp = if size >= n then size - n else size
      where size = length grp
            n = head grp

main :: IO ()
main = putStrLn . show . solve .
       map (fst . fromJust . B.readInt) .
       tail . B.words =<< B.getContents


Measured memory_bytes: 16636
S = input()
 
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
  print('Yes')
elif S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
  print('Yes')
elif S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int S,h,m,s;
    cin>>S;
    h=S/3600;
    m=(S-h*3600)/60;
    s=S-h*3600-m*60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int x = scanner.nextInt();
        int start = Math.max(-1000000, x + 1 - k);
        int end = Math.min(1000000, x + k - 1);
        for (int i = start; i <= end; ++i) {
            System.out.print(i + " ");
        }
    }
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, m;
  cin >> n >> m;
  vi32 ac(n);
  vi32 wa(n);
  rep(i, m) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if (ac[p]) continue;
    if (s == "AC") {
      ac[p] = 1;
      continue;
    }
    wa[p] += 1;
  }
  int ans = 0;
  rep(i, n) if (ac[i]) {
    ans += wa[i];
  }
  int ans2 = 0;
  rep(i, n) ans2 += ac[i];
  cout << ans2 << " " << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin>>n;
  long long sum=0;
for(int i=3;i<=n;i=i+3)
  sum+=i;
  for(int i=5;i<=n;i=i+5)
  sum+=i;
  for(int i=15;i<=n;i=i+15)
    sum-=i;
  cout<<n*(n+1)/2-sum;
  return 0;
}
      

Measured memory_bytes: 3624