akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int x = in();
  int ans = 0;
  int sum = 0;
  for(int i=1;;++i){
    sum += i;
    if(sum>=x){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3760
#include "bits/stdc++.h"
using namespace std;

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
	os << "(" << pair_var.first << ", " << pair_var.second << ")";
	return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	os << "{";
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
	}
	os << "}";
	return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
	os << "{";
	repi(itr, map_var) {
		os << *itr;
		itr++;
		if (itr != map_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
	os << "{";
	repi(itr, set_var) {
		os << *itr;
		itr++;
		if (itr != set_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}

#define DUMPOUT cerr

void dump_func() {
	DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
	DUMPOUT << head;
	if (sizeof...(Tail) > 0) {
		DUMPOUT << ", ";
	}
	dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


vector<P> count_runlength(char* a, char* b) {
	vector<P> v;
	for (char* p = a; p < b;) {
		char* q = p;
		while (q < b && *p == *q) q++;
		v.push_back(P(*p, q - p));
		p = q;
	}
	return v;
}

signed main() {

	int N;
	cin >> N;
	vector<int> d(N);
	rep(i, N) cin >> d[i];
	sort(d.begin(), d.end());

	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int lower = abs(d[i] - d[j]);
			int upper = d[i] + d[j];

			ans += upper_bound(d.begin()+j+1, d.end(), upper-1)
				- lower_bound(d.begin() + j + 1, d.end(), lower+1);

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


Measured memory_bytes: 256
#include<stdio.h>

int IsPrime(int);

int main(void){
  int data,n,i,j,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&data);
    if(IsPrime(data)) count++;
    //printf("data=%d count=%d\n",data,count);
  }

  printf("%d\n",count);
  return 0;
}

int IsPrime(int x){
  int i;

  if(x==2) return 1;
  if(x<2||x%2==0) return 0;

  for(i=3;i<=x/i;i+=2)
    if(x%i==0) return 0;

  return 1;
}

Measured memory_bytes: 2728
#include <stdio.h>

int main(){
    int i,j,N;
    int count=0;
    scanf("%d", &N);
    int a[110];

    for(i=0;i<N;i++){
        scanf("%d", &a[i]);
    }
    
    for(i=0;i<N;i++){
        if(a[i] == a[i+1]){
            for(j=1;j<=N;j++){
                if(a[i] != j && a[i+2] != j) {
                    a[i+1] = j;
                    count += 1;
                    break;
                }
                
            }
        }
    }
    
    printf("%d\n", count);
    return 0;
}


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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
// vll x(n); x[i]=a;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define EPS 1e-12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    ll n ;
    cin >> n;
    vll a;
    REP(i,9) REP(j,9) a.emplace_back((i+1)*(j+1));
    if (find(all(a), n) == a.end()) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

int main() {
  int N,Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<int> sum(N+1,0);
  for(int i=0;i<N;i++){
    if(S[i+1]=='C'&&S[i]=='A'){
      sum[i+1]=sum[i]+1;
    }
    else{
      sum[i+1]=sum[i];
    }
  }
  //0 1 \1 2 2 2 3\ 3 3
  // A C \A C T A C\ G
  int l,r;
  for(int i=0;i<Q;i++){
    cin >> l >> r;
    cout << sum[r-1]-sum[l-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
 
int main()
{
  int H, W;
  char c;
  cin >> H >> W;
  vector<char> all(11111,'.'), warp(H,0), weft(W,0);

  rep(i,H)
  {
    rep(j,W)
    {
      cin >> c;
      if(c=='#')
      {
        all.at(i*H+j)='#';
        warp.at(i)=1;
        weft.at(j)=1;
      }
    }
  }
  rep(i,H)
  {
    if(warp.at(i)==0)
      continue;
    rep(j,W)
    {
      if(weft.at(j)==0)
        continue;
      else
        cout<<all.at(i*H+j);
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int Max=0x3f3f3f3f;
int main()
{
    ll a,b;
    while(~scanf("%lld%lld",&a,&b))
    {
        ll x=a/b;
        if(a%b)x++;
        printf("%lld\n",x);
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
{ if(a[i]%2==0 && (a[i]%3!=0 && a[i]%5!=0)) {
    cout<<"DENIED"; return 0;}
}
cout<<"APPROVED";
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#define INF 10000000
#define I64 long long int
#define FOR(a,start,end) for(I64 a=(start);a<(end);a++)
using namespace std;

int main(){
	//4方向用配列
	int vec[] = {1, -1, 4, -4};
	queue<string> que;
	que.push("01234567");

	//探索済みテーブル
	map<string, int> d;

	//"01234567"から逆向きに幅優先探索しながら探索済みテーブルを埋める
	while(!que.empty()){
		string str = que.front();
		que.pop();
		int zero = str.find("0");

		string str2;
		FOR(i, 0, 4){
			int next_z;
			next_z = zero + vec[i];
			if(next_z >= 0 && next_z <= 7 && !((zero == 3 && next_z == 4) || (zero == 4 && next_z == 3))){
				str2 = str;
				swap(str2[zero], str2[next_z]);
				if(d.find(str2) == d.end()){
					que.push(str2);
					d[str2] = d[str] + 1;
				}
			}
		}
	}

	//入力から' 'を除いて探索済みテーブルから答えを出力
	string num;
	while(getline(cin, num)){
		string::iterator end_it = remove(num.begin(), num.end(), ' ');
		num.erase(end_it, num.end());
		cout << d[num] << endl;
	}
}

Measured memory_bytes: 2192
n,c=map(int,input().split())
xv=[list(map(int,input().split())) for _ in range(n)]
max_right=[]
max_left=[]
right=0
left=0
tmp=0
pre=0
for i in range(n):
  x,v=xv[i]
  tmp+=v
  tmp-=x-pre
  right=max(right,tmp)
  max_right.append(right)
  pre=x
pre=0
tmp=0
for i in range(n):
  x,v=xv[-i-1]
  x=c-x
  tmp+=v
  tmp-=x-pre
  left=max(left,tmp)
  max_left.append(left)
  pre=x

ans=max(max_right[-1],max_left[-1])
sv=0
for i in range(n-1):
  x,v=xv[i]
  sv+=v
  ans=max(ans,max_left[n-i-2]+sv-2*x)
sv=0
for i in range(n-1):
  x,v=xv[-i-1]
  x=c-x
  sv+=v
  ans=max(ans,max_right[n-i-2]+sv-2*x)
print(ans)
  

Measured memory_bytes: 101636
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		int ret = test(array);
		System.out.println(ret);
		sc.close();
	}
	static int test(int[] array) {
		Arrays.sort(array);
		int p = array.length / 2;
		return array[p] - array[p - 1];
	}
}

Measured memory_bytes: 50608
import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    A = ZZ()
    ans = 0
    for i, a in enumerate(A):
        if i%2 == 0 and a%2 == 1: ans += 1
    print(ans)


    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const int N=1e6+5;
ll a[N];
int main()
{
    ll n,t;
    scanf("%lld%lld",&n,&t);
    ll sum=0;
    for(int i=1;i<=n;i++){
        scanf("%lld",a+i);
    }
    a[n+1]=1e15;
    for(int i=1;i<=n;i++){
        ll temp=a[i]+t;
        if(temp>=a[i+1]){
            sum+=a[i+1]-a[i];
        }else{
            sum+=t;
        }
    }
    cout<<sum<<endl;


    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)
#define endl '\n'

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;


int main(){
	fast_io; cout_precision;
	int n;	cin >> n;
	vector <pair <int,int> > v;
  	for(int i=1; i<=n; i++){
		int a;	cin >> a;	v.pb({a,i});
    }
  	sort(v.begin(),v.end());
	for(int i=0; i<n; i++)	cout<<v[i].sc<<" ";
	return 0;
}

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

            for (int i =0;i<a;i++){
                int b = sc.nextInt();
                int c = sc.nextInt();
                if (b<c){
                    System.out.println(b);
                }else if (b % c ==0){
                    System.out.println(c);
                }else{
                    System.out.println(b % c);
                }
            }
        }
    }

Measured memory_bytes: 20336
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define foreach(a,A) for(auto &a:A)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
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(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll n, a; cin >> n >> a;
    n %= 500;
    cout << (n <= a ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	
	if(a[0] == 5 && a[1] == 5 && a[2] == 7)
		cout << "YES";
	else
		cout << "NO";
	
	return 0;
}



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

#define _GLIBCXX_DEBAC
using namespace std;
	

int main() {
	int a, b;
	cin >> a >> b;
	if (a>=10||b>=10) {
		cout << -1;
	}
	else {
		cout << a*b;
	}
		return 0;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs int N = 2e5 + 50;
int n, fa[N], ct[N][2];
struct dat{
	int x, y, c; 
	bool operator < (cs dat &a) cs { return (ll)x * a.y < (ll)y * a.x; }
}; priority_queue<dat> q;
int anc[N];
int fnd(int x){ return x==anc[x]?x:anc[x]=fnd(anc[x]); }
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&n);
	for(int i=1; i<=n; i++) anc[i]=i;
	for(int i=2; i<=n; i++) scanf("%d",&fa[i]);
	for(int i=1,x; i<=n; i++) scanf("%d",&x), ++ct[i][x];
	for(int i=1; i<=n; i++) q.push((dat){ct[i][0],ct[i][1],i});
	ll Ans = 0;
	while(!q.empty()){
		dat x = q.top(); q.pop(); int u = fnd(x.c);
		if(u == 1) continue;
		if(ct[u][0] == x.x && ct[u][1] == x.y){
			int an = fnd(fa[u]); anc[fnd(u)] = an;
			Ans += (ll)ct[u][0] * ct[an][1];
			ct[an][1] += ct[u][1];
			ct[an][0] += ct[u][0]; 
			q.push((dat){ct[an][0],ct[an][1],an});
		}
	} cout << Ans; return 0;
} 

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

/* Print table */
void trace(int A[], int n) {
  int i;
  for (i=0; i<n; i++) {
    if (i>0) {
      cout << " ";
    }
    cout << A[i];
  }
  cout << endl;
}

int main() {
  int n, i, j, v;
  cin >> n;
  int A[n];
  for (i=0; i<n; i++) {
    cin >> A[i];
  }
  trace(A, n);
  for (i=1; i<n; i++) {
    v = A[i];
    j = i-1;
    while (j>=0 && A[j]>v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    trace(A, n);
    }
  
  return 0;
}



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


int main() {
    string num;
    long long count = 0;

    cin >> num;
    int n = num.size()-1;
    for (int bit = 0; bit < (1<<n); bit++) {
        vector<int> S;
        long long tmp = num[0]-'0';
        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                count+=tmp;
                tmp=num[i+1]-'0';
            } else{
                tmp = tmp*10;
                tmp+= num[i+1]-'0';
            }
        }
        count+=tmp;
    }
    cout << count << endl;

    
}



Measured memory_bytes: 3512
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int a, b, c;
int ans;

int main() {
	cin >> a;
	ans = a * a * a;
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
def solve():
    S = input()
    tmp = ''
    ans = 0
    i = 0
    while i < len(S):
        s = S[i]
        if s != tmp:
            ans += 1
            i += 1
            tmp = s
        else:
            ans += 1 if i != len(S) - 1 else 0
            i += 2
            tmp = ''
    print(ans)
    
if __name__ == "__main__":
    solve()

Measured memory_bytes: 67732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    vector<tuple<int, int, int>> t(n);
    rep(i, 0, n) {
        int a, b;
        cin >> a >> b;
        t[i] = make_tuple(a + b, a, b);
    }

    sort(t.begin(), t.end());

    ll ans = 0;
    rep(i, 0, n) {
        if (i % 2 == 0) {
            ans += get<1>(t[n - 1 - i]);
        } else {
            ans -= get<2>(t[n - 1 - i]);
        }
    }

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


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

int main(){
    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int cnt =0;
    int  amax,bmax;
    int a,b;
    amax=min(X/500,A);
    for(a=0;a<=amax;a++){
        bmax=min((X-a*500)/100,B);
    for(b=0;b<=bmax;b++){
        if(a*500+b*100+C*50 >=X)cnt++;
    }

    }
        
    cout << cnt <<endl;
    
    
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i, j, n) for(int i=(j); i<(n); i++)
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; }

map<int, int> mp;
void prime_factorize(long long N) {
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        mp[a] += ex;
    }
    if (N != 1) mp[N]++;
}

int main() { 
   int n; cin >> n;
   fo(i, 1, n+1)prime_factorize(i);

   map<int, int> sisuu;
   for(auto m: mp){
       int num = m.second;
       if(num >=74) sisuu[74]++;
       if(num >=24) sisuu[24]++;
       if(num >=14) sisuu[14]++;
       if(num >=4) sisuu[4]++;
       if(num >=2) sisuu[2]++;
   }
   ll res = 0;
   res += sisuu[74];
   res += sisuu[24] * (sisuu[2]-1);
   res += sisuu[14] * (sisuu[4]-1);
   res += (sisuu[4]*(sisuu[4]-1)/2)*(sisuu[2]-2);

   cout << res << ln;
}








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

main() {
  int X;
  cin >> X;
  vector<bool> exp(X+1);
  exp[1] =1;
  for(int b=2; b<X; b++){
    int v=b*b;
    while(v <= X){
      exp[v] =1;
      v *=b;
    }
  }
  for(int i=X; i>=1; i--){
    if(exp[i]){
      cout << i << endl;
      return 0;
    }  
  }
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  S[3] = '8';
  cout << S << endl;
  return 0;
}


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

int main() {
  string s; cin >> s;
  bool f = false;
  if ( s[0] == 'A' ) f = true;
  if(f) {
  int cnt = 0;
  for ( int i = 2; i < s.size()-1; i++ ) {
    if ( s[i] == 'C' ) cnt++;
  }
  if ( cnt == 1 ) f = true;
  else f = false;
  }
  if (f) {
    for ( int i = 1; i < s.size(); i++ ) {
      if ( i >= 2 && i < s.size()-1 &&s[i] == 'C' ) continue;
      else if ( s[i] >= 'a' &&  s[i] <= 'z' ) f = true;
      else {
	f = false;
	break;
      }
    }
  }
    
  
  if ( f) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            for (int i = 1; i < 10; i++)
            {
                for (int j = 1; j < 10; j++)
                {
                    if (N == i * j) return "Yes";
                }
            }

            return "No";
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

using namespace std;

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    ll n;
    cin >> n;
    ll ans = 1e15;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ans = min(ans, (i - 1) + (n / i - 1));
        }
    }
    cout << ans;
}


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

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

    int N;
    cin >> N;
    vector<vector<int>> cij(10, vector<int>(10));
    for(int i = 1; i <= N; i++)
    {
        int pre, suf;
        suf = i % 10;
        int tmp = i;
        while(tmp >= 10)
        {
            tmp /= 10;
        }
        pre = tmp;
        cij.at(pre).at(suf)++;
    }
    ll answer = 0;
    for(int i = 1; i < 10; i++)
    {
        for(int j = 1; j < 10; j++)
        {
            answer += cij.at(i).at(j) * cij.at(j).at(i);
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
/* ex 9_1
   Sagzar1993 */

#include <stdio.h>
#include <stdlib.h>
//スタックに格納するデータの最大数
#define SIZE 1000

//スタックの定義
typedef struct stack{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}

//データの追加
void push(stack *stk, char elem){
    if(stk->count >= stk->size){
        fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        stk->top--;
        *(stk->top) = elem;
        stk->count++;
    }
}

//データの取り出し
char pop(stack *stk){
    char latest;
    if(stk->count <= 0){
        fprintf(stdout, "Error: stack underflow.\n");
        exit(1);
    }
    else{
        latest = *(stk->top);
        stk->top++;
        stk->count--;
        return latest;
    }
}

int main(void){
    stack stk;
    int i;
    char inputKey;
    //スタックを初期化（ポインタ渡しで関数にわたすこと）
    initialize_stack(&stk);

    //１文字ずつ入力してスタックを操作
    while(1){
        scanf("%c", &inputKey);
        if(inputKey == '\n'){
            //文字列の最後に来たら終了
            break;
        }else if(inputKey != 'B'){
            //0か1ならスタックに文字を追加
            push(&stk, inputKey);
        }else if(stk.count > 0){
            //Bのとき、スタックが空でなければ最後に追加した文字を取り出し
            pop(&stk);
        }
    }
    //スタックの古い方から出力
    for(i = 0; i < stk.count; i++){
        printf("%c", stk.data[SIZE - 1 - i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1592
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  ll mini = longinf, maxi = -longinf;
  rep(i,n){ 
    cin >> a[i]; 
    maxi = max(maxi, a[i]);
    mini = min(mini, a[i]);
  }
  ll ans = maxi-mini;
  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> a(N), b(N);
	for (int i = 0; i < N; i++)
	{
		cin >> a.at(i);
		b.at(i) = a.at(i);
	}
	sort(b.begin(), b.end());

	for (int i = 0; i < N; i++) {
		if (a.at(i) <= b.at((N / 2)-1))cout << b.at(N / 2)<<endl;
		else cout << b.at(N / 2 - 1) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 4840
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
int main(){
	int n=0;
	char a[110];
	char b[110];
	char c[110];
	scanf("%d\n",&n);
	for(int i=0;i<110;i++){
		a[i]='$';
		b[i]='$';
		c[i]='$';
	}
		scanf("%s\n",a);
		scanf("%s\n",b);
		scanf("%s\n",c);

/*	for(int i=0;i<n-1;i++){
		scanf("%s ",a[i]);
	}
		scanf("%s\n",a[n-1]);
	for(int i=0;i<n-1;i++){
		scanf("%s ",b[i]);
	}
	scanf("%s\n",b[n-1]);
	for(int i=0;i<n-1;i++){
		scanf("%s ",c[i]);
	}
		scanf("%s\n",c[n-1]);
*/
	int ans=0;
	for(int i=0;i<n;i++){
		ans=ans+2;
		if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i]){
			ans--;
		}
		if(a[i]==b[i]&&b[i]==c[i]&&c[i]==a[i]){
			ans--;
		}
	}
	printf("%d\n",ans);

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool judge(char c, int n) {
	printf("%c %lld\n", c, n);
	fflush(stdout);
	char s[10];
	if (c == '?') {
		scanf("%s", s);
		if (s[0] == 'Y') return 1;
		return 0;
	}
	return 0;
}
signed main() {
	int len = 1, num = 1, flag = 0;
	while (judge('?', num)) {
		len *= 10; num = len;
		if (len > 1E10) {
			flag = 1; break;
		}
	}
	if (flag) {
		len = 10, num = 10, flag = 0;
		while (!judge('?', num - 1)) {
			len *= 10; num = len;
			if (len > 1E9) break;
		}
		judge('!', num / 10);
		return 0;
	}
	len /= 10; num = len;
	while (len) {
		int l = 0, r = 9 - (num / len) % 10;
		while (l < r) {
			int mid = (l + r + 1) >> 1;
			if (!judge('?', (mid * len + num) * 10)) l = mid;
			else r = mid - 1;
		}
		num += l * len;
		len /= 10;
	}
	judge('!',  num + 1);
	return 0;
}

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

#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define t_times int t; cin >> t; while(t--)
#define _parr(a, n) for(int __i = 0; __i < (int )n; __i++) cout << a[__i] << ' '; cout << '\n'
#define fr(i, p, n) for(int i = (int )p; i < (int )n; i++)
#define frn(i, p, n) for(int i = (int )p; i <= (int )n; i++)
#define rev(i, n, p) for(int i = (int )n; i >= (int )p; i--)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).begin(), (c).end()
#define sci(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define prin(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define mp make_pair
#define F first
#define S second
#define pb push_back

typedef long long int LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
typedef pair< int, int> ii;
typedef vector< int> vi;

const int mod = 1e9 + 7;
const LL INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 2e5 + 22;
const double eps = 1e-10;

int n, m;
ii a[N];
ii sum[N];

/*
* https://en.wikipedia.org/wiki/Minkowski_addition
* https://codeforces.com/blog/entry/69485?#comment-539986
*/
LL sqr(int x) {
    return 1LL * x * x;
}
void _solve() {
    cin >> n;
    fr(i, 0, n) cin >> a[i].F >> a[i].S;
    sort(a, a + n, [](ii x, ii y) {
        return atan2(x.S, x.F) < atan2(y.S, y.F);
    });
    fr(i, n, n + n) a[i] = a[i - n];
    fr(i, 0, n + n) sum[i + 1] = {a[i].F + sum[i].F, a[i].S + sum[i].S};
    double ans = 0.0;
    frn(i, 1, n) frn(j, i, i + n) ans = max(ans, (double )sqrt(sqr(sum[j].F - sum[i].F) + sqr(sum[j].S - sum[i].S)));
    cout << setprecision(12) << ans;
}

int main() {
    fastio;
    //t_times
    _solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int K,A,B;
  cin >> K >> A >> B;
  bool  ju=true;
  for(int i=A;i<=B;i++){
    if(i%K==0){cout << "OK" << endl; ju=false; break;}
    
  }
  if(ju) cout <<"NG" << endl;
}

Measured memory_bytes: 3676
divMod' n d
  | r < 0 = (q+1, r-d)
  | otherwise = qr
  where
    qr@(q,r) = divMod n d

ntb :: Int -> [Bool]
ntb n 
  | n==0 = [False]
  | otherwise = go n []
  where
    go 1 bs = True:bs
    go n bs =
      let (q,r) = n `divMod'` (-2)
      in
        go q ((r==1):bs)

b True = '1'
b False = '0'

main = do
  n <- read <$> getLine
  putStrLn $ map b $ ntb n


Measured memory_bytes: 508
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;
vector<int> PrimeNumber(int num)
{
	vector<int> prime;
	vector<bool> prime_num(num, false);

	prime_num[0] = false;
	prime_num[1] = false;
	for (int i = 2; i < sqrt(num); i++)
	{
		if (prime_num[i])
			continue;

		for (int j = i * 2; j <= num; j += i)
		{
			prime_num[j] = false;
		}
		prime.push_back(i);
	}

	return prime;
}

//割られる数：a
//余りを求めるやつ：valid
long long Modinv(long long a, long long valid = INV)
{
	long long b = valid, u = 1, v = 0;
	while (a)
	{
		if (a < b)
		{
			swap(a, b);
			swap(u, v);
		}
		long long t = a / b;
		a -= t * b;
		u -= t * v;
	}
	v %= valid;
	if (v < 0)
		v += valid;
	return v;
}
//rCnの場合
long long int Combination(long long int r, long long int n)
{
	long long int ans = 1;
	long long int div;

	for (int i = 0; i < n; i++)
	{
		ans *= r - i;
		div = i + 1;

		ans = ans % INV * Modinv(div) % INV;
	}

	return ans;
}

void execute()
{
	int N, M;
	cin >> N >> M;
	int rest_M = M;
	lint ans = 1;
	vector<int> factorization;
	//vector<bool> prime = PrimeNumber(M);

	for (int i = 2; i <= (int)sqrt(M) && rest_M != 1; i++)
	{
		if (rest_M % i == 0)
		{
			int tmp = 0;
			for (; rest_M % i == 0;)
			{
				rest_M /= i;
				tmp++;
			}

			factorization.push_back(tmp);
		}
	}

	if (rest_M != 1)
		factorization.push_back(1);

	for (auto count : factorization)
	{

		ans *= Combination(count + N - 1, min(N - 1, count));
		ans %= INV;
	}

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

// 約数の全列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A = divisor(N);

    ll ans = LINF;

    for(auto v: A){
        ll u = N/v;
        ll a = to_string(v).length();
        ll b = to_string(u).length();
        ans = min(ans, max(a, b));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
N = int(input())
t = [list(map(int,input().split())) for _ in range(N)]

t.sort()
now = 0
ans = "Yes"
past = 0

for i in range(N):
  if t[i][0] - past >= abs(t[i][1] + t[i][2] - now) and abs(t[i][0] - past - abs(t[i][1] + t[i][2] - now))%2 == 0:
    now = t[i][1] + t[i][2]
    past = t[i][0]
  else:
    ans = "No"

print(ans)

Measured memory_bytes: 27300
# ABC114C - 755
def shichi_go_san(s="0"):
    if int(s) > n:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in "753") else 0
    for c in "753":
        ret += shichi_go_san(s + c)
    return ret


n = int(input())
print(shichi_go_san())

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

int main()
{
  std::vector<int> table_st(26,-1);
  std::vector<int> table_ts(26,-1);
  string s,t;
  cin>>s>>t;
  for (int i = 0; i < s.size(); ++i)
  {
    if((table_st[s[i]-'a']==-1||table_st[s[i]-'a']==t[i]-'a')&&
       (table_ts[t[i]-'a']==-1||table_ts[t[i]-'a']==s[i]-'a')){
      table_ts[t[i]-'a']=s[i]-'a';
      table_st[s[i]-'a']=t[i]-'a';
    }
    else{
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
}

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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N, M;
    cin >> N >> M;

    scc_graph G(N);
    REP(i, M){
        ll a, b;
        cin >> a >> b;
        G.add_edge(a, b);
    }

    auto res = G.scc();
    
    cout << res.size() << endl;
    for(auto &v: res){
        cout << v.size() << " ";
        for(auto x: v) cout << x << " ";
        cout << endl;
    }

    return 0;
}

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

typedef long long LL;
const int N = 200005;

int n, m, a[N];
LL d1[N], d2[N], sum, ans = 1e18;

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> m;
	for (int i = 0; i < n; ++i) std::cin >> a[i];
	a[0] %= m;
	for (int i = 1; i < n; ++i) {
		if (a[i] < a[i - 1]) a[i] += m;
		int t = (a[i] - a[i - 1]) % m;
		if (!t) continue; sum += t;
		d1[a[i] + 1] += t - 1;
		--d2[a[i - 1] + 2], ++d2[a[i] + 1];
		a[i] %= m;
	}
	for (int i = 1; i < m * 2; ++i)
		d2[i] += d2[i - 1];
	for (int i = 0; i < m * 2; ++i)
		d1[i] += d2[i];
	for (int i = 1; i < m * 2; ++i)
		d1[i] += d1[i - 1];
	for (int i = 0; i < m; ++i)
		ans = std::min(ans, sum + d1[i] + d1[i + m]);
	std::cout << ans << '\n';
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
	int n,W; cin>>n>>W;
	
	int w,v;
	vector<long long int> dp(W+1,-1);
	dp[0]=0;
   for(int i=0;i<n;i++){
       cin>>w>>v;
   for(int j=W;j>=w;j--){
       if(dp[j-w] != -1)
       dp[j]=max((long long int)(dp[j-w]+v),dp[j]);
     }
   } 
    cout<<*max_element(dp.begin(),dp.end())<<endl;
	return 0;
}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

vector<ll> memo(2020, -1);

int cnt = 0;
ll fibonacci(int n) {
  cnt++;
  if (memo[n] != -1) return memo[n];
  return memo[n] = (fibonacci(n - 1) + fibonacci(n - 3))%mod;
}


int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int S;
	cin >> S;
	memo[0] = 0;
	memo[1] = 0;
	memo[2] = 0;
	memo[3] = 1;
	memo[4] = 1;
	memo[5] = 1;
	ll ans;
	ans = fibonacci(S);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3684
#include <stdio.h>

int main(void){
    
    int a,b,k;
    scanf("%d %d %d",&a,&b,&k);
    
    for(int i=0; i<k && a<b; i++){
        printf("%d\n",a);
        a++;
    }
    for(int i=b-k+1; i<=b; i++){
        if(i>=a)
            printf("%d\n",i);
    }
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {
    
    
    int n; cin >> n;
    if(n > 81) {
        cout << "No" << endl;
        return 0;
    } else if(n <= 9) {
        cout << "Yes" << endl;
        return 0;
    }
    
    


    EFOR(i, 2, 9) {
        if(n%i == 0 && n/i <= 9) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

int N, M;
vector<int> G[10];

int dfs(int v, int flg) {
    if (flg == (1 << N) - 1) return 1;

    int res = 0;
    for (int to : G[v]) {
        if ((flg >> to) & 1) continue;
        res += dfs(to, flg | 1 << to);
    }

    return res;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    read(N, M);
    rep(i, 0, M) {
        var(int, a, b);
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    print(dfs(0, 1));

    return 0;
}


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

using ll=long long;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
  int a=in(),b=in(),c=in();
  if (a==b && b==c) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
fun readInts() = readLine()!!.split(" ").map(String::toInt)

fun main(args: Array<String>) {
  val (n, k) = readInts()
  val xs = readInts()
  val countMap = xs.groupBy { it }.mapValues { it.value.size }
  if (countMap.keys.size <= k) {
    println(0)
    return
  }
  val m = countMap.size
  val ans = countMap.values.sorted().subList(0, m - k).sum()
  println(ans)
}


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

int main(){
    int k; cin >> k;
    
    queue<ll> q;
    for(int i=1; i<10; i++)q.push(i);
    int count = 0;
    
    while(count<k){
        count++;
        if(count==k){
            cout << q.front() << endl;
            return 0;
        }
        
        if(q.front()%10 != 0)
            q.push(q.front() * 10 + (q.front()%10) - 1);
        q.push(q.front() * 10 + (q.front()%10) );
        if(q.front()%10 != 9)
            q.push(q.front() * 10 + (q.front()%10) + 1);
        
        q.pop();
        
    }
    
    return 0;
}

Measured memory_bytes: 5108
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j + i <= n; j++) {
				int k = n - i - j;
				if (i * 1000 + j * 5000 + k * 10000 == y) {
					System.out.println(k + " " + j + " " + i);
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  if(a%10==3)cout<<"bon"<<endl;
  else if(a%10==0||a%10==1||a%10==6||a%10==8)cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
}

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

#pragma region typedef 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ld PI = 3.141592653589793;
#pragma endregion

#pragma region function
template<class T>bool chmax(T &a, const T &b){
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, T &b, T &c){
  if (b<a) { a=b; c++; return 1; } return 0; }
int sort_3int(int a, int b, int c){
  if (a>b) { swap(a,b); }
  if (a>c) { swap(a,c); }
  if (b>c) { swap(b,c); } return true;}
#pragma endregion

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;

  for(int i = 1; i < n; i++){
      ans += max(a[i-1] - a[i], 0LL);
      chmax(a[i], a[i-1]);
  }
  cout << ans << endl;

return 0;
}


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

int main()
{
    int k;
    cin >> k;
    string s = "ACL";
    for (int i = 0; i < k - 1; i++)
    {
        cout << s;
    }
    cout << s << endl;
}

Measured memory_bytes: 3600