akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define forn(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define PrintArray(a,n) for(int i=0;i<n;i++) cout << a[i] << " "; cout << endl;
#define CopyArray(a,temp,n) for(int i=0;i<n;i++) temp[i]=a[i];
#define InputArray(a,n) for(int i=0;i<n;i++) cin >> a[i];
#define MAX(a,b,c) max(max(a,b),c)
#define SumInRange(a,b) ((b*(b+1))/2)-(((a-1)*(a))/2)
#define Different_Random srand(time(NULL))
#define Random(a,b) (rand()%((b+1)-a))+a
#define __delete(v,n) v.erase(remove(v.begin(),v.end(),n),v.end())

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)
#define newline cout << "\n";

#define read(x)    freopen(#x, "r", stdin)
#define write(x)   freopen(#x, "w", stdout)

#define all(x)     x.begin(), x.end()
#define dbg(args...)    {string sss(#args);sss+=',';cerr<<"-->";debugger::call(all(sss), args);cerr<<"\n";}
#define dbgA(A, n)      {cerr<<"-->"<<#A<<"=(";forn(i, n)cerr<<A[i]<<" ";cerr<<")\n";}
#define dbgA2(A, n, m)  {cerr<<"-->"<<#A<<"=\n";forn(i, n){forn(j, m){cerr<<setw(4)<<A[i][j]<<" ";}cerr<<"\n";}cerr<<"\n";}

struct debugger{
    typedef string::iterator si;
    static void call(si it, si ed) {}
    template<typename T, typename ... aT>
    static void call(si it, si ed, T a, aT... rest) {
        string b;
        for(; *it!=','; ++it) if(*it!=' ')b+=*it;
        cerr << b << " = " << a << " ";
        call(++it, ed, rest...);
    }
};

template<typename T>
T Max(T a) {return a;}

template<typename T, typename... Args>
T Max(T a, Args... args){ return a > Max(args...)? a : Max(args...);}

template<typename T>
T Min(T a) {return a;}

template<typename T, typename... Args>
T Min(T a, Args... args){ return a < Min(args...)? a : Min(args...);}


//int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
//int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
//int knight_x[] = {2, 2, -2, -2, 1, 1, -1, -1};
//int knight_y[] = {1, -1, 1, -1, 2, -2, 2, -2};

/*
cout.precision(x);
cout << fixed;
*/

typedef long long int ll;
typedef unsigned long long int ull;
const double GOLD = (1.0 + sqrt(5.0))/2.0;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI = 3.141592653589793;
const double E = 2.718281828459045;

ll expo(ll a, ll n)
{
    ll result = 1;
    while(n)
    {
        if(n%2) result*=a;
        a*=a; n/=2;
    }
    return result;
}

ll mod_expo(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int main()
{
    #ifdef TarekHasan
        read(input.txt);
    #endif // TarekHasan
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    long long int n; cin >> n;
    vector< long long int > v(n);

    for(int i=0;i<n;i++) cin >> v[i];

    long long int money = 1000;

    for(int i=0;i<n-1;i++)
    {
        long long int stock = 0;

        if(v[i]<v[i+1])
            stock = money/v[i];
        money+=((v[i+1]-v[i])*stock);
    }
    cout << money << endl;

    cerr << "time = " << clock() << " ms" << '\n';
    return 0;
}



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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VL a(n);
	ll sm = 0;
	rep(i, n){cin >>a[i]; sm ^= a[i];}
	rep(i, n){
		cout << (sm ^ a[i]) <<" ";
	}
	cout <<"\n";
	return 0;
}


Measured memory_bytes: 4768
#include<bits/stdc++.h>
#define N 310
using namespace std;
vector<int> r[N];
int n,f[N],q[N],t,fa[N],sz[N],MX[N];
void dfs(int x){
	++f[x];sz[x]=0;
	for(int i=0,_E_=r[x].size();i<_E_;++i){
		int y=r[x][i];if(y==fa[x])continue;
		fa[y]=x;f[y]=f[x];++sz[x];dfs(y);
	}
}
void find(int nn){
	fa[1]=0;f[1]=0;dfs(1);
	int mx=0;
	for(int i=1;i<=nn;++i)if(f[i]>f[mx])mx=i;
	f[mx]=0;fa[mx]=0;dfs(mx);
	for(int i=1;i<=nn;++i)if(f[i]>f[mx])mx=i;
	t=0;for(;mx;mx=fa[mx])q[++t]=mx;
}
long long calc1(int nn){
	for(int i=1;i<=nn;++i)MX[i]=1;
	long long ans=1;
	int x=q[t+1>>1];
	fa[x]=0;f[x]=0;dfs(x);
	for(int i=1;i<=nn;++i)MX[f[i]]=max(MX[f[i]],sz[i]);
	for(int i=1;i<=nn;++i)ans*=MX[i];
	return ans;
}
long long calc2(int nn){
	for(int i=1;i<=nn;++i)MX[i]=1;
	int x=q[t>>1],y=q[t+2>>1];
	fa[x]=y;fa[y]=x;f[x]=f[y]=0;dfs(x);dfs(y);
	for(int i=1;i<=nn;++i)MX[f[i]]=max(MX[f[i]],sz[i]);
	long long ans=2;
	for(int i=1;i<=nn;++i)ans*=MX[i];
	return ans;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)MX[i]=1;
	for(int i=1;i<n;++i){
		int x,y;scanf("%d %d",&x,&y);
		r[x].push_back(y);r[y].push_back(x);
	}
	find(n);int TT=t+1>>1;
	long long ans;
	if(t&1){
		ans=calc1(n);
		for(int i=1;i<=n;++i){
			int T=n,ls=i;
			for(;++T;){
				r[ls].push_back(T);
				r[T].push_back(ls);
				ls=T;
				find(T);if((t+1>>1)>TT)break;
				ans=min(ans,(t&1)?calc1(T):calc2(T));
			}
			for(;T>n+1;--T)r[T].pop_back(),r[T-1].pop_back();
			r[T].pop_back();r[i].pop_back();
		}
	}else{
		ans=calc2(n);
	}
	printf("%d %lld",TT,ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin >> n;set<string > s;
    for (int i = 0; i < n; ++i)
    {
        string d;cin >> d;s.insert(d);
    }
    cout << s.size() ;
    }

Measured memory_bytes: 19200
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
ll longinf=(1ll<<60);

string maximum(string s,string t){
      if(s.size()>t.size()) return s;
      else if(t.size()>s.size()) return t;
      else{
            if(s>=t) return s;
            else return t;
      }
}

int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      double ans=0;
      ll n;
      cin>>n;
      double x[n];
      string u[n];
      rep0(i,n){
            cin>>x[i]>>u[i];
      }
      rep0(i,n){
            if(u[i][0]=='B'){
                  ans+=(380000.0)*x[i];
            }
            else{
                  ans+=x[i];
            }
      }
      cout<<shosu<<ans<<endl;
      return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,a[2000000+10],ans=2100000000;
long long aa=0,bb=0,s;
int main()
{
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    cin>>a[i];
    aa+=a[i];
  }
  for(int i=1;i<n;i++)
  {
    aa-=a[i];
	bb+=a[i];
	s=abs(aa-bb);
	if(s<ans)ans=s;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

// 2^10　全パターンを試す

int main() {
    ll n; cin >> n;
    vector<Vl> f(n, Vl(10));
    rep(i, 0, n){
        rep(j, 0, 10) cin >> f[i][j];
    }
    vector<Vl> p(n, Vl(11));
    rep(i, 0, n){
        rep(j, 0, 11) cin >> p[i][j];
    }

    ll ans = -INF;

    for(int tmp = 1; tmp < (1 << 10); tmp++){
        bitset<10> s(tmp);

        Vl cnt(n, 0);
        rep(i, 0, n){
            rep(j, 0, 10){
                if(s.test(j) && f[i][j]) cnt[i]++;
            }
        }

        ll sum = 0;
        rep(i, 0, n){
            sum += p[i][cnt[i]];
        }

        chmax(ans, sum);

    }
    co(ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long

int main() {
	int N;
	cin >> N;
	vector<int> X(N);
	for (int i = 0;i < N;i++) {
		cin >> X[i];
	}
	ll ans = 0;
	for (int i = 0;i < N;i++) {
		for (int j = i + 1;j < N;j++) {
			ans += X[i] * X[j];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
t = 1
n,k = map(int,input().split())
a = [int(x) for x in input().split()]
f = [0] * n
c = 0
d = 0
e = 0
#ループしてるとこを見つける
for i in range(k):
    if (f[t-1] == 1):
        d = 1
        break
    f[t-1] = 1
    t = a[t-1]
    e = e + 1 # ループが1回終わるまでの回数

#ループがあったら
b = t
if(d == 1):
    for i in range(k):
        t = a[t-1]
        c = c + 1
        if t == b:#ループしている範囲を摘出
            break
    e = e - c #ループが始まる場所、原点
    k = (k - e)%c #ループが始まるとこから最後までのループ回数減らす
    k = k + e #ループが始まる場所とループを抜き取ったやつをたす

t = 1
for i in range(k):
    t = a[t-1]
print(t)

Measured memory_bytes: 32316
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BABC solver = new BABC();
        solver.solve(1, in, out);
        out.close();
    }

    static class BABC {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            String st = s.next().replace("BC", "D");
            char c[] = st.toCharArray();
            int n = c.length, cur;
            long ans = 0, curans, cnt;
            for (int i = 0; i < n; ) {
                if (c[i] == 'A') {
                    cur = i;
                    curans = 0;
                    cnt = 0;
                    while (cur < n && (c[cur] == 'A' || c[cur] == 'D')) cur++;
                    for (int j = i; j < cur; j++) {
                        if (c[j] == 'A') cnt++;
                        else curans += cnt;
                    }
                    ans += curans;
                    i = cur;
                } else i++;
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 33436
#include<iostream>

#define ll long long

using namespace std;

int main(){
   int n, m, dif;
   ll b, s, ans = 1;

   cin >> n >> m;
   b = max(n, m);
   s = min(n, m);
   dif = b - s;

   if(dif >= 2){
      ans = 0;
   }else if(dif == 1){
      while(s > 0){
         ans *= s--;
         ans %= 1000000007;
      }
      ans *= ans;
      ans %= 1000000007;
      ans *= b;
      ans %= 1000000007;

   }else{
      while(s > 0){
         ans *= s--;
         ans %= 1000000007;
      }
      ans *= ans;
      ans %= 1000000007;
      ans *= 2;
      ans %= 1000000007;
   }

   cout << ans << endl;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
int main(){
    ll N;
    cin >> N;
    vl H(N);
    for(int i = 0; i < N; i++){
        cin >> H[i];
    }
    vector<bool> A(N);
    A.at(0) = 1;
    for(int i = 0; i < N - 1; i++){
        if(A.at(i)){
            if(H.at(i) <= H.at(i + 1) - 1){
                H.at(i + 1)--;
                A.at(i + 1) = 1;
            }
            else if(H.at(i) == H.at(i + 1)){
                A.at(i + 1) = 1;
            }
        }
        else{
            A.at(i + 1) = 0;
        }
    }
    if(A.at(N -1)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl; 
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int cnt, m;
vi gs;

void insertionSort(vi& a, int g) {
    for (int i = g; i < a.size(); i++) {
        int v = a[i];
        int j = i - g;
        while (j >= 0 && a[j] > v) {
            a[j + g] = a[j];
            j = j - g;
            cnt++;
        }
        a[j + g] = v;
    }
}

void shellSort(vi& a) {
    for (int i = 0; i < m; i++) {
        insertionSort(a, gs[i]);
    }
}

void printvec(vi& x, int size = 0) {
    cout << x.front();
    for (int i = 1; i < (size == 0 ? x.size() : size); i++) {
        cout << " " << x[i];
    }
    cout << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    int n;
    cin >> n;
    vi as;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        as.push_back(a);
    }
    m = 1;
    gs.push_back(1);
    while (1) {
        if (gs.back() * 2 <= n) {
            m++;
            gs.push_back(gs.back() * 2);
        } else {
            break;
        }
    }
    reverse(gs.begin(), gs.end());
    shellSort(as);
    cout << m << endl;
    printvec(gs);
    cout << cnt << endl;
    for (int a: as) {
        cout << a << endl;
    }
}


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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    ll N;
    int K;

    cin >> N >> K;

    int digit = 0;
    while(N){
        N/=K;
        digit++;
    }
    cout << digit << endl;
    return 0;
}

Measured memory_bytes: 256
#   1~n?????§?????????3????????°???????¶??????????????????°???x????????????????????°????±???????????????°??????
while 1:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    ansCount = 0
    for i in range(1, n + 1):
        for j in range(i, n + 1):
            for k in range(j, n + 1):
                if i + j + k == x and i != j and i != k and j != k:
                    ansCount += 1
                    #   print("{0} {1} {2}".format(i, j, k))
    print("{0}".format(ansCount))

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll ans = 1;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(a[i] > MOD){
      cout << -1 << endl;
      return 0;
    }
  }
  sort(a.begin(), a.end());
  for(int i = 0; i < n; i++){
    if(a[i] == 0){
      cout << 0 << endl;
      return 0;
    }else if(a[i] > MOD / ans){
      cout << -1 << endl;
      return 0;
    }
    ans *= a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    int n;
    cin>>n;int ans=0;
    for(int i=2;i<=sqrt(n);i++)
    {   int x=0;int x1;
        while(n%i==0){n/=i;x++;}
        if(x==0)continue;
        int j=sqrt(x)-1;
        while(true)
        {
        	if(j>=0)
        	{
        		if((j*(j+1))/2<=x)x1=j;
        		else break;
        	}
        	j++;
        }
        ans+=x1;
    }
    if(n!=1)ans++;
    cout<<ans<<endl;
    
}


return 0;
}





Measured memory_bytes: 3696
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
const int dm = 1400000;
char dn[dm], * di = dn;
const int MAX = 20000;
class unko {
public:
	char C[MAX * 6 + 10];
	int K[MAX + 10];
	constexpr unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[0] = 0;
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
};
constexpr unko f;
inline void putint(int X) {
	if (X > 20000) {
		int ue = X / 10;
		for (int i = f.K[ue]; i < f.K[ue + 1]; i++)* di++ = f.C[i];
		*di++ = '0' + (X - ue * 10);
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

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


	int N = getint(), K = getint();

	int A[200001];
	rep(i, N) A[i] = getint();
	ll owa = ll(N) * N;

	rep(p, K) {
		int B[200001] = {};
		rep(i, N) {
			B[max(0, i - A[i])]++;
			B[min(N, i + A[i] + 1)]--;
		}
		ll kei = B[0];
		A[0] = B[0];
		rep1(i, N - 1) {
			kei += (A[i] = A[i - 1] + B[i]);
		}
		if (kei == owa) break;
	}

	rep(i, N) putint(A[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

using namespace std;

int main (){
	int a,b;
while(cin >> a >> b){
	if(a == 0 && b == 0) break; 
		for(int y = 1;y <= b;y++){
			cout << "#";
		}
		for(int h = 1;h <= (a-2);h++){
		cout << endl << "#";
		for(int x = 1;x <= (b - 2);x++)cout << ".";
		cout << "#";
		}
		cout << endl;
		for(int y = 1;y <= b;y++){
		cout << "#";
		}

	cout << endl << endl;

}
return 0;
}

Measured memory_bytes: 3064
r, c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(r)]

for i in range(r):
    a[i].append(sum(a[i]))

na = []
for i in range(c + 1):
    na.append(sum([j[i] for j in a]))
a.append(na)

for i in range(r + 1):
    print(*a[i])



Measured memory_bytes: 6232
import numpy as np
nmax = 8
graph = np.array([[False]*nmax]*nmax)
 
n, m = map(int, input().split())
for i in range(m):
    a, b = map(int, input().split())
    graph[a-1][b-1] = graph[b-1][a-1] = True
    
visited = [False]*nmax
visited[0] = True
 
def dfs(v, n, visited): # v：今訪れた頂点
    all_visited = True
    for i in range(n):
        if visited[i] == False:
            all_visited = False
 
    if all_visited:
        return 1 #1通り
    
    ret = 0 #最初は0通り
    
    for i in range(n):
        if graph[v][i] == False: #vからiに行けない場合は除外
            continue
        if visited[i]: #iを訪問済みだったら行かない
            continue
        
        visited[i] = True #vからiに訪問
        ret += dfs(i, n, visited) #今iにいる時の次の動作
        visited[i] = False #iではないところにいくケース
        
    return ret
  
print(dfs(0, n, visited))

Measured memory_bytes: 12504
#include <stdio.h>

int main(){
    int x, div, resto, hap = 0, mil, restod, dezena;
    scanf("%d", &x);

    if(x < 500){
        div = x / 5;
        hap = div * 5;
        printf("%d", hap);
    }else{
        resto = x % 500;
        div = x / 500;
        mil = div * 1000;

        if(resto < 500){
        restod = resto / 5;
        dezena = restod * 5;
        hap = mil + dezena;
        printf("%d", hap);
            }
        }
        return 0;
    }




Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n, k;
  cin >> n >> k;
  k--;
  cout << n - k << endl;
}

Measured memory_bytes: 256
using System;
					
public class Program
{
	public static void Main()
	{
		ulong X = ulong.Parse(Console.ReadLine()); 
		/*
		string[] str = Console.ReadLine().Split(' ');
		int A = int.Parse(str[0]); 
      	int B = int.Parse(str[1]); 
		double num = A / K;
		double ans;
		int amari = A%K;
		*/
		ulong en = 100;
		ulong cnt=0;
		
		for(int i=0; en < X; i++){
			en = en + en/100;
			cnt++;
		}
		
		Console.WriteLine(cnt);
	}
}

Measured memory_bytes: 27516
import java.util.Scanner;
import java.util.HashMap;

public class Main {
    private static final int MAXN = 2 * (int)10e5, MAXA = (int)10e9;

    public static void main(String[] args) {
        var scanner = new Scanner(System.in);
        var n = scanner.nextInt();
        var dif = new HashMap<Long, Long>();
        var a = new int[n];

        for (int i = 0; i < n; ++i) {
            a[i] = scanner.nextInt();
            long key = i - a[i] + MAXA;
            if (!dif.containsKey(key)) {
                dif.put(key, 1L);
            } else {
                dif.put(key, dif.get(key) + 1L);
            }
        }

        Long count = 0L;
        for (int i = 0; i < n; ++i) {
            long key = i + a[i] + MAXA;
            if (dif.containsKey(key)) {
                count += dif.get(key);
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 73384
from itertools import product


D, G = map(int, input().split())
pc = [tuple(map(int, input().split())) for _ in range(D)]


ans = 1e9
for selected in product((True, False), repeat=D):
    tmp_score = 0
    tmp_count = 0
    rest_max = 0

    for i, is_select in enumerate(selected):
        if is_select:
            tmp_score += 100 * (i + 1) * pc[i][0] + pc[i][1]
            tmp_count += pc[i][0]
        else:
            rest_max = i

    if tmp_score < G:
        s1 = 100 * (rest_max + 1)
        need = (G - tmp_score + s1 - 1) // s1

        if need >= pc[rest_max][0]:
            continue

        tmp_count += need

    ans = min(ans, tmp_count)

print(ans)


Measured memory_bytes: 40816
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	std::string a,b,c;
	std::cin >> a >> b >> c;
	std::cout << a[0] << b[0] << c[0] << std::endl;
}

Measured memory_bytes: 256
/*
      Ashraful Islam Paran
      27-August-2020
      20:48:25
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(n) for (int i = 0; i < n; i++)
#define fo(i, x, n) for (int i = x; i < n; i++)
#define fb(i, x, n) for (int i = n - 1; i <= 0; i--)
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)

typedef unsigned long long ull;
typedef vector<long long> vi;
#define ull unsigned long long
#define msi map<string, long long>
#define mii map<long long, long long>
const int MX = 2e5 + 5;
const int INF = 1e18;
#define pb push_back
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define all(x) x.begin(), x.end()
#define ff first
#define ss second

int a[11] = {0};

int check(int n)
{
    while (n > 0)
    {
        int m = n % 10;
        if (a[m])
        {
            return 0;
        }
        n /= 10;
    }
    return 1;
}

int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    // online submission
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, k, x;
    cin >> n >> k;

    f(k)
    {
        cin >> x;
        a[x]++;
    }
    int y = n;
    while (1)
    {
        if (check(y))
        {
            break;
        }
        y++;
    }
    cout << y << endl;

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3768
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

typedef long long ll;
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 (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

#pragma endregion

int main() {
  int k = in();
  int ans = 0;
  reps(i, k) {
    reps(j, k) {
      reps(l, k) { ans += __gcd(__gcd(i, j), l); }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s, t;
  cin >> s >> t;
  int S1 = s.size(), T1 = t.size();
  vector<char> S(S1), T(T1);
  for (int i = 0; i < S1; i++) {
    S.at(i) = s.at(i);    
  }
  for (int i = 0; i < T1; i++) {
    T.at(i) = t.at(i);
  }
  sort(S.begin(), S.end());
  sort(T.begin(), T.end());
  reverse(T.begin(), T.end());
  for (int i = 0; i < S1; i++) {
    s.at(i) = S.at(i);
  }
  for (int i = 0; i < T1; i++) {
    t.at(i) = T.at(i);
  }
  if (s < t) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
    

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        int count = input.nextInt();
        String suit = null;
        int number = 0;
        int[] spade = new int[13];
        int[] heart = new int[13];
        int[] club = new int[13];
        int[] diamond = new int[13];
        int a = 0, b = 0, c = 0, d = 0;
        while(input.hasNext()){
            suit = input.next();
            number = input.nextInt();
            if(suit.compareTo("S") == 0){
                spade[a] = number;
                a++;
            }
            else if(suit.compareTo("H") == 0){
                heart[b] = number;
                b++;
            }
            else if(suit.compareTo("C") == 0){
                club[c] = number;
                c++;
            }
            else if(suit.compareTo("D") == 0){
                diamond[d] = number;
                d++;
            }
        }
        rank(spade, "S");
        rank(heart, "H");
        rank(club, "C");
        rank(diamond, "D");
    }
    
	public static void rank(int[] arr, String su) {
		int len = arr.length;
		int preIndex, current;
		for (int i = 1; i < len; i++) {
			preIndex = i - 1;
			current = arr[i];
			while (preIndex >= 0 && arr[preIndex] > current) {
				arr[preIndex + 1] = arr[preIndex];
				preIndex--;
			}
			arr[preIndex + 1] = current;
		}
		for(int i = 1; i <= 13; i ++ ){
  	        int cnt = 0;
  	        for (int j = 0; j < arr.length; j ++){
                if(arr[j] == i)
                    cnt = 1;
            }
            if(cnt == 0){
                System.out.print(su + " ");
                System.out.println(i);
            }
	    }
	}
 }


Measured memory_bytes: 26216
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<i64>();
    if n < 105 {
        println!("0");
    } else if n < 135 {
        println!("1");
    } else if n < 165 {
        println!("2");
    } else if n < 189 {
        println!("3");
    } else if n < 195 {
        println!("4");
    } else {
        println!("5");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <utility>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cmath>
         
typedef long long ll;
using namespace std;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
   
#define PI 3.14159265358979323846
         
const double EPS = 1e-8;
        
int main()
{
   	ll N,M,a,b;

	cin >> N >> M;

	vector<ll> rN(N,0);
	
	for(int i=0;i<M;i++){
		cin >> a >> b;
		rN[a-1]++;
		rN[b-1]++;
	}

	for(int i=0;i<N;i++){
		cout << rN[i] << endl;
	}

   	return 0;
}

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

int main()
{
  uint64_t n;
  cin >> n;
  vector<char> s;
  while (n != 0)
  {
    if (n % 26 == 0)
    {
      s.push_back('z');
      n/=26;
      n--;
    }
    else
    {
      s.push_back('`' + n % 26);
      n /= 26;
    }
  }

  reverse(s.begin(), s.end());
  for (auto c : s)
  {
    cout << c;
  }
  cout << endl;
}


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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
typedef long long ll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;
vector<int> ac;

int main(){
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    int l[q], r[q];
    rep(i,q){
        cin >> l[i] >> r[i];
    }

    int tmp=0, j=0;
    ac.push_back(0);
    rep(i,n){
        if(s[i]=='A'){
            tmp=1;
        }else if(s[i]=='C' && tmp==1){
            ac.push_back(i);
            tmp=0;
        }else{
            tmp=0;
        }
    }
    ac.push_back(100001);
    
    rep(i,q){
        auto position1 = upper_bound(ac.begin(), ac.end(), l[i]-1);
        auto position2 = upper_bound(ac.begin(), ac.end(), r[i]-1);
        cc(position2-position1);
    }
}

Measured memory_bytes: 2044
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    for (int i = 1; i < n; ++i) {
        A[i] += A[i - 1];
    }

    int total = A.back();
    int res = total;
    for (int i = 0; i < n; ++i) {
        res = min(res, abs(total - 2 * A[i]));
    }
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input(),input()]
mod = 10**9+7
i = 1 + (S[0][0]!=S[1][0])
ans = 3*i
while i<N:
    p = S[0][i-1]==S[1][i-1]
    if S[0][i] == S[1][i]:
        ans *= 1 + p
        i+=1
    else:
        ans *= 3 - p
        i+=2
    ans %= mod
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main()
{
string s;
cin >> s;

vector<string> w = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
rep(i,7){
    if(s== w[i]) cout << 7-i << endl;
}

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define F first
#define S second
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long 
#define ld long double
#define pii pair <int ,int >
#define bug(x)  cout<<"passed "<<x<<endl;
#define ashar(x , y , z) cout<<setprecision(x)<<fixed<<y ; if (z==1) cout<<"\n" ;
#define ppi pair <pair <int, int > , int > 
long long const inf = 3e18, linf = 2e9, mod = 1e9+7 , inf2 = 1e12;
int const mxn = 3e5 + 10 ;
 
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}
 

 
int main(){
	int h1 , h2 , m1 , m2 , k ; 
	cin>>h1>>m1>>h2>>m2>>k ; 
	int A = (h2 - h1) *60 + (m2 - m1) ; 
	cout<<A - k ; 
}



Measured memory_bytes: 3676
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-01-02 16:34:40
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

bool dp1[5050][5050];
bool dp2[5050][5050];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k; cin >> n >> k;
  vector<int> a(n); cin >> a;

  dp1[0][0] = 1;

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      if (dp1[i][j]) dp1[i + 1][j] = 1;
      if (j + a[i] > 5010) continue;
      dp1[i + 1][j + a[i]] |= dp1[i][j];
    }
  }

  dp2[0][0] = 1;

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      if(dp2[i][j]) dp2[i + 1][j] = 1;
      if (j + a[n - 1 - i] > 5010) continue;
      dp2[i + 1][j + a[n - 1 - i]] |= dp2[i][j];
    }
  }
/*
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      cerr << dp1[i][j] << " ";
    }
    cerr << '\n';
  }

  cerr << '\n';

  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      cerr << dp2[i][j] << " ";
    }
    cerr << '\n';
  }
*/
  int need = 0;

  for (int i = 1; i <= n; ++i) {
    int target = max(0, k - a[i - 1]);
    for (int j = target; j <= k - 1; ++j) {
      for (int l = 0; l <= j; ++l) {
        if (dp1[i - 1][l] && dp2[n - i][j - l]) {
          ++need;
          j = l = k + 5;
        }
      }
    }
  }

  cout << n - need << endl;

  return 0;
}

Measured memory_bytes: 49792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>
#include <set>

#define REP(i, n) for (int i=0;i<(n);i++)
#define FOR(i, a, b) for (int i=(a);i<(b);i++)

using namespace std;

int N, M;
int A[1000001];
int B[1000001];


int main()
{
    scanf("%d %d", &N, &M);
    REP(i, N)
        scanf("%d ", &A[i]);
    REP(i, M)
        scanf("%d ", &B[i]);
    sort(A, A+N);
    sort(B, B+M);
    long long int mod = 1000000007;
    int maxA = -1;
    int maxB = -1;
    REP(i, N) {
        if (maxA<A[i])
            maxA = A[i];
    }
    REP(i, M) {
        if (maxB<B[i])
            maxB = B[i];
    }
    bool flag = false;
    if (N>=2) {
        if (A[N-1]==A[N-2])
            flag = true;
    }
    if (M>=2) {
        if (B[M-1]==B[M-2])
            flag = true;
    }
    if (A[N-1] != B[M-1] || maxA!=N*M || flag) {
        cout << 0 << endl;
        return 0;
    } else {
        int row[1000001];
        int col[1000001];
        REP(i, 1000001) {
            row[i] = -1;
            col[i] = -1;
        }
        int mul = N*M;
        REP(i, N)
            row[A[i]] = i;
        REP(i, M)
            col[B[i]] = i;
        long long int ans = 1;
        for (int i=mul; i>0; i--) {
            auto ita = lower_bound(A, A+N, i);
            auto itb = lower_bound(B, B+M, i);
            if (row[i]!=-1 && col[i]!=-1) {
                ans = ans%mod;
            } else if (row[i]==-1 && col[i]!=-1) {
                ans *= (N-distance(A, ita));
                ans %= mod;
            } else if (row[i]!=-1 && col[i]==-1) {
                ans *= (M-distance(B, itb));
                ans %= mod;
            } else {
                //cout << N-distance(A, ita) << endl;
                //cout << M-distance(B, itb) << endl;
                ans *= (N-distance(A, ita))*(M-distance(B, itb))-(mul-i);
                ans = ans%mod;
            }
        }
        cout << ans << endl;



    }

    return 0;
}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#define li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define v(x)        vector<x>
#define int         long long
#define ar(x,y)     array<x,y>
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
/* template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; */

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

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}

struct dsu{
  unordered_map<int,int> pr,sz;
  dsu(){
    (this->pr).clear();
    (this->sz).clear();
  }
  void make(int x){
    pr[x] = x;
    sz[x] = 1;
  }
  int getpar(int x){
    if(pr[x] == x)return x;
    return pr[x] = getpar(pr[x]);
  }
  void merge(int x,int y){
    x = getpar(x);
    y = getpar(y);
    if(sz[x]<sz[y])swap(x,y);
    pr[y] = x;
    sz[x]+=sz[y];
    sz[y] = 0;
  }
};



void solve(){
  int l,r,d;
  cin>>l>>r>>d;
  int start = (l%d == 0 ? l/d : l/d+1);
  int end = r/d;
  cout<<end-start+1<<"\n";
}

signed main(){
    fastio();
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}


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

using namespace std;

int main() {
  int n;
  bool isMltTable = false;
  
  cin >> n;
  int a = 1;
  while (a < 10) {
    if ((n / a < 10) && (n % a == 0)) {
      isMltTable = true;
      break;
    }
    a++;
  }
  
  if (isMltTable) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     int a,b;
     cin>>a>>b;
     cout<<(a+b+1)/2<<endl;
     time();
     return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]
h.sort()
mini = 10 ** 10
for i in range(0, n - k + 1):
    temp = h[i + k - 1] - h[i]
    if temp < mini:
        mini = temp
print(mini)

Measured memory_bytes: 7384
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
ans = [a,b,c,d,e].select { |x| x%10 == 0 }.inject(:+).to_i
rem = [a,b,c,d,e].select { |x| x%10 != 0 }.sort { |x1, x2| x1 % 10 <=> x2 % 10}
if rem.size > 0
  ans += rem[0]
  rem.delete_at(0)
  if rem.size > 0
    ans += rem.map { |x| (x/10.0).ceil * 10 }.inject(:+)
  end
end
puts ans

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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 998244353 
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;

	string str1,str2;
	cin>>str1>>str2;
	int ans=0;

	for(int i=0;i<str1.size();i++){
		if(str1[i]==str2[i])
			ans++;
	}
	cout<<ans;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



bool f(int n, int a[], int k, int d) {
	vector<int> v(n);
	rep(i, n)v[i] = a[i] % d;
	sort(all(v));

	long long s1 = 0, s2 = 0;
	rep(i, n)s2 += d - v[i];
	
	rep(i,n) {
		s1 += v[i];
		s2 -= d - v[i];

		if (s1 == s2) {
			return s1 <= k;
		}
		if (s1 > s2)break;
	}
	return false;
}



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

	int n, k;
	int a[500];

	cin >> n >> k;
	rep(i, n)cin >> a[i];

	int s = 0;
	rep(i, n)s += a[i];
	s = abs(s);

	int ans = -1;
	for (int i = 1; i * i <= s; i++) {
		if (s % i == 0) {
			if (ans < s / i && f(n, a, k, s / i))
				ans = s / i;

			if (ans < i && f(n, a, k, i))
				ans = i;
		}
	}


	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256