akhauriyash/Code-Regression huggingface dataset:
/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n; cin>>n;
    vector<pair<int,int>> a(n);
    for(int i = 0 ; i < n; i++)
        cin>>a[i].ss>>a[i].ff;
    sort(all(a));
    int t = 0;
    bool can = true;
    for(int i = 0 ; i < n; i++){
        if(a[i].ss+t>a[i].ff){
            can = false;
            break;
        }
        t += a[i].ss;
    }
    cout<<((can)?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 4796
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(L: int):
    ret = (L / 3) ** 3
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


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

int main() {
	int n;
  	cin >> n;
  	for(int i = 0; i< 25 ;i++) {
    	for(int j = 0; j < 15; j++) {
        	if(4*i + 7*j == n) {
         		cout << "Yes\n";
              	return 0;
            }
        }
    }
  	cout <<"No"<< endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	vector<int> a(3);
	cin>>a[0]>>a[1]>>a[2];
	int b;
	cin >>b;
	sort (a.begin(),a.end());
	int c;
	c=a[2];
	
	for(int i=0 ;i<b;i++){
		c=c*2;
	}
	cout<<a[0]+a[1]+c<<endl;
	

}
 

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

int main() {
  int x;
  cin >> x;
  
  bool bo = false;
  if (x >= 2100) {
    bo = true;
  }
  else {
    for (int i = 0; i < 20; i++) {
      for (int j = 0; j < 2; j++) {
        for (int k = 0; k < 2; k++) {
          for (int l = 0; l < 2; l++) {
            for (int m = 0; m < 2; m++) {
              if (m * 1 + l * 2 + k * 3 + j * 4 + i * 5 == (x % 100)) {
                if ((i + j + k + l + m) <= x / 100) {
                  bo = true;
                }
              }
            }
          }
        }
      }
    }
  }
  if (bo) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}


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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int n;

vector<vi> fun(vi a,vi b){
	vector<vi> dp(n+1,vector<int>(n+1));
	fr(i,0,n)
	fr(j,0,n)
	dp[i][j+1]=dp[i][j]+(a[i]<b[j]);
	return dp;
}

void solve(){
	cin>>n;
	char x;
	int num;
	vi b(n),w(n);
	fr(i,0,2*n){
		cin>>x>>num;
		if(x=='B')
			b[num-1]=i;
		else
			w[num-1]=i;
	}
	vector<vi> dpb=fun(b,b),dpw=fun(w,w),dpbw=fun(b,w),dpwb=fun(w,b);
	vector<vi> dp(n+1,vector<int>(n+1,INF));
	fr(i,0,n)
	fr(j,0,n)
	dp[0][0]=0;//nobody processed
	fr(i,0,n+1)
	fr(j,0,n+1){
		if(i<n)
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]+dpb[i][i]+dpbw[i][j]);
		if(j<n)
			dp[i][j+1]=min(dp[i][j+1],dp[i][j]+dpw[j][j]+dpwb[j][i]);
	}
	cout<<dp[n][n]<<endl;
	return;
}

int main()
{
	boost();
	//credits:sugim48
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 81844
#include<cstdio>
#include<cstring>
#define ll long long
int arr[110];
int main()
{
    int x;
    int count=0;
    memset(arr,0,sizeof(arr));
    for(int i=0;i<3;i++)
    {
        scanf("%d",&x);
        if(arr[x]==0)
            count++;
        arr[x]++;
    }
    printf("%d\n",count);
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Union Find tree
//-------------------------------------------------
class UnionFind
{
private:
    ::std::vector<int> par;
    ::std::vector<int> rank;
    vector<int> weight;
public:
    UnionFind(int n):par(n), rank(n), weight(n){
        for(int i=0; i<n; i++){
            par[i] = i;
            rank[i] = 0;
            weight[i] = 1;
        }
    }
    int root(int x){
        if (par[x]==x) return x;
        return par[x] = root(par[x]);
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if (rx==ry) return;
        if (rank[rx]>rank[ry]){
            weight[rx] += weight[ry];
            par[ry] = rx;
        }else{
            weight[ry] += weight[rx];
            par[rx] = ry;
            if (rx==ry) rank[ry]++;
        }
    }
    int count(int x){
        return weight[root(x)];
    }
};

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin>>N>>M;
    UnionFind uf(N);
    rep(i,M){
        int a,b; cin>>a>>b; a--; b--;
        uf.unite(a,b);
    }
    int Max = 0;
    rep(i,N){
        chmax(Max, uf.count(i));
    }
    cout<<Max<<endl;
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end



int main(){
    ll t[2],a[2],b[2];
    rep(i,0,2)scanf("%lld",&t[i]);
    rep(i,0,2)scanf("%lld",&a[i]);
    rep(i,0,2)scanf("%lld",&b[i]);
    if(t[0]*a[0]+t[1]*a[1]==t[0]*b[0]+t[1]*b[1]){printf("infinity\n"); return 0;}
    ll d=t[0]*a[0]+t[1]*a[1]-t[0]*b[0]-t[1]*b[1];
    ll m=t[0]*(a[0]-b[0]);
    if((d>0&&m>0)||(d<0&&m<0)){printf("0\n"); return 0;}
    ll ans=max(0LL,-m/d)*2+1-(m%d==0?1:0);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  n--;
  int c[n],s[n],f[n];
  for(int i=0;i<n;i++){
    cin>>c[i]>>s[i]>>f[i];
  }
  for(int i=0;i<n;i++){
    int cnt=s[i]+c[i];
    for(int j=i+1;j<n;j++){
      if(cnt<=s[j]){
        cnt=s[j]+c[j];
      }else{
        if((cnt-s[j])%f[j]==0)
          cnt+=c[j];
        else
          cnt+=f[j]-(cnt-s[j])%f[j]+c[j];
      }
    }
    cout<<cnt<<endl;
  }
  cout<<0<<endl;
}

Measured memory_bytes: 256
//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
import java.awt.Point;
public class Main{
    public static void main(String[] args) throws IOException 
    { 
  
        Scanner input = new Scanner(System.in);
        while(input.hasNext()){
            long n=input.nextLong();
            long len=n;
            long mod=1000000007;
            long ans=0;
            long tot=1;
            int ct=0;
            while(ct!=n){
                tot=(tot*10)%mod;
                ct++;
            }
            ct=0;
            long no_zero=1;
            while(ct!=n){
                no_zero=(no_zero*9)%mod;
                ct++;
            }
            ct=0;
            long none=1;
            while(ct!=n){
                none=(none*8)%mod;
                ct++;
            }
            System.out.println((tot-no_zero-no_zero+none+2*mod)%mod);
        }
    }
 
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int gcd (ll a, ll b){
    if(a<b) swap(a,b);
    if(a%b==0){
        return b;
    }
    
    return gcd(a%b,b);
}
    
int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    
    REP(i,N){
        cin >> A[i];
    }
    
    ll ans = gcd(A[0],A[1]);
    
   for(int i=2; i<N; i++){
       ans = gcd(ans,A[i]);
   }
    
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
  int r,c; //r=tate c=yoko;
  int i,j;
  int total=0;
  scanf("%d%d",&r,&c);
  int hyo[101][101];
  
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
    scanf("%d",&hyo[i][j]);
    }
  }//代入

   for(i=0;i<r;i++){
      int sum=0;
    for(j=0;j<c;j++){
      sum+=hyo[i][j];
    }
    
    hyo[i][j]=sum;
    
    //printf("%d\n",sum);
   }//each yo total

   //printf("\n");

   for(j=0;j<c;j++){ //r=tate c=yoko
	int sum=0;
	for(i=0;i<r;i++){
	  sum+=hyo[i][j];
	}
	hyo[i][j]=sum;
	total+=sum;
	//printf("%d\n",sum);
	  }

   hyo[r][c]=total;
   

   for(i=0;i<r+1;i++){
    for(j=0;j<c+1;j++){
      if(j<c)printf("%d ",hyo[i][j]);
	else printf("%d",hyo[i][j]);
    }
    printf("\n");
   }
  return 0;
}


Measured memory_bytes: 2068
#include <bits/stdc++.h>
using namespace std;
int main(){
    long double t;
    int n;
    cin >>n;
    long double ans = 0;
    for(int i = 0; i <n ; ++i){
            cin >>t;
            ans= ans + 1/t;
    }
    ans = 1/ans;
    cout<< setprecision (16) <<ans ;

}

Measured memory_bytes: 256
N, K = map(int, input().split())
answer = 0

for b in range(K+1, N+1):
  # print(b, (b-K)*(N//b)+max(0, N%b-K+1))
  if K == 0:
    answer += N%b
  else:
    answer += max(0, N%b-K+1)
  answer += (b-K)*(N//b)
print(answer)

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

int main() {
    int N; cin >> N;
    vector<ll> A(N+1);
    ll ans = 1;
    rep(i,N+1) A.at(i) = i;
    for (int i = 2; i <= N; i++) {
        for (int j = i; j <= N; j+=i) {
            A.at(j) += j;
        }
        ans += A[i]; 
    }
    cout << ans << endl;
}


Measured memory_bytes: 81384
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
int main()
{
    std::vector<long> A(3);
    std::cin >> A[0] >> A[1] >> A[2];
    std::sort(A.begin(),A.end());
    if((A[1]==A[0] && A[1]!=A[2]) || (A[1]==A[2] && A[1]!=A[0])){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" <<std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
// クエリ先読みして出てくる単語を掌握
// グラフを張る
// 辞書順に全探索して実際に成立するか確かめる

#include <iostream>
#include <vector>
#include <string>
#include <set>

using namespace std;

int main() {
	int n, f;
	cin >> n >> f;
	set<string>se;
	vector<vector<string>>input(n);
	for (int i = 0; i < n; i++) {
		int m; cin >> m;
		for (int j = 0; j < m; j++) {
			string s;
			cin >> s;
			se.insert(s);
			input[i].push_back(s);
		}
	}
	vector<string>product;
	for (auto s : se)product.push_back(s);

	vector<vector<int>>graph(product.size(), vector<int>(product.size()));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < input[i].size(); j++) {
			for (int k = j + 1; k < input[i].size(); k++) {
				int a = 0;
				for (int index = 0; index < product.size(); index++) {
					if (product[index] == input[i][j])a = index;
				}
				int b = 0;
				for (int index = 0; index < product.size(); index++) {
					if (product[index] == input[i][k])b = index;
				}
				graph[a][b]++;
				graph[b][a]++;
			}
		}
	}

	vector<vector<string>>ret;
	for (int i = 0; i < product.size(); i++) {
		for (int j = i + 1; j < product.size(); j++) {
			if (graph[i][j] >= f) {
				ret.push_back({ product[i],product[j] });
			}
		}
	}

	cout << ret.size() << endl;
	for (auto x : ret)cout << x[0] << " " << x[1] << endl;
	return 0;
}


Measured memory_bytes: 7368
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail
{
  template <typename T, std::size_t NDIMS>
  struct vector_builder
  {
    using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

    static type make(std::vector<std::size_t> dims, const T &v = {})
    {
      const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
      if (!dims.empty())
        dims.pop_back();
      return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
    }
  };

  template <typename T>
  struct vector_builder<T, 1>
  {
    using type = std::vector<T>;

    static type make(std::vector<std::size_t> dims, const T &v = {})
    {
      return type(dims.empty() ? 0 : dims.back(), v);
    }
  };
} // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T &v, SIZE_T... dims)
{
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

vector<LL> calc_yakusu(LL N)
{
  vector<LL> res;
  for (LL i = 1; i * i <= N; i++)
  {
    if (N % i != 0)
      continue;
    if (i != 1)
      res.push_back(i);
    if (N != i * i)
      res.push_back(N / i);
  }
  return res;
}

void solve(long long N)
{
  set<int> res;
  for (auto val : calc_yakusu(N - 1))
    res.insert(val);

  for (auto val : calc_yakusu(N))
  {
    LL tmp = N;
    while (tmp % val == 0)
      tmp /= val;
    if (tmp % val == 1)
      res.insert(val);
  }

  cout << res.size() << endl;
}

int main()
{
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 3760
#include<stdio.h>
#define ll long long
#define mod 1
ll dp[200100]={0};
ll qp[200100]={0};
ll modpow(ll a,ll n){
    ll result=1;
    while(n>0){
        if(n&1)
            result=result*a%mod;
        a=a*a%mod;
        n/=2;
    }
    return result;
}
ll modinv(ll a){return modpow(a,mod-2);}
ll cmobi(ll a,ll n){
    ll m=1,c=n;
    for(ll i=2;i<=a;i++){
        m=m*i%mod;
        c=c*(n-i+1)%mod;
    }
    return c*modinv(m)%mod;
}
int main(){
    ll n,i;
    scanf("%lld",&n);
    ll a[n];
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);
    for(i=0;i<n;i++)
        dp[a[i]]++;
    for(i=1;i<=n;i++){
        qp[i]=dp[i]*(dp[i]-1)/2;
    }
    ll sum=0;
    for(i=0;i<=n;i++)
        sum+=qp[i];
    for(i=0;i<n;i++){
        if(dp[a[i]]==0||dp[a[i]]==1)
            printf("%lld\n",sum);
        else if(dp[a[i]]==n){
            printf("%lld\n",(n-2)*(n-1)/2);
        }
        else{
            ll ans,p;
            p=dp[a[i]]-1;
            ans=p*(p-1)/2;
            printf("%lld\n",sum-qp[a[i]]+ans);
        }
    }
    return 0;
}

Measured memory_bytes: 6272
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
    int field[1001][101];
    while (true) {
        int n, m, a;
        scanf("%d %d %d",&n,&m,&a);
        if (n==0 && m==0 && a==0) {
            break;
        }
        memset(field,0,sizeof(field));
        int st=0;
        for (int i=0; i<m; i++) {
            int h, p, q;
            scanf("%d %d %d",&h,&p,&q);
            field[h][p]=q;
            field[h][q]=p;
            st=max(st,h);
        }
        for (int i=st; i>0; i--) {
            if (field[i][a]!=0) {
                a=field[i][a];
            }
        }
        printf("%d\n",a);
    }
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



int main(){
    int n;
    cin >> n;
    n++;
    V<int> a(n);
    rep(i,n) cin >> a[i];
    // pair = (min, max);
    V<Pl> cnt(n);
    cnt[n-1] = make_pair(a[n-1], a[n-1]);
    for(int i = n-2; i >= 0; i--) {
        cnt[i].fi = (cnt[i+1].fi+1)/2 + a[i];
        cnt[i].se = cnt[i+1].se + a[i];
    }
    if(!(cnt[0].fi <= 1 && 1 <= cnt[0].se)) {
        cout << -1 << endl;
        return 0;
    }
    // rep(i,n) cout << cnt[i].fi << " " << cnt[i].se << endl;
    V<ll> ans(n);
    ans[0] = 1;
    Rep(i,n-1) {
        ans[i] = min(cnt[i].se, (ans[i-1]-a[i-1])*2);
    }
    ll sum = 0;
    rep(i,n) {
        // cout << ans[i] << endl;
        sum += ans[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 5832
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	
	if(a>b)
	{
		printf("a > b\n");
	}
	else if(a<b)
	{
		printf("a < b\n");
	}
	else
	{
		printf("a == b\n");
	}
	
	return 0;
}


Measured memory_bytes: 1928
#include <bits/stdc++.h>
using namespace std;
long long n,s=0;
long long a[1000111];
int main() {
	cin>>n;
	for(int i=1; i<=n; i++)
	cin>>a[i];
	for(int i=1; i<=n; i++){
	if(a[i]>=a[i-1]) continue;
	else{
		s+=a[i-1]-a[i];
		a[i]=a[i-1];
		}
	}
	cout<<s;
}

Measured memory_bytes: 5084
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int H,W;
    cin >> H >> W;

    REP(i,H) {
        REP(j,W) {
            string s;
            cin >> s;
            if (s == "snuke") {
                cout << char('A'+j) << i+1 << endl;
            }
        }
    }



    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main (){
char s[200002]={0};
scanf ("%s",s);
int ha=0,ow=0,i;
for (i=0;i<strlen(s);i++){
	if (s[i]=='A'){
		ha=i;
		break;
		}
		}
for (i=strlen(s)-1;i>-1;i--){
	if (s[i]=='Z'){
		ow=i;
		break;
		}
		}
	printf ("%d",ow-ha+1);
	return 0;
	}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s;
  ll k;
  cin >> s >> k;
  int n = s.size();
  ll count = 0;
  REP(i, n){
    if(s[i] == '1'){
      count++;
      if(k == count){
        cout << 1 << endl;
        return 0;
      }
    }else{
      cout << s[i] << endl;
      return 0;
    }
  }
  return 0;
}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  int ans = 0;
  if (a + b < 2 * c) {
    ans = a * x + b * y;
  } else {
    if (x < y) {
      ans = (2 * c) * x;
      if (b < 2 * c) {
        ans += b * (y - x);
      } else {
        ans += (2 * c) * (y - x);
      }
    } else {
      ans = (2 * c) * y;
      if (a < 2 * c) {
        ans += a * (x - y);
      } else {
        ans += (2 * c) * (x - y);
      }
    }
  }

  // 解答
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *r;
  struct node *l;
  struct node *p;
  int key;
};
typedef struct node * Node;

Node root;

Node find(Node u, int k){
  while(u!=NULL && k != u->key){
    if(k<u->key)u=u->l;
    else u=u->r;
  }
  return u;
}

Node mini(Node x){
  while(x->l!=NULL)
    x=x->l;
  return x;
}

Node suc(Node x){
  if(x->r!=NULL)
    return mini(x->r);
  Node y=x->p;
  while(y!=NULL && x==y->r){
    x=y;
    y=y->p;
  }
  return y;
}

void insert(int k){
  Node x = root;
  Node y = NULL;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->l = NULL;
  z->r = NULL;

  while(x!=NULL){
    y=x;
    if(z->key < x->key){
      x=x->l;
    }
    else {
      x=x->r;
    }
  }
  z->p=y;
  if(y==NULL){
    root=z;
  }
  else{
    if(z->key < y->key){
      y->l=z;
    }
    else{
      y->r=z;
    }
  }


}

void inorder(Node u){
  if(u==NULL)return ;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);

}
void preorder(Node u){
  if(u==NULL)return ;
  printf(" %d",u->key);
  preorder(u->l);
  preorder(u->r);
}

void delete(Node z){
  Node x;
  Node y;

  if(z->l==NULL || z->r==NULL)
    y=z;
  else y=suc(z);
  if(y->l!=NULL){
    x=y->l;
  }
  else{
    x=y->r;
  }
  if(x!=NULL){
    x->p=y->p;
  }
  if(y->p==NULL){
    root=x;
  }
  else{
    if(y==y->p->l){
      y->p->l=x;
    }
    else{
      y->p->r=x;
  }
}
  if(y!=z){
    z->key=y->key;
  }
  free(y);
}

int main(){
  int n, i, x;
  char c[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", c);
    
    if ( c[0] == 'f' ){
      scanf("%d", &x);
      Node t = find(root, x);
      if ( t != NULL ) printf("yes\n");
      else printf("no\n");
    }
    
    else  if ( c[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( c[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(c[0]=='d'){
      scanf("%d", &x);
      delete(find(root,x));
    }
  }

  return 0;
}



Measured memory_bytes: 20484
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

const lli MAX = 2e5;
const lli AMAX = 1e9;
int N;
lli a[MAX];
lli sum = 0;

int main() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
		sum += a[i];
	}
	lli snk = 0;
	lli ans = AMAX * MAX;
	for (int i = 0;i <= N - 2;i++) {
			snk += a[i];
			lli now = abs(sum - 2 * snk);
			if (now<ans) ans = now;
		}
	cout << ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

vvll edges;

ll dfs(ll i, V<bool> visited) {
  bool all_visited = true;
  REP(i, visited.size()) if (!visited[i]) all_visited = false;
  if (all_visited) return 1;

  ll c = 0;
  REP(j, edges[i].size()) {
    if (visited[edges[i][j]]) continue;
    visited[edges[i][j]] = true;
    c += dfs(edges[i][j], visited);
    visited[edges[i][j]] = false;
  }
  return c;
}

int main() {
  ll n, m; cin >> n >> m;
  edges.resize(n);
  REP(i, m) {
    ll a, b; cin >> a >> b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }

  V<bool> visited(n, false);
  visited[0] = true;
  ll ans = dfs(0, visited);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;
#define PI = 3.14159265358979323846
/*------------------------------------------------------------------------------*/

int main(){
  ll x, y;
  scanf("%lld %lld", &x, &y);

  ll absx = abs(x), absy = abs(y);

  ll cnt = abs(absx - absy);

  if((x < 0 && y > 0) || (x >= 0 && y <= 0)){
    cnt++;
  } else if((x < 0 && y < 0 && x > y) || (x >= 0 && y >= 0 && x > y)){
    cnt += 2;
  }
  printf("%lld\n", cnt);

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

  map<string, int> count;
  for (int i = 0; i < n; i++) {
    vector<char> tmp;
    for (char c : s[i]) tmp.push_back(c);
    sort(tmp.begin(), tmp.end());
    string t;
    for (char c : tmp) t.push_back(c);
    count[t] += 1;
  }

  ll sum = 0;
  for (pair<string, int> p : count) {
    ll size = p.second;
    sum += size * (size - 1) / 2;
  }

  cout << sum << endl;

  return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N-1);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N-1) cin >> C[i];
    
    ll ans = 0;
    rep(i,N) ans += B[i];
    rep(i,N-1)
    {
        if(A[i] + 1 == A[i+1]) ans += C[A[i]-1];
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#define DIFFERENCE ('a' - 'A')

int main() {
  int i;
  char str[11];
  for(i = 0; i < 3; i++) {
    scanf("%s", str);
    str[0] -= DIFFERENCE;
    printf("%c", str[0]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
/// input macro from https://qiita.com/tanakh/items/1ba42c7ca36cd29d0ac8
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn main() {
    input!(x: u64);

    let b = (x - 400) / 200;

    println!("{}", 8 - b);
}


Measured memory_bytes: 2128
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;

int main(){
    long long a;
    string b;
    cin >> a >> b;
    long long b100=100*(b[0]-'0')+10*(b[2]-'0')+b[3]-'0';
    cout << a*b100/100 << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
string reverse(string str) {
    string result = "";
    for (int i = str.size()-1;  0 <= i; i--) {
        result += str[i];
    }
    return result;
}
int main(){
    string str;
    int q;
    string command;
    string PRINT = "print";
    string REVERSE = "reverse";
    string REPLACE = "replace";
    int a,b;
    string target;
    cin >> str;
    cin >> q;
    
    for (int i = 0; i < q; i++) {

        cin >> command;
        if (command == PRINT){
            cin >> a >> b;
           cout << str.substr(a,b - a + 1) << endl;
        }
        if (command == REVERSE) {
            cin >> a >> b;
            str =  str.substr(0,a) + reverse(str.substr(a,b-a+1)) + str.substr(b+1,str.size()-1); 
        } 
        if (command == REPLACE) {
            cin >> a >> b >> target;
            str = str.replace(a,b-a+1,target);
        }
    }
    return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <vector>
#include <map>
#include <queue>

using namespace std;

int mod = 1000000007;

long long floor_sum(long long a, long long b, long long n, long long m)
{
	long long ans = 0;
	if (a >= m) {
		ans += (n - 1) * n * (a / m) / 2;
		a %= m;
	}
	if (b >= m) {
		ans += n * (b / m);
		b %= m;
	}

	long long y_max = (a * n + b) / m;
	long long x_max = y_max * m - b;
	if (y_max != 0) {
		ans += (n - (x_max + a - 1) / a) * y_max;
		ans += floor_sum(m, (a - x_max % a) % a, y_max, a);
	}

	return ans;
}

int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		long long n, m, a, b;
		cin >> n >> m >> a >> b;
		cout << floor_sum(a, b, n, m) << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	
	int aa = 1;
	
	for(int i = 0; i < n; i++)
	{
		if (aa*2 > (aa + k))
		{
			aa += k;
		}
		else
		{
			aa *= 2;
		}
	}
	
	cout << aa << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    string s; cin >> s;
    if (s.size() == 3) reverse(all(s));
    cout << s << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
main()
{
    int a, b, r, temp,i,c,d,e,f,j;

    while(scanf("%d %d",&a,&b)!=EOF){
	c=a;
	d=b;
        if(a<b){
			 temp = a; a = b; b = temp;
			 }
        while( (r = a % b) != 0 ) {
            a = b;
            b = r;
        }
	e=c/b;
	f=d/b;
	j=b*e*f;
	printf("%d %d\n",b,j);

    }

return 0;
}

Measured memory_bytes: 596
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	H, W := sc.nextInt(), sc.nextInt()

	if W > 1 && H > 1 {
		fmt.Fprintln(wtr, ceil(H*W, 2))
	} else {
		fmt.Fprintln(wtr, 1)
	}
}


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

int main(void){
    char S[100000]={};
    int count =0,N=0;
    scanf("%s",S);
    
    for(int i=0;i<strlen(S);i++){
        if(S[i]=='1'){
            count ++;
        }else{
            N++;
        }
    }
    if(count>N){
        printf("%d",2*N);
    }else{
        printf("%d",2*count);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
  int a,c,b;
  cin >> a >> b >> c;
  int bin1,bin2;
  bin1 = a-b;
  bin2 = c-bin1;
  if(bin2<0) cout << 0 << endl;
  else cout << bin2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] m = new int[N];
        int min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            m[i] = sc.nextInt();
            X -= m[i];
            if (m[i] < min) {
                min = m[i];
            }
        }

        int num = X / min;

        System.out.println(num + N);

    }

}


Measured memory_bytes: 22612
h,w,d,i,f;main(c){for(;scanf(f="%d %d\n",&h,&w)*h;c=printf(f,h,w))for(d=i=h*h+w*w;c;d++)for(h=d!=i?:h+1;c&&h<(w=sqrt(d-h*h));h+=c)c=w*w!=d-h*h;}

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

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main() {
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n;
    cin >> n;
    map<ll, int> mp;
    rep(i, n) {
        ll a;
        cin >> a;
        mp[-a]++;
    }
    ll tmp = INF;
    for (auto it = mp.begin(); it != mp.end();) {
        if (it-> se >= 4) {
            cout << mp.begin()->fi * mp.begin()->fi << endl;
            return 0;
        }
        if (it->se >= 2) {
            tmp = it-> fi;
            mp.erase(it);
            break;
        }
        it = mp.erase(it);
    }
    if(mp.size() == 0) {
        cout << 0 << endl;
        return 0;
    }
    for(auto& p : mp) {
        if(p.se >= 2) {
            cout << tmp * p.fi << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 6528
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto C = s[2];
    auto S = readln.chomp;

    auto hoge = new int[](N+C+10);
    foreach_reverse (i; 0..N) {
        if (S[i] == 'x') {
            hoge[i] = hoge[i + 1];
        } else {
            hoge[i] = hoge[i + C + 1] + 1;
        }
    }


    int tmp = 0;
    int[] ans;

    for (int i = 0; i < N; ) {
        if (S[i] == 'x') {
            i += 1;
            continue;
        }
        if (tmp + hoge[i + 1] < K) ans ~= i + 1;
        tmp += 1;
        i += C + 1;
    }

    ans.each!writeln;
}


class SegmentTree(T, alias op, T e) {
    T[] table;
    int size;
    int offset;

    this(int n) {
        size = 1;
        while (size <= n) size <<= 1;
        size <<= 1;
        table = new T[](size);
        fill(table, e);
        offset = size / 2;
    }

    void assign(int pos, T val) {
        pos += offset;
        table[pos] = val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    void add(int pos, T val) {
        pos += offset;
        table[pos] += val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    T query(int l, int r) {
        return query(l, r, 1, 0, offset-1);
    }

    T query(int l, int r, int i, int a, int b) {
        if (b < l || r < a) {
            return e;
        } else if (l <= a && b <= r) {
            return table[i];
        } else {
            return op(query(l, r, i*2, a, (a+b)/2), query(l, r, i*2+1, (a+b)/2+1, b));
        }
    }
}




Measured memory_bytes: 3452
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long  a,b,w=0,n,i,c=0;
   cin>>a>>b;
   if(b==1 && a!=1) std::cout << "Bob" << '\n';
   else if(a==1 && b!=1) std::cout << "Alice" << '\n';
   else if(a>b) std::cout << "Alice" << '\n';
   else if(a<b) std::cout << "Bob" << '\n';
   else if(a==b) std::cout << "Draw" << '\n';


return 0;
}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            if (s[0] != 'A')
            {
                Console.WriteLine("WA");
                return;
            }

            var cNum = 0;
            var cIndex = 0;
            for (int i = 2; i <= s.Length - 2; i++)
            {
                if (s[i] == 'C')
                {
                    cIndex = i;
                    cNum++;
                }
            }

            if (cNum != 1)
            {
                Console.WriteLine("WA");
                return;
            }

            for (int i = 1; i < s.Length; i++)
            {
                if (i == cIndex) continue;

                if (Char.IsUpper(s[i]))
                {
                    Console.WriteLine("WA");
                    return;
                }
            }

            Console.WriteLine("AC");
        }
    }
}

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

#define pb push_back
#define mp make_pair
#define size(n) ( int( n.size() ) )
#define sqr(n) ( (n) * (n) )
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 5;

int dsu[N], x[N], y[N], ans = 0;
vector < pair < int, int > > qx, qy;
vector < pair < int, pair < int, int > > > edge;

int getPar( int v ){
    if ( dsu[v] == v ){
        return v;
    }
    return ( dsu[v] = getPar( dsu[v] ) );
}

int get_union( int a, int b ){
    a = getPar(a);
    b = getPar(b);
    if ( a != b ){
        if ( rand() & 1 ){
            swap(a,b);
        }
        dsu[a] = b;
        return 1;
    }
    return 0;
}

int main(){
    srand(127);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    scanf("%d",&n);
    for ( int i = 1; i <= n; i++ ){
        scanf("%d %d",&x[i],&y[i]);
        qx.pb( mp( x[i], i ) );
        qy.pb( mp( y[i], i ) );
        dsu[i] = i;
    }
    sort( qx.begin(), qx.end() );
    sort( qy.begin(), qy.end() );
    for ( int i = 0; i < size(qx) - 1; i++ ){
        edge.pb( mp( abs( qx[i].fi - qx[i+1].fi ), mp( qx[i].se, qx[i+1].se ) ) );
        edge.pb( mp( abs( qy[i].fi - qy[i+1].fi ), mp( qy[i].se, qy[i+1].se ) ) );
    }
    sort( edge.begin(), edge.end() );
    for ( int i = 0; i < size(edge); i++ ){
        if ( get_union( edge[i].se.fi, edge[i].se.se ) ){
            ans += edge[i].fi;
        }
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 8296
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		int n;
		cin>>n;
		if(n==0)break;
		vector<string> s(n);
		REP(i, n) cin>>s[i];
		ll cnt = 0;
		ll d = 0;
		ll ans = -1;
		REP(i, n) {
			if(ans != -1) break;
			FOR(j, i, n) {
				if(d == 5) {
					cnt = 0;
					d = 0;
					break;
				}
				cnt += s[j].size();
				switch(d) {
					case 0:
						if(cnt < 5) continue;
						else if(cnt == 5) {
							cnt = 0;
							++d;
						} else if(cnt > 5) d = 5;
						break;
					case 1:
						if(cnt < 7) continue;
						else if(cnt == 7) {
							cnt = 0;
							++d;
						} else if(cnt > 7) d = 5;
						break;
					case 2:
						if(cnt < 5) continue;
						else if(cnt == 5) {
							cnt = 0;
							++d;
						} else if(cnt > 5) d = 5;
						break;
					case 3:
						if(cnt < 7) continue;
						else if(cnt == 7) {
							cnt = 0;
							++d;
						} else if(cnt > 7) d = 5;
						break;
					case 4:
						if(cnt < 7) continue;
						else if(cnt == 7) {
							ans = i + 1;
							++d;
						} else if(cnt > 5) d = 5;
						break;
				}
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3144