akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    lint N,K;
    cin >> N >> K;
    lint ans=0;
    for(lint i=K;i<=N+1;i++){
        lint add=(((N+1)+(N-i+2))*i)/2;
        lint minus=((1+i)*i)/2;
        add-=minus;
        add++;
        add%=MOD;
        ans=(ans+add)%MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#pragma GCC optimize "trapv" 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define inarr(arr,n)   rep(i,a,n)cin>>arr[i]
#define ll             long long int
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define IOS            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ret            return 0
#define pi             3.1415926536
#define hell           1000000007
#define narak          998244353
#define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
const int inf1=1e9;
const ll inf2=1e18;
const int N=100000;
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
int dirs[4][2] ={{1,0},{-1,0},{0,1},{0,-1}};
ll dp[100000][101][2];
int solve(){
   string s;cin>>s;
   int d;cin>>d;
   dp[0][0][1]++;
   for(int i=1;i<=s.length();i++){
       for(int m=0;m<d;m++){
           for(int j=0;j<=9;j++){
               int mod=((m-j)%d+d)%d;
               if(j==(s[i-1]-48)){
                   dp[i][m][1]=(dp[i][m][1]+dp[i-1][mod][1])%hell;
                   dp[i][m][0]=(dp[i][m][0]+dp[i-1][mod][0])%hell;
               }
               else if(j<(s[i-1]-48)){
                   dp[i][m][0]=(dp[i][m][0]+dp[i-1][mod][1]+dp[i-1][mod][0])%hell;  
               }
               else{
                   dp[i][m][0]=(dp[i][m][0]+dp[i-1][mod][0])%hell;
               }
           }
       }
   }         
   cout<<(dp[s.length()][0][1]+dp[s.length()][0][0]-1+hell)%hell<<endl;
 ret;
}
int main(){
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef cat
    cat();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    ret;
}
 

Measured memory_bytes: 16640
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

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

int main() {
    ll result = 0;
    vector<int> A(3);
    REP(i, 3) cin >> A[i];
    sort(ALL(A));
    while (A[0] != A[1] || A[1] != A[2]) {
        if (A[1] != A[2]) {
            A[0]++;
            A[1]++;
        } else {
            if (A[1] - A[0] == 1) {
                A[0]++;
                A[2]++;
            } else {
                A[0] += 2;
            }
        }
        result++;
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100;
int n,m,d[maxn],fa[maxn];
inline int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
vector<pair<int,int> > ans;
vector<int> ver[maxn];
inline void dfs(int x,int fat)
{
	for(int i=0;i<(int)ver[x].size();i++)
	{
		int y=ver[x][i];if(y==fat) continue;dfs(y,x);
		if(d[y]&1) ans.push_back(make_pair(y,x));
		else d[x]++,ans.push_back(make_pair(x,y));
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1,a,b;i<=m;i++)
	{
		scanf("%d%d",&a,&b);
		if(find(a)==find(b)) d[a]++,ans.push_back(make_pair(a,b));
		else ver[a].push_back(b),ver[b].push_back(a),fa[find(a)]=find(b);
	}
	dfs(1,0);
	if(d[1]&1) return puts("-1"),0;
	for(int i=0;i<(int)ans.size();i++) printf("%d %d\n",ans[i].first,ans[i].second);
	return 0;
}

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

int main() {
    string ans,s;
    cin >> s;

    for(int i=0;i<s.size();i++){
        if(ans.size()!=0 && s[i]=='B'){
            ans.pop_back();
        }
        else if(s[i]!='B'){
            ans+=s[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i<n; i++)
#define REPR(i, n) for(int i = n; n>=0; i--)
#define FOR(i, m, n) for(int i = m, i < n; i++)

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    /*example standard input and output(cout << "\n")
	int x;
	cin >> x;
	cout << x * x * x << "\n";
    */

   int N;
   cin >> N;

   int tmp;
   int cnt=0;

   for(int i = 1; i <= N; i+=2){
        tmp = 0;
        for(int j = 1; j<=i; j++){
            if(i%j == 0) tmp++;
       }
       if(tmp == 8)cnt++;
   }

    printf("%d", cnt);

    return 0;
}

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

using namespace std;

int i;
char s[100005];

int main(){
	scanf("%s", s);
	for(i = 0; i < 4; i++)
	printf("%c", s[i]);
	printf(" ");
	for(i = 4; i < 12; i++)
	printf("%c", s[i]);
	printf("\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h,w,k;
    cin>>h>>w>>k;
    char s[h][w];
    ll i,j;
    for(i=0;i<h;i++)
    {
    	for(j=0;j<w;j++)
    	cin>>s[i][j];
	}
	ll x=pow(2,h)-1;
	ll y=pow(2,w)-1;
	
	
	ll r,c;
	ll n,m;
	ll o,v;
	ll count,ans;
	ans=0;
	for(r=0;r<x;r++)
	{
		//cout<<"hm"<<endl;
		vector<ll>a1;
		a1.clear();
		for(n=0;n<8;n++)
		{
			if(r &(1<<n))
			a1.push_back(n);
		}
		for(c=0;c<y;c++)
		{
			//cout<<"hm2"<<endl;
			vector<ll>a3;
			a3.clear();
			for(m=0;m<8;m++)
		{
			if(c &(1<<m))
			a3.push_back(m);
		}
		count=0;
		for(i=0;i<h;i++)
    {
    	
    //cout<<"hm 3"<<endl;
    	for(j=0;j<w;j++)
    	{
    		//cout<<"hm 4"<<endl;
    		ll flag=0;
    	ll q1=a1.size();
		ll q2=a3.size();
		for(o=0;o<q1;o++)
		{
			if(i==a1[o])
			flag=1;
			}
			for(v=0;v<q2;v++)
		{
			if(j==a3[v])
			flag=1;
			}
			//cout<<"Flag  "<<flag<<endl;
			if(flag==0)
			{
				//cout<<i<<j<<endl;
				//cout<<s[i][j]<<endl;
				if(s[i][j]=='#')
		count++;
		//cout<<"YO count"<<count<<endl;
			}
				
		}
		
		}
		//cout<<"Count"<<count<<endl;
		if(count==k)
		ans++;
	}
}
cout<<ans<<endl;
   
	return 0;
}

    

Measured memory_bytes: 4036
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

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

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 1E3 + 5;

int x[N], y[N];

int main() {
    int n = read();
    int msk = 0;
    for (int i = 0; i < n; ++i) {
        x[i] = read();
        y[i] = read();
        msk |= 1 << ((abs(x[i]) + abs(y[i])) & 1);
    }
    if (msk == 3) {
        puts("-1");
        return 0;
    }
    vector<int> lens;
    if (msk == 1) {
        lens.emplace_back(1);
    }
    for (int i = 30; i >= 0; --i) {
        lens.emplace_back(1 << i);
    }
    cout << lens.size() << '\n';
    for (int x : lens) cout << x << ' ';
    cout << '\n';
    for (int i = 0; i < n; ++i) {
        int xx = x[i], yy = y[i];
        for (int l : lens) {
            if (abs(xx) > abs(yy)) {
                if (xx > 0) {
                    putchar('R');
                    xx -= l;
                } else {
                    putchar('L');
                    xx += l;
                }
            } else {
                if (yy > 0) {
                    putchar('U');
                    yy -= l;
                } else {
                    putchar('D');
                    yy += l;
                }
            }
        }
        putchar('\n');
        assert(!xx && !yy);
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

struct equation {
  double a, b, c, d, e, f;
  double x, y;
};

int main(void) 
{
  struct equation E;

  while (scanf("%lf %lf %lf %lf %lf %lf", &E.a, &E.b, &E.c, &E.d, &E.e, &E.f) != EOF) {

    if (E.a == 0) {
      E.y = E.c / E.b;
      E.x = (E.f - E.e * E.y) / E.d;
    } else if (E.b == 0) {
      E.x = E.c / E.a;
      E.y = (E.f - E.d * E.x) / E.e;
    } else if (E.d == 0) {
      E.y = E.f / E.e;
      E.x = (E.c - E.b * E.y) / E.a;
    } else if (E.e == 0) {
      E.x = E.f / E.d;
      E.y = (E.c - E.a * E.x) / E.b;
    } else {
      E.x = (E.c - E.b * E.f / E.e) / (E.a - E.b * E.d / E.e);
      E.y = (E.c - E.a * E.x) / E.b;
    }

    printf("%.3f %.3f\n", E.x, E.y);
  }

  return 0;
}

Measured memory_bytes: 652
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m,x;
int f[105][105][305],w[105],v[105];
int dfs(int i,int j,int k){
	if (1LL*j*x+k>m) return -2e9;
	if (i==n) return 0;
	if (f[i][j][k]) return f[i][j][k];
	return f[i][j][k]=max(dfs(i+1,j,k),dfs(i+1,j+1,k+w[i+1])+v[i+1]);
}
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	scanf("%d%d",&w[i],&v[i]);
    x=w[1];
	for (int i=1;i<=n;i++) w[i]-=x;
	cout<<dfs(0,0,0);
	return 0;
}

Measured memory_bytes: 10880
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

// const int kMaxN;

int K;
int ans = 0;

int S(int n) {
  int s = 0;
  while (n != 0) {
    s += n%10;
    n /= 10;
  }
  return s;
}

int F(int n) {
  int fn, base = 1;
  double ratio = 1000000000000000;
  while (base <= n*10) {
    int x = (n/base + 1)*base - 1;
    double nr = (double)x/S(x);
    if (nr < ratio) {
      ratio = nr;
      fn = x;
    }
    base *= 10;
  }
  return fn;
}

signed main() {
  cin >> K;

  int n = 0;
  while (K--) {
    n = F(n+1);
    cout << n << endl;
  }
  return 0;
}


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

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<int> X(N), sX(N);
	for (int i = 0; i < N; i++) cin >> X[i];

	sX = X;
	sort(sX.begin(), sX.end());
	int med = sX[(N - 1) / 2];

	for (int i = 0; i < N; i++) {
		if (X[i] <= med) cout << sX[(N + 1) / 2] << "\n";
		else cout << med << "\n";
	}

	return 0;
}

Measured memory_bytes: 3840
#include<bits//stdc++.h>
using namespace std;
 
int main(){
    string s,t;
    cin >> s >> t;
    bool flag = false;
    int st = -1;
 
    //tが含まれているか
    for(int i = 0; i < s.size() - t.size() + 1; i++){
        if(s[i] != t[0] and s[i] != '?') continue;        
        flag = true;
        for(int j = 0; j < t.size(); j++){
            if(s[i + j] != t[j] and s[i + j] != '?'){
                flag = false;
            }
        }
        if(flag) st = i;
    }
 
    if(st == -1){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
 
    for(int i = 0; i < st; i++){
        if(s[i] == '?') s[i] = 'a';
    }
    for(int i = 0; i < t.size(); i++){
        s[i + st] = t[i];
    }
    for(int i = st + t.size(); i < s.size(); i++){
        if(s[i] == '?') s[i] = 'a';
    }
    
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>


using namespace std;
const double pi=acos(-1.0);
#define boost  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define sl(n) scanf("%lld",&n)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<ll, ll>
#define f(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define rf(i,a,b) for(ll i = (ll)(a); i > (ll)(b); i--)
#define ms(a,b) memset((a),(b),sizeof(a))
#define max(a,b) ((a>b)?(a):(b))
#define min(a,b) ((a<b)?(a):(b))
#define vec(g1) int temp;cin>>temp;g1,push_back(temp);
#define abs(x) ((x<0)?(-(x)):(x))
#define MAX 1000005
#define inf LLONG_MAX
#define MIN INT_MIN
//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 + 7 ;
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
// ll fac[200005];
// ll inverse(ll n){return powmod(n, mod-2);}
// ll nCr(ll n, ll r){return (fac[n] * inverse(fac[r]) % mod * inverse(fac[n-r]) % mod) % mod;}

/**.................................................................................................................................*/
int main(){
	boost;
    int n;
    cin>>n;
    int a[n];
    f(i,0,n)cin>>a[i];
    sort(a,a+n);
    if(a[n/2] == a[n/2 -1 ])cout<<"0"<<endl;
    else{ 
    	 ll ans= a[n/2]-a[n/2 -1];
    	 cout<<ans<<endl;
    }
      	return 0;
    }



Measured memory_bytes: 640
// AtCoder ABC137: C - Green Bin
// 2019.8.26 bal4u

#include <stdio.h>
#include <string.h>

typedef long long ll;

//// 高速入力
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

ll ins() { // 文字列の特殊入力
	int i, c; ll n = 0;
	char f[27];
	memset(f, 0, sizeof(f));
	while ((c = gc()) > ' ') f[c-'a'+1]++;
	for (i = 1; i <= 26; i++) { while (f[i]--) n <<= 5, n |= i; }
	return n;
}


//// ハッシュ関数
#define HASHSIZ 2000003
typedef struct { ll n; int id; } HASH;
HASH hash[HASHSIZ+5], *hashend = hash+HASHSIZ;

int insert(ll n, int id) {
	HASH *p = hash + (int)(n % HASHSIZ);
	while (p->n) {
		if (p->n == n) return p->id;
		if (++p == hashend) p = hash;
	}
	p->n = n, p->id = id;
	return -1;
}

int f[100005];

int main()
{
	int i, k, N; ll ans;
	
	N = in();
	for (i = 1; i <= N; i++) {
		if ((k = insert(ins(), i)) < 0) f[i] = 1;
		else f[k]++;
	}
	
	ans = 0; for (i = 1; i <= N; i++) if (f[i] > 1) {
		ans += (ll)f[i] * (f[i]-1) >> 1;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 31744
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int n, m, x;
int c[20];
vector<vector<int>> v, ans;
vector<int> temp;
void rec(int idx){
    if(idx >= n){
        ans.push_back(temp);
        return;
    }
    temp.push_back(idx);
    rec(idx + 1);
    temp.pop_back();
    rec(idx + 1);
}
int main()
{
    Hello
    v.resize(20);
    cin >> n >> m >> x;
    for(int i = 0; i < n; i++){
        cin >> c[i];
        for(int j = 0, a; j < m; j++){
            cin >> a;
            v[i].push_back(a);
        }
    }
    rec(0);
    int mn = 2e9;
    for(int i = 0; i < ans.size(); i++){
        int arr[m + 5] = {}, amount = 0;
        for(int j = 0; j < ans[i].size(); j++){
            amount += c[ans[i][j]];
            for(int k = 0; k < m; k++){
                arr[k] += v[ans[i][j]][k];
            }
        }
        bool ok = true;
        for(int j = 0; j < m; j++)
            if(arr[j] < x)
                ok = false;
        if(ok)
            mn = min(mn, amount);
    }
    if(mn == 2e9)
        cout << -1;
    else
        cout << mn;
    return 0;
}

Measured memory_bytes: 3784
import java.util.*;

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

        long x = sc.nextLong();
        long money = 100;
        int year = 0;
        sc.close();
        
        while(true){
            if(money >= x){
                System.out.println(year);
                break;
            }
            money*=1.01;
            year++;
        }
    }
}

Measured memory_bytes: 27004
program atcoder0328_3
  integer, dimension(:), allocatable:: A,D
  read(5,*)K,N
  allocate(A(N),D(N))
  read(5,*)A
  do I=1,N-1
     D(I)=A(I+1)-A(I)
  end do
  D(N)=K+A(1)-A(N)
  L=maxval(D)
  write(6,*)int(K-L)
end program atcoder0328_3

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc123_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;

  ll ans = 4 + ceil((double)N / min(A, min(B, min(C, min(D, E)))));
  cout << ans << endl;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
	
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int min = Integer.MAX_VALUE;
		for (int i = -100; i <= 100; i++) {
			int v = 0;
			for (int j = 0; j < n; j++) {
				v += (arr[j] - i) * (arr[j] - i);
			}
			if (min > v) {
				min = v;
			}
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 22612
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int a,g=0;
	int n;
	for(int i=0;i<5;i++){
		cin>>a;
		if(a<40)g+=40;
		else g+=a;
	}
	cout<<g/5<<endl;
	
	return 0;
	
}

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

int main(){
    int n;
    ll k;
    ll a[100005];
    cin>>n>>k;
    for(int i=0;i<n;i++) cin>>a[i];
    ll zero[70];
    ll one[70];
    int keta=0;//0,1は0桁
    ll dketame[70]={0};
    while(k>0){
        dketame[keta]=k%2;
        k/=2;
        if(k>0) keta++;
    }
    for(int i=0;i<51;i++){
        for(int j=0;j<n;j++){
            
            if(a[j]%2==0) zero[i]++;
            else one[i]++;
            a[j]/=2;
        }
    }
    ll res=0;
    for(int d=40;d>=-1;d--){
        if(d!=-1 && dketame[d]==0) continue;
        
        ll tmp=0;
        
        for(int i=0;i<40;i++){
            ll mask=1LL<<i;
            if(i<d){
                tmp+=max(zero[i],one[i])*powl(2,i);
            }
            else if(i==d){
                tmp+=one[i]*powl(2,i);
            }
            else{
                if(dketame[i]==1) tmp+=zero[i]*powl(2,i);
                else tmp+=one[i]*powl(2,i);
            }
        }
        res=max(res,tmp);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include"stdio.h"
#include"string.h"
#include"algorithm"
   using namespace std;
int main()
{
    char c;
    scanf("%c",&c);
    if(c=='A')
        printf("T\n");
    else
        if(c=='T')
          printf("A\n");
        else
            if(c=='C')
               printf("G\n");
           else
            printf("C\n");
}


Measured memory_bytes: 128
while True:
    n = int(input())
    t = []
    s = 0
    sum = 0

    if n == 0:
        break

    else:
        for i in range(n):
            t.append(i)
            t[i] = int(input())
            t.sort()

        for m in range(n):
            sum = sum + t[m]*(n-m-1)

        print(sum)



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



void solve() 
{
    int h,w;cin>>h>>w;
    vector<string> a(h);
    REP(i,h)cin>>a[i];
    vector<vector<int> >dp(h,vector<int>(w,(int)1e9));
    dp[0][0]=0;
    REP(i,h)REP(j,w){
        if(i)dp[i][j]=min(dp[i][j],dp[i-1][j]+(a[i-1][j]!=a[i][j]));
        if(j)dp[i][j]=min(dp[i][j],dp[i][j-1]+(a[i][j-1]!=a[i][j]));
    }int ans=dp[h-1][w-1]/2;
    if(a[0][0]=='#'||a[h-1][w-1]=='#')ans++;
    cout<<ans<<endl;
}

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

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

def dpinit(ps, val=0):
    res = [val for i in [0]*ps[-1]]
    for i in ps[:-1][::-1]:
        res = [res[:] for k in [0]*i]
    return res

H = [0] + H + [0]
dp = dpinit((N+2,K+2))

for i in range(1,N+2):
    for j in range(K+1):
        l = min(j+1,i)
        cand = [dp[i-k][j-k+1] + max(0, H[i]-H[i-k]) for k in range(1,l+1)]
        dp[i][j] = min(cand)

print(dp[N+1][K])



Measured memory_bytes: 45532
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <climits>
using namespace std;
int main(){
  int x[5];
  cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
  for(int i=0;i<5;i++){
    if(x[i]==0)cout << i+1 << endl;
  }
}


Measured memory_bytes: 3584
# -*- coding: utf-8 -*-

q = str(input())
a = str(input())

lst_q = list(q)
lst_a = list(a)
len_q = len(lst_q)
ok = 0
for i in range(len_q):
    if lst_q[i] == lst_a[i]:
        ok += 1
print(ok)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
        #define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
        #define ll long long
        //pair<int, int> *p=new pair<int, int>[n];
        //std::vector<pair<int,int>> vp;
        //v.push_back(make_pair(x,y))
        //pair<int, int> p[1001];
        //string *s=new string [n];
         
        //int freq[e];
        //freq[a[i]-'a']++; freq[a[i]]++;
        using namespace std;  
            ll t,n,c,c2,c3,sum,m,mn,k,r;
     
        int main(void)
        {
            SpeeD;  
            cin>>n>>r;
  
 
      while(n>=r)
      {
              c++;
              n/=r;
      }
      cout<<c+1;
  }

Measured memory_bytes: 256
#%%
def ceil(x, y):
    if x % y == 0:
        return x//y
    else:
        return x//y+1

N = int(input())
A = [0] * N
for i in range(N):
    A[i] = list(map(int ,input().split()))

#print('----------')

tmp1 = A[0][0]
tmp2 = A[0][1]
#print(tmp1, tmp2)

for i in range(1, N):
    a = ceil(tmp1,A[i][0])
    b = ceil(tmp2,A[i][1])
    c = max(a, b)    
    tmp1 = A[i][0] * c
    tmp2 = A[i][1] * c
#    print(tmp1, tmp2)

ans = (tmp1 + tmp2)
print(ans)











#%%


Measured memory_bytes: 3188
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			int w = sc.nextInt();
			if(n==0 && w==0) break;
			
			int[] a = new int[12];
			int maxw = 0;
			int maxv = 0;
			for(int i=0;i<n;i++){
				int v = sc.nextInt();
				a[v/w]++;
				maxw = Math.max(maxw, v/w);
				maxv = Math.max(maxv, a[v/w]);
			}
			
			double sum = 0.01;
			for(int i=0;i<=maxw;i++){
				sum += ((double)(maxw-i)/maxw)*((double)a[i]/maxv);
			}
			System.out.println(sum);
		}	
	}	
}

Measured memory_bytes: 23660
import collections as c

n = int(input())
alist = [input() for i in range(n)]

clist = c.Counter(alist)
anlist = clist.most_common()
anslist = []
for i in range(0,len(anlist)):
    if anlist[0][1] == anlist[i][1]:
        anslist.append(anlist[i][0])
anslistt = sorted(anslist)

for i in (anslistt):
    print(i)

Measured memory_bytes: 49208
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (decltype(a) i=(a); i<(b); ++i)
#define iter(it,c) for (decltype((c).begin()) it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = ~(1<<31); // 2147483647

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) { return (a % b + b) % b; }

int main()
{
    int n;
    string s, t;
    cin >> n >> s >> t;
    int res = s.size();
    for(size_t i = t.size() > s.size() ? 0 : s.size()-t.size(); i <= s.size(); i++)
    {
        bool flag = true;
        for(size_t j = 0; flag && j < s.size()-i; j++)
        {
			//cout << i << " " << j << " " << s[i+j] << " " << t[j] << endl;
            if(t[j] != s[i+j]) flag = false;
        }
        if(flag)
		{
			res = i;
			break;
		}
    }

    cout << res+n << endl;
    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*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, A, B;
    cin >> N >> A >> B;
    cout << min(N*A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <bitset>
#include <math.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
#define MOD 1000000007;
#define INF 1000000001

class Tree
{
	public:
//		Tree(int _root);
		int root;
		vector<int> next;
		int value = 0;
};


vector<vector<char>> C;
	

int main(void) {
	
	int H,W;
	inp(H);
	inp(W);
	C.assign(H, vector<char>(W));
	rep(i,H)rep(j,W){
		char a;
		inp(a);
		C[i][j] = a;
	}
	vector<vector<int>> dp(H,vector<int>(W,0));
	dp[0][0] = 1;

	rep(i,H)rep(j,W){
		if(i==0&&j==0) continue;
		if(C[i][j]=='#') continue;
		if(i!=0){
			if(C[i-1][j]=='.'){
				dp[i][j] += dp[i-1][j];
				dp[i][j] %= MOD;
			}
		}
		if(j!=0){
			if(C[i][j-1]=='.'){ 
				dp[i][j] += dp[i][j-1];
				dp[i][j] %= MOD;
			}
		}
	}		
// 	rep(i,H){
//		rep(j,W) printf("%3d ",dp[i][j]);
//		cout << endl;
//	}	 
	out(dp[H-1][W-1]);
}


Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const int INF=1000000007;
int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> v(n);
    vector<ll> dp(n);
    for (int i=0;i<n;i++) {
      cin >> v[i];
      dp[i]=INF;
    }
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);
    for (int i=2;i < n;i++){
      for (int w=1; w <= k;w++){
        if (i-w >= 0) dp[i]=min(dp[i],dp[i-w]+abs(v[i]-v[i-w]));
        else break;
      }
    }
    cout << dp[n-1] << endl;
    
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define nl '\n'
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 1e6;

int arr[N+5];
ll n;
int ans=0;
int num_prime = 0;


int main(){
    AC
    cin>>n;
    ll twos = 2;
    while(n%twos==0){
        n/=twos;
        twos*=2;
        ans++;
    }
    while(n%2==0)
        n/=2;

    for(int i=3; i<=sqrt(n); i+=2){
        if(n%i==0){
            // i is prime
            ll p = i;
            while(n%p==0){
                n/=p;
                p*=i;
                ans++;
            } 
            while(n%i==0)
                n/=i;
        }
    }
    if(n>2)
        ans++;
    cout<<ans<<endl;
}

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

int n;

int main(void){
    cin >> n;
    vector<lli> L(n);
    rep(i, n) cin >> L[i];
    lli ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            for(int k = j+1; k < n; k++){
                if(L[i] != L[j] && L[j] != L[k] && L[k] != L[i]
                &&L[i] + L[j] > L[k] 
                && L[j] + L[k] > L[i] 
                && L[k] + L[i] > L[j]) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  string a;
  ll Q,count=0;
  cin>>a>>Q;
  deque<char> dq(0);
  for(ll i=0;i<a.size();i++){
    dq.push_back(a.at(i));
  }
  vector<ll> t(Q),f(Q);
  vector<char> c(Q);
  for(ll i=0;i<Q;i++){
    cin>>t.at(i);
    if(t.at(i)==1){}
    else{cin>>f.at(i)>>c.at(i);}
  }
  bool direct=true;
  for(ll i=0;i<Q;i++){
    if(t.at(i)==1){direct=!direct;}
    else{count++;
         if(f.at(i)==1 && direct==true){dq.push_front(c.at(i));}
         else if(f.at(i)==2 && direct==true){dq.push_back(c.at(i));}
         else if(f.at(i)==1 && direct==false){dq.push_back(c.at(i));}
         else{dq.push_front(c.at(i));}
    }
  }
  if(direct){
    for(ll i=0;i<a.size()+count;i++){cout<<dq.front();dq.pop_front();}
  }else{
    for(ll i=0;i<a.size()+count;i++){cout<<dq.back();dq.pop_back();}
  }
}

Measured memory_bytes: 4224
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


def solve(N):
    return N // 3


def main():
    N = int(input())
    print(solve(N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4424
#include <bits/stdc++.h>
using namespace std;
 
typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>          vll;

#define ff                  first
#define sf                  scanf
#define pf                  printf
#define ss                  second
#define ppb                 pop_back
#define pb                  push_back
#define MP                  make_pair
#define MAXN                10000
#define MOD                 100000007
#define inf                 0x3f3f3f3f
#define PI                  (2.0*acos(0.0))
#define INF                 0x3f3f3f3f3f3f3f3f
#define rev(v)              reverse(all(v))
#define all(v)              v.begin(), v.end()
#define __lcm(x, y)         (x * y) / __gcd(x, y)
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define si(n)               scanf("%d", &n)
#define sl(n)               scanf("%lld", &n)
#define sii(a, b)           scanf("%d %d", &a, &b)
#define sll(a, b)           scanf("%lld %lld", &a, &b)
#define siii(a, b, c)       scanf("%d %d %d", &a, &b, &c)
#define slll(a, b, c)       scanf("%lld %lld %lld", &a, &b, &c)
#define siiii(a, b, c, d)   scanf("%d %d %d %d", &a, &b, &c, &d)
#define sllll(a, b, c, d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl;}

int main(){
        char ch; scanf("%c", &ch);
        if(ch >= 'a'){
        	cout << "a" << endl;
        } else {
        	cout << "A" << endl;
        }

    return 0;
}

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

using namespace std;

int main () {
  int n; cin >> n;
  vector<int> vec;
  int dp[n+20];
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    vec.push_back(h);
    dp[i] = 2000000000;
  }
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    if (abs(vec[i] - vec[i+1]) + dp[i] < dp[i+1])
      dp[i+1] = abs(vec[i] - vec[i+1]) + dp[i];
    if (abs(vec[i] - vec[i+2]) + dp[i] < dp[i+2])
      dp[i+2] = abs(vec[i] - vec[i+2]) + dp[i];
  }
  printf("%d\n", dp[n-1]);
}

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

int main() {
    int n;
    cin >> n;
    int a[n], b[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= i + 1;
        b[i] = a[i];
    };
    nth_element(b, b + n / 2, b + n);
    long long result = 0;
    for (int i = 0; i < n; i++) {
        result += abs(a[i] - b[n / 2]);
    }
    cout << result;
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define int long long
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)

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

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int t[17][17];

int dp[1 << 16];

signed main()
{
    int N;
    
    while (cin >> N, N) {
        rep(i, N) rep(j, N + 1) cin >> t[i][j];

        rep(i, 1 << N) dp[i] = inf;

        dp[0] = 0;

        rep(i, 1 << N) {
            rep(j, N) {
                if (i & (1 << j)) continue;
                int bit = i | (1 << j);

                int mi = t[j][0];
                rep(k, N) {
                    if (i & (1 << k)) {
                        chmin(mi, t[j][k + 1]);
                    }
                }

                chmin(dp[bit], dp[i] + mi);
            }
        }

        cout << dp[(1 << N) - 1] << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()
#define ADD(a, b) a = (a + b) % MOD

ll dp[100000][2];

int main() {
  string L;
  cin >> L;
  int N = L.size();
  dp[0][0] = 1;
  REP(i, N) {
    ADD(dp[i + 1][1], 3 * dp[i][1]);
    if (L[i] == '1') {
      ADD(dp[i + 1][0], 2 * dp[i][0]);
      ADD(dp[i + 1][1], dp[i][0]);
    } else {
      ADD(dp[i + 1][0], dp[i][0]);
    }
  }
  cout << (dp[N][1] + dp[N][0]) % MOD << endl;
  return 0;
}


Measured memory_bytes: 2048
import math
N = int(input())
S = list(map(int,input().split()))

Q = int(input())
T = list(map(int,input().split()))


ans = 0
for i in range(Q):
    left = 0
    right = N-1
    key = T[i]
    
    while left <= right:
        mid =(left+right)//2

        if S[mid] == key:
            ans += 1
            break
        elif S[mid] < key:
            left = mid+1

        else:
            right = mid-1
        
print(ans)



Measured memory_bytes: 16772
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        TreeSet set = new TreeSet<>();
        for (int i = 0; i < n; i++) set.add(sc.nextLine());
        System.out.println(set.size());
    }
}

Measured memory_bytes: 80364
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M, Q := getInt(), getInt(), getInt()
	n := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		n[i] = make([]int, N+1)
	}
	for i := 0; i < M; i++ {
		l, r := getInt(), getInt()
		n[l][r]++
	}
	// for i := 0; i <= N; i++ {
	// 	out(n[i])
	// }
	// out("----")
	for i := 1; i <= N; i++ {
		for j := i + 1; j <= N; j++ {
			n[i][j] += n[i][j-1]
		}
	}
	// for i := 0; i <= N; i++ {
	// 	out(n[i])
	// }
	var dp [550][550]int
	var calced [550][550]bool
	for i := 0; i < Q; i++ {
		p, q := getInt(), getInt()
		if calced[p][q] == true {
			out(dp[p][q])
			continue
		}
		ans := 0
		// out("pq", p, q)
		for j := p; j <= q; j++ {
			// out(j, j, n[j][p-1], n[j][q])
			ans += n[j][q] - n[j][p-1]
		}
		// out("-----", ans)
		out(ans)
		calced[p][q] = true
		dp[p][q] = ans
	}
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}

const ll MOD = 1e9+7;
long long Comb(int n, int i){long long ans = 1; if(i>n || i < 0) return 0; if(i == 0 || i == n) return 1; else {for(int j = 1; j <= i; ++j){ans *=(n+1-j); ans /= j; ans %= MOD;} }return ans;}

void solve(){
  string s; cin >> s;
  ll ans = 0;

  for(int i = 0; i < s.size(); ++i){
    ans += s[i]-'0';
    ans %= 9;
  }

  if(ans == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1073741823;
const ll LINF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if(a+b>=k)
		cout << min(a,k) << endl;
	else
		cout << a-(k-a-b) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#define MAX 53

const long long MOD = 1000000007;
using namespace std;

char a[MAX];
bool b[MAX];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	a[n+1] = '&';
	a[0] = '%';
	long long cnt = 1;
	int i = 1;
	if (a[i] != a[i+1]) {
		b[i] = 1;
		i++;
		cnt = 3;
	}
	else {
		b[i + 1] = 0;
		i += 2;
		cnt = 6;
	}
	while (i <= n) {
		if (a[i] != a[i + 1]) {
			if (b[i - 1] == 1) {
				cnt = (cnt * 2) % MOD;
			}
			b[i] = 1;
			i++;
		}
		else {
			if (b[i - 1] == 1) {
				cnt = (cnt * 2) % MOD;
			}
			else {
				cnt = (cnt * 3) % MOD;
			}
			b[i + 1] = 0;
			i += 2;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b;
	cin >> a >> b;
	int ans = (a + 1)*(b + 1) - (2 * a + 2 * b);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
a,b,c = gets.split.map &:to_i

if a > c
    temp = a
    a = c
    c = temp
end

if a > b
    temp = a
    a = b
    b = temp
end

if b > c
    temp = b
    b = c
    c = temp
end

print a
print " "
print b
print " "
puts c


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

int N;
int dp[101010][3];
int ans = 0;

int main(){
    cin >> N;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < 3; j++){
            int a;
            cin >> a;
            for(int k = 0; k < 3; k++){
                if(j == k)continue;
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + a);
            }
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func solve(x int64) int64 {

	v := int64(100)
	ret := int64(0)
	for ; v < x; {
		v += v / 100
		ret ++
	}
	return ret
}

func main() {
	defer out.Flush()

	x := nextInt()
	res := solve(x)
	fmt.Fprintln(out, res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  ll m;
  cin >> m;
  ll p=0;
  ll o=-1;
  rep(i,m){
    ll d,c;
    cin >> d >> c;
    o+=c;
    p+=d*c;  
  }
  cout << o+(p-1)/9 << endl;
}


Measured memory_bytes: 3620