akhauriyash/Code-Regression huggingface dataset:
N, H = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

B.sort(reverse=True)
Amax = max(A)
cnt = 0
for b in B:
    if Amax <= b:
        H -= b
        cnt += 1
        if H <= 0:
            print(cnt)
            exit()

print((H-1)//Amax+1 + cnt)

Measured memory_bytes: 61528
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = Integer.parseInt(sc.nextLine());
			String S = sc.nextLine();
			int s = 0, e = 1;
			int max = 0;
			while (s < N && e < N) {
				String sub = S.substring(s, e);
				if (e - s > S.length() - e) break;
				boolean fit = false;
				for (int i = 0; e + i + sub.length() - 1 < N; i++) {
					String sub_sub = S.substring(e + i, e + i + sub.length());
					if (e - s < sub_sub.length()) break;

					fit = sub.equals(sub_sub);
					if (fit) {
						max = Math.max(max, sub_sub.length());
						break;
					}
				}
				if (!fit) s++;
				e++;
			}
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 347496
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int N=in();
	vector<ll> A(N),S(N);
	REP(i,N){
		A[i] = 2LL*in<ll>();
	}
	S[0] = 0LL;
	for(int i=1;i<N;i++){
		S[i] = A[i-1]-S[i-1];
	}
	ll sub = (A[N-1]-S[N-1])/2LL;
	for(int i=0;i<N;i++){
		if(i%2){
			S[i] -= sub;
		}
		else{
			S[i] += sub;
		}
	}

	PRINTALL(S);
	return 0;
}


Measured memory_bytes: 2944
#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);

	int A, B, X;

	cin >> A >> B >> X;

	

	if (A > X || X > A + B){
		cout << "NO\n";
	} else {
		cout << "YES\n";
	}

	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
static auto x = []() {
    std::ios::sync_with_stdio(false); // turn off sync
    cin.tie(nullptr);                 // untie in/out streams
    return 0;
}();
int main()
{
    long long a,b, k;
    cin >> a >> b >> k;
    if (a > k) cout << a - k << ' ' << b;
    else if (a + b > k) cout << 0 << ' ' << b + a - k;
    else cout << "0 0";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include <vector>
#include <map>
#include<cstdlib>


using namespace std;

void Solution()
{
    int number;
    double w, t;
    
    char comma;
    
    while (cin>>number>>comma>>w>>comma>>t)
    {
        if (w / (t * t) >= 25.0)  // don't forget the "( )"
        {
            cout<<number<<endl;
        }
    }
    
}

int main()
{
    Solution();
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  int amin = floor(a / 0.08);
  int bmin = floor(b / 0.1);
  int amax = ceil((a + 1) / 0.08);
  int bmax = ceil((b + 1) / 0.1);
  
  int maximam = max(amax, bmax);
  
  int answer = max(amin, bmin);
  
  for(int i = answer; answer <= maximam; ++answer) {
    if(floor(answer * 0.08) == a && floor(answer * 0.1) == b) {
      cout << answer << endl;
      return 0;
    }
  }
  
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=3e5;
typedef int fuko[yuzu|10];
typedef multiset<int> mts;
fuko a,dp,k;
int main() {
  int n=read(),i,j,m=1<<n;
  for (i=0;i<m;++i) a[i]=read();
  for (i=0;i<m;++i) {
    for (j=i;j<m;j=(j+1)|i) {
      dp[j]=max(dp[j],a[i]+k[j]);
      k[j]=max(k[j],a[i]);
    }
  }
  for (i=1;i<m;++i) 
    printf("%d\n",dp[i]=max(dp[i],dp[i-1]));
}

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

using namespace std;

const int MAXN = 20;
int h[MAXN];

int main()
{
    int n;
    cin >> n;
    int maxx = -1;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if (x >= maxx)
        {
            ans++;
        }
        maxx = max(maxx, x);
    }
    cout << ans << endl;
    return 0;
}


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

#define iter(i, n) for (int i = 1; i <= n; ++i)
#define iter_r(i, n) for (int i = n; i >= 1; --i)
#define forw(i, a, b) for (int i = a; i <= b; ++i) 

const int mod = 1e9 + 7;
const int N = 2e6;
const int NR = N + 10;

int pr(int a, int z) {
	int s = 1;
	while (z > 0) {
		if (z % 2 == 1) s = 1ll * s * a % mod;
		a = 1ll * a * a % mod;
		z /= 2;
	}
	return s;
}

int fac[NR], inv[NR];
int x1, x2, x3, x4, x5, x6;
int y1, y2, y3, y4, y5, y6;

int G(int xl, int yl, int xr, int yr) {
	return xl <= xr && yl <= yr ? 1ll * fac[xr - xl + yr - yl] * inv[xr - xl] % mod * inv[yr - yl] % mod : 0;
}

int F(int xl, int yl, int xr,  int yr) {
	int ans = 0;
	forw(x, x3, x4) {
		ans = (ans - 1ll * G(xl, yl, x, y3 - 1) * G(x, y3, xr, yr) % mod * (x + y3) % mod + mod) % mod;
		ans = (ans + 1ll * G(xl, yl, x, y4) * G(x, y4 + 1, xr, yr) % mod * (x + y4 + 1)) % mod;
	}
	forw(y, y3, y4) {
		ans = (ans - 1ll * G(xl, yl, x3 - 1, y) * G(x3, y, xr, yr) % mod * (y + x3) % mod + mod) % mod;
		ans = (ans + 1ll * G(xl, yl, x4, y) * G(x4 + 1, y, xr, yr) % mod * (y + x4 + 1)) % mod;
	}
	return ans;
}

int F(int x, int y) {
	return (0ll + F(x, y, x6 + 1, y6 + 1) - F(x, y, x5, y6 + 1) - F(x, y, x6 + 1, y5) + F(x, y, x5, y5) + mod + mod) % mod;
}

int main() {
	//freopen("18E.in", "r", stdin);
	fac[0] = inv[0] = 1;
	iter(i, N) fac[i] = 1ll * fac[i - 1] * i % mod;
	inv[N] = pr(fac[N], mod - 2);
	iter_r(i, N - 1) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
	scanf("%d%d%d%d%d%d", &x1, &x2, &x3, &x4, &x5, &x6);
	scanf("%d%d%d%d%d%d", &y1, &y2, &y3, &y4, &y5, &y6);
	printf("%lld\n", (0ll + F(x2, y2) - F(x1 - 1, y2) - F(x2, y1 - 1) + F(x1 - 1, y1 - 1) + mod + mod) % mod);
	return 0;
}

Measured memory_bytes: 15744
/*********************
*  Author: xuziyuan  * 
*********************/
 
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))
 
using namespace std;
 
const LL MOD=1e9+7;
 
string s,ss,t;
LL h[4000010],h2[4000010],pw[4000010],pw2[4000010],hn=998544353,hn2=827122193,
ht[1000010],ht2[1000010],res[4000010],ans=0;
 
pii gethash(LL a,LL b)
{
	return {(h[b+1]-h[a]*pw[b-a+1]%MOD+MOD)%MOD,(h2[b+1]-h2[a]*pw2[b-a+1]%MOD+MOD)%MOD};
}
 
pii gethash2(LL a,LL b)
{
	return {(ht[b+1]-ht[a]*pw[b-a+1]%MOD+MOD)%MOD,(ht2[b+1]-ht2[a]*pw2[b-a+1]%MOD+MOD)%MOD};
}
 
int main()
{
	pw[0]=pw2[0]=1;
	repn(i,4000005)
	{
		pw[i]=pw[i-1]*hn%MOD;
		pw2[i]=pw2[i-1]*hn2%MOD;
	}
	cin>>s>>t;
	ss=s;
	s+=s;
	s+=s;
	repn(i,s.size())
	{
		h[i]=(h[i-1]*hn+s[i-1]-'a')%MOD;
		h2[i]=(h2[i-1]*hn2+s[i-1]-'a')%MOD;
	}
	repn(i,t.size())
	{
		ht[i]=(ht[i-1]*hn+t[i-1]-'a')%MOD;
		ht2[i]=(ht2[i-1]*hn2+t[i-1]-'a')%MOD;
	}
	bool iss=true;
	rep(i,ss.size())
	{
		LL lb=i,num=0;
		while(lb<s.size())
		{
			if(gethash(lb,min(lb+(LL)t.size()-1,(LL)s.size()-1))!=
			gethash2(0,min(lb+(LL)t.size()-1,(LL)s.size()-1)-lb)) break;
			num++;
			lb+=t.size();
			if(clock()>=500)
			{
				iss=false;
				break;
			}
		}
		if(lb>=s.size())
		{
			puts("-1");
			return 0;
		}
		ans=max(ans,num);
		if(!iss) break;
	}
	ans=0;
	rep(i,s.size())
	{
		if(i+t.size()-1>=s.size()) break;
		if(gethash(i,i+(LL)t.size()-1)!=gethash2(0,t.size()-1)) continue;
		if(i-(LL)t.size()<0) res[i]=1;
		else res[i]=res[i-t.size()]+1;
		if(res[i]*(LL)t.size()>floor((double)ss.size()*2.5))
		{
			puts("-1");
			return 0;
		}
		ans=max(ans,res[i]);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main () {
    int k;
    string s;
    cin >> k >> s;
    int ssize = s.size();
    if (k >= ssize) {
      cout << s << endl;
    }
    else {
      rep(i, k) {
        cout << s.at(i);
      }
      cout << "..." << endl;
    }
}

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

int main() {
    int a[3][3];
    int bingo[3][3] = {};
    int n, b;

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

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> b;
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) if (a[i][j] == b) bingo[i][j] = 1;
        }
    }

    int yes = 0;
    for(int i = 0; i < 3; i++) {
        if (bingo[i][0] && bingo[i][1] && bingo[i][2]) yes = 1;
        if (bingo[0][i] && bingo[1][i] && bingo[2][i]) yes = 1;
    }
    if (bingo[0][0] && bingo[1][1] && bingo[2][2]) yes = 1;
    if (bingo[0][2] && bingo[1][1] && bingo[2][0]) yes = 1;

    if (yes) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 3604
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
xy = [list(x) for x in zip(*xy)]
a = [i+j for i,j in zip(xy[0],xy[1])]
b = [i-j for i,j in zip(xy[0],xy[1])]
aa = max(a) - min(a)
ba = max(b) - min(b)
print(max(aa,ba))

Measured memory_bytes: 62648
#include<stdio.h>
#include<iostream>
#include<algorithm> // sort(ALL())
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue> // push(), front(), pop() 先入れ先出し
#include<map> // 連想配列 map<string, int>
#include<iomanip>
#include<set>
#include<utility>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b);  i++)
#define REP(i, n)    for(int i=0;   i<(n);  i++)
#define REP1(i, n)   for(int i=1;   i<=(n); i++)
#define pb push_back
#define mp make_pair
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define EPS 1e-7
#define ALL(obj) (obj).begin(), (obj).end()
using ul    = unsigned long;
using ll    = long long;
using ld    = long double;
using vint  = vector<int>;
using vll   = vector<ll>;
using pint  = pair<int, int>;
using pll   = pair<ll, ll>;
using vpint = vector<pint>;
using vpll  = vector<pll>;
const int INF = (int)1e9 + 1;
const int MOD = (int)1e9 + 7;
#define INT(argu) (int)(argu+eps)

int x, a;

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

  scan(x>>a);
//  vint s(n);
//  REP(i, n) scan(s[i]);

if(x<a) cout << 0;
else     cout << 10;
//  cout <<  << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  int N;
  VE V;
  cin>>N;
  FOR(i,0,N){
    int A;
    cin>>A;
    V.PB(A);
  }
  sort(V.begin(),V.end());
  if(N==2){
    cout<<V[1]<<" "<<V[0]<<endl;
    return 0;
  }
  int M=V[N-1];
  int mid=M/2;
  VE::iterator it=lower_bound(V.begin(),V.end(),mid);
  int a=*it;
  int num=it-V.begin();
  num--;
  int b=V[num];
  if(min(a,M-a)>min(b,M-b)){
    cout<<M<<" "<<a<<endl;
  }else{
    cout<<M<<" "<<b<<endl;
  }
  return 0;
}


Measured memory_bytes: 892
// {{{ by shik
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i, a, b) for (int i = (a); i <= int(b); i++)
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

namespace { namespace shik {

template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" SCNd64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }

template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }

#ifdef SHIK
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T, class F = less<T>> void sort_uniq(vector<T> &v, F f = F()) { sort(begin(v), end(v), f); v.resize(unique(begin(v), end(v)) - begin(v)); }
template<class T> inline T bit(T x, int i) { return (x >> i) & 1; }
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 int N=1e5+10;

int n;
LL s,x[N],p[N];
void main() {
    R(n,s);
    REP1(i,1,n) R(x[i],p[i]);
    VI ord;
    int l=1,r=n;
    while ( x[l]<s && x[r]>s ) {
        if ( p[l]<p[r] ) {
            p[r]+=p[l];
            ord.PB(l++);
        } else {
            p[l]+=p[r];
            ord.PB(r--);
        }
    }
    while ( l<=n && x[l]<s ) ord.PB(l++);
    while ( r>=1 && x[r]>s ) ord.PB(r--);
    reverse(ALL(ord));
    dump(ord);
    LL ans=0,pos=s;
    for ( int i:ord ) {
        ans+=abs(pos-x[i]);
        pos=x[i];
    }
    W(ans);
}

// {{{ main
}}
int main() { shik::main(); return 0; }
// }}}


Measured memory_bytes: 2556
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <utility>

using namespace std;
using pii = pair<int, int>;

int main(){
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	const int n = s.size();
	int m;
	cin >> m;
	set<pii> ranges;
	for(int i = 0; i < m; ++i){
		int l, r;
		cin >> l >> r;
		--l;
		if(l >= (n + 1) / 2){
			const int t = l;
			l = n - r;
			r = n - t;
		}
		if(r > n / 2){ r = n - r; }
		if(r < l){ swap(l, r); }
		//cout << ">> " << l << " " << r << endl;
		if(l < r){ ranges.emplace(l, r); }
	}
	vector<int> a(n / 2);
	for(int i = 0; i < n / 2; ++i){
		a[i] = ((s[n - 1 - i] - 'a') - (s[i] - 'a') + 26) % 26;
	}
	vector<int> d(n / 2 + 1);
	bool answer = true;
	for(int i = 0, acc = 0; i < n / 2; ++i){
		vector<int> tails;
		while(!ranges.empty() && ranges.begin()->first == i){
			tails.push_back(ranges.begin()->second);
			ranges.erase(ranges.begin());
		}
		for(int j = 0; j + 1 < tails.size(); ++j){
			ranges.emplace(tails[j], tails[j + 1]);
		}
		acc = (acc - d[i] + 26) % 26;
		//cout << "i = " << i << ": " << acc << std::endl;
		if(tails.empty()){
			if(a[i] != acc){ answer = false; }
		}else{
			const int t = (a[i] - acc + 26) % 26;
			//cout << "? " << i << " - " << tails[0] << " => " << t << endl;
			d[tails[0]] = (d[tails[0]] + t) % 26;
			acc = (acc + t) % 26;
		}
	}
	cout << (answer ? "YES" : "NO") << endl;
	return 0;
}



Measured memory_bytes: 5504
#include <stdio.h>
int main(void)
{
	unsigned long int a, b, k;
	scanf("%lu %lu %lu",&a,&b,&k);

    if(a <= k)
    {
        if(b <= (k - a))
        {
            b = 0;
            a = 0;
        }
        else
        {
            b -= (k - a);
            a = 0;
        }
    }
    else
    {
        a -= k;
    }

	printf("%lu %lu", a, b);
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll MX = 100005;

namespace Modop {
    ll modAdd(ll a, ll b) {
        return (a + b) % MOD;
    }
    
    ll modSub(ll a, ll b) {
        return (((a - b) % MOD) + MOD) % MOD;
    }
    
    ll modMul(ll a, ll b) {
        return ((a % MOD) * (b % MOD)) % MOD;
    }

    ll modExp(ll base, ll power) {
        if (power == 0) {
            return 1;
        } else {
            ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
            if (power % 2 == 1) cur = cur * base;
            cur = cur % MOD;
            return cur;
        }
    }
    
    ll modInv(ll base) {
        int g = MOD, r = base, x = 0, y = 1;
        while (r != 0) {
            int q = g / r;
            g %= r; swap(g, r);
            x -= q * y; swap(x, y);
        }
        return x < 0 ? x+MOD : x;
    }
    
    ll modDiv(ll a, ll b) {
        return modMul(a, modInv(b));
    }
}

using namespace Modop;

ll N, A, B, ans;

ll combi(ll n, ll k) {
    ll res = 1;
    for (int i = 1; i <= k; i++) {
        res = modMul(res, n - i + 1);
        res = modMul(res, modInv(i));
    }
    
    return res;
}

void solve() {
    cin >> N >> A >> B;
    
    ans = modSub(modExp(2, N), 1);
    ans = modSub(ans, combi(N, A));
    ans = modSub(ans, combi(N, B));
    cout << ans;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 384
N=int(input())
v=list(map(int,input().split()))

l_2=[2**0]
for i in range(N-1):
    l_2.append( 2**i )

s=0
for i in range(N):
    max2=l_2.pop(-1)
    maxv=v.pop(v.index(max(v)))
    s+=maxv*max2

ans=s/(2**(N-1))
print( int(ans) if ans.is_integer() else ans )

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	int a, b;
	cin >> a >> b;
	int ans = a + b;
	if (ans >= 24) ans -= 24;

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(){
    int n,m = 0; cin >> n;
    vector<int> a(n);
    rep(i,n){
        int prea; cin >> prea;
        if(prea < 0){
            m++;
            prea *= -1;
        }
        a[i] = prea;
    }

    sort(a.begin(),a.end());
  	ll ans = 0;
    if(m % 2 == 1){
        for(int i = 1;i < n; i++){
            ans += a[i];
        }
        ans -= a[0];
    }else{
        rep(i,n) ans += a[i];
    }

    cout << ans << endl;
}



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

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

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

ll pow_mod(ll n, ll k, ll mod = MOD)
{
    if (k == 0)
    {
        return 1;
    }
    else if (k % 2 == 1)
    {
        return pow_mod(n, k - 1, mod) * n % mod;
    }
    else
    {
        ll t = pow_mod(n, k / 2, mod);
        return t * t % mod;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> d(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> d[i];
    }
    if (d[0] != 0)
    {
        cout << 0 << endl;
        return 0;
    }
    vector<ll> check = d;
    sort(ALL(check));
    for (ll i = 0; i < n - 1; i++)
    {
        if (check[i + 1] - check[i] > 1)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    vector<ll> cnt(n, 0);
    for (ll i = 0; i < n; i++)
    {
        cnt[d[i]]++;
    }
    if (cnt[0] != 1)
    {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    for (ll i = 0; i < n - 1; i++)
    {
        ans *= pow_mod(cnt[i], cnt[i + 1]);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  double l,r;
  int a[4][2]={};
  while(scanf("%lf %lf",&l,&r) != EOF){
    if(l >= 1.1) a[0][0]++;
    else if(l >= 0.6) a[1][0]++;
    else if(l >= 0.2) a[2][0]++;
    else a[3][0]++;
    if(r >= 1.1) a[0][1]++;
    else if(r >= 0.6) a[1][1]++;
    else if(r >= 0.2) a[2][1]++;
    else a[3][1]++;
  }
  for(int i=0;i<4;i++){
    printf("%d %d\n",a[i][0],a[i][1]);
  }
  return (0);
}

Measured memory_bytes: 2628
#include<stdio.h>

int main(void)
{
    int N, i, flag=0, f2=0;
    scanf("%d", &N);
    int A[N];
    for(i=0; i<N; i++) {
        scanf("%d", &A[i]);
    }

    for(i=0; i<N; i++) {
        if(A[i]%2 == 0) {
            f2 = 1;
        }
    }

    if(f2 == 1) {
        for(i=0; i<N; i++) {
            if(A[i]%2 == 0) {
                if(A[i]%3==0 || A[i]%5==0) {
                flag = 1;
                } else {
                    printf("DENIED\n");
                    return 0;
                }
            }
        }
    }
    
    if(flag == 1 || f2 == 0) {
        printf("APPROVED\n");
    }

    return 0;
}

Measured memory_bytes: 1612
#include <bits/stdc++.h>
#include <stdint.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define int long long
typedef vector<int> vi;
typedef pair<int, int> pii;
const double PI = acos(-1.0);
const int mod = 1e9 + 7;
int pows(int a , int b){int res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
const int N = 1e9+5;
void init() {
  ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
}

void solve(){
    int n , k ;
    cin >> n >> k ;
    int a[n] ;
    rep(i,0,n)    cin >> a[i] ;
    int dp[n] ;
    memset(dp,N,sizeof dp) ;
    dp[0] = 0 ;
    rep(i,1,n){
        for(int j = 1 ; j <= k ; j++){
            if(i-j >= 0)
            dp[i] = min(dp[i] , dp[i-j] + abs(a[i] - a[i-j])) ;
        }
    }
    cout << dp[n-1] << endl ;
}
int32_t main()
{
    init();
    int t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <deque>

using namespace std;

int main(int argc, char const *argv[])
{
	int a,b,c,d;

	cin >> a >> b >> c >> d;	
	
	if(a+b==c+d) cout << "Balanced" << "\n";
	else if(a+b>c+d) cout << "Left" << "\n";
	else cout << "Right" << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int n,t; cin >>n >>t;
  int min_=1e9+1,max_=0,cnt=0;
  rep(i,n){
    int a; cin >>a;
    int d=a-min_;
    if(df) print(a,min_,d,max_,cnt);
    if(a<min_){
      min_=a;
    }else if(d>max_){
      max_=d; cnt=1;
    }else if(d==max_){
      cnt++;
    }
  }
  print(cnt);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;cin>>n;vector<int> vec;
	for(int i=1;i<=n;i++)
	{
		int x;cin>>x;vec.push_back(x);
	}
	sort(vec.begin(),vec.end());
	int nn=n/2;
	cout<<max(0,vec[nn]-vec[nn-1])<<endl;
 } 

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

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

int main(){
  int n,a,b;
  cin >>n >>a >>b;
  int ans = 0;
  for(int i = 1; i<=n; i++){
    int sum = digit(i);
    if(a<=sum && sum<=b) ans += i;
  }
  cout << ans << endl;
  return 0;
}

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

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String[] s = scanner.next().split("");

		for (char c = 'a'; c <= 'z'; c++) {
			if (!Arrays.asList(s).contains(String.valueOf(c))) {
				System.out.println(c);
				return;
			}
		}

		System.out.println("None");
	}
}


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

int main() {
    string s, t;
    cin >> s >> t;
    int sN = s.size();
    int tN = t.size();
    vector<vector<int>> dp(sN + 1, vector<int>(tN + 1, 0));

    for (int i = 1; i <= sN; i++)
        for (int j = 1; j <= tN; j++) {
            int isSame = (s[i - 1] == t[j - 1] ? 1 : 0);
            dp[i][j] =
                max({dp[i][j - 1], dp[i - 1][j], dp[i - 1][j - 1] + isSame});
        }


    string ans = "";
    int i = sN;
    int j = tN;
    while(i>=1 && j>=1){
        if(dp[i][j] == dp[i-1][j]){
            i--;
        } else if(dp[i][j]== dp[i][j-1]) {
            j--;
        } else {
            ans = s[i-1] + ans;
            i--;j--;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 35584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;


public class Main {
	
	static class Scanner{
		BufferedReader br=null;
		StringTokenizer tk=null;
		public Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		public String next() throws IOException{
			while(tk==null || !tk.hasMoreTokens()) {
				String cad = br.readLine();
				if (cad == null)
					return null;
				tk=new StringTokenizer(cad);
			}
			return tk.nextToken();
		}
		public int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		public long nextLong() throws NumberFormatException, IOException{
			return Long.valueOf(next());
		}
		public double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}
	
	public static void main(String args[]) throws NumberFormatException, IOException {
		Scanner sc = new Scanner();
		int N = sc.nextInt();
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < N; i++) {
			int n  = sc.nextInt();
			if (map.containsKey(n))
				map.put(n, map.get(n) + 1);
			else
				map.put(n, 1);
		}
		int M = sc.nextInt();
		boolean ans = true;
		for(int i = 0; i < M && ans; i++) {
			int c = sc.nextInt();
			if (map.containsKey(c)) {
				int times = map.get(c);
				if (times == 1)
					map.remove(c);
				else
					map.put(c, times - 1);
			}
			else
				ans = false;
		}
		System.out.println(ans ? "YES" : "NO");
	}

}


Measured memory_bytes: 81004
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int all;
int cnt;
int visit[128][128];
int matrix[128][128];
char str[10010];

void dfs(int from, int e) {
  if (e == all) { cnt++; }
  if (cnt >= 2) { return; }
  REP(to, 128) {
    if (matrix[from][to] == 0 || visit[from][to] == 1) { continue; }
    visit[from][to] = 1;
    dfs(to, e + 1);
    visit[from][to] = 0;
  }
}

int main() {
  while (scanf("%s", str), str[0] != '#') {
    MEMSET(visit, 0);
    MEMSET(matrix, 0);
    int len = strlen(str);
    if (len <= 2) {
      puts("No Results");
      continue;
    }
    REP(i, len - 1) {
      int pc = str[i], nc = str[i + 1]; 
      matrix[pc][nc] = 1;
    }
    cnt = 0;
    all = 0;
    int ans = 1;
    int root = -1;
    int start = 0;
    int euler = 0;
    REP(i, 128) {
      int indeg = 0;
      int outdeg = 0;
      REP(j, 128) {
        if (matrix[j][i] == 1) { indeg++; }
        if (matrix[i][j] == 1) { outdeg++; ans++; all++; }
      }
      if (outdeg >= 3 || indeg >= 3) { cnt = 2; }
      if (outdeg - indeg == 1) { euler++; root = i; }
      if (outdeg - indeg > 1) { euler = 2; }
      if (!start && outdeg - indeg > 0) {
        start = 1;
        ans += outdeg - indeg - 1;
      } else if (outdeg - indeg > 0) {
        ans += outdeg - indeg;
      }
    }
    if (ans < len || euler != 1) { cnt = 2; }
    if (euler == 1) {
      dfs(root, 0);
    }
    if (cnt == 1) { ans++; }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    int minn = 10e4,maxx = 0;
    for(int i=0;i<n;i++){
        cin>>a.at(i);
        if(a.at(i)>=1){
        minn = min(minn,a.at(i));
        }
        maxx = max(maxx,a.at(i));
    }
    int ans = 0;
    while(maxx!=0){
        int l=-1,r=-1;
        for(int i=0;i<n;i++){
            if(r!=-1)break;
            if(i==n-1&&r==-1){
                r=n-1;
            }
            if(a.at(i)!=0&&l==-1){
                l=i;
            }
            if(a.at(i)==0&&l!=-1&&r==-1){
                r = i-1;
            }
            if(a.at(i)>=1){minn = min(a.at(i),minn);}
        }
        ans+=minn;
        for(int i=l;i<=r;i++){
            a.at(i)= a.at(i)-minn;
        }
        maxx = -1;
        for(int i=0;i<n;i++){
            maxx = max(a.at(i),maxx);
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE RecordWildCards #-}

import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IMS
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import qualified Data.Array.IArray as A
import qualified Data.Array.MArray.Safe as A
import qualified Data.Array.MArray as A
import Data.Array (Array)
import Data.Array.Unboxed (UArray)
import Data.Array.IArray (IArray)
import Data.Array.MArray.Safe (MArray)
import Data.Array.IO.Safe (IOArray, IOUArray)
import Data.Array.ST.Safe (STArray, STUArray, runSTArray, runSTUArray)
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
import Control.Monad.ST
-- import Control.Monad.ST.Safe
import Control.Applicative
import Data.Maybe
import Data.Tuple
import Data.Ord
import Control.Monad.State.Strict
import Data.Int
import System.IO
import Data.Function

main :: IO ()
main = do
  [n,a,b,c] <- map read . words <$> getLine :: IO [Int]
  print $ n - a - b + c



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

int main(){
    int x;
    cin >> x;
    int num1000=x/500,num5=(x-num1000*500)/5;

    //cout << num1000 << num5 << endl;
    cout << num1000*1000+num5*5 <<endl;
}

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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define sz size()

const int maxn = 1e5+10;

vector<int> g[maxn];
vector<int> dist(maxn), vis(maxn);

int dfs(int u)
{
	if(vis[u])
		return dist[u];
	
	vis[u] = 1;
	
	for(auto v : g[u])
		dist[u] = max(dfs(v) + 1, dist[u]);

	return dist[u];
}

int main()
{
	ios::sync_with_stdio(0);

	int i, j, k, n, m;

	cin>>n>>m;

	for(i=0;i<m;++i)
	{
		int u, v;
		cin>>u>>v;
		g[u-1].pb(v-1);
	}

	int ans = 0;
	for(i=0;i<n;++i)
		ans = max(ans, dfs(i));

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 8576
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int K = ni();
        int T = ni();
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < T; i++) {
            a.add(ni());
        }
        Collections.sort(a,Comparator.reverseOrder());
        int largest = a.get(0);
        int lest = 0;
        for (int i = 1; i < T; i++) {
            lest += a.get(i);
        }
        int ans = 0;
        if(largest > lest+1){
            ans = largest - (lest+1);
        }
        out.println(ans);
    }

    final int mod = 1000000007;
    int mul(int x, int y){
        return (int)((x * 1L * y) % mod);
    }
    int add(int x, int y) {
        x += y;
        return x >= mod ? (x - mod) : x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        return x >= mod ? (x - mod) : x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 32916
#include <iostream>
#include <cstring>
#include <fstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
using namespace std;
  
struct point {
	double x,y;
} p[8];  
double dist(point a, point b) {
	return sqrt(pow((b.x-a.x),2) + pow((b.y-a.y),2));
}
int main() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n%2!=0) {
		cout << "No";
		return 0;
	}
	string w1="";
	string w2 = ""; 
	for (int i=0; i<n/2; i++) {
		w1+=s[i];
		w2+=s[n-i-1];
	}
	reverse(w2.begin(), w2.end());
	if(w1==w2) {
		cout <<"Yes";
	} else {
		cout <<"No";
	}
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <math.h>
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n) for(ll i=(n)-1; i>=0; --i)
#define SREP(i,s,n) for(ll i=(s), i##_len=(n); i<i##_len; ++i)


using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool comp(pair<ll, ll> a, pair<ll, ll> b) {
    return (a.first*a.first + a.second*a.second) > (b.first*b.first + b.second*b.second);
}

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

#define MOD (1000000007)

int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll  A, B;
    cin >> A >> B;
    if (A < 10 && B < 10) {
        cout << A*B << endl;
    }else {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

// const int mod = 1000000007;
const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
  bool operator==(const mint rhs) const { return x == rhs.x; }
  bool operator!=(const mint rhs) const { return x != rhs.x; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n,m,k;
  cin >> n >> m >> k;
  combination comb(n-1);
  mint ans = 0;
  mint temp = 1;
  for (int x = n-1; x > k; --x) temp *= m-1; //(m-1)^yを求めておく
  for (int x = k; x >= 0; --x) {
    ans += comb(n-1,x)*temp*m;
    temp *= m-1;
  }
  cout << ans << endl;
  return 0;
}

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

int GetDigit(long long int num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main()
{
        long long int N;
        cin >> N;
        int a = 1;
        for(long long int i=2; i*i<=N; i++){
                if(N%i==0){
                        a = i;
                }

        }
        int b = N/a;
        int a_keta = GetDigit(a);
        int b_keta = GetDigit(b);
        cout << max(a_keta, b_keta);


}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] d = new int[n];
    for(int i = 0; i < n; i++){
      d[i] = sc.nextInt();
    }
    int ans = 0;

    for(int i = 0; i < n; i++){
      for(int j = i;  j < n;j++){
        if(i == j){
          continue;
        }
        ans += d[i] * d[j];
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 24276
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    long int a, b;
    int d, r;
    double f;
    cin >> a >> b;
    d = a/b;
    r = a%b;
    f = (double)a/(double)b;
    cout << std::fixed << d << " " << a%b << " " << setprecision(5) << f << endl;
    return 0;
}



Measured memory_bytes: 3268
def main():
  n = int(input())
  alist = list(sorted(map(int, input().split())))
  aset = set(alist)
  tmpal = list(aset)
  if len(aset) > 3:
    print('No')
  elif len(aset) == 1:
    if tmpal[0] == 0:
      print('Yes')
    else:
      print('No')
  elif n % 3 != 0:
    print('No')
  else:
    if len(aset) == 2:
      if alist.count(0) == n // 3:
        print('Yes')
      else:
        print('No')
    else:
      if tmpal[0] ^ tmpal[2] == tmpal[1]:
        nd = {tmpal[0]: 0, tmpal[1]: 0, tmpal[2]: 0}
        for a in alist:
          nd[a] += 1
        if nd[tmpal[0]] == nd[tmpal[1]] and nd[tmpal[1]] == nd[tmpal[2]]:
          print('Yes')
        else:
          print('No')
      else:
        print('No')


if __name__ == '__main__':
  main()


Measured memory_bytes: 14212
IDENTIFICATION DIVISION.
PROGRAM-ID. 168B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 K          PIC 9(03).
01 S          PIC X(100).
01 LEN        PIC 9(03).
*>
PROCEDURE DIVISION.
  ACCEPT K.
  ACCEPT S.
  UNSTRING S DELIMITED BY ' '
      INTO S COUNT LEN.
*>
  IF (LEN <= K)
    DISPLAY FUNCTION TRIM(S)
  ELSE
    DISPLAY S(1:K) '...'
  END-IF.
*>
  STOP RUN.


Measured memory_bytes: 3792
import math
A,B = (int(x) for x in input().split())
A1 = math.ceil(A/0.08)
Ab = (A+1)/0.08
if float(Ab).is_integer() == True:
    A2 = math.floor(Ab)
else:
    A2 = math.floor(Ab) + 1
B1 = math.ceil(B/0.1)
Bb = (B+1)/0.1
if float(Bb).is_integer() == True:
    B2 = math.floor(Bb)
else:
    B2 = math.floor(Bb) + 1
a = range(A1, A2)
b = range(B1, B2)
c = set(a) & set(b)
if len(c) == 0:
          print(-1)
else:
          print(min(c))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;

const int maxn = 0;
int n , k;
map < int , int > bad;
int ans = 1e9;

void calc(int have)
{
	if(have > 1e6) return;
	if(have < ans && have >= n) ans = have;
	for(int i=0;i<=9;i++)
	{
		if(bad[i]) continue;
		calc(have * 10 + i);
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n >> k;
	for(int i=0,x;i<k;i++) cin >> x , bad[x] = 1;		
	for(int i=1;i<10;i++) if(!bad[i]) calc(i);
	cout << ans;
}

Measured memory_bytes: 384