akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
    string s;
    cin>>s;
    int n =s.length();
    int ans;
    rep(i,n){
        if(i==0)continue;
        if(i%2!=0)continue;
        int a =n-i;
        if(s.substr(0,a/2)==s.substr(a/2,a/2)){
            ans =a; break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
int H,W;
char a[1001][1001];
int g[1001][1001];
queue<Pair> que;
void init(){
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            g[i][j] = MM;
        }
    }
}

void bfs(){
    while(que.size()){
        Pair p = que.front();
        que.pop();
        if(p.first < H && g[p.first+1][p.second] == MM && a[p.first+1][p.second] == '.'){
            g[p.first+1][p.second] = g[p.first][p.second]+1;
            que.push(Pair(p.first+1,p.second));
        }
        if(p.second < W && g[p.first][p.second+1] == MM && a[p.first][p.second+1] == '.'){
            g[p.first][p.second+1] = g[p.first][p.second]+1;
            que.push(Pair(p.first,p.second+1));
        }
        if(p.first >= 1 && g[p.first-1][p.second] == MM && a[p.first-1][p.second] == '.'){
            g[p.first-1][p.second] = g[p.first][p.second]+1;
            que.push(Pair(p.first-1,p.second)); 
        }
        if(p.second >= 1 && g[p.first][p.second-1] == MM && a[p.first][p.second-1] == '.'){
            g[p.first][p.second-1] = g[p.first][p.second]+1;
            que.push(Pair(p.first,p.second-1));
        }
    }
}

int check(){
    int mx = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            mx = max(mx,g[i][j]);
        }
    }
    return mx;
}
int main(){
    cin >> H >> W;
    init();
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> a[i][j];
            if(a[i][j] == '#'){
                que.push(Pair(i,j));
                g[i][j] = 0;
            }
        }
    }
    bfs();
    int ans = check();
    cout << ans << endl;
}



Measured memory_bytes: 13328
//: (Colon)

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) int n;cin>>n;vector<int>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18
#define pai 3.1415926535897

int main (){
    int a,b,h,m;cin>>a>>b>>h>>m;
    double kakudo = abs(5.5*m-30*h);
    double ans = sqrt(a*a+b*b-2*a*b*cos(kakudo*(pai/180)));
    cout15(ans);
    return 0;
}

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

using namespace std;

int main(){
	long long n;
	cin>>n;
	vector<long long> fact(n+1,0);
	long long ans=1;

	for(long long i=2;i<=n;i++){
		long long I=i;
		for(long long j=2;j<=I;j++){
			long long cnt=0;

			while(I%j==0){
				cnt++;
				I/=j;
			}

			fact.at(j)+=cnt;
		}
	}

	for(auto a:fact){
		ans*=a+1;
		ans%=1000000007;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using llv = vector<ll>;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD7 = 1000000007;
	constexpr ll MOD9 = 1000000009;

	template<typename T>
	void init(vector<T>& v, T initVal = T()){
		for(auto& e : v){
			e = initVal;
		}
	}

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	void reverse(vector<T>& v){
		reverse(all(v));
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T1, typename T2>
	inline vector<T1>& operator+=(vector<T1>& v1, const vector<T2>& v2){
		for(const auto& e : v2) v1.push_back(e);
		return v1;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T1, typename T2>
	void in(vector<T1>& v1, vector<T2>& v2){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i];
	}
	template<typename T1, typename T2, typename T3>
	void in(vector<T1>& v1, vector<T2>& v2, vector<T3>& v3){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i] >> v3[i];
	}
	template<typename T1, typename T2, typename T3, typename T4>
	void in(vector<T1>& v1, vector<T2>& v2, vector<T3>& v3, vector<T4>& v4){
		for(int i=0;i<v1.size();i++)
			cin >> v1[i] >> v2[i] >> v3[i] >> v4[i];
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	constexpr ll modPow(ll x, ll n, ll m){ // O(logn)
		if(n == 0) return 1;
		else if(n % 2 == 0) return modPow((x * x) % m, n / 2, m);
		else return x * modPow(x, n - 1, m) % m;
	}
}
using namespace atcoder;
#endif

int main(){
	cout << fixed << setprecision(15);
	
	int N,K;cin>>N>>K;
	intv d(K);
	vector<intv> A(K);
	for(int i=0;i<K;i++){
		cin>>d[i];
		for(int j=0;j<d[i];j++){
			int a;cin>>a;
			A[i]+=a;
		}
	}

	boolv has(N);
	for(auto v : A){
		for(auto e : v){
			has[e-1]=true;
		}
	}
	int ans=0;
	for(auto e : has)
		if(!e)ans++;

	cout<<ans;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  string s;
  cin >> s;

  string s1 = s.substr(0, 4), s2 = s.substr(4, 8);
  cout << s1 << ' ' << s2 << endl;
}

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

using namespace std;

void solve()
{
    int n, m;
    cin >> n >> m;
    priority_queue<int> pq;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        pq.push(a);
    }
    while (m--)
    {
        int x = pq.top();
        pq.pop();
        x /= 2;
        pq.push(x);
    }
    long ans = 0;
    while (!pq.empty())
    {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 1020
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
const int N=100050;
int a[N];
int Get(int x, int y)
{
	for(int i=1;i<=10000;i++) if(i!=x && i!=y) return i;
	return -1;
}
int main()
{
	int n,i,sol=0;
	scanf("%i",&n);
	for(i=1;i<=n;i++) scanf("%i",&a[i]);
	for(i=1;i<=n;i++)
	{
		if(a[i-1]==a[i]) a[i]=Get(a[i-1],a[i+1]),sol++;
	}
	printf("%i\n",sol);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n;
long long sum;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0)continue;
        else sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3716
#include<cstdio>
const static int INF = 1000000;

int main(){
	int N, M;
	scanf("%d %d", &N, &M);
	int d[N][N];
	for (int i = 0; i < N; ++i){
		for (int j = 0; j < N; ++j) d[i][j] = INF;
	}
	int a[M], b[M], c[M];
	for (int i = 0; i < M; ++i){
		scanf("%d %d %d", &a[i], &b[i], &c[i]);
		a[i]--, b[i]--;
		d[a[i]][b[i]] = c[i];
		d[b[i]][a[i]] = c[i];
	}
	for (int k = 0; k < N; ++k){
		for (int i = 0; i < N; ++i){
			for (int j = 0; j < N; ++j) if(d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j];
		}
	}
	int answer = 0;
	for (int i = 0; i < M; ++i) if(c[i] > d[a[i]][b[i]]) answer++;
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(a,n) rep(i,0,n){ cout<<(i ? " ":"")<<a[i]; }cout<<endl;
const int mod = 1e9+7;
const int size=1e5;
const int INF=1e9;
int N;
vector<vector<pair<int,int>>> g(size);
int d[size],pre[size];
priority_queue<pair<int,int>> pq;
void dijkstra(int a){//O(E+NlogN)
	rep(i,0,N){
		d[i]=INF;
		pq.push({-d[i],i});
	}
	d[a]=0;pq.push({0,a});
	int v;int temp;
	rep(i,0,N){
		v=pq.top().second;
		pq.pop();
        int u;
		for(int i=0;i<g[v].size();i++){
            u=g[v][i].first;
			temp=d[v]+g[v][i].second;
			if(d[u]>temp){
				d[u]=temp;
				pre[u]=v;
				pq.push({-d[u],u});
			}
		}
	}return;
}
int calc;
void dfs(int n,int v,int t){
	calc++;
    int u;
	rep(i,0,g[v].size()){
        u=g[v][i].first;
		if(u==n||u==t) continue;
		dfs(v,u,t);
	}return;
}
int main(){
	cin>>N;
	int a,b;
	rep(i,0,N-1){
		cin>>a>>b;a--;b--;
		g[a].push_back({b,1});
		g[b].push_back({a,1});
	}
	dijkstra(0);int k=(d[N-1]-1)/2;
	int t=N-1;
	rep(i,0,k) t=pre[t];
	calc=0;dfs(-1,0,t);int A=calc;
	calc=0;dfs(-1,N-1,pre[t]);int B=calc;
	if(A>B) cout<<"Fennec"<<endl;
	else cout<<"Snuke"<<endl;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
    ll ans=1;
    while(b){
        if(b&1)
            ans=(ans*a)%MOD;
        b/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

int par[MAX];
vector<ll> ans;
ll val;

int root(int v) {return (par[v] < 0) ? v : (par[v] = root(par[v]));}

void connect(int u, int v){
    u = root(u);
    v = root(v);
    ll tmp = ans.back();
    //cout << tmp << endl;
    if (u == v) {
        ans.pb(tmp);
        return;
    }
    //cout << u << " " << v << " " << (ll)par[u] * par[v] << endl;
    ans.pb(tmp - (ll)par[u] * par[v]);
    if (par[u] < par[v]) swap(u, v);
    par[v] += par[u];
    par[u] = v;
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ifstream in("");
    ofstream out("");
    clock_t begin = clock();
    int n,  m;
    cin >> n >> m;
    FOR(i, 1, n + 1) par[i] = -1;
    val = (ll)n * (n - 1) / 2;
    ans.pb(val);
    vector<pi> vec;
    REP(i, m){
        int a, b;
        cin >> a >> b;
        vec.pb({a, b});
    }
    RFOR(i, m, 1){
        connect(vec[i].A, vec[i].B);
    }
    RREP(i, m){
        cout << ans[i] << endl;
    }
    clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
    return 0;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define F first
#define S second
#define mset(x,v) memset(x, v, sizeof(x))
#define left(x) 2*x
#define right(x) (2*x) + 1
#define ALL(t) (t).begin(),(t).end() 
#define ret return 0
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define rev(s) reverse(s.begin(),s.end())
#define WL(t) while(t --)
#define MOD 1000000007
int main()
{
      boost;
      int n;
      cin>>n;
      int a[10000];
      for(int i=1;i<=n;i++)
      cin>>a[i];
      sort(a+1,a+n+1);
      int x=0,y=0,cnt=1;
      for(int i=1;i<=n;i++)
      {
            if(i&1)
            x+=a[i];
            else
            y+=a[i];
      }
      cout<<abs(x-y)<<endl;
}


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

int main()
{
    vector<string> vec(200);
    vector<string> output(200);
    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;i++){
        cin>>vec.at(i);
    }
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            if(i == 0 || i == h+1){
                output.at(j) = '#'; 
            }else{
                if(j == 0 || j == w+1){
                    output.at(j) = '#';
                }else{
                    output.at(j) = vec.at(i-1).at(j-1);
                }
            }
        }
        for(int j=0;j<w+2;j++){
            cout<<output.at(j);
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<map>
#include<vector>
#include<string>
#define ll long long
#define For(i,x,y)  for(ll i=x;i<=y;++i)
#define FOr(i,x,y)  for(ll i=x;i>=y;--i)
using namespace std;
inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return x*f; } 
inline void write(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10);   putchar(x%10+'0');  } 
inline void writeln(ll x){ write(x);   puts("");   }
const ll N=100010;
ll a[N],sum[N],n;
int main(){
	n=read();
	For(i,1,n){
		a[i]=read();
		ll x=0;
		while(!(a[i]%2))	a[i]/=2,x++;
		sum[min(x,2ll)]++;
	}
	sum[0]+=min(sum[1],1ll);
	if (sum[2]+1>=sum[0])	puts("Yes");
	else	puts("No");
}

Measured memory_bytes: 1024
dishes = []
for i in 0..4 do
  dishes[i] = gets.chomp.to_i
end

sum = 0
min_minutes = 0
dishes.each_with_index do |dish, key|
  minutes = (dish.to_s[-1]).to_i
  if ( minutes != 0 && min_minutes < 10 - minutes)
    min_minutes = 10 - minutes
  end
  time = (dish.to_f/10.to_f).ceil * 10
  sum += time.to_i
end

print("#{sum - min_minutes}\n")

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

using namespace std;

int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  long long ans = 1e9;
  
  int lim = max(X, Y) * 2 + 1;
  for (int i=0; i<=lim; i++){
    int a = max(X - i / 2, 0);
    int b = max(Y - i / 2, 0);
    ans = min(ans, (long long)(A *a + B * b + C * i));
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    bool flag = true;
    int min;
    vector<vector<int>> box(3, vector<int>(3));

    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> box.at(i).at(j);
        }
    } 
    for(int i = 0; i < 3; i++){
        min = 100;
        for(int j = 0; j < 3; j++){
            if(min > box.at(i).at(j)){
                min = box.at(i).at(j);
            }
        }

        for(int j = 0; j < 3; j++){
            box.at(i).at(j) -= min;
        }
    }

    for(int i = 0; i < 3; i++){
        if(box.at(0).at(i) != box.at(1).at(i) || box.at(2).at(i) != box.at(1).at(i) || box.at(0).at(i) != box.at(2).at(i)){
            flag = false;
        }
    } 

    if(flag){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }






}

Measured memory_bytes: 256
q = int(input())

MASK = (1 << 64) -1
n = 0
for i in range(q):
    query = [i for i in map(int,input().split())]
    if query[0] == 0:
        temp = 1 << query[1]
        if (n & temp) == 0:
            print(0)
        else:
            print(1)

    elif query[0] == 1:
        temp = 1 << query[1]
        n = (n | temp)

    elif query[0] == 2:
        temp = 1 << query[1]
        n = n & (~temp & MASK)
        
    elif query[0] == 3:
        temp = 1 << query[1]
        n = n ^ temp
        
    elif query[0] == 4:
        if n == MASK:
            print(1)
        else:
            print(0)
    elif query[0] == 5:
        if n & MASK > 0:
            print(1)
        else:
            print(0)
            
    elif query[0] == 6:
        if n == 0:
            print(1)
        else:
            print(0)
            
    elif query[0] == 7:
        temp = n
        one = 1
        counter = 0
        for i in range(64):
            if one & temp == 1:
                counter += 1
            temp = temp >> 1
        print(counter)
        
    elif query[0] == 8:
        print(n)
    



Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std; 
#define endl '\n'
#define ll long long int
     
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int cont=0;
    for (int i = a; i <=b; ++i)
    {
      if (i%c==0)
      {
        cont++;
      }
    }
    cout<<cont;
}

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

#define MOD 1000000007
#define INF 1000000001

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


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}



int main(int argc, char const *argv[]) {
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    for (int i = 0; i < N; ++i) {
        cin >> V[i];
    }

    int ans = 0;
    for (int x = 0; x <= min(N, K); ++x) {
        for (int y = 0; x + y <= min(N, K); ++y) {
            multiset<int, greater<int>> S;
            for (int i = 0; i < x; ++i) {
                S.insert(V[i]);
            }
            for (int i = 0; i < y; ++i) {
                S.insert(V[N-i-1]);
            }

            int sum = 0;
            int res = x + y;
            for (int item : S) {
                if (item < 0 && res <= K - (x + y)) {
                    break;
                }
                res -= 1;
                sum += item;
            }
            ans = max(ans, sum);
            // print(x, y, sum);
        }
    }

    cout << ans << endl;
       
    return 0;
}


Measured memory_bytes: 256
const MOD: i64 = 1000000007;

fn modpow(a: i64, n: i64) -> i64 {
    let mut a = a;
    let mut n = n;
    let mut res = 1;
    while n > 0 {
        if n & 1 > 0 {
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n >>= 1;
    }
    res
}

fn modinv(a: i64) -> i64 {
    let mut a = a;
    let mut b = MOD;
    let mut u = 1;
    let mut v = 0;
    while b > 0 {
        let t = a / b;
        a -= t * b;
        std::mem::swap(&mut a, &mut b);
        u -= t * v;
        std::mem::swap(&mut u, &mut v);
    }
    u %= MOD;
    if u < 0 {
        u += MOD;
    }
    u
}

fn main() {
    let (n, a, b): (i64, i64, i64) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut ws = buf.split_whitespace();
        let n = ws.next().unwrap().parse().unwrap();
        let a = ws.next().unwrap().parse().unwrap();
        let b = ws.next().unwrap().parse().unwrap();
        (n, a, b)
    };
    let mut ans = modpow(2, n) - 1;

    let mut c = 1;
    for i in 1..(a + 1) {
        c *= n - i + 1;
        c %= MOD;
        c *= modinv(i);
        c %= MOD;
    }
    ans -= c;
    let mut c = 1;
    for i in 1..(b + 1) {
        c *= n - i + 1;
        c %= MOD;
        c *= modinv(i);
        c %= MOD;
    }
    ans -= c;
    ans += MOD * 2;
    ans = ans % MOD;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

struct city{
   int p, y, o;
};

int main() {
    int n, m;
    cin >> n >> m;
    vector<PiP> a(m);
    vector<int> cnt(n+1, 0);
    rep(i, m){
        cin >> a[i].second.first >> a[i].first;
        a[i].second.second = i;
    }
    sort(all(a));
    vector<pair<int, string>> ans(m);
    rep(i, m){
        cnt[a[i].second.first]++;
        stringstream ss;
        ss << setw(6) << setfill('0') << a[i].second.first;
        ss << setw(6) << cnt[a[i].second.first];
        ans[i].first = a[i].second.second;
        ans[i].second = ss.str();
    }
    sort(all(ans));
    rep(i, m)cout << ans[i].second << endl;
}      

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end()))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    int d = abs(A - B);
    if ((V - W) * T >= d) { cout << "YES" << endl; }
    else { cout << "NO" << endl; }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const long long INF = numeric_limits<long long>::max();

int main(void) {
    int a, b, c, x; cin >> a >> b >> c >> x;
    int cnt = 0;

    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++){
            for (int k = 0; k <= c; k++) {
                if (500*i + 100*j + 50*k == x) {
                    cnt++;
                }
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Maybe
import Data.Function (fix)
import Data.Array (Array, array, (!))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8

modular :: Integer
modular = 1000000007
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt

getIntegers :: IO [Integer]
getIntegers = (map parseInteger . BS8.words) <$> BS.getLine 
    where parseInteger = fst . fromJust . BS8.readInteger

solve :: Int -> Int
solve n = go 1 n
    where go k n
            | n <= 0 = 0
            | otherwise = 1 + go (k+1) (n-k)

main :: IO ()
main = do
    [n] <- getInts
    print (solve n)

Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
    int m1, d1;
    int m2, d2;

    cin >> m1 >> d1 >> m2 >> d2;

    if (m1 != m2 && d1 != d2) {
        cout << "1" << endl;
    } else {
        cout << "0" << endl;
    }
}

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

using namespace std;

const int INF = 1000000009;

int main() {
  int h, w; cin >> h >> w;
  vector<string> maze(h);
  for (int i = 0; i < h; i++) {
    cin >> maze[i];
  }
  int dp[102][102];
  for (int i = 0; i < 102; i++) {
    for (int j = 0; j < 102; j++) {
      dp[i][j] = INF;
    }
  }
  dp[0][0] = (maze[0][0] == '#');
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (x > 0) {
        if (maze[y][x] == '#' && maze[y][x-1] == '.') {
          dp[y][x] = min(dp[y][x], dp[y][x-1]+1);
        } else {
          dp[y][x] = min(dp[y][x], dp[y][x-1]);
        }
      }
      if (y > 0) {
        if (maze[y][x] == '#' && maze[y-1][x] == '.') {
          dp[y][x] = min(dp[y][x], dp[y-1][x]+1);
        } else {
          dp[y][x] = min(dp[y][x], dp[y-1][x]);
        }
      }
    }
  }
  cout << dp[h-1][w-1] << endl;
  return 0;
}

Measured memory_bytes: 256
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

vector<vector<int>> edges;

void rec(vector<int> nodes, int level)
{
    if (nodes.size()<=1) return;
    // separate into two
    vector<int> white, black;
    int N = nodes.size();
    rep(i, 0, N/2) white.emplace_back(nodes[i]);
    rep(i, N/2, N) black.emplace_back(nodes[i]);

    // make edgee between two groups
    for (auto w: white)
        for (auto b: black)
        {
            edges[w][b] = level;
            edges[b][w] = level;
        }

    // go to next
    rec(white, level+1);
    rec(black, level+1);
}

int main()
{
    int n;
    cin >> n;
    edges.assign(n, vector<int>(n, 0));
    vector<int> nodes(n, 0);
    rep(i, 0, n)
        nodes[i] = i;

    rec(nodes, 1);
    rep(i, 0, n)
    {
        rep(j, i+1, n)
            printf("%d ", edges[i][j]);
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>

using namespace std;

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

  if ((a == 5 && b == 5 && c == 7) || (a == 5 && b == 7 && c == 5) || (a == 7 && b == 5 && c == 5)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

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

int main(){
  int n, q, count = 0, max, min;
  int S[100000], T[50000];

  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> S[i];
  }
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> T[i];
  }

  //T?????????????????????
  for(int i = 0; i < q; i++){
    //S????????????n/2??????????????§??????????°??????????
    max = n;
    min = 0;
    for(;max > min;){
      if(T[i] == S[(max+min)/2]){
        count++;
        break;
      }
      else if(T[i] > S[(max+min)/2]){
        max = max;
        min = (max+min)/2 + 1;
      }
      else if(T[i] < S[(max+min)/2]){
        max = (max+min)/2;
        min = min;
      }
    }
  }

  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3576
#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>;

const int mod = 998244353;

int main(int, char**)
{
    string s;
    cin >> s;

    cout << s.substr(0,3) << endl;

    return 0;
}

Measured memory_bytes: 3644
from collections import deque
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
LIST = deque()
 
num_command = int(input())
 
for loop in range(num_command):
 
    input_command = input()
 
    if input_command == 'deleteFirst':
        LIST.popleft()
    elif input_command == 'deleteLast':
        LIST.pop();
    else:
        com,num = input_command.split()
 
        if com == 'insert':
            LIST.appendleft(num)
        elif com == 'delete':
            try:
                LIST.remove(num)
            except:
                pass
 
print(' '.join(LIST))


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i=0; i<n; ++i) {
        cin >> s.at(i);
    }
    for (int i=0; i<n; ++i) {
        sort(s.at(i).begin(), s.at(i).end());
    }
    map<string, ll> mp;
    for (int i=0; i<n; ++i) {
        mp[s.at(i)]++;
    }
    ll res = 0;
    for (auto iter=mp.begin(); iter!=mp.end(); ++iter) {
        ll tmp = iter->second;
        res += tmp * (tmp-1) / 2;
    }
    cout << res << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 16640
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(a: u64,mut b: u64, mut c: u64, mut k: u64);

    let mut count: u64 = 0;
    while a >= b {
        b *= 2;
        count += 1;
    }
    while b >= c {
        c *= 2;
        count += 1;
    }

    println!("{}", if count > k { "No" } else { "Yes" });
}


Measured memory_bytes: 2164
import java.util.Scanner;

public class Main 
{
	static int n, m, k;
	static int[] par;
	static int[] rank;
	static int[] size;
	
	static void union(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		
		if(rank[rx] >= rank[ry])
		{
			par[ry] = rx;
			if(rank[rx] == rank[ry])
				rank[rx]++;
		}
		else par[rx] = ry;
	}
	
	static int root(int x)
	{
		if(par[x] != x)
			par[x] = root(par[x]);
		return par[x];
	}

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		k = sc.nextInt();
		par = new int[n];
		rank = new int[n];
		size = new int[n];
		int[] penalty = new int[n];
		
		for(int i = 0; i < n; i++)
			par[i] = i;
			
		for(int i = 0; i < m; i++)
		{ //read friendships
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			
			union(a, b);
			
			//penalty for each direct friend on the same set
			penalty[a]++;
			penalty[b]++;
		}
		
		for(int i = 0; i < n; i++)
		{ //count size of each set
			size[root(i)]++;
		}
		
		for(int i = 0; i < k; i++)
		{ //read blockships
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			
			if(root(a) == root(b))
			{ //penalty for each blocked user on the same set
				penalty[a]++;
				penalty[b]++;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < n; i++)
		{
			int an = size[root(i)] - 1 - penalty[i];
			if(i>0)sb.append(' ');
			sb.append(an);
		}
		System.out.println(sb);
	}

}


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

int main(){
  int64_t n, a, b;
  cin >> n >> a >> b;
  
  cout << (n/(a+b))*a + min(n%(a+b), a) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	
	if(x-r < 0 || w < x+r ){
		printf("No\n");
		return 0;
	}
	
	else if(y-r < 0 || h < y+r){
		printf("No\n");
		return 0;
	}
	
	else{
		printf("Yes\n");
		return 0;
	}
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);


class comb{
	vector<ll> f,fr;
	ll MOD_;
	public:
	//a^(p-1) = 1 (mod p)(p->Prime numbers)
	//a^(p-2) = a^(-1)
	ll calc(ll a,ll b,ll p){//a^(b) mod p   
		if(b==0)return 1;
		ll y = calc(a,b/2,p);y=(y*y)%p;
		if(b & 1) y = (y * a) % p;
		return y;
	}
	void init(ll n,ll mod){//input max_n
		MOD_ = mod;
		f.resize(n+1);
		fr.resize(n+1);
		f[0]=fr[0]=1;
		for(ll i=1;i<n+1;i++){
			f[i] = (f[i-1] * i) % mod;
			fr[i] = calc(f[i],mod-2,mod);
		}
	}
	ll nCr(ll n,ll r){
		if(n<0||r<0||n<r)return 0;
		return f[n] * fr[r] % MOD_ * fr[n-r] % MOD_;
	}
};


int main(){
	ll r1,r2,c1,c2,ans=0;
	cin >> r1 >> c1 >> r2 >> c2;
	comb co;
	co.init(r2+c2+2,MOD);
	FOR(i,c1,c2+1){
		ans += co.nCr(i+r2+1,r2);
		ans %= MOD;
		ans += MOD - co.nCr(i+r1,r1-1);
		ans %= MOD;
	}
	cout << ans << endl;
}



Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

bool a[26];
int main() {
	string s;
	cin>>s;
	if(s.size()!=26){
		for(int i=0;i<s.size();i++){
			ll now=s[i]-'a';
			a[now]=true;
		}
		for(int i=0;i<26;i++){
			if(a[i]==false){
				cout << s+char(i+'a');
				return 0;
			}
		}
	}
	for(int i=24;i>=0;i--){
		ll ans=inf;
		if(s[i]<s[i+1]){
			char now=s[i];
			for(int j=25;j>=i;j--){
				if(now<s[j]){
					ans=min(ans,ll(s[j]-'a'));
				}
			}
			for(int j=0;j<i;j++){
				cout << s[j];
			}
			cout << char(ans+'a');
			return 0;
		}
	}
	cout<< -1;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
	long d, n, i, ans = 1, a = 1, k;
	scanf("%ld%ld", &d, &n);
	switch (d) {
	case 0:
		ans = 1;
		break;
	case 1:
		ans = 100;
		break;
	case 2:
		ans = 10000;
	}
	if (n == 100) {
		n=101;
	}
	k = ans * n;
	printf("%ld", k);
}


Measured memory_bytes: 128
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        var temp = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int h = temp[0];
        int a = temp[1];

        Console.WriteLine(h / a + (h % a == 0 ? 0 : 1));
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#define F(i,a,n) for(int i = (a); i < (n); ++i)
using namespace std;
double A,B,C,D,E,F;
double nodomax = 0.0;
double ans[2] = {};
vector<double> sato;
vector<double> water;
int main(){
  double a,b;
  cin >> a >> b >> C >> D >> E >> F;
  A = 100 * a;
  B = 100 * b;
  double nodolim = E / (100 + E);
  ans[0] = A;
  ans[1] = 0;
  F(i,0,F){
    F(j,0,F){
      if(i * A + j * B <= F){
        water.push_back(i * A + j * B );
      }
      if(i * C + j * D <= F){
        sato.push_back(i * C + j * D);
      }
    }
  }
  F(i,0,water.size()){
    F(j,0,sato.size()){
      double nodo = sato.at(j) / (sato.at(j) + water.at(i));
      if(nodo <= nodolim && water.at(i) + sato.at(j) <= F){
        //cout << water.at(i) + sato.at(j) <<  " " << sato.at(j) << endl;
        if(nodo > nodomax){
          nodomax = nodo;
          ans[0] = water.at(i) + sato.at(j);
          ans[1] = sato.at(j);
        }
      }
    }
  }
  cout << ans[0] << " " << ans[1] << endl;
  return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#pragma GCC optimize("O2")
#define sz(x) ((long long)(x).size())
#define all(x)  x.begin(),x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define leastsigbit(x)     __builtin_ffs(x)
#define mod             1000000007
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair<ll,ll>
#define vpii vector<pii>
#define tt ll tt;cin >> tt;while(tt--)
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n";}
const double PI = acos(-1);
ll power(ll a,ll b,ll m=mod){ ll ans=1; a=a%m;  while(b>0) {  if(b&1)  ans=(1ll*a*ans)%m; b>>=1;a=(1ll*a*a)%m;}return ans;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm( ll x, ll y) { return (x*y)/gcd(x,y);}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
bool isPowerOfTwo(int x)
{
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));
}
const int MAXN = 2e5+ 10;
const ll inf = 1e18;

int intlog(double base, double x) {
    return (int)(log(x) / log(base));
}
int32_t main() {
    fio
    int d,t,s;
    cin >> d >> t >> s;
    if(s * t >= d)cout << "Yes" << endl;
    else cout << "No" << endl;


    cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;


}






Measured memory_bytes: 3768
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

int main(){
    ll N, M , C; cin >> N >> M >> C;
    vl bs(M, 0); REP(i, M) cin >> bs[i];
    vvl as(N, vl(M, 0)); REP(i, N) REP(j, M) cin >> as[i][j];
    
    ll ret = 0;
    REP(i, N){
        ll tmp = 0;
        REP(j, M){
            tmp += as[i][j] * bs[j];
        }
        tmp += C;
        if(tmp > 0) ret++;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
list_753=["3","5","7"]
for i in range(len(str(n))):
    for num in list_753:
        if len(num)==i:
            list_753.append(num+"3")
            list_753.append(num+"5")
            list_753.append(num+"7")
        else:
            pass

counter=0
for i in range(len(list_753)):
    if int(list_753[i])<=n and "3" in list_753[i] and "5" in list_753[i] and "7" in list_753[i]:
        counter+=1
    else:
        pass
print(counter)

Measured memory_bytes: 5156
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll n,m;
    cin >> n >> m;
    ll p=1,o;
    rep(i,n){
        ll a;
        cin >> a;
        ll u=a;
        int x=0;
        while(true){
            if(u%2==0) u/=2;
            else break;
            x++;
        }
        if (i==0) o=x;
        if (o!=x) {
            cout << 0 << endl;
            return 0;
        }
        p=p*(a/(__gcd(a,p)));
        // cout << p << endl;
        if (p>1e10){
            cout << 0 << endl;
            return 0;
        }
    }
    m+=p/2;
    cout << m/p << endl;
}


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

int main() {
  int n, d;
  cin >> n >> d;
  int ans;
  ans = (n + 2 * d) / (2 * d + 1);
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

int main() {
	int X; cin >> X;

	int ans = 1000 * (X / 500);
	X %= 500;
	ans += 5 * (X / 5);

	cout << ans << endl;
}

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

using namespace std;

using ll =  long long;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    for(int i=0;i<n;++i){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for(int i=0;i<n;++i){
        cin >> b[i];
    }
    sort(b.begin(), b.end());
    for(int i=0;i<n;++i){
        cin >> c[i];
    }
    sort(c.begin(), c.end());
    

    vector<ll> ab(n), bc(n), bc_count(n, 0);
    for(int i=0;i<n;++i) {
        ab[i] = upper_bound(b.begin(), b.end(), a[i]) - b.begin();
        ++bc_count[ab[i]];
    }
    for(int i=1;i<n;++i) bc_count[i] += bc_count[i-1];
    for(int i=0;i<n;++i) {
        bc[i] = upper_bound(c.begin(), c.end(), b[i]) - c.begin();
    }

    ll ans = 0LL;
    for(int i=0;i<n;++i) {
        ans += bc_count[i] * (n-bc[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 4992
import sys
input = sys.stdin.buffer.readline

import bisect
N, M, K = map(int, input().split())
A = list(map(int, (input().split())))
B = list(map(int, (input().split())))
cumA, cumB = [0], [0]
for a in A:
    cumA.append(cumA[-1]+a)
for b in B:
    cumB.append(cumB[-1]+b)
ans = 0
for i in range(N, -1, -1):
    if cumA[i] > K: continue
    j = bisect.bisect_right(cumB, K-cumA[i])
    ans = max(ans, i+j-1)
print(ans)

Measured memory_bytes: 124652