akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const ll INF = ll(1e18);
const int MOD = 1000000007;
// const int MOD = 998244353;

const int MAX_V = 105;
ll dp[MAX_V][MAX_V];
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   int V, E;
   cin >> V >> E;
   rep(i, 0, V) rep(j, 0, V) {
      if (i == j)
         dp[i][j] = 0;
      else
         dp[i][j] = INF;
   }
   rep(i, 0, E) {
      int s, t, d;
      cin >> s >> t >> d;
      dp[s][t] = d;
   }
   rep(k, 0, V) rep(u, 0, V) rep(v, 0, V) {
      if (dp[u][k] == INF || dp[k][v] == INF) continue;
      dp[u][v] = min(dp[u][v], dp[u][k] + dp[k][v]);
   }
   rep(i, 0, V) if (dp[i][i] < 0) {
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
   }

   rep(i, 0, V) rep(j, 0, V) {
      if (dp[i][j] >= INF)
         cout << "INF";
      else
         cout << dp[i][j];
      if (j == V - 1)
         cout << endl;
      else
         cout << " ";
   }
   return 0;
}


Measured memory_bytes: 3304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define unique(a)  (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define mod 1000000007
typedef long long LL;
#define int long long
typedef long double LD;
typedef vector<int> VI;
inline LL add(LL x, LL y) { x += y; if (x >= mod) x -= mod; return x; }
inline LL moduloMultiplication(LL x, LL y) {
	return (x%mod * 1LL * y%mod) %

		mod;
}
inline LL power(LL a, LL b) {
	LL x = 1 % mod;
	while (b) {
		if (b & 1) x = moduloMultiplication(x, a);
		a = moduloMultiplication(a, a);
		b >>= 1;
	}
	return x % mod;
}

inline LL inv(LL a) { return power(a, mod - 2) % mod; }
LL gcd(LL a, LL b)
{
	if (!a)
		return b % mod;
	return gcd(b%a, a) % mod;
}

signed main()
{
	fastio;
	int n;
	cin >> n;
	cout << (n + 1) / 2 << endl;
}



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

int main()
{
    int x, y;
    char op;
    while (cin >> x >> op >> y)
    {
        switch (op)
        {
        case '+':
            cout << x + y << endl;
            break;

        case '-':
            cout << x - y << endl;
            break;

        case '*':
            cout << x * y << endl;
            break;

        case '/':
            cout << x / y << endl;
        case '?':
            break;
        }
    }
}


Measured memory_bytes: 3096
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#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 rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n+1);
    rep(i,n){
        cin>>a[i+1];
        a[i+1]+=a[i];
    }
    int ans=inf;
    REP(i,2,n-2){
        int l=lower_bound(all(a),a[i]/2)-a.begin();
        int r=lower_bound(all(a),(a[n]-a[i])/2+a[i])-a.begin();
        REP(j,-1,1){
            REP(k,-1,1){
                int P=a[l+j],Q=a[i]-P,R=a[r+k]-a[i],S=a[n]-a[i]-R;
                ans=min(ans,max({P,Q,R,S})-min({P,Q,R,S}));
            }
        }
    }
    cout<<ans<<endl;
}
        

Measured memory_bytes: 1792
(defun read-list-from-string (str)
  (read-from-string (concatenate 'string "(" str ")")))

(defun read-num-from-string (str)
  (parse-integer str))

(defun read-list ()
  (read-list-from-string (read-line)))

(defun read-num ()
  (read-num-from-string (read-line)))

(defun solve ()
  (let ((list (read-list)))
    (if (and (<= (nth 0 list) (nth 2 list))
	     (<= (nth 2 list) (nth 1 list)))
	(princ "Yes")
	(princ "No"))))

(solve)

Measured memory_bytes: 11880
// template version 1.2
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

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

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  int n;cin>>n;
  int a[n]; rep(i, n) {cin>>a[i];}
  int b[n]; rep(i, n) {cin>>b[i];}
  sort(a, a+n);
  sort(b, b+n);
  int c[n]; rep(i, n){
    c[i] = max(a[i], b[i]);
  }

  int dp[n]={};
  dp[0] = 1;
  rep(i, 1, n){
    int d = i - (lower_bound(c, c+i, min(a[i], b[i])) - c);
    dump(i, d);
    dp[i] = (1+d)*dp[i-1];
    dp[i] %= MOD;
  }

  cout << dp[n-1] << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


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

int main()
{
    int n;

    cin >> n;

    int a[n];

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

    for( int i = 0; i < n; i++ )
    {
        cout << a[i];
        if( i != n - 1 )
            cout << " ";
    }
    cout << endl;    

    return 0;
}


Measured memory_bytes: 3488
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
typedef long long ll;

ll a[6],b[6];
const ll MOD=(ll)1e9+7;
ll qpow(ll x,ll y)
{
    ll ret=1;
    while(y)
    {
        if(y&1) ret=ret*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return ret;
}

void solve()
{
    ll n; scanf("%lld",&n);
    ll tmp1=qpow(10,n)-qpow(9,n);
    ll tmp2=tmp1;
    ll tmp3=qpow(8,n);
    ll tmp=qpow(10,n);
    printf("%lld\n",((tmp1+tmp2+tmp3-tmp)%MOD+MOD)%MOD);
}

int main()
{
    int TTT=1; //scanf("%d",&TTT);
    while(TTT--){solve();}
    return 0;
}

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

long long int fastexpo(long long int a, long long int b)
{
    long long int ans = 1;
    while (b)
    {
        if (b & 1)
            ans = (ans * a) % m;
        b = b / 2;
        a = (a * a) % m;
    }
    return ans;
}
int main()
{

    ll a, b;
    cin >> a >> b;
    cout << a * b << "\n";
    return 0;
}

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

void solve(){
    vector <int> sides;
    int n, temp , ans = 0;
    cin >> n;

    for(int i = 0 ; i < n ; i++) {
        cin >> temp;
        sides.emplace_back(temp);
    }

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

    for (int side1 = 0 ; side1 < n-2 ; side1++){
        for (int side2 = side1 ; side2 < n-1 ; side2++){
            for (int side3 = side2 ; side3 < n ; side3++){
                if (sides[side1] != sides[side2] && sides[side1] != sides[side3] && sides[side2] != sides[side3]){
                    if (sides[side3] >=(sides[side1] + sides[side2])){
                        ;
                    }
                    else{
                       ans++;
                    }
                }

            }

        }
    }



    cout  << ans;






}

int main(){
    solve();
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
using namespace std;
ll n,t,x,y,m,q;

int main(){
      ios_base::sync_with_stdio(false); cin.tie(NULL);
      string s;
      cin>>s;
      cout<<s;
      if(s[s.length()-1]=='s')cout<<"es";
      else cout<<"s";
}

Measured memory_bytes: 3660
import java.util.*;

class Main{
  public static int mintwo(int a,int b){
    if(a<b) return a;
    return b;
  }
  
  public static int abs(int a){
    if(a>=0) return a;
    return -a;
  }
  
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int N=sc.nextInt();
    int[] H=new int[N];
    int[] H_C=new int[N];
    H_C[0]=0;
    
    for(int i=0;i<N;i++){
      H[i]=sc.nextInt();
    }
    
    H_C[1]=abs(H[1]-H[0]);
    
    for(int i=2;i<N;i++){
      H_C[i]=mintwo(H_C[i-2]+abs(H[i]-H[i-2]),H_C[i-1]+abs(H[i]-H[i-1]));
    }
    
    System.out.print(H_C[N-1]);
  }
}

Measured memory_bytes: 58572
#include<bits/stdc++.h>
#define IL inline
#define _ 200005
#define ll long long
using namespace std;

#define inf 1000000007
IL int gi(){
	int data=0,fu=1; char ch=0; while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
	if(ch=='-')fu=-1,ch=getchar();
	while('0'<=ch&&ch<='9')data=(data<<1)+(data<<3)+(ch^48),ch=getchar(); return data*fu;
}

int bit[_][2],f[_][2],mx[40*_][2],lson[40*_],rson[40*_],rt[_],Q[_],n,m,oo;
int P[_]; bool Is[_];
IL void Insert(int op,int ps,int fv){
	while(ps)bit[ps][op]=max(bit[ps][op],fv),ps-=ps&-ps; return; 
}
IL int Query(int op,int ps){
	int ret=-inf; while(ps<=n)ret=max(ret,bit[ps][op]),ps+=ps&-ps; return ret;
}
void Insert(int &o,int l,int r,int ps,int id){
	lson[++oo]=lson[o]; rson[oo]=rson[o]; mx[oo][0]=mx[o][0]; mx[oo][1]=mx[o][1];
	o=oo;
	mx[o][0]=max(mx[o][0],f[id][0]),mx[o][1]=max(mx[o][1],f[id][1]); 
	if(l==r)return; int mid=(l+r)>>1;
	ps<=mid?Insert(lson[o],l,mid,ps,id):Insert(rson[o],mid+1,r,ps,id); return; 
}
int Query(int o,int l,int r,int ql,int qr,int op){
	if(ql<=l&&r<=qr)return mx[o][op]; int mid=(l+r)>>1,v=-inf;
	if(ql<=mid)v=max(v,Query(lson[o],l,mid,ql,qr,op));
	if(qr >mid)v=max(v,Query(rson[o],mid+1,r,ql,qr,op));
	return v; 
}
IL bool Check(int la,int lb,int mv,int i){
	if(i>n)return true; int vl=la+Q[i]-lb,t=(vl&1); if(vl<0)return false; 
	//cout<<i<<": "<<"la="<<la<<"; lb="<<lb<<" ; mv="<<mv<<" ; Qry="<<Query(rt[i],1,n,mv,n,t)<<" ; vl="<<vl<<endl; 
	return Query(rt[i],1,n,mv,n,t)>=vl; 
}
int main(){
	n=gi(); for(int i=1;i<=n;++i)P[i]=gi();
	for(int i=1,mv=0;i<=n;++i)mv=max(mv,P[i]),Is[i]=(mv==P[i]);
	for(int i=n;i>=1;--i)Q[i]=Q[i+1]+Is[i];
	for(int i=n;i>=1;--i)bit[i][0]=bit[i][1]=-inf; Insert(0,n,0); 
	for(int i=n;i>=1;--i){
		if(!Is[i])f[i][0]=Query(1,P[i])+1,f[i][1]=Query(0,P[i])+1;
		else f[i][0]=Query(0,P[i])+2,f[i][1]=Query(1,P[i])+2;
		Insert(0,P[i],f[i][0]);
		Insert(1,P[i],f[i][1]);
		rt[i]=rt[i+1],Insert(rt[i],1,n,P[i],i); 
	}
	string sx,sy;
	sx.clear(); sy.clear();
	//fix X; Y nolimit
	for(int i=1,la=0,lb=0,ma=0,mb=0;i<=n;++i){
		if(i==n){
			if(la+(P[i]>ma)==lb)sx+='0';
			else if(la==lb+(P[i]>mb))sx+='1'; else sx[0]='2';
			break; 
		}
		if(!(!Is[i]&&P[i]>ma)&&Check(la+(P[i]>ma),lb,mb,i+1))sx+='0',la+=(P[i]>ma),ma=max(ma,P[i]);
		else sx+='1',lb+=(P[i]>mb),mb=max(mb,P[i]);
		if(!Check(la,lb,mb,i+1)){sx[0]='2'; break;}
	}
	//fix Y; X nolimit
	for(int i=1,la=0,lb=0,ma=0,mb=0;i<=n;++i){
		if(i==n){
			if(la+(P[i]>ma)==lb)sy+='0';
			else if(la==lb+(P[i]>mb))sy+='1'; else sy[0]='2';
			break; 
		}
		if(Check(lb,la+(P[i]>ma),max(ma,P[i]),i+1))sy+='0',la+=(P[i]>ma),ma=max(ma,P[i]);
		else if((!Is[i]&&P[i]>mb)||!Check(lb+(P[i]>mb),la,ma,i+1)){sy[0]='2'; break; }
		else sy+='1',lb+=(P[i]>mb),mb=max(mb,P[i]);
		//cout<<i<<": "<<sy<<" "<<endl;
	}
	//cout<<sx<<" "<<sy<<endl;
	if(sx[0]=='2'&&sy[0]=='2')return puts("-1"),0;
	if(sx>sy)swap(sx,sy);
	cout<<sx<<endl;
	return 0;	
}


Measured memory_bytes: 72200
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

//double dp[100][100][100][100];
pair <int, int> ba_pair[100000];
int main(){
    int N;
    int M;
    cin >> N >> M;
    
    for(int i = 0; i < M; i++){
        cin >> ba_pair[i].second >> ba_pair[i].first;
    }
    
    sort(ba_pair, ba_pair + M);
    int ans = 0;
    int last_end = 0;
    for(int i = 0; i < M; i++){
        if(last_end <= ba_pair[i].second){
            ans ++;
            last_end = ba_pair[i].first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;

int main(){
  int n;
  int mx, mn;
  int sum;
  cin >> n;
  while(n != 0){
    mx = 0;
    mn = 1e9;
    sum = 0;
    int in;
    for(int i = 0; i < n; i++){
      cin >> in;
      mx = max(mx, in);
      mn = min(mn, in);
      sum += in;
    }
    sum -= mx + mn;
    cout << sum / (n - 2) << endl;
    cin >> n;
  }
      

}

Measured memory_bytes: 3092
-- Watch
import Data.List -- intercalate

main = readLn >>= putStrLn . solve

solve :: Int -> String
solve = intercalate ":" . map show . watch

watch :: Int -> [Int]
watch n = [h,m,s]
  where
    h = div n 3600
    m = mod (div n 60) 60
    s = mod n 60

-- import Data.List
-- intercalate :: [a] -> [[a]] -> [a]
-- intercalate xs xss = concat $ intersperse xs xss

Measured memory_bytes: 3616
from itertools import product
from bisect import bisect_left,bisect_right
#pre processing
st = '753'
ls = []
for i in range(3,10):
	s = list(product(st,repeat = i))
	for i in s:
		zz = ''.join(list(i))
		ls.append(zz)

arr = []
for i in ls:
	if '7' in i and '5' in i and '3' in i:
		arr.append(int(i))
arr.sort()
n = input()
print bisect_right(arr,n)


Measured memory_bytes: 37916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {
	static class Pair implements Comparable<Pair> {
		int B;
		long C;

		Pair(int B, long C) {
			this.B = B;
			this.C = C;
		}

		@Override
		public int compareTo(Pair o) {
			if (this.C < o.C) {
				return 1;
			} else if (this.C > o.C) {
				return -1;
			} else {
				return 0;
			}
		}
	}

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		Long[] A = new Long[N];
		tokens = in.readLine().split(" ");
		for (int i = 0; i < N; ++i) {
			A[i] = Long.parseLong(tokens[i]);
		}
		Arrays.sort(A);

		Queue<Pair> pairs = new PriorityQueue<>();

		for (int i = 0; i < M; ++i) {
			tokens = in.readLine().split(" ");
			int B = Integer.parseInt(tokens[0]);
			long C = Integer.parseInt(tokens[1]);
			pairs.add(new Pair(B, C));
		}

		int index = 0;
		while (index < N) {
			Pair pair = pairs.poll();
			if (pair == null) {
				break;
			}
			for (int i = index; i < Math.min(index + pair.B, N); ++i) {
				if (A[i] >= pair.C) {
					break;
				}
				A[i] = pair.C;
			}
			index += pair.B;
		}

		long result = 0;
		for (int i = 0; i < N; ++i) {
			// System.out.println(" " + A[i]);
			result += A[i];
		}
		System.out.println(result);

		in.close();
	}

	static void step(Queue<Long> queue, int B, long C) {
		int count = 0;
		for (int i = 0; i < B; ++i) {
			long elem = queue.peek();
			if (elem > C) {
				break;
			}
			queue.poll();
			++count;
		}
		for (int i = 0; i < count; ++i) {
			queue.add(C);
		}
		return;
	}
}

Measured memory_bytes: 63652
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 998244353
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int n;
    cin >> n;

    string s;
    cin >> s;

    vector<int> left(n);
    vector<int> right(n);

    left[0] = 1<<(s[0] - '0');

    for(int i = 1; i <= n - 3; i++){
        left[i] = left[i - 1] | (1<<(s[i] - '0'));
    }

    right[n - 1] = 1<<(s[n - 1] - '0');

    for(int i = n - 2; i >= 2; i--){
        right[i] = right[i + 1] | (1<<(s[i] - '0'));
    }

    /*
    rep(i,n){
        cerr << left[i] << " ";
    }
    
    cerr << endl;

    rep(i,n){
        cerr << right[i] << " ";
    }

    cerr << endl;
    */

    map<int, int> m;

    for(int i = 1; i <= n - 2; i++){

        for(int j = 1; j <= 1024; j = j * 2){
            for(int k = 1; k <= 1024; k = k * 2){
                if((j & left[i - 1]) && (k & right[i + 1])){
                    int l = (int)log2((double)j) - 1;
                    int r = (int)log2((double)k) - 1;

                    m[l * 100 + 10 * (s[i] - '0') + r] = 1;
                }
            }
        }
    }

    cout << m.size() << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
ll digitPoor(ll n)
{
    assert(INT_MAX == 2147483647);
    assert(n >= 0);

    if (n < 10)         return 1;
    if (n < 100)        return 2;
    if (n < 1000)       return 3;
    if (n < 10000)      return 4;
    if (n < 100000)     return 5;
    if (n < 1000000)    return 6;
    if (n < 10000000)   return 7;
    if (n < 100000000)  return 8;
    if (n < 1000000000) return 9;
    return 10;
}
struct p{
  ll x;
  bool b;
};
int main(){
    ll N,A,B;
    cin>>N>>A>>B;
    
    ll t=((N-1)*B+A)-((N-1)*A+B)+1;
    cout<<(t<0?0:t);
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<int> c(m);
  for (int i = 0; i < m; i++)
  {
    cin >> s[i] >> c[i];
    s[i]--;
  }
  for (int i = 0; i < pow(10, n); i++)
  {
    string num = to_string(i);
    if (num.length() == n)
    {
      int ok = 1;
      for (int j = 0; j < m; j++)
      {
        if (num[s[j]] - '0' != c[j])
        {
          ok = 0;
        }
      }
      if (ok)
      {
        cout << i << endl;
        return 0;
      }
    }
  }

  cout << -1 << endl;
}


Measured memory_bytes: 3888
#include <bits/stdc++.h>
#define maxn 200001
#define maxa 201
#define MOD 1000000007
#define INF 1000000000000000000
#define lim 20

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<pii, ll>
#define ft first
#define sd second

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

ll power(ll a, ll b){
    if(b == 0) return 1;
    ll r = power(a, b/2);
    r = (r*r)%MOD;
    if(b%2 == 1) r = (r*a)%MOD;
    return r;
}




void solve(){
    ll n= 1, m;
    cin >> m;
    ll a[m];
    for(ll i = 0; i < m; i++){
        cin >> a[i];

    }
    ll mx = a[0];
    for(ll i = 1; i < m; i++){

        if(mx >= a[i])n++;
        mx = min(mx, a[i]);

    }
    cout << n;

}

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


Measured memory_bytes: 1792
/*
				GAURAV KUMAR
				 MNNIT
				  BTECH 3RD YEAR
*/

#include<bits/stdc++.h>
using namespace std;
#define debug1(x) cout << # x << " " << x << endl;
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define debug3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z << endl;
typedef long long int ll;
const ll INF=1e12;
ll dp[100001][2];
ll dp1[3001][3001][2];
ll a[3001];
int n;
ll fun(int k,int t)
{
	
	//debug2(k,t);
	if(k==0)
		return 1-t;
	if(k<0)
		return t;
	if(dp[k][t]!=-1)return dp[k][t];
	for(int i=0;i<n;i++)
		if(a[i]==k)
			return dp[k][t]=t;
	for(int i=0;i<n;i++)
	{
		if(fun(k-a[i],1-t)!=(1-t))
			return dp[k][t]=t;
	}
	return dp[k][t]=1-t;







}

int main()
{
	
	ll k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<100001;i++)
		dp[i][0]=dp[i][1]=-1;
	if(fun(k,0)==0)
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;
	
}

Measured memory_bytes: 11136
import java.math.*;
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        String t=sc.next();
        for(int i=0;i<n;i++){
            System.out.print(s.charAt(i));
            System.out.print(t.charAt(i));
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<int> s(N);
    for (int i = 0; i < N; i++) cin >>s[i];
    vector<int> dp(10005);
    dp[0] = 1;
    for (int si : s) {
        for (int i = 10000; i >= 0; i--) {
            if (i + si > 10000) continue;
            if (dp[i] == 1) dp[i + si] = 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < 10001; i++) {
        if (i % 10 != 0 && dp[i]) ans = max(ans, i);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 998244353;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    int ret = 0;
    for(int i = 0;i < K;i++) {
        ret += vec.at(i);
    }
    cout << ret << endl;
}

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

int main()
{
	string s;
	cin >> s;
	if(s.at(s.size()-1) == 's')
		cout << s << "es";
	else
	{
		cout << s << 's';
	}
}


Measured memory_bytes: 3624
#include<stdio.h>

int main()
{
  int i,j,n,count=0,v,c,c1,v1;
  int G[101][101],color[101],d[101],pi[101],mincost,ii;
  for(i=0;i<101;i++){
    for(j=0;j<101;j++)G[i][j]=-1;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&c);
    for(j=0;j<c;j++){
      scanf("%d%d",&v1,&c1);
      G[v][v1]=c1;
    }
  }

  for(i=0;i<n;i++){
    color[i]=0;
    pi[i]=-1;
    d[i]=10000001;
  }
  d[0]=0;

  while(1){
    mincost=10000001;
    for(i=0;i<n;i++){
      if(color[i]!=2 && d[i]<mincost){
        mincost=d[i];
        ii=i;
      }
    }
    if(mincost==10000001)break;
    color[ii]=2;
    for(i=0;i<n;i++){
      if(G[ii][i]!=-1 && color[i]!=2 && (G[ii][i]+d[ii])<d[i]){
	pi[i]=ii;
	d[i]=G[ii][i]+d[ii];
	color[i]=1;
      }
    }
  }
  for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
  return 0;
}



Measured memory_bytes: 2084
#include<algorithm>
#include<iostream>
#include<queue>
#include<tuple>
#include<vector>

typedef std::tuple<int, int, int> T;

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

int x, y;
int n;
int sx[10], sy[10];
std::vector<int> field[10][10];

bool safe( int x, int y )
{
	return x >= 0 && x < 10 && y >= 0 && y < 10;
}

bool bfs()
{
	std::queue<T> que;
	que.push( T( 0, x, y ) );

	while( !que.empty() )
	{
		T t = que.front(); que.pop();
		int cnt = std::get<0>( t );
		int fx = std::get<1>( t ), fy = std::get<2>( t );

		if( cnt == n )
			return true;

		for( int i = 0; i != 12; ++i )
		{
			int nx = fx + dx[i], ny = fy + dy[i];

			if( !safe( nx, ny ) )
				continue;

			if( std::find( field[nx][ny].begin(), field[nx][ny].end(), cnt + 1 ) == field[nx][ny].end() )
				continue;

			que.push( T( cnt + 1, nx, ny ) );
		}
	}

	return false;
}

int main()
{
	while( std::cin >> x >> y, x | y )
	{
		for( int i = 0; i != 10; ++i )
			for( int j = 0; j != 10; ++j )
				field[i][j].clear();

		std::cin >> n;
		for( int i = 0; i != n; ++i )
		{
			int sx, sy;
			std::cin >> sx >> sy;

			for( int j = -1; j <= 1; ++j )
				for( int k = -1; k <= 1; ++k )
					if( safe( sx + j, sy + k ) )
						field[sx+j][sy+k].push_back( i + 1 );
		}

		if( bfs() )
			std::cout << "OK" << std::endl;
		else
			std::cout << "NA" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1212
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

inline int read() {
    int res = 0;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar());
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res;
}

int n, k;
char s[N];

int main() {
    scanf("%s", s);
    int a, b;
    a = (s[0] - '0') * 10 + (s[1] - '0');
    b = (s[2] - '0') * 10 + (s[3] - '0');
    if (1 <= a && a <= 12 && 1 <= b && b <= 12) puts("AMBIGUOUS");
    else if (1 <= a && a <= 12) puts("MMYY");
    else if (1 <= b && b <= 12) puts("YYMM");
    else puts("NA");
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int N,K;
    scanf("%d%d",&N,&K);
    char S[N];
    scanf("%s",S);
    for(int i=0;i<N;i++){
        if(i==K-1){
               if(S[i]=='A'){
                   S[i]='a';
               }else if(S[i]=='B'){
                   S[i]='b';
               }else{
            S[i]='c';
        }
    }
    }
    printf("%s\n",S);
    return 0;
}


Measured memory_bytes: 128
n = int(input())
A = sorted(list(map(int, input().split())), reverse = True)
l = 0
ln = []
for a in A:
    if l == a:
        ln.append(a)
        l = 0
    else:
        l = a
    if len(ln) == 2:
        break
if len(ln) == 2:
    print(ln[0]*ln[1])
else:
    print(0)

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

int main() {
    string s, t;
    cin >> s >> t;
    int si = s.size();
    rep(i, 100) {
        s = s[si-1] + s.substr(0, si-1);
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s=[int(input())for i in range(n)]
d10=sorted([x for x in s if x%10!=0])
su=sum(s)
if su % 10 != 0:
    print(su)
elif len(d10)>0:
    print(su - d10[0])
else:
    print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1


int main(){
  string ABC[3];

  rep(i,3) cin>>ABC[i];

  int ans=0;
  while(ABC[ans].size()!=0){
    int j=ans;
    switch(ABC[ans][0]){
      case 'a': ans=0;break;
      case 'b': ans=1;break;
      case 'c': ans=2;break;
    }
    ABC[j].erase(ABC[j].begin());
  }
  switch(ans){
    case 0:print("A");break;
    case 1:print("B");break;
    case 2:print("C");break;
  }

  return 0;
}


Measured memory_bytes: 256
import os
import sys
import numpy as np

def solve(N, U, V, AB):
    G = [[0]*0 for _ in range(N+1)]
    for idx_ab in range(len(AB)):
        a, b = AB[idx_ab]
        G[a].append(b)
        G[b].append(a)
    P1 = np.zeros(N+1, dtype=np.int64)
    def dfs1(u):
        st = [u]
        while st:
            v = st.pop()
            p = P1[v]
            for u in G[v]:
                if p != u:
                    st.append(u)
                    P1[u] = v
    dfs1(U)
    path_u2v = [U]
    v = V
    while v != U:
        v = P1[v]
        path_u2v.append(v)
    path_u2v.reverse()
    l = len(path_u2v)
    half = (l-2) // 2
    c = path_u2v[half]
    ng = path_u2v[half+1]
    Depth = np.zeros(N+1, dtype=np.int64)
    def dfs2(c):
        st = [c]
        P = np.zeros(N+1, dtype=np.int64)
        while st:
            v = st.pop()
            p = P[v]
            d = Depth[v]
            for u in G[v]:
                if p != u and u != ng:
                    st.append(u)
                    P[u] = v
                    Depth[u] = d + 1
    dfs2(c)
    c_ = path_u2v[l-1-half]
    v = c_
    while v != c:
        Depth[v] = 0
        v = P1[v]
    d = l%2
    ans = max(Depth) + half + d
    return ans


# >>> numba compile >>>
numba_config = [
    [solve, "i8(i8,i8,i8,i8[:,:])"],
]
if sys.argv[-1] == "ONLINE_JUDGE":
    from numba import njit
    from numba.pycc import CC
    cc = CC("my_module")
    for func, signature in numba_config:
        vars()[func.__name__] = njit(signature)(func)
        cc.export(func.__name__, signature)(func)
    cc.compile()
    exit()
elif os.name == "posix":
    exec(f"from my_module import {','.join(func.__name__ for func, _ in numba_config)}")
else:
    from numba import njit
    for func, signature in numba_config:
        vars()[func.__name__] = njit(signature, cache=True)(func)
    print("compiled!", file=sys.stderr)
# <<< numba compile <<<


def main():
    N, u, v = map(int, input().split())
    if N==2:
        print(0)
        return
    AB = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(N-1, 2)
    ans = solve(N, u, v, AB)
    print(ans)

main()


Measured memory_bytes: 53012
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define F first
#define S second
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;}
#define OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 100000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  IN(ll,N);
  IN(ll,K);
  ll X = 1;
  ll count = 0;
  while(N>=X){
    count++;
    X *= K;
  }
  OUT(count);
}

Measured memory_bytes: 256
N=int(input())

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

import itertools
itertools.permutations(P)
l=list(itertools.permutations(P))
l.sort()
P=tuple(P)
Q=tuple(Q)

p=l.index(P)
q=l.index(Q)

print(abs(p-q))


Measured memory_bytes: 8052
#include<bits/stdc++.h>
#include<bitset>
#include<random>
#include<time.h>

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 550;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

int n;
int c[N];
int s[N];
int f[N];
ll findans(int curr, ll t)
{
  if(curr == n-1) return t;
  if(t <= s[curr])
  {
    return findans(curr + 1, t + (s[curr] - t) + c[curr]);
  }
  else
  {
    int x = t % f[curr];
    if(x != 0)
    return findans(curr + 1, t + f[curr] - x + c[curr]);
    else
    return findans(curr + 1, t + c[curr]);
  }
}

int main()
{
  cin>>n;
  rep(i, 0, n-1)
  {
    cin>>c[i]>>s[i]>>f[i];
  }
  rep(i, 0, n)
  {
    ll ans = findans(i, 0);
    cout<<ans<<endl;
  }
}


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

bool SerchRecursive(vector<int>& vec, int num)
{
	int right = vec.size();
	int left = 0;
	int index = 0;
	while (true)
	{
		if (index == (right + left) / 2)
		{
			break;
		}

		index = (right + left) / 2;
		if (vec[index] == num)
		{
			return true;
		}
		else if (vec[index] < num)
		{
			left = index;
		}
		else if (vec[index] > num)
		{
			right = index;
		}
	}
	return false;
}

int main()
{
	int n, q;
	cin >> n;

	vector<int> vNumS(n,0);
	for (int i = 0; i < n; i++)
	{
		int num = 0;
		cin >> num;
		vNumS[i] = num;
	}

	cin >> q;
	vector<int> vNumT(q, 0);

	for (int i = 0; i < q; i++)
	{
		int num = 0;
		cin >> num;
		vNumT[i] = num;
	}


	int result = 0;
	for (int j = 0; j < q; j++)
	{
		if (SerchRecursive(vNumS, vNumT[j]))
		{
			result += 1;
		}
	}

	cout << result << endl;
	return 0;
}












Measured memory_bytes: 3276
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
 
constexpr int mod = 1000000007;
 
inline long long mod_pow(long long n, long long k) {
	long long res = 1;
	while(k > 0) {
		if(k & 1) res = res * n % mod;
		n = n * n % mod;
		k >>= 1;
	}
	return res;
}
 
inline long long mod_inverse(long long n) {
	return mod_pow(n, mod - 2);
}
 
inline long long mod_combination(long long n, long long k) {
	long long res = 1;
	if(k * 2 > n) k = n - k;
 
	for(int i = 0; i < k; ++i) {
		res = res * ((n - i) % mod) % mod;
	}
 
	long long tmp = 1;
	for(int i = 1; i <= k; ++i) {
		tmp = tmp * i % mod;
	}
 
	res = res * mod_inverse(tmp) % mod;
 
	return res;
}
 
constexpr int MAX = 2000;
int dp[MAX + 1][MAX + 1];
 
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, x;
	long long d;

	while(cin >> n >> d >> x && n) {
		const int eat = min<long long>(n, d);
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
 
		for(int i = 0; i < eat; ++i) {
			int sum = dp[i][0];

			for(int k = 1; k <= n; ++k) {
				if(k >= x) sum = (sum + mod - dp[i][k - x]) % mod;
				dp[i + 1][k] = (dp[i + 1][k] + sum) % mod;
				sum = (sum + dp[i][k]) % mod;
			}
		}

		long long ans = 0;
		for(int day = 1; day <= eat; ++day) {
			ans = (ans + dp[day][n] * mod_combination(d, day)) % mod;
		}
		cout << ans << endl;
	}
 
	return EXIT_SUCCESS;
}

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

int main(){
	long int a,b,c,s;
	double r;
	while(cin >> a >> b){
		c = a + b;
		r = log10(c) + 1;
		s = r;
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}



int main(){
    ll n,i=0,c=0;
    cin >> n;
    i+=n/11*2;
    n=n%11;
    while(c<n){
        if (i%2){
            c+=5;
        }else{
            c+=6;
        }
        i++;
    }
    cout << i << endl;
    return 0;
}


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

char bd[105][105];

int main(){
    int a, b;
    scanf("%d%d",&a,&b);
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            bd[i][j] = '#';
        }
    }
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            bd[i+50][j] = '.';
        }
    }
    for(int i=0;i<(a-1);i++){
        int mok = i / 50, res = i % 50;
        bd[mok * 2][res * 2] = '.';
    }
    for(int i=0;i<(b-1);i++){
        int mok = i / 50, res = i % 50;
        bd[99 - (mok * 2)][res * 2] = '#';
    }
    printf("100 100\n");
    for(int i=0;i<100;i++){
        for(int j=0;j<100;j++){
            printf("%c", bd[i][j]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine();
            var result = 0;

            for (int i = 0; i < s.Length / 2; i++)
            {
                if (s[i] != s[s.Length - i - 1])
                {
                    result++;
                }
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	char ch = getchar(); int u = 0, f = 1;
	while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
	while (isdigit(ch)) { u = (u << 1) + (u << 3) + ch - 48; ch = getchar(); }
	return u * f;
}
const int maxn = 2e5 + 10;
inline void file(){
	freopen(".in","r",stdin);
}
int main(){
	int A = read(), B = read(), C = read(), X = read(), Y = read();
	int ans = A * X + B * Y;
	if (X > Y){ swap(A, B); swap(X, Y); }
	ans = min(ans, X * C * 2 + (Y - X) * B);
	ans = min(ans, max(X, Y) * C * 2);
	cout << ans;
	return 0;
}

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

int main() {
    int N,M; cin>>N>>M;
    vector<int>x(M);
    rep(i,M)cin>>x[i];
    sort(x.begin(),x.end());
    vector<int>xx(M-1);
    rep(i,M-1){
        xx[i]=x[i+1]-x[i];
    }
    sort(xx.begin(),xx.end());
    int ans =0;
    if(M-N<=0)cout<<0<<endl;
    else {
        rep(i,M-N){
            ans+=xx[i];
        }
          cout<<ans<<endl;
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;

const ll D=60;
const ll nmax=200003;
int main(){
    ll n,k;
    cin>>n>>k;
    vector<vector<ll>> v(D,vector<ll>(nmax));
    
    for(ll i=0;i<n;i++){
        cin>>v[0][i];
        v[0][i]--;
    }
    
    for(ll i=0;i<D-1;i++){ 
        for(ll j=0;j<n;j++){
            v[i+1][j]=v[i][v[i][j]];
        }
    }
    int ans=0;
    for(ll i=D-1;i>=0;i--){
        ll ix=1ll<<i;
        if(k>=ix){
            ans=v[i][ans];
            k-=ix;
        }        
    }
    cout<<ans+1<<endl;
    return 0;
}

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

int main(void)
{
    char s[10];
    int i;

    scanf("%s", s);
    for (i = 0; i < strlen(s) - 1; i++)
    {
        if (s[i] == 'A' && s[i + 1] == 'C')
        {
            printf("Yes");
            return (0);
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout <<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr << #x << ":" << (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;

	VAR(int, x);
	int sm = 0, ans;
	FOR(i, 1, x + 1) {
		sm += i;
		if (sm >= x) {
			ans = i;
			break;
		}
	}
	OUT(ans)BR;
  
  return 0;
}


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

int numd(int n){
    int ret = 0;
    for(int i = 1; i <= n; ++i){
        if(n%i==0) ++ret;
    }
    return ret;
}

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

    int n;
    cin >> n;

    if(n<105){
        cout << 0 << endl;
        return 0;
    }

    int res = 0;

    for (int i = 105; i <= n; ++i){
        if(i%2 && numd(i) == 8) ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 256