akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

int main(void)
{
    int min, max, n, answer;
    scanf("%d %d %d", &min, &max, &n);
    answer = floor(max / n) - floor(min / n);
    min % n == 0? answer++:answer;
    printf("%d\n", answer);
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int A[N];
    
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    sort(A, A + N, greater<int>());
    
    cout << A[0] - A[N - 1] << endl;
}

Measured memory_bytes: 3644
n,m = map(int, input().split())
H = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
h = [1]*n

for i in range(m):
    if H[l[i][0]-1] > H[l[i][1]-1]:
        h[l[i][1]-1] = 0
    elif H[l[i][0]-1] < H[l[i][1]-1]:
        h[l[i][0]-1] = 0
    elif H[l[i][0]-1] == H[l[i][1]-1]:
        h[l[i][0]-1] = 0
        h[l[i][1]-1] = 0
ans=0
for i in range(n):
    if h[i] != 0:
        ans+=1
print(ans)

Measured memory_bytes: 31888
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    int N;
    cin >> N;
    unordered_map<string, bool> S;
    for (int i = 0; i < N; i++) {
        string tmp;
        cin >> tmp;
        S[tmp] = true;
    }
    cout << S.size();

    return 0;
}


Measured memory_bytes: 17688
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
//#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010
#define md 1000000007//998244353

#define pb push_back
#define _vcppunko4(tuple) _getname4 tuple
#define _getname4(_1,_2,_3,_4,name,...) name
#define _getname3(_1,_2,_3,name,...) name
#define _trep2(tuple) _rep2 tuple
#define _trep3(tuple) _rep3 tuple
#define _trep4(tuple) _rep4 tuple
#define _rep1(n) for(lint i=0;i<n;++i)
#define _rep2(i,n) for(lint i=0;i<n;++i)
#define _rep3(i,a,b) for(lint i=a;i<b;++i)
#define _rep4(i,a,b,c) for(lint i=a;i<b;i+=c)
#define _trrep2(tuple) _rrep2 tuple
#define _trrep3(tuple) _rrep3 tuple
#define _trrep4(tuple) _rrep4 tuple
#define _rrep1(n) for(lint i=n-1;i>=0;i--)
#define _rrep2(i,n) for(lint i=n-1;i>=0;i--)
#define _rrep3(i,a,b) for(lint i=b-1;i>=a;i--)
#define _rrep4(i,a,b,c) for(lint i=a+(b-a-1)/c*c;i>=a;i-=c)
template<class T>
istream& operator>>(istream& is,vector<T>& vec);
template<class T,size_t size>
istream& operator>>(istream& is,array<T,size>& vec);
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p);
template<class T>
ostream& operator<<(ostream& os,vector<T>& vec);
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p);
template<class T>
istream& operator>>(istream& is,vector<T>& vec){ for(T& x: vec) is>>x;return is; }
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p){ is>>p.first;is>>p.second;return is; }
//template<class T>
//ostream& operator<<(ostream& os,vector<T>& vec){ os<<vec[0];rep(i,1,vec.size())os<<' '<<vec[i];return os; }
//template<class T>
//ostream& operator<<(ostream& os,deque<T>& deq){ os<<deq[0];rep(i,1,deq.size())os<<' '<<deq[i];return os; }
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p){ os<<p.first<<" "<<p.second;return os; }

inline void in(){}
template <class Head,class... Tail>
inline void in(Head&& head,Tail&&... tail){ cin>>head;in(move(tail)...); }
template <class T>
inline bool out(T t){ cout<<t<<'\n';return 0; }
inline bool out(){ cout<<'\n';return 0; }
template <class Head,class... Tail>
inline bool out(Head head,Tail... tail){ cout<<head<<' ';out(move(tail)...);return 0; }

#define rep(...) _vcppunko4((__VA_ARGS__,_trep4,_trep3,_trep2,_rep1))((__VA_ARGS__))
#define rrep(...) _vcppunko4((__VA_ARGS__,_trrep4,_trrep3,_trrep2,_trrep1))((__VA_ARGS__))
#define lin(...) lint __VA_ARGS__;in(__VA_ARGS__)
#define stin(...) string __VA_ARGS__;in(__VA_ARGS__)
#define vin(type,name,size) vector<type> name(size);in(name)
#define fi i.first
#define se i.second

int main(){
	lin(n);
	vin(lint,a,n);
	liv s(n+1);
	map<lint,lint>ma;++ma[0];
	rep(i,n)s[i+1]=s[i]+a[i],++ma[s[i+1]];
	lint ans=0;
	for(auto i:ma)ans+=se*(se-1)/2;
	cout<<ans<<endl;
}

//sub-EOF


Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int a, b, c, d;
    cin>>a>>b>>c>>d;
    if (a + b < c + d) cout<<"Right"<<endl;
    else if (a + b > c + d) cout<<"Left"<<endl;
    else cout<<"Balanced"<<endl;
}

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

int main(void){
  int N, D;
  cin >> N >> D;
  int space[N][D];
  for(int i=0; i < N; i++){
      for(int j=0; j < D; j++){
          cin >> space[i][j];
      }
  }
  int count = 0;
  for(int i=0; i < N - 1; i++){
      for(int j=i + 1; j < N; j++){
          double d = 0;
          for(int k=0; k < D; k++){
              double diff = (space[i][k] - space[j][k]);
              d += (diff * diff);
          }
          d = sqrt(d);
          if(ceil(d) == floor(d)){
              count += 1;
          }
      }
  }
  cout << count;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ul;

const int iinf = 1 << 29;
const long long linf = 1l << 61;

int main(int argc, char* argv[])
{
	char X, Y;
	scanf("%c %c", &X, &Y);
	char ans;
	if(X < Y) ans = '<';
	if(X > Y) ans = '>';
	if(X == Y) ans = '=';
	printf("%c\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>


int main(int argc, char const *argv[])
{
    int a;
    scanf("%d", &a);
    int b;
    scanf("%d", &b);

    int prc;
    if(13 <= a){
        prc = b;
    }
    else if(6 <= a){
        prc = b/2;
    }
    else{
        prc = 0;
    }

    printf("%d\n", prc);



    
    return 0;
} 



Measured memory_bytes: 128
class UnionFind:
    def __init__(self,n):
        self.par=[i for i in range(n+1)]
        self.rank=[0]*(n+1)

    def find(self,x):
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            return self.par[x]
    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
            return
        if self.rank[x]<self.rank[y]:
            self.par[x]=y
        else:
            self.par[y]=x
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1
    def same_check(self,x,y):
        return self.find(x)==self.find(y)

n,m=map(int,input().split())
P=list(map(int,input().split()))
UF=UnionFind(n)
for _ in range(m):
    x,y=map(int,input().split())
    UF.union(x,y)
count=0
for i in range(n):
    if UF.same_check(i+1,P[i]):
        count+=1
print(count)

Measured memory_bytes: 14452
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
aj=0
xsum=0
mod1,mod2=10**9+7,998244353
mod=mod1
for j in range(1,n):
    aj=(aj+j*(x[j]-x[j-1])%mod)%mod
    xsum=(xsum+aj)%mod
bj=0
ysum=0
for j in range(1,m):
    bj=(bj+j*(y[j]-y[j-1])%mod)%mod
    ysum=(ysum+bj)%mod

print(xsum*ysum%mod)

Measured memory_bytes: 24464
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

struct zahyo{
    double x,y;
};

void solve(int n,zahyo a,zahyo b){
    if(n == 0) return;
    zahyo s,t,u;
    double rad = M_PI * 60.0 / 180.0;
    s.x = (2.0*a.x + b.x) / 3.0;
    s.y = (2.0*a.y + b.y) / 3.0;
    t.x = (a.x + 2.0*b.x) / 3.0;
    t.y = (a.y + 2.0*b.y) / 3.0;
    u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
    u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y; 
    
    solve(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    solve(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    solve(n-1, u, t);
    printf("%.8f %.8f\n",t.x,t.y);
    solve(n-1, t, b);
    
}
int main(){
    int n;
    zahyo a,b;
    a.x = 0.0;
    a.y = 0.0;
    b.x = 100.0;
    b.y = 0.0;
    scanf("%d", &n);
    printf("%.8f %.8f\n",a.x, a.y);
    solve(n,a,b);
    printf("%.8f %.8f\n", b.x, b.y);
    return 0;
}



Measured memory_bytes: 3208
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

vector<vector<int> > edge(100010);
vector<int> memo(100010);
int dfs(int ver) {
  if (memo[ver] != -1) return memo[ver];
  int res = 0;
  for (int e : edge[ver]) {
    res = max(res, dfs(e) + 1);
  }
  memo[ver] = res;
  return res;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, m; cin >> n >> m;
  REP(i, m) {
    int x, y; cin >> x >> y;
    --x;
    --y;
    edge[x].push_back(y);
  }
  REP(i, n) memo[i] = -1;
  int ans = 0;
  REP(i, n) ans = max(ans, dfs(i));
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 8192
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
#define MOD 1000000007
using namespace std;

typedef pair<int,int> P;

signed main(){
	int n,m,dp[302][302][302] = {1},ans = 0;
	cin >> n >> m;
	vector<P> vec[302];
	for(int i = 0;i < m;i++){
		int l,r,x;
		cin >> l >> r >> x;
		vec[r].push_back(P(l,x));
	}
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			for(int k = 0;k <= n;k++){
				int ma = max({i,j,k});
				for(P p : vec[ma]){
					int cnt = 0;
					if(p.first <= i) cnt++;
					if(p.first <= j) cnt++;
					if(p.first <= k) cnt++;
					if(cnt != p.second) dp[i][j][k] = 0;
				}
				if(ma == n) ans = (ans + dp[i][j][k]) % MOD;
				dp[ma + 1][j][k] = (dp[ma + 1][j][k] + dp[i][j][k]) % MOD;
				dp[i][ma + 1][k] = (dp[i][ma + 1][k] + dp[i][j][k]) % MOD;
				dp[i][j][ma + 1] = (dp[i][j][ma + 1] + dp[i][j][k]) % MOD;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    ll N, C, ans=0;
    cin>>N>>C;
    vector<ll>X(N+2, 0), V(N+2, 0);
    X[N+1]=C;
    for(int i=1;i<=N;i++){
        cin>>X[i]>>V[i];
    }
    vector<ll>CW(N+2, 0);
    for(ll i=1, cal=0;i<=N;i++){
        cal += (V[i] - X[i] + X[i-1]);
        ans = max(ans, cal);
        CW[i] = max(CW[i-1], cal - X[i]);
    }
    vector<ll>RW(N+2, 0);
    for(ll i=N, cal=0;i>=1;i--){
        cal += (V[i] + X[i] - X[i+1]);
        ans = max(ans, cal);
        ans = max(ans, cal + CW[i-1]);
        RW[i] = max(RW[i+1], cal - C + X[i]);
    }
    for(ll i=1, cal=0;i<=N;i++){
        cal += (V[i] - X[i] + X[i-1]);
        ans = max(ans, cal);
        ans = max(ans, cal + RW[i+1]);
        CW[i] = max(CW[i-1], cal - X[i]);
    }
    

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

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

template<int mod> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % mod) {
        if (val < 0) val += mod;
    }
    constexpr int getmod() { return mod; }
    constexpr Fp operator - () const noexcept {
        return val ? mod - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= mod) val -= mod;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += mod;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % mod;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = mod, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % mod;
        if (val < 0) val += mod;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr istream& operator >> (istream &is, const Fp<mod>& x) noexcept {
        int val; is >> val;
        x = Fp<mod>(val);
        return is;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<mod>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<mod> modpow(const Fp<mod> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

const int mod = 998244353;
using mint = Fp<mod>;

int main(){
    int n,s; cin >> n >> s;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<mint> c(s+1);
    c[0] = 1;
    rep(i,n){
        vector<mint> tmp = c;
        rep(j,s+1) c[j] = (mint)2*tmp[j];
        rep(j,s+1) if(a[i] + j <= s) c[a[i] + j] += tmp[j];
    }
    cout << c[s] << endl;
}


Measured memory_bytes: 3684
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    S = input()
    stack = deque([])
    left = 0
    for s in S:
        if s == "(":
            stack.append(s)
        else:
            if len(stack) == 0:
                left += 1
            else:
                _ = stack.pop()

    right = len(stack)
    ans = "(" * left + S + ")" * right
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
using namespace std;
inline int read(int f = 1, int x  = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 3e2+5;
int n, m, a[N][N], del[N], c[N], p[N], ans;
int main()
{
    ans = n = read(), m = read(), del[0] = 1;
    for(int i = 1; i <= n; ++i) 
        for(int j = 1; j <= m; ++j) 
            a[i][j] = read();
    for(int maxw = 0; m; maxw = 0)
    {
        memset(c+1, 0, sizeof(int)*m);
        for(int i = 1; i <= n; ++i) 
        {
            for( ; del[a[i][p[i]]]&&p[i] <= m; ++p[i]);
            ++c[a[i][p[i]]]; if(p[i] > m) return printf("%d\n", ans), 0;
        }
        for(int i = 1; i <= m; ++i) maxw = max(maxw, c[i]);
        ans = min(ans, maxw);
        for(int i = 1; i <= m; ++i) if(maxw == c[i]) del[i] = 1;
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <bitset>
#include <tuple>
#include <queue>
#include <map>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i <(int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i,k,n) for (int i = (int)(n)-1; i >= k; i--)
#define INF 1LL<<61
int main(){
    int n;
    cin >> n;
    int c[200100];
    int u[200100];
    ll dp[200100] = {};
    ll ddp[200100] = {};
    ddp[0] = 1;
    rep(i,200100) u[i]=-1;
    rep(i,n) cin >> c[i];
    rep(i,n){
        int num = c[i];
        if(u[num]!=-1){
            if(u[num]==i-1) {
                u[num]=i;
                dp[i] = dp[i-1];
                ddp[i] = ddp[i-1];
                continue;
            }
            int fn = u[num];
            if(fn<0) dp[i]=1+ddp[i-1];
            else dp[i] = dp[fn]+ddp[fn];
            ddp[i] = dp[i-1]+ddp[i-1];

            u[num]=i;
        }else{
            u[num]=i;
            if(i==0) continue;
            dp[i] = dp[i-1];
            ddp[i] = ddp[i-1];
        }
        dp[i]%=1000000007;
        ddp[i]%=1000000007;
    }
    cout << (dp[n-1]+ddp[n-1])%1000000007 << endl;
    return 0;
}
// rep(i,n){
//     if(a[c[i]].empty())
//         a[c[i]].push_back(i);
//     else if(a[c[i]].back()!=i-1)
//         a[c[i]].back() = i;
//     else
//         a[c[i]].push_back(i);
//         dp[i] = dp[i-1];
//
// }


Measured memory_bytes: 4992
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k;
  if (e - a <= k) cout << "Yay!" << endl;
  else           cout << ":(" << endl;
}


Measured memory_bytes: 3588
#include<iostream>
#include<string.h>

using namespace std;

bool appn[10000];
int main(){
	memset(appn,false,sizeof(appn));
	int n;
	cin >> n;
	int num[1000];
	for(int i = 0;i < n;i++){
		cin >> num[i];
	}

	for(int i = 0;i < n;i++){
		int an = 0;
		int dig = 1;
		for(int j = 0;j < 4;j++){
			if((i - j) >= 0){
				an += num[i - j] * dig;
				dig *= 10;
			}else{
				break;
			}
			appn[an] = true;
		}
	}
	
	for(int i = 0;i < 10000;i++){
		if(!appn[i]){
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}


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

#define ll long long int

#define Bit_off(val,pos)       (val & (~(1<<pos)))
#define Bit_on(val,pos)        (val | (1<<pos))
#define Bit_toggle(val,pos)    (val ^ (1<<pos))
#define Bit_check(val,pos)     (bool)(val & (1<<pos))
#define odd_even(val)          (bool)(val & 1)
#define koita_1_ase(val)       (__builtin_popcount(val))

ll ar[5000009],br[5000009],cr[5000009];
map<ll,ll>mp,mp1;
vector<ll>v;

//void seive()
//{
//    ll i,j;
//
//    for(i=3; i<=10000; i+=2)
//    {
//        if(Bit_check(status[i>>5],i%32)==0)
//        {
//            for(j=(i*i); j<=100000000; j+=(i<<1))
//            {
//                status[j>>5]=Bit_on(status[j>>5],j%32);
//            }
//        }
//    }
//    for(i=3; i<100000000; i+=2)
//    {
//        if(Bit_check(status[i>>5],i%32)==0)
//        {
//            ///Prime
//        }
//    }
//}
int main()
{
    ll a,b,c,i,j,k,x,y,z,f,g,h;
    string s,d;
    cin>>a>>b;
    c=0;
    while(a>0)
    {
        c++;
        a=a/b;
    }
    cout<<c<<endl;
}


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

int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int m=0;int ma=0;
    for(int i=0;i<n-1;i++)
    {
    	if(a[i]>=a[i+1])
    	{
    		m++;
    	}
    	else
    	{  
    		ma=max(m,ma);
    		m=0;
    	}
    	
    }
    ma=max(m,ma);
    cout<<ma;
}

Measured memory_bytes: 640
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(std::string t){
    for(int i = 0; i < t.size(); ++i)
        if(t[i] == '?')
            t[i] = 'D';
    cout << t << endl;
}


signed main(){
    std::string T;
    std::cin >> T;
    solve(T);
    return 0;
}


Measured memory_bytes: 3852
A, B, C, X, Y = map(int, input().split())

price = 0

if A + B > 2 * C:
	price += min(X,Y) * 2 * C
	price += (X - min(X,Y)) * min(A, 2*C)
	price += (Y - min(X,Y)) * min(B, 2*C)
else:
	price = A * X + B * Y

print(price)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pii pair<int,int>
#define reset(x,n) memset((x),(n),sizeof(x))
#define all(n) (n).begin(),(n).end()
#define pb push_back
#define IOS ios::sync_with_stdio(0),cin.tie(0);
int arr[100005][3];
ll dp[100005][3];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+arr[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+arr[i][1];
		dp[i][2]=max(dp[i-1][1],dp[i-1][0])+arr[i][2];
	}
	cout<<max({dp[n][0],dp[n][1],dp[n][2]});
}


Measured memory_bytes: 3712
package main

import "fmt"

func main() {
	var n, t uint64
	fmt.Scanf("%d %d", &n, &t)
	ti := make([]uint64, n)
	for i := uint64(0); i < n; i++ {
		fmt.Scan(&ti[i])
	}
	sum := uint64(t)
	for i := uint64(1); i < n; i++ {
		tmp := ti[i] - ti[i-1]
		if t < tmp {
			sum += t
		} else {
			sum += tmp
		}
	}
	fmt.Println(sum)
}


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

int main(){
    int len, hug = 0;
    string S, copy;

    cin >> S;
    copy = S;
    reverse(copy.begin(), copy.end());
    len = S.size();

    for(int i = 0; i < len / 2; i++){
        if(S[i] != copy[i])hug++;
    }
    cout << hug << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int digit(int b) {
    int cnt = 0;
    while(b){
        cnt++;
        b /= 10;
    }
    return cnt;
}
int main(){
    int a,b; cin >> a >> b;
    int num = a*pow(10, digit(b))+b;
    if((int)sqrt(num)*(int)sqrt(num) == num) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <set>

using namespace std;

#define Get(ty,...) ty __VA_ARGS__;cins(__VA_ARGS__);
#define GetArray(ty,v,n) vector<ty> v(n);cin_arr(v,n);
#define ci cin
#define co cout
#define en endl;
#define Arr(f, arr,pred) f(arr.begin(),arr.end(),pred)
#define Arr2(f, arr) f(arr.begin(),arr.end())
#define ArrExpr(f, arr,expr) f(arr.begin(),arr.end(),[](auto x){return expr;})
#define Acc(init,arr,pred) accumulate(arr.begin(),arr.end(),init,pred)

void cins(){}

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

template<class Arr>
void cin_arr(Arr& v,int n) {
	for (int i = 0; i < n; i++)
		cin >> v[i];
}

bool canMove(int tDelta, int x1, int y1 ,int x2, int y2) {
	int a = abs((x1 - x2)) + abs((y1 - y2));
	if ((a == 0) && (tDelta % 2 != 0))return false;
	if (a == 0)return true;
	if (a > tDelta)return false;
	if ((tDelta - a) % 2 == 0)return true;
	return false;
}

int main() {
	Get(int, n);
	int bt = 0;
	int bx = 0;
	int by = 0;
	while (n-- != 0)
	{
		Get(int, t, x, y);
		if (canMove(t - bt, bx, by, x, y) == false) {
			co << "No" << en;
			return 0;
		}
		bx = x;
		by = y;
		bt = t;
	}
	co << "Yes" << en;

}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		if(age == 1) {
			System.out.println("Hello World");
		} else {
			int a = sc.nextInt();
			int b = sc.nextInt();

			System.out.println(a + b);
		}
	}

}


Measured memory_bytes: 21076
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <sstream>
#include <ostream>
#include <bitset>
#include <list>
#include <deque>
#include <complex>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cfloat>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <climits>

using namespace std;

#define MAX 60010
#define MAX_C 20
#define INF 1e9
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define FOR(i,a,b) for(int i = a ; i < b ; i++)
#define all(p) (p).begin(),(p).end() 

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

int N,M;
int c[MAX_C];

int solve(){
  int dp[MAX];
  fill(dp,dp+MAX,INF);
  dp[0] = 0;
  for(int i = 0 ; i < M ; i++){
    for(int j = c[i] ; j < MAX ; j++){
      dp[j] = min(dp[j],dp[j-c[i]] + 1);
    }
  }
  return dp[N];
}

int main(){
  scanf("%d%d",&N,&M);
  rep(i,M){
    scanf("%d",&c[i]);
  }
  printf("%d\n",solve());
  return 0;
}

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

int main() {
    int numbs[3][3];
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> numbs[i][j];
        }
    }

    int n;
    cin >> n;
    int numb;
    for(int i = 0; i < n; i++) {
        cin >> numb;
        for(int k = 0; k < 3; k++) {
            for(int j = 0; j < 3; j++) {
                if(numbs[k][j] == numb) {
                    numbs[k][j] = -1;
                }
            }
        }
    }
    bool state = true;
    for(int i = 0; i < 3; i++) {
        if(numbs[i][0] == numbs[i][1] && numbs[i][1] == numbs[i][2]) {
            cout << "Yes" << endl;
            state = false;
            break;
        }
        if(numbs[0][i] == numbs[1][i] && numbs[1][i] == numbs[2][i]) {
            cout << "Yes" << endl;
            state = false;
            break;
        }
    }

    if(state == true) {
        if(numbs[0][0] == numbs[1][1] && numbs[1][1] == numbs[2][2]) {
            cout << "Yes" << endl;
            state = false;
        }
        else {
            if(numbs[0][2] == numbs[1][1] && numbs[1][1] == numbs[2][0]) {
                cout << "Yes" << endl;
                state = false;
            }
        }
    }
    if(state == true) {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import heapq
N,M,S,T = map(int,input().split())

adj=[[] for _ in range(N)]

for _ in range(M):
    a,b,c,d = map(int,input().split())
    adj[a-1].append((b-1,c,d))
    adj[b-1].append((a-1,c,d))


D_S=[float("inf")]*N
D_T=[float("inf")]*N

D_S[S-1]=0
D_T[T-1]=0

Q=[]
heapq.heappush(Q,S-1)


while Q:
    v = heapq.heappop(Q)
    dist_to_node,node=v//N,v%N
    for nex in adj[node]:
        (next_node,yen,_) = nex
        if dist_to_node+yen<D_S[next_node]:
            D_S[next_node] = dist_to_node+yen
            heapq.heappush(Q,D_S[next_node]*N+next_node)

Q=[]
heapq.heappush(Q,T-1)

while Q:
    v = heapq.heappop(Q)
    dist_to_node,node=v//N,v%N
    if D_T[node]< dist_to_node:
        continue
    for nex in adj[node]:
        (next_node,_,yen) = nex
        if dist_to_node+yen<D_T[next_node]:
            D_T[next_node] = dist_to_node+yen
            heapq.heappush(Q,D_T[next_node]*N+next_node)


tmp_min=float("inf")
ans=[]
for i in reversed(range(N)):
    tmp_min = min(tmp_min,D_S[i]+D_T[i])
    ans.append(tmp_min)


for a in reversed(ans):
    print(10**15-a)


Measured memory_bytes: 113516
n = int(input())
ans = 100000
for i6 in range(16668):
    count = 0
    n1 = n-i6*6
    if n1>=0:
        j = 0
        while j<=5:
            count = count + (i6%(6**(j+1)))//(6**j)
            i6 -= i6%(6**(j+1))
            j += 1
        j = 0
        i9 = n1//9
        count += n1%9
        while j<=5:
            count += (i9%(9**(j+1)))//(9**j)
            i9 -= i9%(9**(j+1))
            j += 1
        ans = min(ans,count)
print(ans)

Measured memory_bytes: 39664
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C;
  cin>>A>>B>>C;
  
  if(A==B&&B==C&&A%2==0){
    cout<<-1<<endl;
  }
  else{
  int ans=0;
  
  while(true){
    if(A%2==1||B%2==1||C%2==1){
      break;
    }
    int a=A/2;
    int b=B/2;
    int c=C/2;
    
    A=a+b;
    B=b+c;
    C=c+a;
    
    ans++;
  }
  
  cout<<ans<<endl;
  }
}

Measured memory_bytes: 3612
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;

int main() {

	int n;

	cin >> n;

	string s;

	cin >> s;

	int count = 0;

	for (int i = 0; i < n; i++) {
		if (i >= 2) {
			if (s[i] == 'C' && s[i - 1] == 'B' && s[i - 2] == 'A') {
				count++;
			}
		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int H, W;
  cin >> H >> W;
  string S[50+1];
  rep(i, H) cin >> S[i];
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      int cnt = 0;
      //cout << i << ' ' << j << endl;
      if(S[i][j] == '.'){
        for(int p = i-1; p <= i+1; p++){
          for(int q = j-1; q <= j+1; q++){
            //cout << p << ' ' << q << endl;
            if(p >= 0 && p < H && q >= 0 && q < W){
              if(S[p][q] == '#') cnt++;
            //  cout << p << ' ' << q << endl;
            }else{
              continue;
            }
          }
        }
        S[i][j] = cnt + 0x30;
      }else{
        continue;
      }
    }
  }
  rep(i, H){
    rep(j, W){
      cout << S[i][j];
    }
    cout << endl;
  }
  return 0;
}


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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

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)swap(a, b);
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

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

int main() {

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

	sort(a, a + n,greater<int>());

	int alice = 0, bob = 0;

	rep(i, n) {
		if (i % 2 == 0)alice += a[i];
		else bob += a[i];
	}

	pr(alice - bob);

	///system("pause");
	return 0;
}

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

int main(){
  int n,N;
  cin >> N;
  n = N;
  int sum = 0;
  while(n > 0) {
    sum += n % 10;
    n /= 10;
  }
  if((N%sum) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

/////------------------------TYPEDEF--------------------------/////
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
#define prq priority_queue<ll>;

/////------------------------CONSTANTS--------------------------/////
ll MOD=1000000007;
#define PI 3.1415926535897932384626433832795

/////------------------------GENERAL--------------------------/////
#define forx(i,j,n) for(int i=j;i<n;i++)
#define fory(i,j,n) for(int i=j;i>=n;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false)
#define testcase int t; cin>>t
#define MEM(xx,yy) memset(xx,yy,sizeof(xx))
#define vbs(xx,x) binary_search(all(xx),x)
#define vlb(xx,x) lower_bound(all(xx),x)
#define vub(xx,x) upper_bound(all(xx),x)

/////------------------------IO--------------------------/////
#define inpi(xx) scanf("%d",&xx)
#define inpl(xx) scanf("%lld",&xx)
#define inpc(xx) scanf("%c",&xx)
#define inps(xx) scanf("%s",&xx)
#define pri(xx) printf("%d",xx)
#define prl(xx) printf("%lld",xx)
#define prls(xx) printf("%lld ",xx)
#define prle(xx) printf("%lld\n",xx)
#define prc(xx) printf("%c",xx)
#define prs printf(" ");
#define pre printf("\n")
ll n,W;
ll w[100005],v[100005];
ll ans[3005][3005];

ll fun(string a,string b){  
ll n=a.size();
ll m=b.size();
forx(i,0,n+1){
    forx(j,0,m+1){
        if(i==0||j==0) ans[i][j]=0;
        else if(a[i-1]==b[j-1]) ans[i][j]=1+ans[i-1][j-1];
        else ans[i][j]=max(ans[i][j-1],ans[i-1][j]);
    }
}
return ans[n][m];
}

void fun2(ll index,string a,string b){
    int i=a.size(),j=b.size();
    vector<char> lcs(index);
    while(i>0&&j>0){
        if(a[i-1]==b[j-1]){
            lcs[index-1]=a[i-1]; i--; j--; index--;
        }
        else if(ans[i-1][j]>ans[i][j-1]) i--;
        else j--;
    }
    forx(i,0,lcs.size()) cout<<lcs[i];
}

int main() {
	int t=1;
	while(t--){
	    string is,it;
	    cin>>is>>it;
	    ll cc=fun(is,it);
	    fun2(cc,is,it);
	}
	return 0;
}

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

#include <cstdio>
#include <cstdlib>
#include <cmath>

#include <iostream>

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll mod = 1000000007;

class mint{
public:
  ll x;
  mint(ll x=0) : x(x%mod){}
  mint& operator+=(const mint rhs){
    x += rhs.x;
    while(x >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint rhs){
    x -= rhs.x;
    while(x < 0) x += mod;
    return *this;
  }
  mint & operator*=(const mint rhs){
    (x *= rhs.x) %= mod;
    return *this;
  }
  mint operator+(const mint rhs) const {
    mint res(*this);
    return res += rhs;
  }
  mint operator-(const mint rhs) const {
    mint res(*this);
    return res -= rhs;
  }
  mint operator*(const mint rhs) const {
    mint res(*this);
    return res *= rhs;
  }
  bool operator>(const ll rhs) const {
    return x > rhs;
  }
  bool operator<(const ll rhs) const {
    return x < rhs;
  }
  bool operator>=(const ll rhs) const {
    return x >= rhs;
  }
  bool operator<=(const ll rhs) const {
    return x <= rhs;
  }
  bool operator==(const ll rhs) const {
    return x == rhs;
  }
  bool operator!=(const ll rhs) const {
    return x != rhs;
  }
  friend ostream& operator<<(ostream& os,const mint rhs){
    os << rhs.x;
    return os;
  }
};

#define rep(index,num) for(int index=0;index<num;++index)

int main(){
  double A,B;
  int H,M;
  std::cin >> A >> B >> H >> M;
  //std::cout << A << " " <<  B << " " << H << " "  << M << std::endl;

  double dA,dB;
  dA = 360.0 / (12.0 * 60.0);
  dB = 360.0 / 60.0;
  double tA,tB;
  tA = dA * (60*H + M);
  tB = dB * M;

  double dt = std::abs(tA - tB);
  //int tmp = dt / 180.0;
  //dt -= tmp * 180.0;

  double dr;
  dr = std::sqrt(A*A + B*B - 2*A*B*cos(dt/180*M_PI));
  //std::cout << dt << " " << 2*A*B*cos(dt/M_PI) << std::endl;
  std::cout << std::setprecision(10) << dr << std::endl;

  return 0;
}


Measured memory_bytes: 4192
#include <bits/stdc++.h>
#define fname "NAME"
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define bug(x) cerr << (#x) << " = " << (x) << endl;
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define X first
#define Y second

using namespace std;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<double, double> dd;
typedef pair<float, float> ff;

int main()
{
	if (fopen(fname".INP", "r")) {
		freopen(fname".INP", "r", stdin);
		freopen(fname".OUT", "w", stdout);
	}
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, l;
	cin >> n >> l;
	vector<string> arr(n);
	REP0(i, n) cin >> arr[i];
	sort(arr.begin(), arr.end());
	REP0(i, n) cout << arr[i];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll max3(ll a,ll b,ll c){ return max( max(a,b),c ); }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin>>n;
	ll v[n][3];
	forn(i,n) cin>>v[i][0]>>v[i][1]>>v[i][2];
	ll dp[n+1][3];
	forn(i,3) dp[0][i] = 0;
	forn1(i,n)
	{
	    forn(j,3)
	    {
	        dp[i][j] = -1e18;
	        forn(k,3)
	        {
	            if(j==k) continue;
	            dp[i][j] = max( dp[i-1][k] + v[i-1][j] , dp[i][j] );
	        }
	    }
	}
	cout<<max( dp[n][0] , max( dp[n][1] , dp[n][2] ) );
	
	return 0;
}


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


int main(){
	int resp = 700;
	string S;
	cin >> S;
	if(S[0]=='o') resp+=100;
	if(S[1]=='o') resp+=100;
	if(S[2]=='o') resp+=100;
	cout << resp;
	return 0;
}

Measured memory_bytes: 256
#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))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#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>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
  int N,Y,check=0;
  cin >> N >> Y;
  rep(i,N+1){
    rep(j,N+1){
      if(N-i-j>=0 && Y==i*10000+j*5000+(N-i-j)*1000){
        cout << i << " " << j << " " <<  N-i-j << endl;
        check=1;
        break;
      }
    }
    if(check==1) break;
  }
  if(check==0) cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;


ll m,d;
int main()
{
        cin >> m >> d;
        ll ans = 0;
        for(ll i=4;i<=m;i++) {
                for(ll j=1;j<=d;j++){
                        ll x = j%10;
                        ll y = j/10;
                        if(x >= 2 && y >= 2 && x*y == i){
                                ans++;
                        }
                }
        }
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cases long long t;cin>>t;while(t--)
#define f_io ios::sync_with_stdio(false); cin.tie(0)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000007
#define INF 1000000000
using namespace std;

void dfs(vector< vector<ll> > &adj,vector<ll> &visited,ll src,ll k)
{
    visited[src] = k;
    foi(0,adj[src].size())
    {
        if (!visited[adj[src][i]])
            dfs(adj,visited,adj[src][i],k);
    }
}

int main()
{
    f_io;
    ll n,m;
    cin >> n >> m;
    vector<vector<ll> > adj(n);
    foi(0,m)
    {
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector<ll> visited(n);
    ll k=1;
    foi(0,n)
    {
        if(!visited[i])
        {
            dfs(adj,visited,i,k);
            k++;
        }
    }
    map<ll,ll> mp;
    foi(0,n)
        mp[visited[i]]++;
    ll ans = 0;
    for(auto x:mp)
        ans = max(ans,x.second);
    cout << ans;
    return 0;
}


Measured memory_bytes: 24908
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int x, y; cin >> x >> y;
    rep(i,x+1) {
        if (y == i*2+(x-i)*4) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
string s;
int solve()
{
	if(s=="SUN")
		cout<<7<<endl;
	else if(s=="MON")
		cout<<6<<endl;
	else if(s=="TUE")
		cout<<5<<endl;
	else if(s=="WED")
		cout<<4<<endl;
	else if(s=="THU")
		cout<<3<<endl;
	else if(s=="FRI")
		cout<<2<<endl;
	else if(s=="SAT")
		cout<<1<<endl;
}
int main()
{
	cin>>s;
	solve();
	return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;


int main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  string s;
  ll k;

  cin >> s >> k;

  ll n = s.size();
  
  vector<pair<char, ll>> a;
  for (char c : s) {
    if (a.empty() || a.back().first != c)
      a.emplace_back(c, 0);
    a.back().second++;
  }

  if (a.size() == 1) {
    cout << (k * n) / 2 << "\n";
    return 0;
  }

  if (a[0].first != a.back().first) {
    ll res = 0;
    for (auto p : a)
      res += p.second / 2;
    cout << res * k << "\n";
    return 0;
  }

  ll res = a[0].second / 2;
  res += a.back().second / 2;
  for (int i = 1; i < (int) a.size() - 1; ++i)
    res += (a[i].second / 2) * k;
  res += ((a[0].second + a.back().second) / 2) * (k - 1);
  cout << res << "\n";
  return 0;
}



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

int main() {
  int N,L;
  cin >> N >> L;
  
  if (L * (L+N-1) <= 0) {
    cout << (L*2 + N - 1) * N / 2 << endl;
  }
  else if (L < 0) {
    cout << (L*2 + N - 1) * N / 2 - (L + N - 1) << endl;
  }
  else {
    cout << (L*2 + N - 1) * N / 2 - L<< endl;
  }
    
  
  return 0;
}

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

int main(){

    //freopen("planting.in", "r", stdin);
    //freopen("planting.out", "w", stdout);

    long long x, k, d;
    cin >> x >> k >> d;             // k is the total no. of moves
    x = abs(x);                     //considering that we are on +ve x-axis
    long long steps = x/d;          // no. of steps we are away from origin
    if(k <= steps) x -= k*d;        //if k<=steps, we will try to move as close to origin as
                                    //possible
    else {                          //if we are forced to move more steps than required
        k -= steps;                 //now k is the extra steps which we are condemned to move
        if(k % 2 == 0) x -= d*steps;//if extra steps is even, we can simply waste them by
                                    //moving 1 step forward and 1 step backward again and again
        else {                      //if odd, we will cross origin (at least) once as we have no other choice
            x -= d*(steps + 1);
        }
    }
    x = abs(x);                     //finally getting the distance from origin
    cout << x;
}


Measured memory_bytes: 3636
import scala.io.StdIn
object Main extends App {
  val n = StdIn.readLine().trim.toInt
  val result = (0 until n).foldLeft(List.empty[String], Set.empty[String]){
      case ((acc, dict), _) =>
    val cmd = StdIn.readLine().split(' ')
    if(cmd(0) == "insert"){
      (acc, dict + cmd(1))
    } else {
      if(dict.contains(cmd(1))) {
        ("yes" :: acc, dict)
      } else {
        ("no" :: acc, dict)
      }
    }
  }

  println(result._1.reverse.mkString(f"%n"))

}


Measured memory_bytes: 488108
S = input()
print("NA" if (S[:2] < "01" or "12" < S[:2]) and (S[2:] < "01" or "12" < S[2:])
      else "YYMM" if (S[:2] < "01" or "12" < S[:2]) and ("01" <= S[2:] <= "12")
      else "MMYY" if ("01" <= S[:2] <= "12") and (S[2:] < "01" or "12" < S[2:])
      else "AMBIGUOUS")


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

int main() {
	string s;
	int k;
	cin >> s >> k;
	vector<string> str;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 1; j <= k; j++) {
			str.push_back(s.substr(i, j));
		}
	}

	sort(str.begin(), str.end());
	str.erase(unique(str.begin(), str.end()), str.end());

	cout << str[k - 1] << endl;
	return 0;
}

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

long long f(long long x,long long y){
	if(x==0){
		return y;
	}
	else{
		return f(y%x,x);
	}
}

int main(){
	long long a,b,temp;
	cin>>a>>b;
	
	temp=(a/f(a,b))*b;
	cout<<temp<<endl;
}

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

int main(){
  int n;
  int card_n[5][15] ={0};
  cin >> n;
  rep(i, n) {
    char tc;
    int tn;
    cin >> tc >> tn;
    --tn;
    if (tc == 'S') card_n[0][tn] = 1;
    if (tc == 'H') card_n[1][tn] = 1;
    if (tc == 'C') card_n[2][tn] = 1;
    if (tc == 'D') card_n[3][tn] = 1;
  }
  
  rep(i, 4) {
    rep(j, 13) {
      if (card_n[i][j] == 0) {
        if (i==0) cout << 'S' << " "; 
        if (i==1) cout << 'H' << " ";
        if (i==2) cout << 'C' << " ";
        if (i==3) cout << 'D' << " ";
        cout << j+1 << endl;
      }
    }
  }
  
  return 0;
}



Measured memory_bytes: 3088