akhauriyash/Code-Regression huggingface dataset:
import math

a,b=map(int,input().split())
ma=a*100//8
mb=b*100//10

if ma<mb:
  ta=ma
  tb=mb
else:
  tb=ma
  ta=mb
  
ta=max(0,ta-10)
tb=tb+10

#print(ta,tb)

ans=-1
for i in range(ta,tb+1):
  k=0
  if a==math.floor(i*0.08):
    if b==math.floor(i*0.1):
      ans=i
      k=1
      break
    if k:
      break

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int x;
    cin >> x;
    int ans;
    if(x < 600) ans = 8;
    else if(x < 800) ans = 7;
    else if(x < 1000) ans = 6;
    else if(x < 1200) ans = 5;
    else if(x < 1400) ans = 4;
    else if(x < 1600) ans = 3;
    else if(x < 1800) ans = 2;
    else ans = 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cstring>

// use printf, scanf instead of cout, cin.

using namespace std;

// Node class
template <typename T>
struct Node
{
	Node(const T& value) : mValue(value), mNext(nullptr), mPrev(nullptr) {}

	T mValue;

	Node<T>* mNext;
	Node<T>* mPrev;
};

// Doubly Linked List class
template <typename T>
class List
{
private:

	Node<T>* mFront;
	Node<T>* mBack;

public:

	List() : mFront(nullptr), mBack(nullptr) {}
	~List() { while (mFront) popFront(); }

	void pushFront(const T& val)
	{
		auto node(new Node<T>(val));

		if (mFront)
		{
			node->mNext = mFront;
			mFront->mPrev = node;

			mFront = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void pushBack(const T& val)
	{
		auto node(new Node<T>(val));

		if (mBack)
		{
			node->mPrev = mBack;
			mBack->mNext = node;

			mBack = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void popFront()
	{
		if (mFront)
		{
			auto next(mFront->mNext);
			delete mFront;

			if (next)
			{
				next->mPrev = nullptr;
				mFront = next;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void popBack()
	{
		if (mBack)
		{
			auto prev(mBack->mPrev);
			delete mBack;

			if (prev)
			{
				prev->mNext = nullptr;
				mBack = prev;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void erase(const T& val)
	{
		auto node(mFront);

		while (node)
		{
			if (node->mValue == val)
			{
				if (node->mPrev) node->mPrev->mNext = node->mNext;
				else mFront = node->mNext;

				if (node->mNext) node->mNext->mPrev = node->mPrev;
				else mBack = node->mPrev;

				delete node;

				break;
			}

			node = node->mNext;
		}
	}

	void print()
	{
		auto node(mFront);

		size_t index(0);
		while (node)
		{
			printf(index++ ? " %d" : "%d", node->mValue);

			node = node->mNext;
		}

		printf("\n");
	}
};

int main()
{
	List<int> list;

	int n;
	scanf("%d", &n);

	for (size_t i(0); i < n; ++i)
	{
		char command[16];
		scanf("%s", command);

		if (!strcmp(command, "insert"))
		{
			int x;
			scanf("%d", &x);

			list.pushFront(x);
		}
		else if (!strcmp(command, "delete"))
		{
			int x;
			scanf("%d", &x);

			list.erase(x);
		}
		else if (!strcmp(command, "deleteFirst"))
		{
			list.popFront();
		}
		else if (!strcmp(command, "deleteLast"))
		{
			list.popBack();
		}
	}

	list.print();

	return 0;
}

Measured memory_bytes: 34432
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    ll x3, y3, x4, y4;
    x3 = x2 + (y1 - y2);
    y3 = y2 - (x1 - x2);
    x4 = x3 + (y2 - y3);
    y4 = y3 - (x2 - x3);

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}

Measured memory_bytes: 3608
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

x = k()
print("Yes" if x >= 30 else "No")


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

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

    string s;
    set<char> d;
    cin >> s;
    // cout <<s<<endl;
    for(auto e:s){
        d.insert(e);
    }

    if(d.size()==2){
        cout << "Yes" <<endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
   int h, w, n,big,small;
   scanf("%d %d %d",&h,&w,&n);
   if(h>=w){
    big = h;
    small = w;
    }
   else{
    big = w;
    small = h;
    }
   int count = 1;
   for(int i = 1; i <= small; i++){
      if(n>big*i)
      count++;
   }
   printf("%d\n",count);
   return 0;
   }

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    set<string>st;
    for (int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        st.insert(s);
    }
    cout<<st.size();
    return 0;
}


Measured memory_bytes: 19228
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    rep(i, N) cin >> S[i];
    sort(S.begin(), S.end());
    string res;
    rep(i, N) res += S[i];
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

void solution()
{
    unordered_map<int, int> counts;
    int n;
    cin >> n;
    rep(i,n){
        int a;
        cin >> a;
        counts[a] += 1;
    }
    int64_t sum = 0;
    for(auto [k,v] : counts){
        sum += static_cast<int64_t>(k) * static_cast<int64_t>(v);
    }
    int q;
    cin >> q;
    rep(i,q){
        int b,c;
        cin >> b >> c;
        const int count = counts[b];
        sum -= static_cast<int64_t>(b) * static_cast<int64_t>(count);
        sum += static_cast<int64_t>(c) * static_cast<int64_t>(count);
        counts[c] += count;
        counts[b] = 0;
        cout << sum << '\n';
    }
}

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


Measured memory_bytes: 7084
import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
from itertools import accumulate, permutations
import sys
sys.setrecursionlimit(10 ** 7)
import bisect
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

import string

a = input().strip()

if a in string.ascii_uppercase:
    print('A')
else:
    print('a')




Measured memory_bytes: 9904
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    lint N;
    cin >> N;
    if (N % 2 == 1) {
        cout << 0 << endl;
    } else {
        lint p5 = 0;
        while (N > 0) {
            p5 += N / 10;
            N /= 5;
        }

        cout << p5 << endl;
    }
    return 0;
};

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

int main(){
    int N, M;
    cin>>N;
    string b[N];
    rep(i, N){
        cin>>b[i];
    }
    cin>>M;
    string r[M];
    rep(i, M){
        cin>>r[i];
    }
    int ans=0;
    int count=0;
    string s;
    rep(i, N){
        count=0;
        s=b[i];
        rep(j, N){
            if (s==b[j]){
                count++;
            }
        }
        rep(j, M){
            if (s==r[j]){
                count--;
            }
        }
        ans=max(ans, count);
    }
    cout<<ans<<endl;
}

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

int main(){
  int N,W;
  cin>>N>>W;
  vector<int> w(N),v(N);
  for(int i=0;i<N;i++){
    cin>>w.at(i)>>v.at(i);
  }

  vector<ll> dp(100001,1000000000000);
  dp.at(0)=0;
  for(int i=0;i<N;i++){
    for(int j=100000;j>=v.at(i);j--){
      dp.at(j)=min<ll>(dp.at(j),dp.at(j-v.at(i))+w.at(i));
    }
  }

  int ans=0;
  for(int i=0;i<=100000;i++){
    if(dp.at(i)<=W){
      ans=i;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int a;
    long long sum=0;
    for(int i=0;i<n;i++){
        cin>>a;
        while(a%2==0){
            sum++;
            a/=2;
        }
    }
    cout<<sum;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

//long long int MOD = 524287;
#define MAX 200001
using namespace std;

typedef long long int lli;

lli COMNUM[MAX][3];
// テーブルを作る前処理
void COMinit() {
  for(int i=0;i<MAX;i++){
    COMNUM[i][0] = 1;
    if(i < 3){
      COMNUM[i][i] = 1;
    }
  }
}

// 二項係数計算
lli COM(lli n, lli k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(COMNUM[n][k] != 0){
      return COMNUM[n][k];
    }
    lli ans = COM(n-1,k-1) + COM(n-1,k);
    COMNUM[n][k] = ans;
    return ans;
}

int A[MAX];
int num[MAX];

int main(void){
  int N;
  vector<int> v;
  lli sum = 0;
  
  cin >> N;
  //cout << N << endl;
  for(int i=0;i<N;i++){
    //cout << i << endl;
    int tmp;
    cin >> tmp;
    A[i] = tmp;
    v.push_back(A[i]);
  }
  //cout << "flag" << endl;
  COMinit();
  sort(v.begin(),v.end());
  int tmpsize=1;
  int cur = v[0];
  for(int i=1;i<v.size();i++){
    if(cur != v[i]){
      num[cur] = tmpsize;
      sum = sum + COM(tmpsize,2);
      tmpsize = 1;
      cur = v[i];
    }else{
      tmpsize++;
    }
  }
  num[cur] = tmpsize;
  sum = sum +COM(tmpsize,2);
  
  //sumにはなにもしていないときの総数
  //cout << sum << endl;
  for(int i=0;i<N;i++){
    int tmp = num[A[i]];
    //cout << "num:" << tmp << endl;
    //sumから(tmp,2)を引き(tmp-1,2)をeたす
    lli ans = sum - COM(tmp,2) + COM(tmp-1,2);
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 18676
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 60;

int MOD = 1000000007;

int main(){
    std::ios_base::sync_with_stdio(false);

    int n; int k; cin>>n>>k;

    bool usable[10];
    rep(i,10) usable[i]=true;

    rep(i,k){
      int m;cin>>m;
      usable[m]=false;
    }

    while(true){
        string ns = to_string(n);

        bool ok=true;

        for(int i=0; i<ns.length();i++){
            if(!usable[ns[i]-'0']){
                ok=false;
                break;
            }
        }

        if(ok) break;

        n++;
    }

    cout << n << endl;

    return 0;
}


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

using namespace std;

int main()
{
  int n,count=0;
  cin>>n;
  int a[n];
  for(auto i = 0 ; i< n ; i++)
    cin>>a[i];
  sort(a,a+n);
  for(auto i = n-1 ; i>0 ; i--)
  {
    int l=0;
    int r=i-1;
    while(l<r)
    {
      if(a[l] +a[r] >a[i])
      {
        count+=r-l;
        r--;
      }
      else
        l++;
    }

  }
  cout<<count;
}


Measured memory_bytes: 256
#Atcoder dp educational contest

n = int(input())
l = []

for i in range(n):
    l.append(list(map(int, input().split())))


dp = []
for i in range(n + 1):
    dp.append([-1, -1, -1])

dp[1][0] = l[0][0]
dp[1][1] = l[0][1]
dp[1][2] = l[0][2]

for i in range(2, n + 1):
    dp[i][0] = l[i - 1][0] + max(dp[i - 1][1], dp[i - 1][2])
    dp[i][1] = l[i - 1][1] + max(dp[i - 1][0], dp[i - 1][2])
    dp[i][2] = l[i - 1][2] + max(dp[i - 1][0], dp[i - 1][1])

print(max(dp[n][0], max(dp[n][1], dp[n][2])))


Measured memory_bytes: 47280
import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] a = sc.next().toCharArray();
        char[] b = sc.next().toCharArray();
        
        if(a.length<b.length){
            System.out.println("LESS");
        }else if(a.length>b.length){
            System.out.println("GREATER");
        }else{
            for(int i = 0;i<a.length;i++){
                if(a[i]>b[i]){
                    System.out.println("GREATER");
                    break;
                }else if(a[i]<b[i]){
                    System.out.println("LESS");
                    break;
                }else{
                    if(i==a.length-1){
                        System.out.println("EQUAL");
                    }
                }
            }
        }

    }
}






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

using namespace std;

using i64 = int64_t;

const i64 INF = 1e18 + 7;
const i64 MOD = 1e9 + 7;

struct UnionFind{
    vector<i64> par;
    UnionFind(i64 n) : par(n, -1){}
    i64 Find(i64 x){return par[x] < 0 ? x : Find(par[x]);}
    bool Unite(i64 x, i64 y){
        x = Find(x);
        y = Find(y);
        if(x == y)
            return false;
        if(par[x] > par[y])
            swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
};

double add(double a, double b){
    if(abs(a + b) < 1e-10 * (abs(a) + abs(b)))
        return 0;
    return a + b;
}
struct poi64{
    double x, y;
    poi64(){}
    poi64(double x, double y) : x(x), y(y){}
    poi64 operator-(const poi64& p){
        return poi64(add(x, -p.x), add(y, -p.y));
    }
    double det(const poi64& p){
        return add(x * p.y, -y * p.x);
    }
};
bool cmp_x(const poi64& p, const poi64& q){
    if(p.x != q.x)
        return p.x < q.x;
    return p.y < q.y;
}

vector<poi64> ch(vector<poi64>& ps){
    i64 n = ps.size();
    sort(ps.begin(), ps.end(), cmp_x);
    i64 k = 0;
    vector<poi64> qs(n * 2);
    for(i64 i = 0; i < n; ++i){
        while(k > 1 && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) < 0)
            k--;
        qs[k++] = ps[i];
    }
    for(i64 i = n - 2, t = k; i >= 0; i--){
        while(k > t && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) < 0)
            k--;
        qs[k++] = ps[i];
    }
    qs.resize(k - 1);
    return qs;
}

signed main(){
    i64 n, m;
    cin >> n >> m;
    vector<i64> x(n), y(n);
    vector<pair<i64,i64>> v;
    vector<poi64> v_p;
    for(i64 i = 0; i < n; ++i){
        cin >> x[i] >> y[i];
        v_p.emplace_back(x[i], y[i]);
    }
    auto ch_p = ch(v_p);
    vector<i64> ch_v;
    for(i64 i = 0; i < ch_p.size(); ++i){
        for(i64 j = 0; j < n; ++j)
            if(ch_p[i].x == x[j] && ch_p[i].y == y[j]){
                ch_v.emplace_back(j);
                break;
            }
        assert(ch_v.size() == i + 1);
    }

    auto dist_func = [&](i64 i, i64 j){
        double xd = x[i] - x[j];
        double yd = y[i] - y[j];
        return sqrt(xd * xd + yd * yd);
    };
    set<i64> ch_s;
    for(auto& x : ch_v)
        ch_s.emplace(x);


    double ans = 0;
    for(i64 i = 0; i < ch_v.size(); ++i)
        ans += dist_func(ch_v[i], ch_v[(i + 1) % ch_v.size()]);

    UnionFind uf(n + 1);
    for(i64 i = 0; i < n; ++i){
        bool fl = false;
        for(auto& x : ch_v){
            if(i == x){
                fl = true;
                break;
            }
        }
        if(fl)
            uf.Unite(i, n);
    }

    vector<tuple<double,i64,i64>> eds;
    for(i64 i = 0; i < m; ++i){
        i64 s, t;
        cin >> s >> t;
        --s, --t;
        eds.emplace_back(dist_func(s, t), s, t);
    }
    sort(eds.begin(), eds.end());
    for(auto& ed : eds){
        double dist;
        i64 s, t;
        tie(dist, s, t) = ed;
        if(uf.Unite(s, t)){
            ans += dist;
        }
    }
    printf("%.20lf\n", ans);

}



Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){return modpow(x,mod-2);}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,m,a[10010];
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    int sm=0;
    rep(i,m){
        cin>>a[i];
        sm+=a[i];
    }
    if(n-sm>=0)cout<<n-sm<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 3724
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] maxab = new int[2];
        for (int i = 0; i < n; i++)
        {
            int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (ab[0] > maxab[0]) maxab = ab;
        }
        Console.WriteLine(maxab.Sum());
    }
}

Measured memory_bytes: 17448
string = input()
array = string.split(' ')
a = int(array[0])
b = int(array[1])
c = int(array[2])
k = int(array[3])

answer = 0
if a >= k:
  answer = k
else:
  answer = a
  if b >= k - a:
    answer += 0
  else:
    answer -= k - a - b
print(answer)


Measured memory_bytes: 9116
/*
 * FileName:     B
 * CreatedDate:  2020-03-28 21:03:59 +0900
 * LastModified: 2020-03-28 21:09:37 +0900
 */

#include <stdio.h>

int main(void){
    unsigned long int X;
    scanf("%ld",&X);
    int count=0;
    count+=(X/500)*1000;
    int tugi = X-X/500*500;
    count+=(tugi/5)*5;
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n,m;
  cin >> n >> m;
  int x[n];
  rep(i,n) cin >> x[i];
  sort(x,x+n);
  int c[m],kumi[m];
  rep(i,m){
    c[i]=0;
    kumi[i]=0;
  }
  rep(i,n){
    c[x[i]%m]++;   
  }
  rep(i,n-1){
    if(x[i]==x[i+1]){
      kumi[x[i]%m]++;
      i++;
    }
  }
  //  rep(i,m) cout << i << " " << c[i] << endl;
  int ans=0;
  rep(i,m/2+1){//0と半分
    if(i==0){
      ans+=c[i]/2;
    }
    else if(m%2==0 && i==m/2){
      ans+=c[i]/2;
    }
    else if(c[i]>=c[m-i]){
      ans+=c[m-i];
      ans+=min(kumi[i],(c[i]-c[m-i])/2);
    }else{
      ans+=c[i];
      ans+=min(kumi[m-i],(c[m-i]-c[i])/2);
    }
    //    cout << ans << endl;
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define INF 2147483647
typedef long long ll;

const double g = 9.8;
const double eps = 1e-8;

#define MAXN 60
int N,V,X,Y;
int L[MAXN], B[MAXN], R[MAXN], T[MAXN];

double calc(double vy, double t) //given velocity in y, where is it after t sec
{
    return vy*t - g*t*t/2;
}

int cmp(double lb, double ub, double a)
{
    return a < lb+eps ? -1 : a > ub-eps ? 1 : 0;
}

bool check(double qx, double qy)//if bird passes qx, qy, will it hit pig?
{
    //solve for t
    double a=g*g/4, b=g*qy-V*V, c=qx*qx+qy*qy;
    double D = b*b - 4*a*c;
    if(D<0 && D>-eps) D = 0;
    if(D<0)return false;

    for(int d=-1; d<=1; d+=2)//test for two solutions for t^2
    {
        double t2 = (-b+d*sqrt(D))/(2*a);
        if(t2<=0)continue;
        double t = sqrt(t2);
        double vx=qx/t, vy=(qy+g*t*t/2)/t;

        double yt = calc(vy, X/vx);
        if(yt < Y-eps)continue;

        bool ok = true;
        for(int i = 0; i < N; i++)
        {
            if(L[i] >= X)continue;
            if(R[i] >= X && Y <= T[i] && B[i] <= yt) ok = false;//?

            //use int?
            int yL = cmp(B[i], T[i], calc(vy, L[i]/vx));
            int yR = cmp(B[i], T[i], calc(vy, R[i]/vx));
            int xH = cmp(L[i], R[i], vx*(vy/g));
            int yH = cmp(B[i], T[i], calc(vy, vy/g));

            if(xH==0 && yH>=0 && yL<0)ok = false;
            if(yL*yR <= 0)ok = false;
        }
        if(ok) return true;
    }
    return false;
}

void solve()
{
    for(int i = 0; i < N; i++)R[i] = min(R[i], X); //why tho
    bool ok = check(X, Y);
    for(int i = 0; i < N; i++)
    {
        ok |= check(L[i],T[i]);
        ok |= check(R[i],T[i]);
    }
    if(ok)cout << "Yes\n";
    else cout << "No\n";
}

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

    cin >> N >> V >> X >> Y;
    FOR(i,0,N-1)cin >> L[i] >> B[i] >> R[i] >> T[i];
    solve();

    return 0;
}

/*
TESTCASES:
1 7 3 1
1 1 2 2
*/



Measured memory_bytes: 3200
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, K;
  cin>>N>>K;
  ll V[N];
  for(int i=0;i<N;++i) cin>>V[i];
  vector<ll> jewel;
  ll ans = -big;
  ll tmpans;
  for(int l=0;l<=N;++l) {
    for(int r=0;r+l<=N;++r) {
      if(l+r>K) continue;
      jewel.clear();
      for(int k=0;k<l;++k) jewel.push_back(V[k]);
      for(int k=0;k<r;++k) jewel.push_back(V[N-1-k]);
      sort(jewel.begin(), jewel.end());
      tmpans = 0;
      for(int k=0;k<l+r;++k) {
        if(K-(l+r)>k && jewel[k]<0) continue;
        tmpans += jewel[k];
      }
      ans = max(ans, tmpans);
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3620
fun main(args: Array<String>) {
    val (N, K) = readInputLine().split(" ").map { it.toInt() }
    val S = readInputLine().toCharArray()

    val dims = mutableListOf<Pair<Int, Int>>()
    
    var now = S[0]
    var start = 0
    
    for (i in 1 until N) {
        if (S[i] != now) {
            dims.add(Pair(start, i - 1))
            now = S[i]
            start = i
        }
    }

    dims.add(Pair(start, N - 1))

    println(Math.min(N - 1, dims.sumBy { it.second - it.first } + K * 2))
}

fun readInputLine(): String {
    return readLine()!!
}


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

using namespace std;

int main(void) {
  int n, m, p;
  while (cin >> n >> m >> p, n) {
    vector<int> x(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> x[i];
      sum += x[i];
    }
    sum *= 100 - p;

    cout << (x[m - 1] ? sum / x[m - 1] : 0) << endl;
  }

  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int prime[10000011];
bool is_prime[10000011];
int MAX[10000011];

void sieve(int n) {
	int p = 0;
	rep (i, 0, n + 1) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	rep(i, 2, n + 1) {
		if (is_prime[i]) {
			prime[p++] = i;
			for (int j = i * 2; j <= n; j += i) {
				is_prime[j] = false;
			}
		}
	}
}

signed main() {
	int n;
	sieve(10000001);
	MAX[9] = 0;
	rep(i, 10, 10000001) {
		MAX[i] = MAX[i - 1];
		if (is_prime[i] && is_prime[i - 2] && is_prime[i - 6] && is_prime[i - 8]) {
			MAX[i] = i;
		}
	}
	/*rep(i, 10, 30) {
		cout << i << " " << MAX[i] <<" " << is_prime[i]<< endl;
	}*/
	while (cin >> n && n) {
		cout << MAX[n] << endl;
	}
}

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

 using namespace std;
 typedef long long ll;
 #define rep(i, n) for(int i = 0; i < (int)(n); i++)

 int main() {
   int A, B, C;
   ll K;
   cin >> A >> B >> C >> K;

   if (K % 2 == 0) cout << A - B << endl;
   else cout << B - A << endl;
 }


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define chmin(x,y) x = min(x, y)
#define chmax(x,y) x = max(x, y)
#define V vector
vector<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
vector<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

const int INF = 1e9;

int main () {
    int h, n; cin >> h >> n;
    V<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    V<int> dp(h+1, INF);//dp[i]:体力をi減らすのに必要な魔力のmin
    dp[0] = 0;
    rep(i, n) {
        for (int j = 0; j <= h; j++) {
            int nj = min(h, j + a[i]);
            chmin(dp[nj], dp[j] + b[i]);
        }
    }
    cout << dp[h] << endl;
    return 0;
}

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

struct player {
	char cards[100];
	int card_num;
	int round;
	char name;
};

int main(void)
{
	struct player a = { { 0 } , 0, 0, 'A'};
	struct player b = { { 0 } , 0, 0, 'B'};
	struct player c = { { 0 } , 0, 0, 'C'};
	struct player *tmp_player;

	scanf("%s", a.cards);
	scanf("%s", b.cards);
	scanf("%s", c.cards);

	a.card_num = (char)strlen(a.cards);
	b.card_num = (char)strlen(b.cards);
	c.card_num = (char)strlen(c.cards);

	tmp_player = &a;

	while(tmp_player->card_num - tmp_player->round > 0) {
		switch(tmp_player->cards[tmp_player->round++]) {
		case 'a':
			tmp_player = &a;
			break;
		case 'b':
			tmp_player = &b;
			break;
			
		case 'c':
			tmp_player = &c;
			break;
		}
	}

	printf("%c\n", tmp_player->name);

	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> h(N + 1, 0);
  for (int i = 1; i <= N; i++) cin >> h[i];

  vector<int> dp(N + 1);
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = abs(h[2] - h[1]);
  for (int i = 3; i <= N; i++) {
    dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]));
  }
  cout << dp[N] << endl;
}

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

using namespace std;

int main()
{
    int n, x;
    int summ = 0;
    int sm = 1e9 + 7;
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
        int m;
        cin >> m;
        summ += m;
        sm = min(sm, m);
    }
    x -= summ;
    int ans = n + (x/sm);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll
// B
signed main(){
  int t;
  int n; cin>>n>>t;
  int min_ans=INF;
  for(int i=0; i<n; i++){
    int a,b; cin>>a>>b;
    if(b<=t) min_ans=min(min_ans,a);
  }
  if(min_ans==INF) cout<<"TLE"<<en;
  else cout<<min_ans<<en;
}

Measured memory_bytes: 256
whn_list = list(map(int,input().split()))
x_y_list = []
x = [0,whn_list[0]]
y = [0,whn_list[1]]

for i in range(whn_list[2]):
    x_y_list.append(list(map(int,input().split())))

for i in x_y_list:
    if i[2] == 1:
        x[0] = max(i[0],x[0])
    elif i[2] == 2:
        x[1] = min(i[0],x[1])
    elif i[2] == 3:
        y[0] = max(i[1],y[0])
    else:
        y[1] = min(i[1],y[1])

s = (x[1]-x[0])*(y[1]-y[0])

if  (x[1] <= x[0]) or (y[1] <= y[0]):
    print(0)
else:
    print(s)

Measured memory_bytes: 9004
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        long[] dp = new long[10010];
        Arrays.fill(dp, 1000000010L);
        dp[0] = 0;

        int k=0, sum=0;
        for (int j = 0; j < n; j++){
            int v = sc.nextInt();
            int w = sc.nextInt();
            sum += v;
            for(int i=sum; i>=v; i--){
                dp[i] = Math.min(dp[i], dp[i-v]+w);
            }
        }

        for(int i=sum; i>=1; i--){
            if(dp[i] <= m){
                k = i;
                break;
            }
        }
        System.out.println(k);
        sc.close();
    }
}


Measured memory_bytes: 27372
import numpy as np

N, M, C = map(int, input().split())
B = np.array([int(i) for i in input().split()])
inputs = [
    np.array([int(i) for i in input().split()]) * B for _ in range(N)
]

ans = 0
for i in range(N):
    if C + sum(inputs[i]) > 0:
        ans += 1

print(ans)


Measured memory_bytes: 18644
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    long long n,a,b;
    cin >> n >> a >> b;
    if(b >= a && n >= 2) cout << (b-a)*(n-2) + 1 << endl;
    else if(b == a && n == 1) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

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

    Scanner cin;

    public void calc()
    {
        cin = new Scanner();
        long N = cin.nextLong();
        long C = cin.nextLong();
        long K = cin.nextLong();

        long[] T = new long[N];


        for (long l = 0; l < N; l++)
        {
            T[l] = cin.nextLong();
        }

        Array.Sort(T);

        long now = T[0];
        long ans = 1;
        long pas = 1;
        for (long l = 1; l < N; l++)
        {
            long t = T[l];

            if(pas >= C)
            {
                now = t;
                pas = 1;
                ans++;
                continue;
                
            }

            if (t > now + K)
            {
                now = t;
                pas = 1;
                ans++;
                continue;
            }

            pas++;
        }

        Console.WriteLine(ans);
        Console.Read();
    }
}


class Scanner
{
    string[] s;
    int i;

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

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

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

    public int nextInt()
    {
        return int.Parse(next());
    }

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

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

}

Measured memory_bytes: 17456
K, N = map(int, input().split())

A = list(map(int, input().split()))

B = []

for i in range(len(A)-1):
    B.append(A[i+1]-A[i])

B.append(A[0] - A[N-1] + K)

b_max       = max(B)
b_max_index = B.index(max(B))


B.remove(b_max)
print(sum(B))


Measured memory_bytes: 32244
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n, -1) {}

    int find(int x) {
        if (d[x] < 0) return x;
        else {
            d[x] = find(d[x]);
            return d[x];
        }
    }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (d[x] > d[y]) swap(x, y);
        if (x == y) return false;
        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};



int main() {

    int N, M, K;
    cin >> N >> M >> K;

    vector<int> count(100010, 0);
    UnionFind uf(N);

    int A, B;
    for (int i = 0; i < M; ++i) {
        cin >> A >> B;
        A--;
        B--;
        uf.unite(A, B);
        count[A]++;
        count[B]++;
    }

    int C, D;
    vector<vector<int>> b(100010);
    for (int i = 0; i < K; ++i) {
        cin >> C >> D;
        C--;
        D--;
        b[C].push_back(D);
        b[D].push_back(C);
    }

    int ans;
    for (int i = 0; i < N; ++i) {
        ans = uf.size(i) - count[i] - 1;
        for (int j: b[i]) {
            if (uf.same(i, j)) ans--;
        }
        cout << ans << " ";
    }
    cout << endl;

    return 0;
}


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

typedef pair<int,int> pii;

int N,K;
vector<int> G[2010];
int A[2020],B[2020];

int DFS(int v,int p,int d)
{
    int res = 0;
    for(int i = 0; i < G[v].size(); i++)if(G[v][i] != p)
        res += DFS(G[v][i],v,d + 1);
    return res + (d <= K / 2);
}

int main()
{
    scanf("%d%d",&N,&K);
    for(int i = 0; i < N - 1; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        A[i] = a;
        B[i] = b;
        G[a].push_back(b);
        G[b].push_back(a);

    }

    int ans = 100010;
    if(K & 1)
    {
        for(int i = 0; i < N - 1; i++)
            ans = min(ans,N - DFS(A[i],B[i],0) - DFS(B[i],A[i],0));
    }
    else
    {
        for(int i = 1; i <= N; i++)
            ans = min(ans,N - DFS(i,-1,0));
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 512
using System;
class Program
{
	static void Main()
	{
	string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
	int n = int.Parse(input[0]);
	int y = int.Parse(input[1]);

  int end = 0;

  for(int i=0; i <= n; i++)
    {
      for(int j=0; i+j <= n; j++)
      {
        if(10000*i + 5000*j + 1000*(n-i-j) == y)
        {
          Console.WriteLine(i + " " + j + " " + (n-i-j));
          end = 1;
          break;
        }
      
      }
      if(end == 1)break;
    
    }
    if(end == 0) Console.WriteLine((-1) + " " + (-1) + " " + (-1) );//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 13140
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    total_length = sum(a_list)
    ans = total_length
    accum_length = 0

    for i in range(n):
        accum_length += a_list[i]
        ans = min(ans, abs(2 * accum_length - total_length))

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 105032
s = input()
n = len(s)+1
ls = [0]*n
rs = [0]*n
for i in range(n-1):
    if s[i] == "<":
        ls[i+1] = ls[i]+1
for i in range(n-1):
    if s[-1-i] == ">":
        rs[-2-i] = rs[-1-i]+1
ans = 0
for i,j in zip(ls,rs):
    ans += max(i,j)
print(ans)

Measured memory_bytes: 33088
#include<bits/stdc++.h>
#define ll long long int
const ll mod=1e9+7;
const int maxn=2e5+50;
using namespace std;
int main()
//int found; found=chaine.find(cara); if (found!=std::string::npos) how to verify if a caracter exists in a chaine
// toupper(caractere) ==> return the majuscule of a caractere
//floor(x) Returns the largest integer smaller than x
//ceil(x) returns  Returns the smallest integer greater
{
	string s,t;
	cin>>s;
	cin>>t;
	int nt,ns;
	nt=t.size();
	ns=s.size();
	int mat[ns+1][nt+1];
	for(int i=0;i<=ns;i++)
	{
		mat[i][0]=0;
	}
	for(int i=0;i<=nt;i++)
	{
		mat[0][i]=0;
	}
	for(int i=1;i<=ns;i++)
	{
		for(int j=1;j<=nt;j++)
		{
			if(s[i-1]==t[j-1])
			{
				mat[i][j]=mat[i-1][j-1]+1;
			}
			else
			{
				mat[i][j]=max(mat[i-1][j],mat[i][j-1]);
			}
		}
	}
	string res;
	res="";
	int i=ns;
	int j=nt;
	while(mat[i][j]!=0)
	{
		if(mat[i][j]>max(mat[i-1][j],mat[i][j-1]))
		{
			res=s[i-1]+res;
			i=i-1;
			j=j-1;
		}
		else
		{
			if(mat[i-1][j]>=mat[i][j-1])
			{
				i=i-1;
			}
			else
			{
				j=j-1;
			}
		}
	}
	cout<<res;
}



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

int main()
{
  int n, m;

  cin >> n;
  string s[n];
  for (auto& ss : s)
  {
    cin >> ss;
  }

  cin >> m;
  string t[m];
  for (auto& tt : t)
  {
    cin >> tt;
  }

  int ans = 0;
  for (int i=0; i<n; ++i) {
    string word = s[i];
    int point = 0;
    for (int j=0; j<n; ++j) {
      if (s[j] == word) ++point;
    }
    for (int j=0; j<m; ++j) {
      if (t[j] == word) --point;
    }
    ans = max(ans, point);
  }

  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456];
int keta(int x) {
	int res = 0;
	while(x >= 1) {
		x /= 10; res++;
	}return res;
}
signed main() {
	int n, c, d, a, b, ans=0; cin >> n >> a >> b;
	for (int h = 0; h < n; h++) {
		cin >> c >> d;
		if (c >= a && d >= b) { ans++; }
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int number[100000];
int main(){
    number[1] = 1;
    number[2] = 1;
    number[3] = 1;
    number[4] = 2;
    number[5] = 1;
    number[6] = 2;
    number[7] = 1;
    number[8] = 5;
    number[9] = 2;
    number[10] = 2;
    number[11] = 1;
    number[12] = 5;
    number[13] = 1;
    number[14] = 2;
    number[15] = 1;
    number[16] = 14;
    number[17] = 1;
    number[18] = 5;
    number[19] = 1;
    number[20] = 5;
    number[21] = 2;
    number[22] = 2;
    number[23] = 1;
    number[24] = 15;
    number[25] = 2;
    number[26] = 2;
    number[27] = 5;
    number[28] = 4;
    number[29] = 1;
    number[30] = 4;
    number[31] = 1;
    number[32] = 51;
    int x;
    cin >> x;
    cout << number[x] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define ff first
#define ss second
typedef pair<int,int> pii;

int32_t main()
{
 int k ; 
 cin >> k ;
 if(k % 2 == 0 || k % 5 == 0)return cout << -1 , 0 ;

 int f = 7 % k ;
 int flag = 0 ;
 if(f == 0)return cout << 1 , 0 ;

 int c = 1 ;

 for(int i = 0 ; i < 1000008 ; i++){
  int tf = (7 % k + ((10 % k ) * f) % k ) % k ;

  if(tf % k == 0 )
   return cout << c + 1, 0 ;
  ++c ;
  f = tf ;
 }
 cout << -1 ;
 return 0;
}        

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <cstdlib> //abs(x-y)
#include <iomanip> //

using namespace std;

int main() {
  string sa, sb, sc;
  cin >> sa >> sb >> sc;
  char x = sa.front();
  
  while(1){    
    if(x == 'a'){
      if(sa.empty()){
        cout << 'A' << endl;
        break;
      }
      x = sa.front();
      sa.erase(0, 1);
    }
    else if(x == 'b'){
      if(sb.empty()){
        cout << 'B' << endl;
        break;
      }
      x = sb.front();
      sb.erase(0, 1);
    }
    else{
      if(sc.empty()){
        cout << 'C' << endl;
        break;
      }
      x = sc.front();
      sc.erase(0, 1);
    }
  }
}


Measured memory_bytes: 256
numBits = int(input())
bitString = input()

def calculateAndPrintPopcount(n):
  popCount = 0
  while(n > 0):
    n %= bin(n).count('1')
    popCount += 1
  return popCount

count1 = bitString.count('1')
x = int(bitString,2)
xPlus = x % (count1 + 1)
if (count1 - 1) == 0:
  xMinus = 0
else:
  xMinus = x % (count1 - 1)

for i in range(numBits)  :
  if bitString[i] == '0':
    print(calculateAndPrintPopcount( (xPlus + pow(2,numBits-1-i,(count1+1))) % (count1+1) ) + 1)
  else:
    if (count1-1) == 0:
      print(0)
    else:
      print(calculateAndPrintPopcount( (xMinus - pow(2,numBits-1-i,(count1-1)) ) % (count1-1) ) +1)

Measured memory_bytes: 80876
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
//library begin
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int log(int a){
    int b=a;
    int cnt=0;
    while(b%2==0){
        b/=2;
        cnt++;
    }
    return cnt;
}
int mypow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    int t=mypow(a,b/2);
    if(b%2==0)return t*t;
    return t*t*a;
}
//library end
int h,n;
int sum=0;
int a[200000];
signed main(){
    cin>>h>>n;
    int ans=(h+n-1)/n;
    cout<<ans<<endl;
    return 0;
}


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


int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n, q;
    std::cin >> n;
    std::vector<int> s(n+1);
    for(int i=0; i<n; ++i)
        std::cin >> s.at(i);
    std::cin >> q;
    std::vector<int> t(q);
    for(int i=0; i<q; ++i)
        std::cin >> t.at(i);
    
    int count = 0;
    for(const int key : t){
        s.back() = key;
        int i = 0;
        while(s.at(i) != key)
            i += 1;
        if(i != n)
            count += 1;
    }
    std::cout << count << std::endl;
}


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

int main() {
    string o, e;
    cin >> o >> e;

    for (int i = 0; i < o.size(); i++) {
        cout << o.at(i);
        if (i < e.size()) cout << e.at(i);
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

Int sim(vector<Int> A){
  Int n = A.size();
  for(Int i=0;i<n;i++) assert(A[i] == 0 || A[i] == 1);
  
  cout<<A<<endl;
  while(A.size() != 1){
    n = A.size();
    vector<Int> nA;
    for(Int i=0;i<n-2;i++){
      vector<Int> a = {A[i],A[i+1],A[i+2]};
      sort(a.begin(), a.end());
      nA.push_back(a[1]);
    }
    A = nA;
    cout<<A<<endl;
  }
  cout<<A<<endl;
  return A[0];
}

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
 
  Int n;
  cin>>n;
  n = 2 * n - 1;
  vector<Int> A(n);
  cin>>A;

  auto getDis = [&](const vector<Int> &X, Int num){
    Int res = INF;
    Int n = X.size();
    for(Int i=0;i<n-1;i++) {
      if(X[i] == num && X[i+1] == num) Min(res, abs(n/2 - i));
      if(X[i] == num && X[i+1] == num) Min(res, abs(n/2 - (i+1)));
    }
    return res;
  };
  
  auto check=[&](Int x){
    vector<Int> X(n);
    for(Int i=0;i<n;i++) X[i] = A[i] >= x;
    
    {
      Int flag = 1;
      for(Int i=0;i<n-1;i++) flag &= X[i] != X[i+1];
      if(flag) return X[0];
    }
    
    Int one = getDis(X, 1);
    Int zero = getDis(X, 0);
    assert(one != zero);
    return (Int)(one < zero);
  };
  
  Int L = 1, R = n;
  while(L+1 < R){
    Int M = (L+R)/2;
    check(M)? L = M: R = M;
  }

  Int ans = L;
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3436