akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

double R = 6378.1;
double r = R;
struct Point
{  
    double x, y, z;
    Point(){};
    Point(double x, double y, double z):x(x),y(y), z(z){};

    Point operator -(Point p){
        return Point(x-p.x, y-p.y, z-p.z);
    }
    double getDist2(){
        return x*x+y*y+z*z;
    }

    void print(){
        printf("(%lf, %lf, %lf)\n", x, y, z);
    }
};

Point getPoint(double ang1, double ang2){
    return Point(R*cos(ang1)*cos(ang2), R*cos(ang1)*sin(ang2), R*sin(ang1));
}

double getAng(double d){
    return d*PI/180;
}

int main(){
    double a, b, c, d;
    while(cin>>a>>b>>c>>d){
        if(a == -1 && b==-1 && c ==-1 && d == -1) break;
        Point p1 = getPoint(getAng(a), getAng(b)), p2 = getPoint(getAng(c), getAng(d));
        //p1.print();
        //p2.print();
        double co = (2*r*r-(p1-p2).getDist2())/2/r/r;
        double e = acos(co);

        cout<<(int)(r*e+0.5)<<endl;
    }
}

Measured memory_bytes: 1284
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<list>
#include<functional>
#include<string.h>
#include<string>
#include<limits.h>
#include<deque>
#include<queue>
#include<stack>
#define P pair<int,int>
using namespace std;

P a[100], b[100];
bool used[100];
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i].first >> b[i].second;
	}
	sort(a, a + n,greater<P>());
	sort(b, b + n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int MIN = 1 << 29;
		for (int j = 0; j < n; j++) {
			if (a[i].first < b[j].first&&a[i].second < b[j].second && !used[j]) {
				MIN = min(MIN, b[j].second);
			}
		}
		for (int j = 0; j < n; j++) {
			if (a[i].first < b[j].first&&a[i].second < b[j].second && !used[j]) {
				if (MIN == b[j].second) {
					ans++;
					used[j] = true;
					break;
				}
			}
		}
	}
	cout << ans << endl;
}

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

using namespace std;

int main() {
  int N, M;
  while(cin >> N >> M && (N|M)) {
    vector<pair<int, int> > vec;
    int expect = 0;
    for(int i=0; i<N; i++) {
      int d, p;
      cin >> d >> p;
      vec.push_back(make_pair(p, d));
      expect += d * p;
    }
    sort(vec.begin(), vec.end(), greater<pair<int, int> >());
    for(int i=0; i<N; i++) {
      expect -= vec[i].first * min(vec[i].second, M);
      M -= vec[i].second;
      if(M <= 0) break;
    }
    cout << expect << endl;
  }
  
  return 0;
}

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

int main(){
  char a,b,c;
  string s,t,r;
  cin >> s >> t >> r;
  a = toupper(s[0]);
  b = toupper(t[0]);
  c = toupper(r[0]);
  cout << a << b << c << endl;
  return 0;
}


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

using ll = long long;

int main(){
  int R, G, B, N;
  cin >> R >> G >> B >> N;

  int ans = 0;
  for (int rr = 0; rr < N/R+1; rr++) {
    for (int gg = 0; gg < (N-R*rr)/G+1; gg++) {
        if ((N-R*rr-G*gg)%B==0) ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr ll inf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    string s, t;
    in(s);
    in(t);
    int slen = s.length();
    int tlen = t.length();
    ll dp[slen + 1][tlen + 1];
    floop(i, slen + 1)
    {
        floop(j, tlen + 1)
        {
            dp[i][j] = 0;
        }
    }
    floop(i, slen)
    {
        floop(j, tlen)
        {
            if (s[i] == t[j])
            {
                chmax(dp[i + 1][j + 1], dp[i][j] + 1);
            }
            chmax(dp[i + 1][j + 1], dp[i + 1][j]);
            chmax(dp[i + 1][j + 1], dp[i][j + 1]);
        }
    }
    string v = "";
    int i = slen, j = tlen;
    while (i > 0 && j > 0)
    {
        if (dp[i][j] == dp[i - 1][j])
        {
            i--;
        }
        else if (dp[i][j] == dp[i][j - 1])
        {
            j--;
        }
        else
        {
            v = s[i - 1] + v;
            i--, j--;
        }
    }
    out(v);
}

Measured memory_bytes: 70656
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean[][] match = new boolean[N][N];

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                int cur = sc.nextInt();
                match[i][j] = (cur == 1);
            }
        }
        int m = (int) 1e9 + 7;
        long[] dp = new long[(1 << N) + 1];
        dp[0] = 1;
        for (int mask = 1; mask < (1 << N); mask++) {
            int i = Integer.bitCount(mask) - 1;
            for (int j = 0; j < N; j++) {
                if (match[i][j] && ((mask & (1 << j)) != 0)) {
                    dp[mask] = (dp[mask] + dp[mask - (1 << j)]) % m;
                }
            }

        }

        System.out.println(dp[(1 << N) - 1]);
    }


}


Measured memory_bytes: 40916
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let calc sign =
        let rec loop i sum acc sign =
            if i = n then acc else
                let sum = sum + a.(i) in
                if sum * sign > 0 then loop (i + 1) sum acc (-sign) else
                    loop (i + 1) sign (acc + abs sum + 1) (-sign)
        in
        loop 0 0 0 sign
    in
    min (calc 1) (calc (-1)) |> Printf.printf "%d\n"
)

Measured memory_bytes: 5376
n = int(input())
s = [0] * 4
c = ["AC", "WA", "TLE", "RE"] 
for i in range(n):
    a = input()
    for j in range(4):
        if a == c[j]:
            s[j] += 1

for i in range(4):
    print(c[i]+" x "+str(s[i]))


Measured memory_bytes: 9180
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N,D;
string s;
int a[200010];
int b[200010];
int main(){
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a,a+N);
    for(int i=0;i<N;i++){
        if(b[i]==a[N-1]){
            cout<<a[N-2]<<endl;
        }else{
            cout<<a[N-1]<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3200
package main

import (
	"bufio"
	"os"
	"fmt"
	"strings"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	sum := 0

	for i := 1; scanner.Scan(); i++ {
		if err := scanner.Err(); err != nil {
			// エラー処理
			break
		}
		if i == 1 {
			data := fmt.Sprint(scanner.Text())
			data_format := strings.Split(data, " ")
			for k := 0; k < len(data_format); k++ {
				count, _ := strconv.Atoi(data_format[k])
				sum = sum + count
			}

			if sum >= 10 {
				fmt.Println("error")
			} else {
				fmt.Println(sum)
			}
			break
		}
	}

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int W, a, b;
	cin >> W >> a >> b;

	int ans = 0;
	if (a + W < b) {
		ans = b - (a + W);
	}
	else if (a > b + W) {
		ans = a - (b + W);
	}

	cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

Vi multi(200050,0);
void solve(){
    int n;
    cin >> n;
    vi a(n);
    rp(i,n) cin >> a.at(i);
    vi ans;
    for(ll i=n; i>0; i--){
        if((multi[i]%2)!=a[i-1]){
            ans.pb(i);
            for(ll j=1; j*j<=i; j++){
                if(i%j==0){
                    multi[j]++;
                    if(j*j!=i) multi[i/j]++;
                }
            }
        }
    }
    print(ans.size());
    for(auto an:ans){
        princ(an);
    }
    cout << endl;
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 6104
#include <iostream>

using namespace std;

static const int MAX = 100;

void trace(int *a, int n) {
    int i;
    for (int i = 0; i < n; i++) {
        if (i > 0) cout << ' ';
        cout << a[i];
    }
    cout << "\n";
}

void insertion_sort(int *a, int n) {
    int j, i, v;
    for (int i = 1; i < n; i++) {
        int key = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > key) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = key;
        trace(a, n);
    }

}

int main(){
    int R[MAX], n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];

    trace(R, n);
    insertion_sort(R, n);


    return 0;
}

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

typedef long long i64;
const int MAXN = 140000;

vector <pair<i64, i64>> dp[MAXN], tmp1, tmp2;
vector <int> Adj[MAXN];

int N;
int fa[MAXN], dis[MAXN], ch[MAXN][2], chCnt[MAXN];
i64 dep[MAXN];
i64 lim;

template <class T>
void myInsert(vector <T> & result, const T & x)
{
	int p = result.size() - 1;
	if(p < 0)
		result.push_back(x);
	else if(x.second < result[p].second)
		result.push_back(x);
}

template <class T>
void merge(T & result, const T & L, const T & R)
{
	result.clear();
	int x = L.size(), y = R.size();
	int p = 0, q = 0;
	if(!y)
		return;

	while(p != x)
	{
		while(q != y && L[p].second + R[q].first <= lim)
			q++;
		if(q)
			q--;
		if(L[p].second + R[q].first <= lim)
			result.emplace_back(L[p].first, R[q].second);
		p++;
	}
}

template <class T>
void mergesort(T & result, const T & L, const T & R)
{
	result.clear();
	int x = L.size(), y = R.size();
	int p = 0, q = 0;

	while(p != x || q != y)
	{
		if(p == x)
			myInsert(result, R[q++]);
		else if(q == y)
			myInsert(result, L[p++]);
		else if(L[p].first < R[q].first)
			myInsert(result, L[p++]);
		else
			myInsert(result, R[q++]);
	}
}

void DFS(int cur)
{
	if(!chCnt[cur])
	{
		dp[cur].clear();
		dp[cur].emplace_back(dep[cur], dep[cur]);
		return;
	}

	const int &ls = ch[cur][0], &rs = ch[cur][1];
	DFS(ls), DFS(rs);

	lim += 2 * dep[cur];

	merge(tmp1, dp[ls], dp[rs]);
	merge(tmp2, dp[rs], dp[ls]);

	mergesort(dp[cur], tmp1, tmp2);

	lim -= 2 * dep[cur];

}

int main(int argc, char * argv[])
{
	ios::sync_with_stdio(false), cin.tie(nullptr);
	cin >> N ;

	for(int i = 2; i <= N; i++)
		cin >> fa[i] >> dis[i] ,
		dep[i] = dep[fa[i]] + dis[i],
		ch[fa[i]][chCnt[fa[i]]++] = i;

	i64 L = 0, R = 1e13, answer = (L + R) >> 1;

	while(L < R)
	{
		lim = answer;
		DFS(1);

		if(dp[1].size())
			R = answer;
		else
			L = answer + 1;
		answer = (L + R) >> 1;
	}

	cout << answer << endl ;
	return 0;
}


Measured memory_bytes: 34024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

ll N;

string to_str(ll n) {
	stringstream ss;
	ss << n;
	return ss.str();
}

bool queryAuto(ll n) {
	bool res = false;
	if (n <= N && to_str(n) <= to_str(N)) res = true;
	if (n > N && to_str(n) > to_str(N)) res = true;
	
	puts(res ? "Y" : "N");
	return res;
}

bool query(ll n) {
	printf("? %lld\n", n);
	fflush(stdout);
	
	if (debug) return queryAuto(n);
	
	string ans; cin >> ans;
	return ans == "Y";
}

int askfl() {
	bool bef;
	
	int one = -1;
	for (ll i = 1, cnt = 0; i <= 100000000000ll; i *= 10, cnt++) {
		bool now = query(i);
		if (i != 1 && bef != now) one = cnt;
		bef = now;
	}
	
	int nine = -1;
	for (ll i = 9, cnt = 0; i <= 100000000000ll; i *= 10, cnt++) {
		bool now = query(i);
		if (i != 9 && bef != now) nine = cnt + 1;
		bef = now;
	}
	
	int res;
	if (one != -1) res = one;
	else res = nine;
	if (res == -1) res = 1;
	
	return res;
}

int main() {
	if (debug) cin >> N;
	
	int keta = askfl();
	
	ll l = 1, r;
	REP(i, keta - 1) l *= 10;
	r = l * 10;
	
	while (r - l > 1) {
		ll m = (r + l) / 2;
		if (query(m * 10)) r = m;
		else l = m;
	}
	
	ll ans = r;
	if (query(l * 10)) ans = l;
	
	printf("! %lld\n", ans);
	return 0;
}


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

int main()
{
   string a;
   cin >> a;
   int ans=0;
   int cnt=0;
   for(int i=0;i<a.size();i++){
   switch(a.at(i)){
     case 'A':
     case 'T':
     case 'G':
     case 'C':
       cnt++;
       break;

     default:
      ans=max(ans,cnt);
      cnt=0;
   }
   }
 cout << max(cnt,ans) << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cstdint>

using namespace std;

const u_int64_t D = 1'000'000'007LL;

u_int64_t dpow(const u_int64_t x, const u_int64_t y)
{
    if (y == 0LL)
    {
        return 1;
    }
    else if (y % 2LL == 0)
    {
        return dpow(x * x % D, y / 2LL);
    }
    else
    {
        return x * dpow(x, y - 1LL) % D;
    }
}

u_int64_t inv(const u_int64_t x)
{
    return dpow(x, D - 2LL);
}

u_int64_t comb(const u_int64_t n, const u_int64_t k)
{
    u_int64_t a = 1;
    u_int64_t b = 1;

    for (u_int64_t i = 0; i < k; i++)
    {
        a = a * (n - i) % D;
        b = b * (i + 1) % D;
    }

    return (a * inv(b)) % D;
}

int main()
{
    u_int64_t n, k;

    cin >> n >> k;

    for (u_int64_t i = 1; i <= k; i++)
    {
        const u_int64_t blue = comb(k - 1, i - 1);
        const u_int64_t red = comb(n - k + 1, i);

        cout << blue * red % D << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

bool isprime(int n) { //?´???°????????°true
    for(int i=2; i*i <= n; i++) {
        if(n%i==0) return false;
    }
    return n != 1;
}

signed main() {
    int a, d, n;
    int cnt = 0;
    while(cin >> a >> d >> n, a || d || n) {
        int t = a;
        while(1) {
            if(isprime(t)) cnt++;
            if(cnt == n) break;
            t += d;
        }
        cout << t << endl;
        cnt = 0;
    }
    return 0;
}

Measured memory_bytes: 3096
import  math
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n = getN()
nums = []


for i in range(n):
  nums.append(getN())

if n == 2:
    print(abs(nums[0]-nums[1]))

if n > 2:
    half = int(math.floor(n/2))
    nums.sort()
    nums1 = nums[:half]
    nums2 = nums[half:]
    nums2[1], nums2[-1] = nums2[-1], nums2[1]

    tmp = nums2[0]
    diff = 0
    diff2 = 0
    for i in range(half):
        num = nums2[i]
        diff += abs(tmp-num)
        tmp = num

        num = nums1[i]
        diff += abs(tmp - num)
        tmp = num

    if n%2 == 1:
        diff += abs(tmp-nums2[-1])

    if n%2 == 1:
        nums1 = nums[:half+1]
        nums2 = nums[half+1:]
        nums1[0], nums1[-2] = nums1[-2], nums1[0]

        tmp = nums1[0]
        for i in range(half):
            num = nums1[i]
            diff2 += abs(tmp - num)
            tmp = num

            num = nums2[i]
            diff2 += abs(tmp - num)
            tmp = num

        diff2 += abs(tmp-nums1[-1])

    #print(nums1)
    #print(nums2)
    print(max(diff, diff2))
"""
3 4 5 9
1 1 3
"""


Measured memory_bytes: 8180
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

ll answer(const int& idx, const int& n, const int& m, const ll& now_cost, const vector<ll>& Cost, const vector<vector<ll>>& A, const ll& X , vector<ll> judge) {
  if (idx == n) {
    rep(i, m) {
      if (judge[i] < X) return -1;
    }
    return now_cost;
  }
  ll answer_on, answer_off;
  {
    vector<ll> new_on_judge(m, 0);
    rep(i, m) {
      new_on_judge[i] = judge[i] + A[idx][i];
    }
    answer_on = answer(idx+1, n, m, now_cost + Cost[idx], Cost, A, X, new_on_judge);
  }
  {
    answer_off = answer(idx+1, n, m, now_cost, Cost, A, X, judge);
  }
  if (answer_on == -1) return answer_off;
  else if (answer_off == -1) return answer_on;
  if (answer_on < answer_off) return answer_on;
  else return answer_off;
}
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int N, M;
  ll X;
  cin >> N >> M >> X;
  vector<ll> Cost(N);
  vector<vector<ll>> A(N, vector<ll>(M));
  rep(i, N) {
    cin >> Cost[i];
    rep(j, M) {
      cin >> A[i][j];
    }
  }
  vector<ll> judge(M, 0);
  cout << answer(0, N, M, 0, Cost, A, X, judge) << '\n';
}


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

using namespace std ; 

int main () { 
	int  t ; 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ;
	int matrix[3][3] ; 
	for (int i = 0 ; i < 3 ; i ++ ) 
		for (int j = 0 ;  j < 3 ; j ++ ) 
			cin>> matrix[i][j] ; 
	cin >> t;
	vector<int> vect ;   
	while ( t--  ) {
		int a; 
		cin >> a; 
		vect.push_back(a) ; 
		for ( int i = 0 ; i < vect.size() ; i ++)  {
			for (int j = 0 ; j < 3 ; j ++ ) {
				for (int k = 0 ; k < 3 ; k++ ) {
				  if ( matrix[j][k] == vect[i] )
						matrix[j][k] = 0 ;
				}
			}
			
		}
	
}
		if ( matrix[0][0] == 0 && matrix[1][1] == 0 && matrix[2][2] == 0 ){
			cout << "Yes" << endl ; 
			return 0 ; 
		}
		if ( matrix[0][2] == 0 && matrix[1][1] == 0 && matrix[2][0] == 0 ){
			cout << "Yes" << endl ; 
			return 0 ; 
		}
		for ( int i = 0 ; i < 3 ; i ++ ) {
			int found = 0 ; 
			for ( int j = 0 ; j < 3 ; j ++ ) { 
				if (matrix[i][j] == 0 ) 
					found ++ ; 
			}
			if ( found ==3 ) 
				{ cout << "Yes" << endl ; 
					return 0 ; }
			
		}
		for ( int i = 0 ; i < 3 ; i ++ ) {
			int found = 0 ; 
			for ( int j = 0 ; j < 3 ; j ++ ) { 
				if (matrix[j][i] == 0 ) 
					found ++ ; 
			}
			if ( found ==3 ) 
				{ cout << "Yes" << endl ; 
					return 0 ; }
			
		}
		cout << "No" << endl ;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
char s[100000];
int main()
{
	int g = 0, p = 0;
	cin >> s;
	for(int i = 0;s[i] != '\0'; i++)
		if(s[i] == 'g') g++;
		else p++;
	cout << (g - p) / 2 << endl;
	return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define REVE(x) reverse(ALL(x))
#define SZ(x) ((int)(x).size())
#define MP make_pair
#define PB push_back
#define INF 999999999

typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int n, a[5], ans=0;
	cin >> n;
	a[0] = n / 1000;
	a[1] = n / 100 % 10;
	a[2] = n / 10 % 10;
	a[3] = n % 10;
	REP(i, 4) {
		if (a[i] == 2)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	int n, m;
	cin >> n >> m;


	VI v(m);
	REP(i, m) {
		cin >> v[i];
	}
	int ptr = 0;

	if (m == 0) {
		long long now = 1;
		long long tmp2 = 1;
		long long tmp1 = 1;

		FOR(i, 2, n) {

			now = tmp1 + tmp2;
			tmp2 = tmp1;
			tmp1 = now;

			now %= 1000000007;
			tmp1 %= 1000000007;
			tmp2 %= 1000000007;
		}

		ANS(now);
		return 0;
	}

	long long now = 0;
	long long tmp2 = 1;
	long long tmp1 = 1;
	if (v[0] == 1) {
		tmp1 = 0;
		ptr++;
	}

	FOR(i, 2, n) {
		if (ptr == m) {
			now = tmp1 + tmp2;
			tmp2 = tmp1;
			tmp1 = now;
		}
		else if (v[ptr] == i) {
			now = 0;
			tmp2 = tmp1;
			tmp1 = now;
			ptr++;
		}
		else {
			now = tmp1 + tmp2;
			tmp2 = tmp1;
			tmp1 = now;
		}
		now %= 1000000007;
		tmp1 %= 1000000007;
		tmp2 %= 1000000007;
	}

	ANS(now);

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
typedef long long int llint;


std::vector<llint> decomposit_prime(llint num){
  std::vector<llint> ret;
  llint a = 2;
  while(num >= a*a){
    if(num%a == 0){
      ret.push_back(a);
      num /= a;
    }else{
      a++;
    }
  }
  if(num != 1){
    ret.push_back(num);
  }
  return ret;
}

int main(void){
  llint n, p;
  std::cin >> n >> p;

  std::vector<llint> ret = decomposit_prime(p);

  std::map<llint, llint> m;

  for(auto elem: ret){
    if(m.count(elem) == 0) m[elem] = 0;
    m[elem] += 1;
  }

  llint result = 1;
  for(auto elem: m){
    for(int i=0; i<elem.second/n; i++){
      result *= elem.first;
    }
  }

  std::cout << result << std::endl;

  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
using namespace std;
const int maxn=10005;
int n,m,t;
vector<int> v[maxn];
int main()
{
	scanf("%d",&n);
	n*=2;
	while(m*(m+1)<n) m++;
	if(m*(m+1)!=n)
	{
		puts("No");
		return 0;
	}
	puts("Yes");
	m++;
	cout<<m<<endl;
	rep(i,1,m)
	{
		int vv=v[i].size();
		rep(j,vv,m-2)
		{
			t++;
			v[i].push_back(t);
		}
		int e=0;
		rep(j,1,m)
		{
			if(j==i)
			continue;
			v[j].push_back(v[i][e]);
			e++;
		}
		printf("%d ",m-1);
		rep(j,0,m-2)
		{
			printf("%d ",v[i][j]);
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>
using namespace std;
int a[100005],pre[100005],post[100005];
int gcd(int a,int b)
{
 return b==0?a:gcd(b,a%b);
}
int main()
{
 int n,ans=1;
 scanf("%d",&n);
 for(int i=1;i<=n;i++)
  scanf("%d",&a[i]);
 pre[1]=a[1],post[n]=a[n];
 for(int i=1;i<=n;i++)
  pre[i]=gcd(pre[i-1],a[i]);
 for(int i=n-1;i;i--)
  post[i]=gcd(post[i+1],a[i]);
 for(int i=1;i<=n;i++)
  ans=max(ans,gcd(pre[i-1],post[i+1]));
 printf("%d\n",ans);
 return 0;
}

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

#define io(F) string t_="";ifstream fin(t_+F+".in");ofstreamfout(t_+F+".out")
#define qio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define graph unordered_map<int, unordered_set<int>>
typedef long long ll;

ll ps[300000];

int main() {
	qio; ll n, k; cin >> n >> k;
	forl(i, 0, 299999) { ps[i] += i; ps[i+1] += ps[i]; }
	ll tot = 0;
	forl(i, k-1, n+1) {
		if(i == n) tot += 1;
		else tot += ps[n]-ps[n-i-1]-ps[i]+1;
		tot %= 1000000007;
	}
	println(tot);
}


Measured memory_bytes: 5980
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
       
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int x1 = a[0];
        int y1 = a[1];
        int x2 = a[2];
        int y2 = a[3];
        
    　　int x3 = x2 + y1 - y2;
    　　int y3 = y2 + x2 - x1;
    　　int x4 = x1 + y1 - y2;
    　　int y4 = y1 + x2 - x1;
    　　
    　　Console.WriteLine(x3 + " " + y3 + " " + x4 + " " + y4);
    }
}

Measured memory_bytes: 11348
#include<stdio.h>
int fibnacci(int);
int F[45];
int main(){

  int n;
  
  scanf("%d",&n);
  printf("%d\n",fibnacci(n));
  
  return 0;
}
int fibnacci(int n){

  int i;
  F[0]=1;
  F[1]=1;
  for(i=2;i<=n;i++){
    F[i]=F[i-2]+F[i-1];
  }
  return F[n];
}



Measured memory_bytes: 2100
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long long;
using llu = long long unsigned;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vpii = vector<pii>;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod(ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

template<typename T, typename M = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, M, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

////////////////////////// Solution starts below. //////////////////////////////

const int N = 1e5 + 100;

int n;
int st, en;
vector<int> adj[N];
int taka[N], aoki[N];

void dfsAoki(int v, int p, int t) {
	aoki[v] = t;
	for(int u : adj[v])
		if(u != p)
			dfsAoki(u, v, t+1);
}

void dfsTak(int v, int p, int t) {
	taka[v] = t;
	if(aoki[v] <= t) return;
	for(int u : adj[v])
		if(u != p)
			dfsTak(u, v, t+1);
}

int main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
	
	cin >> n;
	if(n == 2) {
		cout << "0\n";
		exit(0);
	}
	cin >> st >> en;
	for(int i = 0; i < n-1; i++) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	memset(taka, -1, sizeof taka);
	dfsAoki(en, en, 0);
	dfsTak(st, st, 0);
	int ans = -1e9;
	for(int v = 1; v <= n; v++) {
		if(LEN(adj[v]) == 1 and taka[v] != -1) {
			ans = max(ans, aoki[v]-(aoki[v] != taka[v]));
		}
	}
	cout << ans << '\n';


	return 0;
}


Measured memory_bytes: 13624
#include <stdio.h>
 
#define GROUP_1_MAX 7
#define GROUP_2_MAX 4
#define GROUP_3_MAX 1
 
typedef struct {
  int group[GROUP_1_MAX];
} GROUP_t;
 
int checkNum( GROUP_t *a_pstGroup, int x, int y, int groupNum );
 
int main(){
  int x,y,ret1,ret2,ret3;
  GROUP_t stGroup1 = { 1, 3, 5, 7, 8, 10, 12 };
  GROUP_t stGroup2 = { 4, 6, 9, 11 };
  GROUP_t stGroup3 = { 2 };
  
  scanf( "%d", &x );
  scanf( "%d", &y );
  
  ret1 = checkNum( &stGroup1, x, y, GROUP_1_MAX );
  ret2 = checkNum( &stGroup2, x, y, GROUP_2_MAX );
  ret3 = checkNum( &stGroup3, x, y, GROUP_3_MAX );
  if( ( ret1 != 0 ) || ( ret2 != 0 ) || ( ret3 != 0 ) ) {
    printf( "%s\n", "Yes" );
  } else {
    printf( "%s\n", "No" );
  }
  
  return 0;
}
 
int checkNum( GROUP_t *a_pstGroup, int x, int y, int groupNum ) {
  int i, ret, x_count = 0, y_count = 0;
  
  for( i = 0; i < groupNum; i++ ){
    if( x == a_pstGroup->group[i] ){
      x_count = 1;
    }
    if( y == a_pstGroup->group[i] ){
      y_count = 1;
    }
  }
  if ( ( x_count == 1 ) && ( y_count == 1 ) ) {
    ret = groupNum;
  } else {
    ret = 0;
  } 
  
  return ret;
}

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

int main() {
  int N;
  cin >> N;
  vector<long> a(N);
  for (auto &v : a) {
    cin >> v;
  }
  vector<vector<long>> dp(N, vector<long>(N));
  for (int l = N - 1; l >= 0; --l) {
    for (int r = l; r < N; ++r) {
      if (l == r) {
        dp[l][r] = a[l];
      } else {
        dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1]);
      }
    }
  }
  cout << dp[0][N - 1];
  return 0;
}

Measured memory_bytes: 70656
#include<stdio.h>
#define Found 1
#define NotFound -1
int binarysearch(int *A,int keyword,int num1);
int main(){
  int num1,num2,i,number[1000000],keyword,count=0;
  scanf("%d",&num1);
  for(i=0;i<num1;i++){
    scanf("%d",&number[i]);
  }
  scanf("%d",&num2);
  for(i=0;i<num2;i++){
    scanf("%d",&keyword);
    if(binarysearch(number,keyword,num1)==Found)count++;
  }
  printf("%d\n",count);
  return 0;
}

int binarysearch(int *A,int keyword,int num1){
  int left=0,right,mid;
  right=num1;
  while(left<right){
    mid=(left+right)/2;
    if(keyword==A[mid])return Found;
    if(keyword>A[mid]) left=mid+1;
    else if(keyword<A[mid])right = mid;
  }
  return NotFound;
}

Measured memory_bytes: 2652
#include<bits/stdc++.h>
#define ll long long
#define debug(x) cout<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
const int inf=0x3f3f3f3f;
const int maxn=2e6+10;
bool fun(string s)
{
    string rev=s;
    reverse(s.begin(),s.end());
    if(s==rev) return true;
    return false;
}
int main()
{
   string s;
   cin>>s;
   int n=s.size();
   if(n%2==0) 
   {
       cout<<"No"<<endl;
       return 0;
   } 
   int flag=0;
   string s1=s.substr(0,(n-1)/2);
   string s2=s.substr((n+3)/2-1);
   if(fun(s)&&fun(s1)&&fun(s2)) flag=1; 
   if(flag) cout<<"Yes";
   else cout<<"No";
   //system("pause");
   return 0;
}


Measured memory_bytes: 256
/*   CREATED BY
       STREAM_CIPHER
       28-03-2020
  */
  #include <bits/stdc++.h>
  #include <cstdio>
  using namespace std;
  typedef long long  int ll;
   int main()  
   {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL); 
        
        int n;
        cin>>n;
        int ans=0;
        ans=1000*(n/500);
        n%=500;
        ans+=5*(n/5);
        cout<<ans<<endl;
   }      

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

namespace ClassLibrary1
{
    public class ListNode
    {
        public int val;
        public ListNode next;
        public ListNode(int x) { val = x; }
    }


    public class Class1
    {

        static void Main(string[] args)
        {
            long s = Int64.Parse( Console.ReadLine());

            Console.WriteLine(s*s);

        }

        static int rec(int[] n, int i, int j, int x)
        {
            if (i + 1 == j)
            {
                return Math.Min(n[j], x);
            }
            return rec(n, i + 1, j, n[i]) + rec(n, i, j - 1, n[j]);
        }


    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main(){
	long n,k;
	cin >> n>>k;
	vector<long> a(n);
	vector<int> b(n);
	
	
	for(int i=0;i<n;i++) {
		cin >>a[i] >> b[i];
		a[i] = a[i]*100000+i;
	}
	sort(a.begin(),a.end());
	
	long temp=0;
	
	for(int i=0;i<n;i++) {
		temp += b[(int)(a[i] % 100000)];
		if(temp >= k) {
			cout << (int)(a[i] / 100000) << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{  
    ll n,w;
    cin>>n>>w;
    vector<ll> sums(n);
    vector<ll> values(n);
    unordered_map<ll,ll> um;
    ll totsum = 0;
    for(int i = 0 ; i <  n ; i++)
    {
        cin>>sums[i];
        
        cin>>values[i];
        um[values[i]]++;
        totsum += values[i];
    }
    vector<ll> dp(totsum+1, INT_MAX);
    dp[0] = 0;
    for(int i = 0 ; i < n ; i++)
    {
        for(int j = totsum - values[i] ; j>=0 ; j-- )
        {   
           
          dp[j+values[i]] = min(dp[j+values[i]] , dp[j]+sums[i]);
               
        }
    }
    for(int j = totsum ; j>= 0 ;j--)
    {
        if(dp[j] <= w)
        {
           cout<<j<<endl;
            break;
        }
    }
    return 0;
        
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long  a[100005];
const long long  MOD = 998244353;
long long  mult(long long  a , long long  b) {
    return (a%MOD*b%MOD)%MOD;
}
long long  power(long long  a , long long  b){
    //cout << a << " " << b << "\n";
    if(b == 0 ) return a;
    if(b == 1) return a;
    if(b%2){
        long long  k = power(a , b/2);
        return mult(mult(k , k ),a);
    }
    else{
        long long  k = power(a , b/2);
        return mult(k , k );
    }
}
long long  sd[1000005] = {0};
int  main(int argc , char* argv[]){
    long long  n;
    cin >> n;
    for(long long  i = 0 ; i < n ; i++) cin >> a[i];
    if(a[0] !=0 ){ cout << "0"; return 0;}
    long long  ans = 1;
    
    for(long long  i = 0 ; i < n ; i++)
        sd[a[i]]++;
    long long  f= 0 ;
   // long long  f= 0 ;
    /*for(long long  i = 0 ; i < n ;i++){
        if(sd[i] == 1 && f == 1) { cout << "0"; return 0;}
        else if(sd[i] == 0){ f=1;
        } 
    }*/
    for(long long i = 1 ; i < n;i++){
        if(a[i]==0) {
            f=1;break;
        }
    }
    if(f){cout << "0"; return 0;}
    f=0;

    for(long long  i = 0 ; i < n ;i++){
        if(sd[i] == 1 && f == 1) { cout << "0"; return 0;}
        else if(sd[i] == 0){ f=1;
        } 
    }
    for(long long  i = 1 ; i < n ; i++){
        if(sd[i] == 0) continue;

        ans = mult(ans , power(sd[i-1] , sd[i]));
    }
    cout << ans;
    return 0;
    
}

Measured memory_bytes: 3456
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int n;
	pair < int, int > b[50], t;
	vector <pair < int, int >> f;
	cin >> n;
	REP(i, n){
		cin >> b[i].first >> b[i].second;
	}
	REP(i, n){
		for(int j=i+1; j<n; j++){
			t.first = b[i].first - b[j].first;
			t.second = b[i].second - b[j].second;
			if(t.first < 0){
				t.first *= -1;
				t.second *= -1;
			}
			else if(t.first == 0 && t.second < 0){
				t.first *= -1;
				t.second *= -1;
			}
			f.push_back(t);
		}
	}
	sort(f.begin(), f.end());
	int now = 1, ma = 1;
	for(int i = 1; i<f.size(); i++){
		if(f[i-1] == f[i]){
			now++;
		}
		else{
			ma = max(now, ma);
			now = 1;
		}
	}

    if(n>1) cout << n - ma << endl;
	else cout << 1 << endl;
}	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <functional>

using namespace std;
const double PI = 3.14159265358979323846;

int main()
{
	int R;
	double L;
	cin >> R;

	L = double(PI * R * 2);

	cout << L;
	return 0;
}

Measured memory_bytes: 3784
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
#include <cmath>
#include <random>
using namespace std;
long long mod = 1000000000 + 7;


int main()
{
	long long h, a;
	cin >> h >> a;

	int ans = h /a;
	if (h %a != 0) {
		ans++;
	}
	
	cout << ans << endl;
	

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll d[MAXn];
vector<ll> tmp;
int main(){
    IOS();
    ll n,k;
    cin >> n >> k;
    REP (i,n) cin >> d[i];

    ll ans = 0;
    REP1 (i,k) {
        REP (l,i+1) {
            ll r = i-l;
            tmp.clear();
            REP (j,min(n,l)) tmp.eb(d[j]);
            for (ll j=n-1;j>max(l-1,n-1-r);j--) tmp.eb(d[j]);
            sort(ALL(tmp));

            debug(tmp);
            ll coda = k-i;
            ll cnt = 0;
            REP (j,SZ(tmp)) {
                if (coda > 0 && tmp[j] < 0) coda--;
                else cnt += tmp[j];
            }
            ans = max(ans,cnt);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import heapq

dic = []

while True:
    line = input()
    if line[2] == "d":
        break
    elif line[2] == "t":
        item = heapq.heappop(dic)
        print(-item)
    else:
        value = int(line.split(" ")[1])
        heapq.heappush(dic, -1*int(value))



Measured memory_bytes: 45304
#include <bits/stdc++.h>
#define debug(...)
#include <complex.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int bound = n / 2;
    auto Sum = [](int x){
        int S = 0; while(x) S += x % 10 , x /= 10; return S;
    };
    int ans = (int)1e9;
    for(int a = 1 ;a <=bound; a++){
        int b = n - a;
        ans = min(ans , Sum(a) + Sum(b));
    }
    cout << ans << '\n';


    return 0;
}















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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int w, a, b;
	cin >> w >> a >> b;
	int ans;
	if (a > b) {
		if (b + w >= a) {
			ans = 0;
		}
		else {
			ans = a - (b + w);
		}
	}
	else {
		if (a + w >= b) {
			ans = 0;
		}
		else {
			ans = b - (a + w);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;

int d,s,t;

void solve() {
	cin >> d >> s >> t;
	cout << (s*t >= d ? "Yes" : "No");
}

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

 	solve();

  	return 0;
}



Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	char pre=' ';
	int ans=0;
	for(int i=0;i<n;i++){
		if(s[i]==pre)continue;
		pre=s[i];
		ans++;
	}
	cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3688
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
// #define double long double
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
//#define endl "\n"
#define inf 1e+15

signed main(){
  fast;
  long double n , k , ans = 0.0;
  cin>>n>>k;
  for(int i = 1 ; i<= n ; i++){
  	   long double p = 1.00 ;
  	   int j = i;
  	   while(j < k)
  	   	p/=2 , j= j+j;
  	   ans += p/n;
  }

  cout <<fixed << setprecision(12)<< ans << endl;
 

}
  


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
struct p {
	int x, y, i;
	bool operator<(const p &A) const {
		if (x == A.x) return y < A.y;
		return x < A.x;
	}
} in[110];
int stk[1000];
int t = -1;
double ans[110];
int chk(int x, int y, int z) {
	int i, j, u, v;
	i = in[y].x - in[x].x;
	j = in[y].y - in[x].y;
	u = in[z].x - in[x].x;
	v = in[z].y - in[x].y;
	long long r = 1ll * i*v - 1ll * j*u;
	if (r > 0) return 1;
	if (r == 0) return 0;
	return -1;
}
double getA(int x, int y) {
	return atan2(-(in[y].x - in[x].x), in[y].y - in[x].y);
	//return atan2(in[y].y - in[x].y, in[y].x - in[x].x);
}
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &in[i].x, &in[i].y);
		in[i].i = i;
	}
	sort(in + 1, in + n + 1);
	stk[++t] = 1;
	for (int i = 2; i <= n; i++) {
		while (t > 0 && chk(stk[t - 1], stk[t], i) <= 0) t--;
		stk[++t] = i;
	}
	int b = t;
	for (int i = n - 1; i >= 1; i--) {
		while (t > b && chk(stk[t - 1], stk[t], i) <= 0) t--;
		stk[++t] = i;
	}
	double S = atan(1) * 8;
	for (int i = 1; i < t; i++) {
		ans[in[stk[i]].i] = (getA(stk[i], stk[i + 1]) - getA(stk[i - 1], stk[i])) / S;
	}
	ans[in[stk[0]].i] = (getA(stk[0], stk[1]) - getA(stk[t - 1], stk[0])) / S;
	for (int i = 1; i <= n; i++) {
		if (ans[i] < 0) ans[i] += 1;
		printf("%.20lf\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 128