akhauriyash/Code-Regression huggingface dataset:
#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(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
  }
  for(int i=0; i<n-1; i++){
    cout << a[n-1-i] << " ";
  }
  cout << a[0] << endl;

  return 0;
}


Measured memory_bytes: 3076
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  (function(S) {
    var h = Math.floor(S / (60 * 60));
    var m = Math.floor(S % (60 * 60) / 60);
    var s = Math.floor(S % 60);
    var output = h + ':' + m + ':' + s;
    console.log(output);
}(parseInt(inputs.trim(),10)));
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15572
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>

using namespace std;
using ll = unsigned long long;

int main() {

	ll n;
	ll k;

	cin >> n >> k;

	unsigned long long ans = k * pow(k - 1, n - 1);

	cout << ans << endl;

	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    for(int i=0; i<N; ++i) {
        cin >> A[i];
    }
    for(int j=0; j<M; ++j) {
        cin >> B[j];
    }
    for(int i=0; i<=N-M; ++i) {
        for(int j=0; j<=N-M; ++j) {
            bool ok = true;
            for(int k=0; k<M; ++k) {
                for(int l=0; l<M; ++l) {
                    ok &= A[i+k][j+l] == B[k][l];
                }
            }
            if(ok) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

using namespace std;

#define int long long

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

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#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 rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int Q, H, S, D, N;

int a, b, s;

signed main(){
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  cin>>Q>>H>>S>>D;
  cin>>N;
  
  a = min(D, min(2*S, min(4*H, 8*Q)));
  b = min(S, min(2*H, 4*Q));
  
  s = N/2;
  s = s*a;
  s += (N%2)*b;
  
  cout<<s;
  cout<<endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

ll gcd(ll a,ll b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}

ll sum;

struct segtree{
  int n;
  vector<ll> dat;
  segtree(int n_){
    init(n_);
  }
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.resize(2*n-1);
    for(int i=0;i<2*n-1;i++) dat[i]=sum;
  }
  void update(int k,ll a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=gcd(dat[k*2+1],dat[k*2+2]);
    }
  }
  ll get(int a,int b,int k=0,int l=0,int r=-1){
    if(r<0) r=n;
    if(r<=a||b<=l){
      cout << "r:"<<r<<"a:"<<a<<"b:"<<b<<"l:"<<l << endl;
      return 1;
    }
    if(a<=l&&r<=b) return dat[k];
    else{
      ll vl=get(a,b,k*2+1,l,(l+r)/2);
      ll vr=get(a,b,k*2+2,(l+r)/2,r);
      return (vl,vr);
    }
  }
};

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  sum=a[0]*a[1];
  segtree st(n);
  rep(i,n){
    st.update(i,a[i]);
  }
  ll ans=-1;
  rep(i,n){
    if(i+1<n) st.update(i,a[i+1]);
    else st.update(i,a[i-1]);
    chmax(ans,st.dat[0]);
    st.update(i,a[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3072
#include <iostream>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    long long t, total = 0, t_i, t_prev = 0;
    cin >> n >> t;
    cin >> t_prev;
    for (int i = 1; i < n; ++i) {
        cin >> t_i;
        if (t_i - t_prev < t) total += t_i - t_prev;
        else total += t;
        t_prev = t_i;
    }
    total += t; // last
    
    cout << total << endl;
    
    return 0;
}

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

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))

typedef complex<double> P;

int n,m;
P pos[25];

double R[1<<14];

double f(int msk, double x, double y){
  P p(x,y);
  double ret = 1e-14;
  REP(i,n)if((msk>>i)&1)CHMAX(ret, abs(pos[i]-p));
  return ret;
}

const double ppp = 100.0;
const double qqq = 101.0;

double calc(int msk, double x){
  double ylow = -1, yhigh = 1e5+1;
  REP(_,40){
    double ylolo = (qqq*ylow + ppp*yhigh) / (ppp+qqq);
    double yhihi = (ppp*ylow + qqq*yhigh) / (ppp+qqq);
    if(f(msk, x, ylolo) < f(msk, x, yhihi)){
      yhigh = yhihi;
    }else{
      ylow = ylolo;
    }
  }
  return (yhigh + ylow) / 2.0;
}

double dp[25][1<<14];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n){
    double x,y;
    scanf("%lf%lf",&x,&y);
    pos[i] = P(x,y);
  }
  R[0] = 0;
  FOR(i,1,1<<n){
    double xlow = -1, xhigh = 1e5+1;
    REP(_,40){
      double xlolo = (qqq*xlow + ppp*xhigh) / (ppp+qqq);
      double xhihi = (ppp*xlow + qqq*xhigh) / (ppp+qqq);
      double ylolo = calc(i, xlolo);
      double yhihi = calc(i, xhihi);
      if(f(i, xlolo, ylolo) < f(i, xhihi, yhihi)){
        xhigh = xhihi;
      }else{
        xlow = xlolo;
      }
    }
    double x = (xlow + xhigh) / 2.0;
    double y = calc(i, x);
    R[i] = f(i, x, y);
  }

  REP(i,m+1)REP(msk,1<<n)dp[i][msk] = 1e18;
  dp[0][0] = 1e-14;
  REP(i,m)REP(msk,1<<n){
    int submsk = ((1<<n)-1) - msk;
    for(int T=submsk; ; T=(T-1)&submsk){
      CHMIN(dp[i+1][msk|T], max(dp[i][msk], R[T]));
      if(T==0)break;
    }
  }
  printf("%.9f\n",dp[m][(1<<n)-1]);
  return 0;
}



Measured memory_bytes: 4984
import sys
from heapq import *

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

countA = [0] * (N + 1)
countB = [0] * (N + 1)
for x in A:
    countA[x] += 1
for x in B:
    countB[x] += 1

q = []
only_A = []
only_B = []
for i in range(N + 1):
    if countA[i] and countB[i]:
        q.append((-countA[i] - countB[i], i))
        continue
    for _ in range(countA[i]):
        only_A.append(i)
    for _ in range(countB[i]):
        only_B.append(i)
heapify(q)

if q and -q[0][0] > N:
    print('No')
    exit()
print('Yes')

ans = []
while q:
    _, x = heappop(q)
    if q:
        _, y = heappop(q)
        flag = True
    else:
        y = only_B.pop()
        flag = False
    countA[x] -= 1
    countB[y] -= 1
    ans.append((x, y))
    if countA[x]:
        heappush(q, (-countA[x] - countB[x], x))
    else:
        for _ in range(countB[x]):
            only_B.append(x)
    if flag and countB[y]:
        heappush(q, (-countA[y] - countB[y], y))
    if flag and not countB[y]:
        for _ in range(countA[y]):
            only_A.append(y)
while only_A:
    x, y = only_A.pop(), only_B.pop()
    assert countA[x] > 0
    assert countB[y] > 0
    countA[x] -= 1
    countB[y] -= 1
    ans.append((x, y))

ans.sort()
X, Y = zip(*ans)
print(*Y)



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

int main(){
    int r,g,b,n;
    int ans=0;
    scanf("%d %d %d %d",&r,&g,&b,&n);
    for(int i=0;i<=(n/r);i++){
        for(int j=0;j<=(n/g);j++){
            if((n-r*i-g*j>=0) && (n-r*i-g*j)%b==0){ans++;}
        }
    }
    printf("%d\n",ans);
    return 0;

}

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

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


Measured memory_bytes: 256
import fractions

a, b = map(int, input().split())

x = fractions.gcd(a,b)
ans = []

i = 2
y = int(x**0.5)
while True:
    if x%i == 0:
        x //= i
        ans.append(i)
    elif i == y:
        ans.append(x)
        break
    elif x == 1:
        break
    else:
        i += 1

print(len(set(ans))+1)

Measured memory_bytes: 65768
import heapq

def dijkstra(start, edge, n):

    dist = [float('inf')] * n
    dist[start] = 0

    pq = [(dist[start], start)]

    while len(pq):
        d, frm = heapq.heappop(pq)
        if dist[frm] < d:
            continue
        for to, cost in edge[frm]:
            if dist[frm] + cost < dist[to]:
                dist[to] = dist[frm] + cost
                heapq.heappush(pq, (dist[to], to))

    return dist


if __name__ == '__main__':
    
    n, m, r = map(int, input().split())
    edge = [[] for _ in range(n)]
    for i in range(m):
        x, y, d = map(int, input().split())
        edge[x].append((y, d))

    dist = dijkstra(r, edge, n)

    for d in dist:
        if d == float('inf'):
            print('INF')
        else:
            print(d)


Measured memory_bytes: 89288
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;


int main() {
    ll N; cin >> N;
    string s = to_string(N);

    //1999とかはどうする？
    int f = 1;
    for(int i = s.size()-1; i >= 1; i--){
        if(s[i] != '9'){
            f = 0;
            break;
        }
    }

    //9995
    int l = s.size()-1; //3
    ll  m = pow(10,l); //1000
    int t = N/m; //9

    if(f){
        cout << 9*l + t << "\n";
        return 0;
    }

    // cout << l << " " << m << " " << t << endl;
    int ans = 9*l + t-1;

    cout << ans << "\n";

}

Measured memory_bytes: 384
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
#A
def A():
    t,x = LI()
    print(t/x)

#B
def B():
    n = I()
    a = LI()
    m = max(a)
    if m >= sum(a)-m:
        print("No")
    else:
        print("Yes")


#C
def C():
    n,m = LI()
    x = LI()
    x.sort()
    l = [x[i+1]-x[i] for i in range(m-1)]
    l.sort()
    l = l[::-1]
    ans = sum(l[max(n-1,0):])
    print(ans)

#D
def D():
    n,k = LI()
    a = LI()
    k = list(map(int,list(bin(k)[2:])))
    l = len(k)
    for i in range(n):
        a[i] = list(map(int,list(bin(a[i])[2:])))
        l = max(l,len(a[i]))
    for i in range(n):
        for j in range(l-len(a[i])):
            a[i].insert(0,0)
    for j in range(l-len(k)):
        k.insert(0,0)
    s = [[0,0] for i in range(l)]
    pow2 = [1 for i in range(l)]
    for i in range(l-1)[::-1]:
        pow2[i] = pow2[i+1]*2
    for i in a:
        for j in range(l):
            s[j][0] += pow2[j]*i[j]
            s[j][1] += pow2[j]*(not i[j])
    dp = [0 for i in range(l+1)]
    small = False
    for i in range(l):
        if not small:
            if not k[i]:
                dp[i+1] += dp[i]+s[i][0]
            else:
                if s[i][0] >= s[i][1]:
                    dp[i+1] += dp[i]+s[i][0]
                    small = True
                else:
                    dp[i+1] += dp[i]+s[i][1]
        else:
            dp[i+1] += dp[i]+max(s[i])
    print(dp[l])

#E
if __name__ == "__main__":
    B()

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

template<class T, int ME> class BIT {
	public:
	T bit[1<<ME],val[1<<ME];
	T sum(int e) {T s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;}
	T add(int e,T v) { val[e++]+=v; while(e<=1<<ME) bit[e-1]+=v,e+=e&-e;}
	T set(int e,T v) { add(e,v-val[e]);}
};

int n, m, res;
vector<pair<int,int> > a;
BIT<int,20> b;

signed main() {
	cin >> n >> m;
	a.resize(m);
	rep(i,m) cin >> a[i].first >> a[i].second;
	sort(a.rbegin(), a.rend());
	rep(i,m) if (b.sum(a[i].second-1) - b.sum(a[i].first-1)==0) res++, b.add(a[i].first, 1);
	cout << res << endl;
}

Measured memory_bytes: 5504
{-# LANGUAGE BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Applicative
import Text.Printf


readInt :: IO Int
readInt = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

main = do
    n <- readInt
    as <- replicateM n readInt
    putStrLn $ concat $ intersperse " " $ map show $ reverse as


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

using ip = pair<int,int>;
using iv =   vector<int>;
using vp =    vector<ip>;

const int N = 1e5+1;

int m, n, p, b[N], parity[N], x[N]; iv s; vp g[N]; ip bomb[N]; bool visited[N];

inline int lb(int d) { return lower_bound(x,x+p,d)-x; }

int dfs(int u, int t = -1) {
	visited[u] = true;
	for (auto e: g[u])
		if (e.second != t and not visited[e.second] and dfs(e.second,u))
			s.push_back(e.first), parity[u] ^= 1;
	return parity[u]; }
	
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cin >> n >> m, p = n+1;
	for (int i = 0; i < n; ++i)
		cin >> bomb[i].first >> bomb[i].second;
	sort(bomb,bomb+n);
	for (int i = 0; i < n; ++i)
		x[i] = bomb[i].first, b[i] = bomb[i].second;
	x[n] = INT_MAX, parity[0] = b[0];
	for (int i = 0, j = 1; i < n; i = j++)
		if (b[j] != b[i])
			parity[j] = 1; 
	for (int l, r, i = 1; i <= m; ++i)
		cin >> l >> r, l = lb(l), r = lb(r+1), g[l].emplace_back(i,r), g[r].emplace_back(i,l); 
	for (int i = 0; i < p; ++i)
		if (not visited[i] and dfs(i))
			cout << -1, exit(0);
	cout << s.size() << "\n", sort(s.begin(), s.end());
	for (auto cord: s)
		cout << cord <<  ' '; }
		

Measured memory_bytes: 15996
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    
    ll h,w;
    cin>>h>>w;
    map<ll,ll> H,W;
    string a[110];
    char b[110][110];
    rep(i,h){
        cin>>a[i];
        // rep(j,w){
        //     cout<<a[i][j]<<endl;
        // }
    }
    rep(i,h){
        if(a[i][0]=='#') continue;
        bool ok=true;
        rep(j,w){
            if(a[i][j]=='#') ok=false;
        }
        if(ok) H[i]++;
    }
    rep(i,w){
        if(a[0][i]=='#') continue;
        bool ok=true;
        rep(j,h){
            if(a[j][i]=='#') ok=false;
        }
        if(ok) W[i]++;
    }
    ll cnti=0;
    ll cntj=0;
    ll cj=0;
    rep(i,h){
        if(H[i]>0) continue;
        rep(j,w){
            if(W[j]>0) continue;
            b[cnti][cntj]=a[i][j];
            cntj++;
        }
        cnti++;
        cj=cntj;
        cntj=0;
    }
    rep(i,cnti){
        rep(j,cj){
            cout<<b[i][j];
        }
        cout<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

ll K;

ll dp[20][2][10];

ll f(string s){
    if((int)s.size() == 1) return (s[0]-'0');

    REP(i, 20)REP(j, 2)REP(k, 10) dp[i][j][k] = 0;
    ll n = s.size();
    dp[0][1][0] = 1;
    REP(i, n){
        ll val = s[i] - '0';
        if(i==0){
            for(int d=1;d<s[i]-'0';d++) dp[i+1][0][d] = 1;
            dp[i+1][1][val] = 1;
        }else{
            REP(j, 10){
                for(int d=0;d<10;d++){
                    if(abs(j-d)>1) continue;

                    dp[i+1][0][d] += dp[i][0][j];
                    //dp[i+1][1][d] += dp[i][0][d];
                    if(d<val) dp[i+1][0][d] += dp[i][1][j];
                    if(d==val) dp[i+1][1][d] += dp[i][1][j];
                }
            }
        }
    }
    ll res = 0;
    REP(i, 2){
        REP(j, 10){
            res += dp[n][i][j];
        }
    }
    return res;
}

bool judge(ll x){
    string t = to_string(x);
	ll n = t.size();
	ll res = 0;
	for(int i=1;i<n;i++){
		res += f(string(i, '9'));
        //dump(f(string(i, '9')))
	}
	res += f(t);
    //dump(f(t))

    //dump(res)

	return (res>=K);
}

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

    
    cin >> K;

    ll ng = 0;
    ll ok = 3234566667+10;

    //judge(K);

    
    while(ok-ng>1){
        ll md = (ok+ng)/2;
        if(judge(md)) ok = md;
        else ng = md;
    }

    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 256
from sys import exit


def mpow(x, n):
    result = 1
    while n != 0:
        if n & 1 == 1:
            result *= x
            result %= 1000000007
        x *= x
        x %= 1000000007
        n >>= 1
    return result


p = 1000000007

X, Y = map(int, input().split())

if (X+Y) % 3 != 0:
    print(0)
    exit()

a = (2 * Y - X) // 3
b = (2 * X - Y) // 3

if a < 0 or b < 0:
    print(0)
    exit()

n = a + b
k = min(a, b)

if n == 0 and k == 0:
    print(1)
    exit()

if n < k or k < 0:
    print(0)
    exit()

fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
    fac[i + 1] = fac[i] * (i + 1) % p
print(fac[n] * mpow(fac[n - k], p - 2) * mpow(fac[k], p - 2) % p)


Measured memory_bytes: 29300
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

const int mod=1000000007;
struct mint{
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const{return mint(-x);}
  mint& operator+=(const mint a){
    if((x+=a.x)>=mod) x-=mod;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x+=mod-a.x)>=mod) x-=mod;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=mod;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a=pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }

  // for prime mod
  mint inv() const{
    return pow(mod-2);
  }
  mint& operator/=(const mint a){
    return (*this)*=a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

struct Eratosthenes{
  int n;
  vector<int> f,primes;
  Eratosthenes(int n=1):n(n),f(n+1){
    f[0]=f[1]=-1;
    for(ll i=2;i<=n;++i){
      if(f[i]) continue;
      primes.push_back(i);
      f[i]=i;
      for(ll j=i*i;j<=n;j+=i){
        if(!f[j]) f[j]=i;
      }
    }
  }
  bool isPrime(int x){return f[x]==x;}
  vector<int> factorList(int x){
    vector<int> res;
    while (x!=1){
      res.push_back(f[x]);
      x/=f[x];
    }
    return res;
  }
  vector<i_i> factor(int x){
    if(x<=0) return {};
    vector<int> fl=factorList(x);
    if(fl.size()==0) return {};
    vector<i_i> res(1,i_i(fl[0],0));
    for(int p:fl){
      if(res.back().first==p){
        res.back().second++;
      } else{
        res.emplace_back(p,1);
      }
    }
    return res;
  }
};

int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i,N) cin >> a[i];
  Eratosthenes sieve(1e7);
  map<int,int> mp;
  rep(i,N){
    vector<i_i> f=sieve.factor(a[i]);
    for(auto c:f){
      mp[c.first]=max(c.second,mp[c.first]);
    }
  }
  mint lcm=1;
  for(auto c:mp){
    rep(i,c.second){
      lcm*=c.first;
    }
  }
  mint ans=0;
  rep(i,N){
    ans+=lcm/a[i];
  }
  cout << ans.x << endl;
}


Measured memory_bytes: 45556
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <deque>
#include <iomanip>
#include <queue>
using namespace std;
#define rep(i,n) for (ll i=0;i<n;i++)
#define REP(i,n) for (ll i=1;i<=n;i++)
#define PI 3.141592653589793238462643383279
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1000000000000000;

string S;

int main() {
	cin >> S;
	ll T = S.size();
	ll now = 0;
	deque<char> ans(0);
	rep(i, T) {
		if (S[i] == '0') {
			ans.push_back('0');
			now++;
		}
		else if (S[i] == '1') {
			ans.push_back('1');
			now++;
		}
		else if (now) {
			now--;
			ans.pop_back();
		}
	}
	rep(i, now) cout << ans[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split(" ")))
h.append(0)
d=[]
for i in range(n):
    d.append(h[i+1]-h[i])
c=0
for j in range(len(d)):
    k=d[j]
    if k < 0:
        c-=k
print(c)

Measured memory_bytes: 38256
#include <cstdio>

char pi[2333];

void sou(int n,int k,int p)
{
	if(n==0)
	{
		printf("%s",pi); return;
	}
	for(int i=0; i<p; i++)
	{
		pi[k]='a'+i;
		sou(n-1,k+1,p);
	}
	if(p!=26)
	{
		pi[k]='a'+p;
		sou(n-1,k+1,p+1);
	}
	return;
}

int main()
{
	int n; scanf("%d",&n);
	pi[n]='\n'; pi[n+1]='\0';
	sou(n,0,0);
	return 0;
}

Measured memory_bytes: 1408
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    numdct = {}
    for i in range(2):
        for div in make_divisors(a[i]):
            if(not div in numdct):
                numdct[div] = 0
            numdct[div] += 1

    dellist = []
    for i in range(2, n):
        for num in numdct.keys():
            if(a[i] % num != 0):
                numdct[num] -= 1
                if(numdct[num] == 0):
                    dellist.append(num)
        for d in dellist:
            del numdct[d]
        dellist.clear()
    
    numlist = sorted(numdct.items(), key=lambda x: -x[1])

    maxnum = 0
    for item in numlist:
        if(item[1] > 0):
            if(maxnum <= item[0]):
                maxnum = item[0]
        else:
            break

    print(maxnum)


Measured memory_bytes: 14588
s=list(input())
n=len(s)
a=s[:(n-1)//2]
b=s[(n+1)//2:]
s_i=s[::-1]
a_i=a[::-1]
b_i=b[::-1]

if s==s_i and a==a_i and b==b_i:
  print('Yes')
else:
  print('No')

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left !=NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key){
      u = u->left;
    } else {
      u = u->right;
    }
  }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL){
    return treeMinimum(x->right);
  }
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL){
    y = z;
  } else {
    y = treeSuccessor(z);
  }
  
  if(y->left != NIL){
    x = y->left;
  } else {
    x = y->right;
  }

  if(x != NIL){
    x->parent = y->parent;
  }
  
  if(y->parent == NIL){
    root = x;
  } else if( y == y->parent->left){
    y->parent->left = x;
  } else {
    y->parent->right = x;
  }

  if(y != z){
    z->key = y->key;
  }



  }

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

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if(y==NIL){
    root = z;
  } else if(z->key < y->key){
    y->left = z;
  } else{
    y->right = z;
  }
  
}

void inorder(Node u){
  if(u->left!=NIL){
    inorder(u->left);
  } 
  printf(" %d",u->key);
  if(u->right!=NIL){
    inorder(u->right);
  } 
}

void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!=NIL){
    preorder(u->left);
  } 
  if(u->right!=NIL){
    preorder(u->right);
  } 
}


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

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

  return 0;
}

Measured memory_bytes: 19364
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int a[10][10], b[10][10], res[10][10];
int dy[] = {-1,0,0,1,0}, dx[] = {0,-1,0,0,1};

int judge(int *used){
  memcpy(b, a, sizeof(a));
  memset(res, 0, sizeof(res));

  rep(i, 10){
    if(!used[i]) continue;
    res[0][i] = 1;
    rep(d, 5){
      int ny = dy[d], nx = i + dx[d];

      if(ny < 0 || nx < 0 || ny >= 10 || nx >= 10) continue;
      b[ny][nx] = !b[ny][nx];
    }
  }
  
  REP(i, 1, 10){
    rep(j, 10){
      if(!b[i-1][j]) continue;
      res[i][j] = 1;
      rep(d, 5){
	int ny = i + dy[d], nx = j + dx[d];

	if(ny < 0 || nx < 0 || ny >= 10 || nx >= 10) continue;
	b[ny][nx] = !b[ny][nx];
      }
    }
  }
 
  rep(i, 10) rep(j, 10) if(b[i][j]) return 0;

 
  return 1;
}

bool solve(int i, int *used){
  if(i == 10){
    if(judge(used)) return 1;
    return 0;
  }

  if(solve(i+1, used)) return 1;
  used[i] = 1;
  if(solve(i+1, used)) return 1;
  used[i] = 0;

  return 0;
}

int main(){
  int n;
  scanf("%d", &n);
  while(n--){
    rep(i, 10) rep(j, 10) scanf("%d", &a[i][j]);

    int used[10];
    memset(used, 0, sizeof(used));
    solve(0, used);

    rep(i, 10){
      rep(j, 10) printf(j?" %d":"%d", res[i][j]); puts("");
    }
  }
  return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	string s[105];
	int L,n;
	string ans="";
	cin>>L>>n;
	for(int i=0;i<L;i++){
		cin>>s[i];
	}
	sort(s,s+L);
	for(int i=0;i<L;i++){
		ans+=s[i];
	}	
	cout<<ans<<endl;
}


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

int main() {
  int H, W;

  while (1) {
    cin >> H >> W;

    if (H == 0 && W == 0) {
      break;
    }

    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        
        if (i % 2 == 0) {
          if (j % 2 == 0) {
            cout << "#";
          }
          else{
            cout << ".";
          }
        }
        else {
          if (j % 2 == 0) {
            cout << ".";
          } 
          else {
            cout << "#";
          }
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}
template<typename TypeInt>
string Itoa(const TypeInt v, int base)
{
    static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string ret;
    static numeric_limits<TypeInt> t;
    TypeInt n = v;
    if (t.is_signed) {
        if (v < 0) n *= -1;
    }

    while (n >= base) {
        ret += table[n%base];
        n /= base;
    }
    ret += table[n];
    if (t.is_signed) {
        if (v < 0 && base == 10) ret += '-';
    }
    // 文字列の順番を逆にする
    reverse(ret.begin(), ret.end());

    return ret;
}
int main() {
    int n,k;
    cin >> n >> k;
    string res;
    res = Itoa(n,k);
    cout << res.size() << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	while(n--){
		int x; cin >> x;
		if(x % 2 == 0){
			if((x % 3) && (x % 5)){
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}


Measured memory_bytes: 256
// 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(long long x){
    cout << 8 - (x - 400) / 200 << endl;
}


signed main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 3676
#include<iostream>
using namespace std;
int main(){
  int time[2][3],ans[3];
  for(int y=0;y<3;y++){
    for(int i=0;i<2;i++){
      cin >> time[i][0] >> time[i][1] >> time[i][2];
    }
    if(time[0][2]>time[1][2]){
      if(time[1][1]==0){
	time[1][0]--;
	time[1][1]+=60;
      }
      time[1][1]--;
      time[1][2]+=60;
    }
    ans[2]=time[1][2]-time[0][2];
    if(time[0][1]>time[1][1]){
      time[1][0]--;
      time[1][1]+=60;
    }
    ans[1]=time[1][1]-time[0][1];
    ans[0]=time[1][0]-time[0][0];
    cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
  }
}

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

int main()
{
    long long size;
    cin >> size;
    priority_queue<long long> n[size];
    long long q;
    cin >> q;
    for (long long i = 0; i < q; i++)
    {
        long long a, t, x;
        cin >> a >> t;
        if (a == 0)
        {
            cin >> x;
            //n[t].enqueue(x);
            n[t].push(x);
        }
        else if (a == 1)
        {
            if(n[t].empty() == 1) continue;
            cout << n[t].top() << endl;
        }
        else
        {
            if(n[t].empty() == 1) continue;
            //n[t].dequeue();
            n[t].pop();
        }
    }

    return 0;
}


Measured memory_bytes: 5080
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
const int SIZEN = 200010;
const int mod = 998244353;
struct Robot{
	int x,d;
}r[SIZEN];
int R[SIZEN];
int N;
int tmp[SIZEN];
int cnt = 0;
int mx[SIZEN << 2] = {0};
void change(int rt,int l,int r,int x,int y){
	if(l == r){
		mx[rt] = y;
		return;
	}
	int mid = (l+r)>>1;
	if(x <= mid)change(rt<<1,l,mid,x,y);
	else change(rt<<1|1,mid+1,r,x,y);
	mx[rt] = max(mx[rt<<1],mx[rt<<1|1]);
}
int query(int rt,int l,int r,int x,int y){
	if(x <= l && y >= r){
		return mx[rt];
	}
	int mid = (l+r)>>1;
	if(y <= mid)return query(rt<<1,l,mid,x,y);
	if(x >  mid)return query(rt<<1|1,mid+1,r,x,y);
	return max(query(rt<<1,l,mid,x,y),query(rt<<1|1,mid+1,r,x,y));

}
bool cmp(const Robot &A,const Robot &B){
	return A.x < B.x;
}
int f[SIZEN];
int main(){
	scanf("%d",&N);
	for(int i = 1;i <=N;i++)scanf("%d%d",&r[i].x,&r[i].d),tmp[++cnt] = r[i].x;
	sort(tmp + 1,tmp + 1 + cnt);
	sort(r+1,r+1+N,cmp);
	cnt = unique(tmp + 1,tmp + 1 + cnt) - tmp - 1;
	change(1,1,N,lower_bound(tmp + 1,tmp + 1 + cnt,r[N].x) - tmp,N);
	R[N] = N;
	for(int i = N-1;i >= 1;i--){
		int tr = lower_bound(tmp + 1,tmp + 1 + cnt,r[i].x + r[i].d) - tmp - 1;
		int tl = lower_bound(tmp + 1,tmp + 1 + cnt,r[i].x) - tmp;
		if(tl > tr){
			R[i] = tr;
		}
		else{
			R[i] = max(tr,query(1,1,N,tl,tr));
		}
		change(1,1,N,tl,R[i]);
	}
	// for(int i = 1;i <= N;i++)printf("%d ",R[i]);printf("\n");
	f[N+1] = 1;
	for(int i = N;i >= 1;i--){
		f[i] = (f[i+1] + f[R[i] + 1]) % mod;
	}
	printf("%d\n",f[1]);
	return 0;
}

Measured memory_bytes: 7684
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i++){
    int c=0;
    int res=i;
    while(res){
      res/=10;
      c++;
    }
    if(c%2==1)
      ans++;
  }
  cout<<ans<<endl;
}
    

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int i,j,N,Min=1000000,Cou[1000000],nub=0;
char S[1000000];
int main()
{
    scanf(" %d",&N);
    for(i=1;i<=N;i++){
        scanf(" %c",&S[i]);
    }
    for(i=1;i<=N;i++){
        if(S[i]=='E')  nub++;
        Cou[i]=nub;
    }
    for(i=0;i<=N;i++){
       if((i-Cou[i]+Cou[N]-Cou[i])<Min)  Min=(i-Cou[i]+Cou[N]-Cou[i]);
    }
    printf("%d",Min);
    return 0;
}

Measured memory_bytes: 3712
sa = input()
sb = input()
sc = input()
ch = "a"
while True :
    if ch == "a" :
        if len(sa) == 0 :
            print("A")
            break
        ch = sa[0]
        sa = sa[1:]
    if ch == "b" :
        if len(sb) == 0 :
            print("B")
            break
        ch = sb[0]
        sb = sb[1:]
    if ch == "c" :
        if len(sc) == 0 :
            print("C")
            break
        ch = sc[0]
        sc = sc[1:]

Measured memory_bytes: 3064
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(k, n):
        print("Yes") if a[i] > a[i-k] else print("No")
    return 0

if __name__ == "__main__":
    solve()

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

int main(){
  int X; 
  cin >> X;
  
  int sum /*f(X)*/ = 0;
  int unk = X;
  for (int i=0; i<9; i++){
    sum += X % 10;
    X /= 10; 
  }
  
  if (unk % sum == 0)
    cout << "Yes" << endl;
  else if (unk % sum != 0)
    cout << "No" << endl;
}


Measured memory_bytes: 3560
import sys

day = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
num = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

for s in sys.stdin:
    M, D = map(int, s.strip().split())
    if M == 0:
        break
    totalDay = D
    M -= 1

    while M > 0:
        totalDay += num[M-1]
        M -= 1

    print(day[(totalDay+2)%7])

Measured memory_bytes: 6720
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <fstream>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;



int main(){
  string s;
  cin >> s;
  if (s.find("YAKI") == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

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

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

    ll k, q;
    cin >> k >> q;
    vec d(k);
    Rep (i, k) cin >> d[i];
    while (q--) {
        ll n, x, m;
        cin >> n >> x >> m;
        vec dm(k);
        Rep (i, k) dm[i] = d[i] % m;
        ll cnt = 0;
        ll tmp = 0;
        Rep (i, k) {
            if (dm[i] == 0) tmp++;
        }
        cnt += tmp * ((n-1) / k);
        Rep (i, (n-1) % k) {
            if (dm[i] == 0) cnt++;
        }

        // cout << "cnt(=):" << cnt << "\n";

        ll s = 0;
        Rep (i, k) {
            s += dm[i];
        }
        ll y = x;
        y += s * ((n-1) / k);
        Rep (i, (n-1) % k) {
            y += dm[i];
        }

        // cout << "x=" << x << " y=" << y << "\n";

        cnt += y / m - x / m;

        // cout << "cnt(>):" << cnt << "\n";
        cout << n - 1 - cnt << endl;
    }

}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int num = 0;
    int temp;
    while(n)
    {
        temp = n%10;
        if(temp == 2)
            num ++;
        n /= 10;
    }
    printf("%d",num);
    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N, M, C;
	cin >> N >> M >> C;
	vector<int> B(M);
	REP(i, M) cin >> B[i];
	int res = 0;
	REP(i, N) {
		int sum = C;
		REP(j, M) {
			int A;
			cin >> A;
			sum += A * B[j];
		}
		if (sum > 0) res++;
	}
	cout << res << "\n";

	return 0;
}

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

int main(){
  long long int x, y;
  scanf("%lld%lld",&x,&y);
  int sequenceCount = 0;
  //for(long long int i = x; i <= y; i++){
  long long int i = x;
    int countTrial = 1;
    long long int trial = i;
    while(trial + trial <= y){
      trial = trial + trial;
      countTrial++;
      //printf("%lld(%d): %lld\n", i, countTrial, trial);
      //printf("IN");
    }
    //printf("HI");
    //printf("\n");
    sequenceCount = max(countTrial,sequenceCount);
  //}
  printf("%d\n", sequenceCount);
  return 0;
}


Measured memory_bytes: 256
class Combination:
    def __init__(self, mod, max_n):
        self.MOD = mod
        self.MAX_N = max_n

        self.f = self.factorial(self.MAX_N)
        self.f_inv = [self.inv(x) for x in self.f]

    def inv(self,x):
        return pow(x, self.MOD-2, self.MOD)
    
    def factorial(self, n):
        res = [1]
        for i in range(1,n+1):
            res.append(res[-1] * i % self.MOD)
        return res
    
    def comb(self, n, r):
        return (self.f[n] * self.f_inv[r] % self.MOD) * self.f_inv[n-r] % self.MOD

N, M, K = map(int,input().split())
CB = Combination(10**9+7, 200010)

ans = 0

for d in range(N):
    ans += (((CB.comb(N*M-2, K-2) * (N-d) % CB.MOD ) * M % CB.MOD ) * M % CB.MOD) * d % CB.MOD
    ans %= CB.MOD

for d in range(M):
    ans += (((CB.comb(N*M-2, K-2) * (M-d) % CB.MOD ) * N % CB.MOD ) * N % CB.MOD) * d % CB.MOD
    ans %= CB.MOD

print(ans)



Measured memory_bytes: 24760
times = [int(input()) for _ in range(5)]

rem = float("inf")
last = 0
for time in times:
    if time % 10 < rem and time % 10 != 0:
        rem = time % 10
        last = time
if last:
    times.remove(last)

total_time = 0
for time in times:
    if time % 10 == 0:
        total_time += time
    else:
        total_time += time + (10 - time % 10)
total_time += last

print(total_time)

Measured memory_bytes: 9096
#include <bits/stdc++.h>
using namespace std;
#define ll = long long int
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int n;
    scanf("%d",&n);
    if(n%10==7||(n/10)%10==7||n/100==7)printf("Yes");
    else printf("No");
    return 0;
}


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

int main(){
  int l,r,d;
  cin >> l >> r >> d;
  int ans=0;
  for(int i=l;i<=r;i++){
    if(i%d==0){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592