akhauriyash/Code-Regression huggingface dataset:
// includes
#include <bits/stdc++.h>
using namespace std;

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.end());}
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
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> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  ll n, k; cin >> n >> k;
  ll res = n;
  ll b = n % k;
  res = min(b, k - b);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector< vector<int> > I(N+1);
  for(int i = 0; i < M; ++i){
    int l, r;
    cin >> l >> r;
    I[l].push_back(r);
  }
  for(int i = 0; i < N; ++i) sort(I[i+1].begin(), I[i+1].end());
  for(int i = 0; i < Q; ++i){
    int p, q;
    cin >> p >> q;
    int ans = 0;
    for(int j = p; j <= q; ++j)
      ans += upper_bound(I[j].begin(), I[j].end(), q) - I[j].begin();
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0; i < 3; i++) {
			sb.append(sc.next());
		}
      
     	System.out.println(Integer.parseInt(sb.toString()) % 4 == 0 ? "YES" : "NO");
	}
}

Measured memory_bytes: 35504
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
//	char s[n],t[n];
	string s,t;
	cin>>s>>t;
	for(int i=0;i<n;i++)
	{
		cout<<s[i]<<t[i];
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

	int ans = 0;
	for (int i = 1; i < n; i++){
		int count = 0;

		for (char c = 'a'; c <= 'z'; c++){
			bool left, right;
			left = right = 0;

			for (int j = 0; j < i; j++){
				if (s[j] == c) left = 1;
			}

			for (int j = i; j < n; j++){
				if (s[j] == c) right = 1;
			}

			if (left && right) count++;

		}

		if (ans < count) ans = count;

	}

	cout << ans << endl;


}


Measured memory_bytes: 256
/*
ID: ramil-p1
PROG: sprime
LANG: C++11
*/
#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 100, inf = 2e9 + 100;



int main(){
    ios::sync_with_stdio(0);
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
        if (s[i] == ',')
            s[i] = ' ';
    cout << s;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b) { ll res=1; a%=mod; assert(b>=0); for(;b;b>>=1) { if(b&1) res=res*a%mod; a=a*a%mod; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }

int main() {
	int t;
	// cin >> t;
    t = 1;

	while(t--) {
		int l, r, d;
		cin >> l >> r >> d;
        
        int res = (r / d) - ((l-1) / d);
        cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
const int mod = 1000000007;
int a[3];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	ll ans = 1;
	for (int i = 1; i <= n; ++i)
	{
		int x;
		cin >> x;
		int cnt = 0;
		if (a[2] == x)
		{
			cnt = 1 + (a[0] == x) + (a[1] == x);
			++a[2];
		}
		else if (a[1] == x)
		{
			cnt = 1 + (a[0] == x);
			++a[1];
		}
		else if (a[0] == x)
		{
			cnt = 1;
			++a[0];
		}
		ans = ans * cnt % mod;
		sort(a, a + 3);
	}
	cout << ans;
}


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

int main(void){
	long long int X,Y,count=1;
	cin >> X;
	cin >> Y;
	for(int i=0;i<1000000;i++){
		if(X*2<=Y){
			count=count+1;
			X=X*2;
		}
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        TreeSet<Integer> st = new TreeSet<>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            int b=sc.nextInt();
            st.add(b);
        }
        int q=sc.nextInt();
        int ans=0;
        for(int i=0;i<q;i++){
        int c=sc.nextInt();
        if(st.contains(c)) ans++; 
        }
        System.out.println(ans);
        sc.close();
      
    }
}



Measured memory_bytes: 89516
#include<cstdio>
#include<cstring>

#define M 1046527
#define L 14

char H[M] [L];

//将字符转换为数值
int getChar(char ch){
    if (ch =='A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

//将字符串转换为数值并生成key
long long getKey(char str[]){
    long long sum = 0,p=1,i;
    for(i = 0; i<strlen(str); i++){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}


int h1(int key) {return key % M;}
int h2(int key) {return 1 + (key % (M-1));}


int find(char str[]){
    long long key,i,h;
    key = getKey(str);//将１字符串转换为数值

    for(i=0; ; i++){
        h = (h1(key) + i * h2(key)) % M;
        if(strcmp(H[h],str) == 0 ) return 1;
        else  if(strlen(H[h])==0) return 0;
    }
    return 0;
}


int insert(char str[]){
    long long key, i, h;
    key = getKey(str);//将字符串转换为数值
    for(i = 0; ;i++){
        h = (h1(key) + i * h2(key)) % M ;
        if(strcmp(H[h],str) == 0) return 1;
        else if (strlen(H[h]) == 0){
            strcpy(H[h],str);
            return 0;
        }
    }
    return 0;
}


int main(){
    int i,n,h;
    char str[L],com[9];
    for(i=0; i<M; i++) H[i] [0] = '\0';
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",com ,str);//使用速度更快的输入函数scanf

        if(com[0] == 'i'){
            insert(str);
        }else{
            if (find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}













































Measured memory_bytes: 17000
#include<stdio.h>

void maxHeapify(int *, int);
void buildMaxHeap(int *);
int H;

int main(){
  int A[500000], i;

  scanf("%d", &H);
  if(H <= 500000 && H >= 1){
    for(i = 1; i < H+1; i++){
      scanf("%d", &A[i]);
    }

    buildMaxHeap(&A[0]);

    for(i = 1; i < H+1; i++)
      printf(" %d", A[i]);
    
    printf("\n");
  }
  return 0;
}

void buildMaxHeap(int *A){
  int i;
  for (i = H/2; i > 0; i--)
    maxHeapify(&A[0], i);
}

void maxHeapify(int *A, int i){
  int l = i * 2, r = i * 2 + 1, largest, temp;
  if(l <= H && A[l] > A[i])
    largest = l;
  else
    largest = i;

  if(r <= H && A[r] > A[largest])
    largest = r;
  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
    maxHeapify(&A[0], largest);
  }
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

const int max_a = 20005;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    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;
    }
    // for prime MOD
    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;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

//nが非常に大きく、aが小さい場合
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<vector<mint>> dp(n+1, vector<mint>(2, 0));
    dp[0][0] = 1;

    rep(i,n){
        // a & b = 0のものを列挙

        // a、bも0の場合
        if(s[i] == '0'){
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1]; 
        }
        else{
            dp[i+1][1] = dp[i][0] + dp[i][1];
        }
        // aまたはbが1の場合
        if (s[i] == '0'){
            dp[i+1][1] += dp[i][1]*2;
        }
        else{
            dp[i+1][0] += dp[i][0]*2;
            dp[i+1][1] += dp[i][1]*2;
        }

    }

    cout << dp[n][0] + dp[n][1] << endl;
}


Measured memory_bytes: 8696
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

int n, i, ans;

int sum(int x) {
    int ans = 0;
    while (x > 0) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

int main()
{
    cin >> n;
    ans = 1 << 30;
    for (i = 1; i < n; i++)
        ans = min(ans, sum(i) + sum(n - i));

    cout << ans;


    return 0;
}


Measured memory_bytes: 256
/*
    In the name of
        "ALLAH"
    And say "AL-HAMD-U-LILLAH"
*/

#include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define _  printf("\n")
int take() {
    int n;
    scanf("%d",&n);
    return n;

}
double ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define Int take()
#define Dnt ttake()
#define LL takes()
#define done {return 0;}
#define fr(i,x,n,a) for(int i=x;i<=n;i+=a)
#define FR(a,b,x) for(int i=(a);i<=(b);i+=(x))
#define rfr(i,x,n,a) for(int i=x;i>=n;i--)
int cas;
#define print printf("Case %d:",++cas)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pii pair<int,int>
#define vii vector<pii>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mk  make_pair
#define fill(x,v) memset(x,v,sizeof x)

using namespace std;

bool approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define STR {struct info}
#define dbg(x) {cout<<"ekhane"<<x<<endl;}
#define  SS second
#define  FF first
#define PQ priority_queue
#define great greatest
#define less lesser
#define mii map<int,int>
#define mil map<int,ll>
#define mll map<ll,ll>
#define msb map<string,bool>
#define V vector
#define M 100005
#define pf printf
//////////////////////////////////////////


int main(){

   string s ;
   cin>>s ;
   sort( s.begin() , s.end() ) ;
   if( s[ 0 ] =='a' && s[1] =='b' && s[2]=='c'){
    pf("Yes") ;
   }else{
    pf("No\n") ;
   }

    done;
}



Measured memory_bytes: 764
/*

*/
#include<bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,a,n) for(int i=(a);i<(n);i++)
#define repe(i,a) for(auto &i:a)
#define be begin()
#define en end()
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string s;cin>>s;
  rep(i,s.size()){
    if(s[i]=='?'){
      s[i]='D';
    }
  }
  cout<<s<<endl;
}

Measured memory_bytes: 3732
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.util.StringTokenizer;

class Main {
    //static {
      //  try {
        //    System.setOut(new PrintStream(new File("output.txt")));
          //  new File("input.txt").createNewFile();
            //System.setIn(new FileInputStream(new File("input.txt")));
        //} catch (Exception e) {
          //  e.printStackTrace();
        //}
    //}
    static FastReader fastReader = new FastReader();
    static BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));
    static StringBuffer stringBuffer = new StringBuffer();

    public static void main(String[] args) throws Exception {
        try {
            // int testCases = fastReader.nextInt();
            int testCases=1;
            while (testCases-- > 0) {
                int n=fastReader.nextInt();
                long arr[]=new long[n];
                for(int i=0;i<n;i++){
                    arr[i]=fastReader.nextLong();
                }
                long dp[]=new long[n];
                dp[0]=0;
                dp[1]=Math.abs(arr[1]-arr[0]);
                for(int i=2;i<n;i++){
                    long option1=dp[i-2]+Math.abs(arr[i]-arr[i-2]);
                    long option2=dp[i-1]+Math.abs(arr[i]-arr[i-1]);
                    dp[i]=Math.min(option1,option2);
                }
                System.out.println(dp[n-1]);
            }
            bufferedWriter.write(stringBuffer.toString());
            bufferedWriter.flush();
        } catch (Exception e) {
            return;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 43656
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    for(int i=0;;i++){
        int m = i * 108 / 100;
        if(m == n){
            cout << i << endl;
            return 0;
        }
        if(m > n){
            puts(":(");
            return 0;
        }
    }
    return 0;
}


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

const long long MOD = 1000000007;

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  long long n,a,b;
  cin>>n>>a>>b;
  
  long long total=1;
  
  long long x,y;
  x=n/20;
  y=n%20;
  
  for(int i=0; i<x; i++){
    total = (total * 1048576LL) % MOD;
  }
  
  for(int i=0; i<y; i++){
    total = (total * 2LL) % MOD;
  }
  
  long long counta=1;
  long long countb=1;
  
  for(int i=0; i<a; i++){
    long long mae=n-i;
    long long usiro=i+1;
    counta = (mae * modinv(usiro, MOD) % MOD) * counta % MOD;
  }
  
    for(int i=0; i<b; i++){
    long long mae=n-i;
    long long usiro=i+1;
    countb = (mae * modinv(usiro, MOD) % MOD) * countb % MOD;
  }
  
  total = (total + MOD - counta) % MOD;
  total = (total + MOD - countb) % MOD;
  
  cout << total-1 << endl;
  
}

Measured memory_bytes: 256
from collections import defaultdict
import bisect

n, m = map(int, input().split())
d = defaultdict(list)

queue = []
for i in range(m):
    p, y = map(int, input().split())
    d[p].append((y, i))

arr = [0] * m
for k, v in d.items():
    for i, item in enumerate(sorted(v, key=lambda x: x[0])):
        arr[item[1]] = (k, i)

for k, v in arr:
    print('{:06d}{:06d}'.format(k, v + 1))

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

int main(){
    long long int x, a, b;
    cin >> x >> a >> b;
    if(-a+b<=0){
        cout << "delicious" << endl;
    }else if(-a+b<=x){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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;
}

int main(void) {
    ll H, W;
    cin >> H >> W;

    if (H == 1 || W == 1){ 
        cout << 1 << endl;
        return 0;
    }

    const ll h = (H / 2) * 2;
    const ll w = (W / 2) * 2;

    ll ans = h * w / 2;
    ans += (W % 2) * ((H + 1) / 2);
    ans += (H % 2) * ((W + 1) / 2);

    if (H % 2 == 1 && W % 2 == 1) {
        ans--;
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef long long int lli;

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

    int n, c, x, y, z;
    priority_queue<pair<int, pair<int, int>>> event;

    cin >> n >> c;
    for (int i=0; i<n; i++) {
        cin >> x >> y >> z;
        event.push(make_pair(-x, make_pair(1, z)));
        event.push(make_pair(-y, make_pair(0, z)));
    }

    int ans = 0, cont = 0, record[31] = { 0 };
    while (!event.empty()) {
        auto e = event.top(); event.pop();
        int stat = e.second.first, ch = e.second.second;

        if (stat == 1) {
            if (record[ch] == 0) {
                record[ch] = 1;
                cont++;
                ans = max(ans, cont);
            }
            else if (record[ch] == 1) {
                record[ch] = 2;
            }
        }
        else if (stat == 0) {
            if (record[ch] == 1) {
                record[ch] = 0;
                cont--;
            }
            else if (record[ch] == 2) {
                record[ch] = 1;
            }
        }

        // cout << e.first << " " << stat << " " << ch << " " << cont << endl;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4596
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>

using namespace std;

int main(){
	int H, W;
	char a[101][101];
	bool b[101][101] = {};
	bool newline[101] = {};
	cin >> H >> W;

	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < H; ++i){
		int j = 0;
		for (j = 0; j < W; ++j){
			if (a[i][j] != '.')
				break;
		}
		if (j == W){
			for (j = 0; j < W; ++j){
				b[i][j] = true;
				newline[i] = true;
			}
		}			
	}

	for (int i = 0; i < W; ++i){
		int j = 0;
		for (j = 0; j < H; ++j){
			if (a[j][i] != '.')
				break;
		}
		if (j == H){
			for (j = 0; j < H; ++j){
				b[j][i] = true;
			}
		}
		
	}
	for (int i = 0; i < H; ++i){
		for (int j = 0; j < W; ++j){
			if (b[i][j] != true)
				cout << a[i][j];
		}
		if (newline[i] != true)
			cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	

using namespace std;

int main() {
	vector<int> spend_time;
	int a;
	for (int i = 0; i < 3; ++i) {
		cin >> a;
		spend_time.push_back(a);
	}
	sort(spend_time.begin(), spend_time.end());
	cout << spend_time[0] + spend_time[1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
	int a,b,i,j;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0) return 0;
		for(i=0;i<a;i++){
			for(j=0;j<b;j++){
				if(i==0||j==0||i==a-1||j==b-1){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}


Measured memory_bytes: 2060
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define PI 3.141592653589793238462643383279


void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}
int compare_int(const void *a, const void *b){
	return *(int*)a - *(int*)b;
}
int gcd(int a, int b)
{
    int c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main(void){
	int n;
	int a,b;
	scanf("%d", &n);
	if(n==1)	printf("Hello World");
	else{
		scanf("%d %d", &a, &b);
		printf("%d", a+b);
	}
	return 0;
}



Measured memory_bytes: 128
//
// Created by Daiki Kuyoshi on 2020/05/17.
//

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

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

    if(S.length() <= K){
        cout << S << endl;
    }
    else{
        cout << S.substr(0, K) + "..." << endl;
    }
}

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

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


	int x, n, t; cin >> n >> x >> t;

	int count = 0;
	int time = 0;
	while (count < n) {
		time += t;
		count += x;
	}

	cout << time << endl;



	return 0;

}

Measured memory_bytes: 3640
def q1():
    N = int(input())
    H = [int(i) for i in input().split()]

    # dp配列の初期化 (最小化問題なので初期値をINFとする)
    dp = [float('inf')]*(N + 1)
    dp[0] = 0
    dp[1] = abs(H[1] - H[0])

    for i in range(2, N):
        step1 = dp[i-1] + abs(H[i] - H[i-1])  # 1段飛んだとき
        step2 = dp[i-2] + abs(H[i] - H[i-2])  # 2段飛んだとき
        dp[i] = min(step1, step2)

    print(dp[N-1])


if __name__ == '__main__':
    q1()

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

int main()
{
    int A, B;
    cin >> A >> B;
    if (A >= 10 || B >= 10)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << A * B << endl;
    }
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)
	c := 0
	for i := 0; i < n-2; i++ {
		tmp := string(s[i : i+3])
		if tmp == "ABC" {
			c++
		}
	}
	fmt.Println(c)
}


Measured memory_bytes: 512
N,K = map(int,input().split())
if K % 2 == 0:
    K_unit1 = int(N//K)
    K_half = K//2
    N_khalf = N-K_half
    K_unit2 = 1 + int(N_khalf//K)
    K1 = K_unit1 ** 3
    K2 = K_unit2 ** 3
    out = K1 + K2
else:
    K_unit1 = int(N/K)
    out = K_unit1 ** 3

print("{0}".format(out))

Measured memory_bytes: 3060
#include <iostream>
#include <unordered_set>

using namespace std;

int main(){
    unsigned long long s;
    cin >> s;
    unordered_set<unsigned long long> founds;
    founds.insert(s);
    int i;
    for(i=2; i<=1000*1000; ++i){
        if(s%2==0) s=s/2;
        else s=3*s+1;
        if(founds.find(s)!=founds.end()) break;
        founds.insert(s);
    }
    cout << i << endl;
    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 repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b; cin >> a >> b;
    if(a > b) rep(i,a) cout << b;
    else if (a < b) rep(i,b) cout << a;
    else rep(i,b) cout << a;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

using State = string::const_iterator;

//-------------------------------------

int add(int a, int b) {
    if(a == 0 && b == 0) {
        return 0;
    }
    if(a == 2 || b == 2) {
        return 2;
    }
    return 1;
}

int mul(int a, int b) {
    if(a == 0 || b == 0) {
        return 0;
    }
    if(a == 1 || b == 1) {
        return 1;
    }
    return 2;
}

int Not(int a) {
    if(a == 0) {
        return 2;
    } else if(a == 1) {
        return 1;
    }
    return 0;
}

int p, q, r;
int formula(State &now) {
    if(*now == '0') {
        now++;
        return 0;
    } else if(*now == '1') {
        now++;
        return 1;
    } else if(*now == '2') {
        now++;
        return 2;
    } else if(*now == 'P') {
        now++;
        return p;
    } else if(*now == 'Q') {
        now++;
        return q;
    } else if(*now == 'R') {
        now++;
        return r;
    } else if(*now == '-') {
        now++;
        return Not(formula(now));
    } else {
        now++;
        int res = formula(now);
        // cout << *now << endl;
        if(*now == '*') {
            now++;
            res = mul(res, formula(now));
        } else if(*now == '+') {
            now++;
            res = add(res, formula(now));
        }
        now++;
        return res;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    while(1) {
        cin >> s;
        if(s == ".") {
            break;
        }
        int ans = 0;
        for(int i = 0; i <= 2; i++) {
            for(int j = 0; j <= 2; j++) {
                for(int k = 0; k <= 2; k++) {
                    p = i, q = j, r = k;
                    State now = s.begin();
                    int res = formula(now);
                    if(res == 2) {
                        // cout << p << ' ' << q << ' ' << r << endl;
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3136
#include <stdio.h>

int main()
{
    //UG20-53-20-014
    int x1,x2,x3;
    scanf("%d%d%d",&x1,&x2,&x3);
if ((x1+x2+x3)>=22)
printf("bust");
else (printf("win"));


    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();
    static long inf = 0x7fffffffffL;

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        long p = scanner.nextInt();
        Edge[] edges = new Edge[m];
        for (int i = 0; i < m; i++) {
            int a = scanner.nextInt() - 1;
            int b = scanner.nextInt() - 1;
            long c = scanner.nextLong();
            edges[i] = new Edge(a, b, p - c);
        }
        long[] d = new long[n];
        Arrays.fill(d, inf);
        d[0] = 0;
        Set<Integer> loop = new HashSet<>();

        for (int i = 1; i <= 2 * n; i++) {
            for (int j = 0; j < m; j++) {
                if (d[edges[j].to] > d[edges[j].from] + edges[j].cost) {
                    d[edges[j].to] = d[edges[j].from] + edges[j].cost;
                    if (i >= n) {
                        loop.add(edges[j].from);
                        loop.add(edges[j].to);
                    }
                }
            }
        }

        if (loop.contains(n - 1)) {
            System.out.println(-1);
        } else {
            System.out.println(Math.max(0, -d[n - 1]));
        }
    }

    static class Edge implements Comparable<Edge> {
        int from;
        int to;
        long cost;

        Edge(int from, int to, long cost) {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }

        @Override
        public int compareTo(Edge o) {
            return Long.compare(this.cost, o.cost);
        }

        @Override
        public String toString() {
            return String.format("[%s, %s, %s]", from, to, cost);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

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

typedef pair<int,int> PII;
typedef long long LL;
const int M=2e5+5;

int main()
{
	int n; scanf("%d",&n);
	vector<PII> vec;
	int a,b;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		vec.push_back({b,a});
	}
	sort(vec.begin(),vec.end());
	int f=1;
	LL sum=0;
	for(int i=0;i<n;i++)
	{
		sum+=vec[i].second;
		if(sum>vec[i].first)
		{
			f=0;
			break;
		}
	}
	printf("%s\n",f?"Yes":"No");
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
ll mod = 1000000007;
P p[200005];

ll i, b[10005], c, k, j, n, m, z = 0, mi = 0, t, cc, th;
ll a;
vector<ll> va, vb, vc, vj;
string s;
char ca[10000];
priority_queue<ll> q;




int main() {
	cin >> n;
	rep(i, n)cin >> b[i];
	sort(b,b+n);
	rep(i, n-2) {
		for (j = i + 1; j < n - 1; j++) {
			k = j + 1;
			while (b[i] + b[j] > b[k]&&k<n) {
				z++;
				k++;
			}
		}
	}

	cout <<z ;


	return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}


/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
//constexpr int inf = 1<<30;

signed main(){
  int x;
  cin >> x;

  // 100n + b + 2c + 3d + 4e + 5f
  // n = a + b + c + d + e + f

  int h = x/100, l = x/105;
  bool ok = false;
  rep(i, l, h+1){
    int t = x - 100*i;
    if(0 <= t and t <= 5*i) ok = true;
  }

  cout << ok << endl;

  return 0;
}



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

int n, m;
int a[10];
string dp[10010];
map<int, int> mp;

string solve(int x){
  if(x < 0) return "#";
  if(x==0 || dp[x].size()>0) return dp[x];
  string ret = "";
  rep(i, m){
    string tmp = solve(x-mp[a[i]]) + to_string(a[i]);
    if(tmp[0] == '#') continue;
    if(tmp.size() > ret.size()){
      ret = tmp;
      continue;
    }
    if(tmp.size() < ret.size()) continue;
    if(tmp > ret) ret = tmp;
  }
  if(ret == "") return dp[x] = "#";
  return dp[x] = ret;
}

int main(){
  cin >> n >> m;
  rep(i, m) cin >> a[i];
  mp[1] = 2; mp[2] = 5; mp[3] = 5; mp[4] = 4; mp[5] = 5; mp[6] = 6; mp[7] = 3; mp[8] = 7; mp[9] = 6;
  rep(i, n+1) dp[i] = "";
  cout << solve(n) << endl;
}

Measured memory_bytes: 26624
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
//Int mod = 1e6+3;

int main() {
    Int n;
    cin >> n;
    vector<Int> w(n);
    for (Int i = 0; i < n; i++) cin >> w[i];
    Int res = 1e9;
    for (Int i = 0; i < n; i++) {
        Int a = 0;
        for (Int j = 0; j <= i; j++) a += w[j];
        Int b = 0;
        for (Int j = i + 1; j < n; j++) b += w[j];
        res = min(res, abs(a - b));
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 256
double x[100],y[100],t,u,s;n,i,j,k,c;main(m){for(;scanf("%d",&n),i=j=n;printf("%d\n",m)){for(m=1;i--;scanf("%lf,%lf",x+i,y+i));for(i=n;--i;)for(j=i-1;j--;)if((u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)for(s=1,t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)for(k=n;k--;)hypot(x[i]+cos(t+s*u)-x[k],y[i]+sin(t+s*u)-y[k])<1.1&&++c>m?m=c:0;}}

Measured memory_bytes: 0
MAX_DIGIT = 9

n = int(input())

def n753():
    q = ['']
    ns = []
    while q:
        n = q.pop()
        for c in ('7', '5', '3'):
            n1 = n + c
            if len(n1) <= MAX_DIGIT:
                q.append(n1)
                ns.append(n1)
    ns = [int(n) for n in ns if len(set(n)) == 3]
    return ns


answer = sum(1 for n1 in n753() if n1 <= n)
print(answer)


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

const int N = 2000001;  
ll fact[N + 1],inv[N + 1],factinv[N + 1]; 
  
void Inverse() 
{ 
    inv[0] = inv[1] = 1; 
    for (int i = 2; i <= N; i++)
        inv[i] = inv[mod % i] * (mod - mod / i) % mod; 
} 
 
void Inversefact() 
{ 
    factinv[0] = factinv[1] = 1; 
    for (int i = 2; i <= N; i++) 
        factinv[i] = inv[i] * factinv[i - 1] % mod; 
} 
 
void factorial() 
{ 
    fact[0] = 1;  
    for (int i = 1; i <= N; i++) 
        fact[i] = fact[i - 1] * i % mod; 
} 

void pre_ncr()
{
    factorial();
    Inverse();
    Inversefact();
}

ll ncr(ll n, ll r) 
{ 
    if(r>n) return 0;
    ll ans = ((fact[n] * factinv[r])% mod * factinv[n - r])% mod; 
    return ans; 
}

ll expo(ll x, ll n)
{
	ll res=1;
	while(n)
	{
		if(n&1)
			res =(res*x)%mod;
		x =(x*x)%mod;
		n >>= 1;
	}
	return res;
}

void solve()
{
	pre_ncr();
	string s;
	//cin>>s;
	int k;
	cin>>k;
	cin>>s;
	int n=L(s),i;
	ll ans=0;
	for(i=n;i<=n+k;i++)
	{
		ans += ncr(n+k,i)*expo(25,n+k-i)%mod;
		ans %= mod;
	}
	cout<<ans<<'\n';
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 51108
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    rep(i,N) cin >> H[i];
    sort(H.begin(), H.end());
    ll sum = 0;
    rep(i,N-K) sum += H[i];
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<string>
#include<vector>
#include<climits>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define endl '\n'
#define rtl rt<<1
#define rtr rt<<1|1
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
#define maxx(a, b) (a > b ? a : b)
#define minn(a, b) (a < b ? a : b)
#define zero(a) memset(a, 0, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define _test printf("==================================================\n")
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> P2;
const double pi = acos(-1.0);
const double eps = 1e-7;
const ll MOD =  1000000007LL;
const int INF = 0x3f3f3f3f;
const int _NAN = -0x3f3f3f3f;
const double EULC = 0.5772156649015328;
const int NIL = -1;
template<typename T> void read(T &x){
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
const int maxn = 1e3+10;

int main(void) {
    int n, k;
    while(~scanf("%d%d", &n, &k))
        printf("%d\n", n/(2*k+1) + bool(n%(2*k+1)));
    return 0;
}

Measured memory_bytes: 256
using System;
        using System.Linq;
 
        public class Program
        {
            public static void Main(string[] args)
            {
            string input =  Console.ReadLine();
            int max = 0;
            int stock = 0;

            foreach (char i in input)
            {
                if (i == 'A' || i == 'C' || i == 'T' || i == 'G')
                {
                    stock++;
                }
                else
                {
                    if (max < stock)
                    {
                        max = stock;
                    }
                    stock = 0;
                }

                if (max < stock)
                {
                    max = stock;
                }
            }


            Console.WriteLine(max);
            }
        }

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

int pow(int b,int p){
	int ans = 1;
	while(p > 0){
		ans *= b;
		p--;
	}
	return ans;
}
int main(){
	int X;
	cin >> X;
	int ans = 1;
	for (int b = 2;b < 1000;b++){
		int p = 2;
		int x = pow(b,p);
		while(x <= X){
			p++;
			ans = max(ans,x);
			x = pow(b,p);
		}
	}
	cout << ans <<endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;


int main(){
	int a,b,c,n;
	while(cin >> a >> b >> c&&a!=0&&b!=0&&c!=0){
		cin >> n;
		vector<int> parts(a+b+c+1);
		vector<int> i(n),j(n),k(n),r(n);
		for(int l=1; l<=a+b+c; ++l){
			parts[l]=2;
		}
		for(int l=0; l<n; ++l){
			cin >> i[l] >> j[l] >> k[l] >> r[l];
			if(r[l]==1){
				parts[i[l]]=1;
				parts[j[l]]=1;
				parts[k[l]]=1;
			}
		}
		for(int l=0; l<n; ++l){
			if(r[l]==0){
				if(parts[i[l]]==1&&parts[j[l]]==1&&parts[k[l]]==2) parts[k[l]]=0;
				else if(parts[i[l]]==1&&parts[k[l]]==1&&parts[j[l]]==2) parts[j[l]]=0;
				else if(parts[j[l]]==1&&parts[k[l]]==1&&parts[i[l]]==2) parts[i[l]]=0;
			}
		}
		for(int l=1; l<=a+b+c; ++l){
			cout << parts[l] << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1216
let (n1, n2) = (3, 9)
let n_limit = 100
let mdt = Array.make_matrix n2 n2 0
let path = Array.make n_limit 0
let dx = [| 0; -1; 0; 1 |]
let dy = [| 1; 0; -1; 0 |]

type puzzle = { tbl : int array; space : int; md : int }

let dfs puzzle limit =
  let rec doit depth prev pzl =
    if pzl.md = 0 then true
    else if depth + pzl.md > limit then false
    else begin
      let (sx, sy) = (pzl.space / n1, pzl.space mod n1) in
      let { tbl; md } = pzl in
      let swap tbl i j = let t = tbl.(i) in tbl.(i) <- tbl.(j); tbl.(j) <- t in
      let rec move r =
        if r = 4 then false
        else
          let (tx, ty) = (sx + dx.(r), sy + dy.(r)) in
          if tx < 0 || ty < 0 || tx >= n1 || ty >= n1 then move (r + 1)
          else if max prev r - min prev r = 2 then move (r + 1)
          else begin
            let (space, num) = (tx * n1 + ty, sx * n1 + sy) in
            let md = md - mdt.(space).(tbl.(space) - 1) in
            let md = md + mdt.(num).(tbl.(space) - 1) in
            let tbl = Array.copy tbl in
            swap tbl space num;
            if doit (depth + 1) r { tbl; space; md } then begin
              path.(depth) <- r;
              true
            end else move (r + 1)
          end in
      move 0
    end in
  doit 0 (-n_limit) puzzle

let idastar tbl space =
  let (_, md) =
    Array.fold_left (fun (i, sum) e ->
      (i + 1, if e = n2 then sum else sum + mdt.(i).(e-1)))
      (0, 0) tbl in
  let pzl = { tbl; space; md } in
  let rec doit limit =
    if limit > n_limit then assert false
    else if dfs pzl limit then limit
    else doit (limit + 1) in
  doit pzl.md

let () =
  for i = 0 to n2 - 1 do
    for j = 0 to n2 - 1 do
      mdt.(i).(j) <- abs (i / n1 - j / n1) + abs (i mod n1 - j mod n1)
    done
  done;
  let tbl = Array.make n2 0 in
  let rec doit i space =
    if i = n2 then space
    else begin
      let x = Scanf.scanf "%d " (fun i -> i) in
      let (x, space) = if x = 0 then (n2, i) else (x, space) in
      tbl.(i) <- x;
      doit (i + 1) space
    end in
  doit 0 0 |> idastar tbl |> Printf.printf "%d\n"

Measured memory_bytes: 4508
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    ll X, K, D;
    cin >> X >> K >> D;
    if (K < abs(X) / D) {
        cout << abs(X) - D * K << endl;
    } else {
        K -= (abs(X) / D);
        ll tmp = abs(X) % D;
        if (K % 2 == 0) {
            cout << tmp << endl;
        } else {
            cout << abs(tmp - D) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3620