akhauriyash/Code-Regression huggingface dataset:
import sys
import random
import time

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')




def solve():
    D = ni()
    c = nl()
    s = [nl() for _ in range(D)]
    m = 26
    start = time.time()

    def calc(sche, m=26):
        last = [-1] * m
        ans = 0
        for i in range(D):
            t = sche[i]
            ans += s[i][t]
            last[t] = i
            for j in range(m):
                ans -= c[j] * (i - last[j])
        return ans

    def change(d, q, sc):
        b = sche[d]
        fq, bq = -1, D
        fb, bb = -1, D
        for i in range(d):
            if sche[i] == q:
                fq = i
            if sche[i] == b:
                fb = i
        for i in range(D-1, d, -1):
            if sche[i] == q:
                bq = i
            if sche[i] == b:
                bb = i
        sc += ((bb - d) * (bb - d - 1) // 2 + (d - fb) * (d - fb - 1) // 2) * c[b]
        sc += ((bq - fq) * (bq - fq - 1) // 2) * c[q]
        sc -= s[d][b]
        sc -= ((bq - d) * (bq - d - 1) // 2 + (d - fq) * (d - fq - 1) // 2) * c[q]
        sc -= ((bb - fb) * (bb - fb - 1) // 2) * c[b]
        sc += s[d][q]
        return sc

    sche = [random.randint(0, m-1) for _ in range(D)]
    sc = calc(sche)
    for _ in range(15):
        a = [random.randint(0, m-1) for _ in range(D)]
        nsc = calc(a)
        if sc < nsc:
            sche = a
            sc = nsc

    while time.time() - start < 1.8:
        for _ in range(500):
            d = random.randint(0, D-1)
            q = random.randint(0, m-1)
            nsc = change(d, q, sc)
            if nsc > sc:
                sche[d] = q
                sc = nsc
    prn([1 + x for x in sche])

    return

solve()


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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const int INF = 1e9;
const int MAXN = 2e5 + 5;
const int MOD = 1e9 + 7;

ll n, m, k, x, y;
ll A[MAXN], B[MAXN], C[MAXN], sum;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> x >> y >> n >> m >> k;
	for(int i=1; i<=n; i++) cin >> A[i];
	for(int i=1; i<=m; i++) cin >> B[i];
	for(int i=1; i<=k; i++) cin >> C[i];
	sort(A+1, A+1+n, greater<ll>());
	sort(B+1, B+1+m, greater<ll>());
	sort(C+1, C+1+k, greater<ll>());

	for(int i=1; i<=x; i++) sum += A[i];
	for(int i=1; i<=y; i++) sum += B[i];

	for(int i=1; i<=k; i++) {
		if(x && y) {
			if(A[x] < B[y]) {
				if(A[x] < C[i]) sum -= A[x--], sum += C[i];
			}
			else {
				if(B[y] < C[i]) sum -= B[y--], sum += C[i];
			}
		}
		else if(x) {
			if(A[x] < C[i]) sum -= A[x--], sum += C[i];
		}
		else if(y) {
			if(B[y] < C[i]) sum -= B[y--], sum += C[i];
		}
	}
	cout << sum;
}

Measured memory_bytes: 3584
import bisect
import numpy as np

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A = np.array(A, dtype=np.int64)

lst = [list(map(int, input().split())) for _ in range(M)]
lst = sorted(lst, key=lambda x:x[1], reverse=True)

x = 0
for i in range(len(lst)):
    idx = bisect.bisect_left(A[x:], lst[i][1])
    
    if(A[x+idx-1] <= lst[i][1]):     
        if(lst[i][0] >= idx):
            A[x:(x+idx)] = lst[i][1]
            x = x+idx
        else:
            A[x:(x+lst[i][0])] = lst[i][1]
            x = x + lst[i][0]
    else:
        break
    
print(sum(A))  

Measured memory_bytes: 48428
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(void){
  int thp,tak,ahp,aak;
  (void)scanf("%d %d %d %d",&thp,&tak,&ahp,&aak);
  while(thp>0){
    ahp-=tak;
    if(ahp<=0){
      printf("Yes\n");
      break;
    }
    thp-=aak;
  }
  if(thp<=0)printf("No\n");
  return 0;
}

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

int main(){
	int a,b;
	cin >> a >> b;
	if(a > 9 || b > 9){
		cout << -1 << endl;
	}
	else{
		cout << a*b << endl;
	}
}

Measured memory_bytes: 3628
// Problem : A - A?C
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<string, string> pss;
#define pb push_back
#define PI acos(-1.0)
#define EPS 1e-4
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fout(S,x)            cout<<fixed<<setprecision(x)<<(S)<<endl
#define present(c,x) ((c).find(x) != (c).end())
#define T() ll t;cin>>t;while(t--)
#define mem(input,b) memset(input,b,sizeof(input))
#define ff first
#define ss second
#define fread(input) freopen("input","r",stdin)
#define fwrite(b) freopen("b","w",stdout)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define FOREACH(i,c) for (__typeof ((c).begin()) i = (c).begin() ; i != (c).end() ; i++)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int main(){
    fastio;
    string s;
    cin>>s;
    if(s=="ABC"){
    	cout<<"ARC";
    }
    else{
    	cout<<"ABC";
    }
    return 0;
}    


Measured memory_bytes: 3616
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
import random
import time
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def score(t):
        n = 26
        v = 0
        minus = sum_ = sum(c)
        last = [0]*n
        for i in range(d):
            ti = t[i]-1
            minus -= (i+1-last[ti])*c[ti]
            v += s[i][ti]-minus
            minus += sum_
            last[ti] = i+1
        return v
    start = time.time()
    d = I()
    c = LI()
    s = LIR(d)
    n = 26
    t = [(i%n)+1 for i in range(d)]
    v = score(t)
    i = 0
    while time.time() < 1.5+start:
        nt = [i for i in t]
        r = random.random()
        if r > 0.5:
            if nt[i] < n:
                nt[i] += 1
        else:
            if nt[i] > 1:
                nt[i] -= 1
        nv = score(nt)
        if v < nv:
            t = [i for i in nt]
            v = nv
        i += 1
        i %= d
    for i in t:
        print(i)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 83148
#include <stdio.h>
char s [100001];
int main ()
{
    int i,j,b=0,b1=0;
    scanf("%s", s);
    for (i=0;s[i]!= '\0';i++);
    for (j=0;j<i;j++ ){
        if(j%2==0 && s[j]=='1') 
            b++;
        if (j%2!=0 && s[j]=='0')
            b++;        
    }   
    for (j=0;j<i;j++ ){
        if(j%2==0 && s[j]=='0') 
            b1++;
        if (j%2!=0 && s[j]=='1')
            b1++;        
    }  
    if (b<b1) printf ("%d", b);
    else printf ("%d", b1);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stdint.h>
#include <set>

using namespace std;

int main()
{
  int A, B;
  cin >> A;
  cin >> B;

  set<int> S;
  S.insert(A);
  S.insert(B);

  for (int x = 1; x < 4; ++x) {
    if (S.count(x)==0) {
      cout << x << endl;
      break;
    }
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

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

int main() {
  int N, Y;
  cin >> N >> Y;

  int x = -1;
  int y = -1;
  int z = -1;
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N - i; j++) {
      int k = N - i - j;
      if ((i * 10000 + j * 5000 + k * 1000) == Y) {
        x = i;
        y = j;
        z = k;
        break;
      }
    }
  }
  cout << x << " " << y << " " << z << endl;

  return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


inline void transpose(vector<string> &a) {

    int n = a.size();
    if (n == 0) return;
    int m = a[0].size();
    vector<string> b(m, string(n, ' '));
    fori (i, n) fori (j, m) b[j][i] = a[i][j];
    a = b;
}


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

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


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const ll M = 1e9 + 7;
const int N = 3009;

ll dp[N][N];
ll pref[N][N];

ll get_pref(int i, int l, int r)  {
    if (!l--) return pref[i][r];
    return (pref[i][r] - pref[i][l] + M) % M;
}

string s;
int n;

void smain() {

    cin >> n >> s;
    dp[n - 1][0] = 1;
    fori (i, n + 1) pref[n - 1][i] = 1;
    for (int i = n - 2; i >= 0; --i) {
        int num = n - i;
        for (int j = 0; j < num; ++j) {
            if (s[i] == '>') {
                dp[i][j] = get_pref(i + 1, 0, j - 1);
            } else {
                dp[i][j] = get_pref(i + 1, j, n);
            }
        }
        pref[i][0] = dp[i][0];
        for (int j = 1; j <= n; ++j) {
            pref[i][j] = (pref[i][j - 1] + dp[i][j]) % M;
        }
    }
    cout << pref[0][n];
}

Measured memory_bytes: 141568
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

    int N, K, l[50];
    cin >> N >> K;

    rep(i, N) cin >> l[i];
    sort(l, l+N, greater<int>());

    int ans = 0;
    rep(i, K) ans += l[i];
    cout << ans << endl;
}

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

int main() {
	string s, t; cin >> s >> t;
	sort(s.begin(),s.end());
	sort(t.begin(), t.end(),greater<char>());
	if (t < s || s == t)cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define sh short int
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const int inf = 1e9*2;
const ll mod = 1e9+7;
ll n,k;
ll a[200009];
double dp[1009];
double sol(ll val){
    double ret = 0;
    for(ll j=1;j<=val;j++){
        ret += (double)j/val;
    }
    return dp[val]=ret;
}
int main(){
    fast,cin>>n>>k;
    for(int i=0;i<n;i++) cin>>a[i];
    double ans = 0,mx = 0;
    for(int i=0;i<k;i++){
        ans += sol(a[i]);
    }
    ll j = 0; mx = ans;
    for(int i=k;i<n;i++){
        ans -= dp[a[j++]];
        ans += sol(a[i]);
        mx = max(mx,ans);
    }
    cout<<fixed<<setprecision(12)<<mx<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
bool judge(int n,string s){
    int nn = n/2;
    rep(i,nn){
        if(s[i]!=s[i+nn]) return false;
    }
    return true;
}
int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n%2!=0){
        cout << "No" << endl;
        return 0;
    }
    if(judge(n,s)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    char c;
    cin >> c;
    c++;
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
vec after_sim(vec &v) {
	int c[4][4];
	rep(i, 16) {
		int x = i / 4, y = i % 4;
		c[x][y] = v[i];
	}
	vec w[4][4];
	while (true) {
		vec nex[4][4];
		rep(i, 4) {
			rep(j, 4) {
				rep(k, w[i][j].size()) {
					int dir = w[i][j][k];
					int nx = i + dx[dir], ny = j + dy[dir];
					if (nx < 0 || ny < 0 || nx >= 4 || ny >= 4)continue;
					nex[nx][ny].push_back(dir);
				}
			}
		}
		rep(i, 4) {
			rep(j, 4) {
				if (c[i][j] > 0) {
					c[i][j] += nex[i][j].size(); nex[i][j].clear();
				}
				if (c[i][j] > 4) {
					rep(k, 4)nex[i][j].push_back(k);
					c[i][j] = 0;
				}
			}
		}
		int sum = 0;
		rep(i, 4)rep(j, 4) {
			w[i][j] = nex[i][j]; sum += w[i][j].size();
		}
		if (sum == 0)break;
	}
	vec ret;
	rep(i, 16) {
		ret.push_back(c[i / 4][i % 4]);
	}
	return ret;
}
map<vec, bool> used;
void solve() {
	vec v(16);
	rep(i, 16) {
		cin >> v[i];
	}
	int tmp = 0;
	vec g(16, 0);
	if (g == v) {
		cout << 0 << endl; return;
	}
	queue<vec> q; q.push(v); used[v] = true;
	while (!q.empty()) {
		tmp++;
		if (tmp > 5) {
			cout << -1 << endl; return;
		}
		int len = q.size();
		rep(aa, len) {
			vec v = q.front(); q.pop();
			rep(i, 16) {
				vec u = v; u[i]++;
				u = after_sim(u);
				if (u == g) {
					cout << tmp << endl; return;
				}
				if (used[u])continue;
				used[u] = true;
				q.push(u);
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> w>>h>>n,n)solve();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 14464
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    v = [[] for i in range(n)]
    v_ = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v_[b].append(a)
    dp = [0]*n
    for y in range(1,n)[::-1]:
        d = dp[y]
        for x in v_[y]:
            dp[x] += (d+1)/len(v[x])
    ans = dp[0]
    p = [0]*n
    p[0] = 1
    for x in range(n-1):
        d = p[x]/len(v[x])
        for y in v[x]:
            p[y] += d
    for a in range(n-1):
        if len(v[a]) == 1:
            continue
        m = max([dp[b] for b in v[a]])
        for b in v[a]:
            if dp[b] == m:
                break
        l = dp[0]
        k = dp[a]
        dp[a] = 0
        le = len(v[a])-1
        for y in v[a]:
            if y == b:
                continue
            dp[a] += (dp[y]+1)/le
        d = l+p[a]*(dp[a]-k)
        dp[0] = l
        if 0 < d < ans:
            ans = d
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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


bool isRange(int x,int y){
    return -75<=x && x<=75 && -75<=y && y<=75;
}
int main(){
    int t,n;
    int dx[6]={1,1,0,-1,-1,0};
    int dy[6]={1,0,-1,-1,0,1};
    while(cin>>t>>n,t){
        vector<vector<int>> ob(151,vector<int>(151,0));
        for(int i=0;i<n;i++){
            int x,y;
            cin>>x>>y;
            ob[x+75][y+75]=1;
        }
        pair<int,int> s;
        cin>>s.first>>s.second;
        vector<vector<int>> been(151,vector<int>(151,0));
        been[s.first+75][s.second+75]=1;
        int cnt=1;
        queue<pair<pair<int,int>,int>> q;
        q.push(make_pair(s,0));
        while(!q.empty()){
            auto state=q.front();
            q.pop();
            auto p=state.first;
            int turn=state.second;
            if(turn==t)
                continue;
            for(int i=0;i<6;i++){
                int tox=p.first+dx[i];
                int toy=p.second+dy[i];
                if(isRange(tox,toy) && !ob[tox+75][toy+75] && !been[tox+75][toy+75]){
                    been[tox+75][toy+75]=1;
                    cnt++;
                    q.push(make_pair(make_pair(tox,toy),turn+1));
                }


            }

        }
        cout<<cnt<<endl;

    }

    return 0;
}

Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int a, b, c;
	cin >> a >> b >> c;

	if(c <= a - b){
		cout << 0 << endl;
	}else{
		cout << c - (a - b) << endl;
	}

}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int k = 0;
    if(a % d == 0){
        k = a / d;
    }else{
        k = a /d;
        k++;
    }

    int m = 0;
    if(c % b == 0){
        m = c / b;
    }else{
        m = c / b;
        m++;
    }

    if(m <= k){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3636
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (n, m) = (it.next().unwrap(), it.next().unwrap());
    
    let c = n * m;
    if c % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}

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

typedef long long ll;
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>> cities(n + 1);
    for (int i = 0; i < m; i++) {
        int p, y;
        cin >> p >> y;
        cities[p].push({y, i});
    }
    vector<pair<int, int>> ans(m);
    for (int i = 1; i <= n; i++) {
        auto city = cities[i];
        int idx = 1;
        while (!city.empty()) {
            auto top = city.top();
            city.pop();
            ans[top.second] = {i, idx};
            idx++;
        }
    }
    for (auto a : ans) {
        string fh = string(6 - to_string(a.first).length(), '0') + to_string(a.first);
        string sh = string(6 - to_string(a.second).length(), '0') + to_string(a.second);
        cout << fh << sh << endl;
    }
    return 0;
}


Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T f=0,x=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
namespace run{
	const int N=409,mod=998244353;
	inline int add(int x,int y){return x+y>=mod?x-mod+y:x+y;}
	inline void addto(int &x,int y){x=x+y>=mod?x-mod+y:x+y;}
	inline int sub(int x,int y){return x>=y?x-y:x+mod-y;}
	inline void subto(int &x,int y){x=x>=y?x-y:x+mod-y;}
	inline int qpow(int x,int y){
		int ret=1;
		while(y){
			if(y&1) ret=1LL*x*ret%mod;
			x=1LL*x*x%mod,y>>=1;
		}
		return ret;
	}

	int n,A[N],B[N],f[2][N][N],cur,pre,SA,SB,inv[N];
	int main(){
		n=read<int>();
		for(int i=1;i<=n;i++) A[i]=read<int>(),B[i]=read<int>();
		inv[0]=inv[1]=1;
		for(int i=2;i<N;i++) inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;

		f[cur][0][0]=mod-1;
		for(int i=1;i<=n;i++){
			pre=cur,cur^=1;
			memset(f[cur],0,sizeof f[cur]);
			for(int j=0;j<=SA;j++)
				for(int k=0;k<=SB;k++){
					addto(f[cur][j][k],f[pre][j][k]);
					int ifac=1,pw=1;
					for(int p=0;p<B[i];p++){
						subto(f[cur][j+A[i]][k+p],1LL*f[pre][j][k]*ifac%mod*pw%mod);
						ifac=1LL*ifac*inv[p+1]%mod,pw=1LL*pw*A[i]%mod;
					}
				}
			SA+=A[i],SB+=B[i]-1;
		}

		int ans=0;
		for(int j=1;j<=SA;j++){
			int fac=1,pw=1;
			for(int k=0;k<=SB;k++){
				addto(ans,1LL*f[cur][j][k]*fac%mod*pw%mod*SA%mod*inv[j]%mod);
				fac=1LL*fac*(k+1)%mod,pw=1LL*pw*inv[j]%mod;
			}
		}
		printf("%d\n",ans);
		return 0;
	}
}
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}

Measured memory_bytes: 5084
#include <stdio.h>
// #include <bits/std++.h>

#include <algorithm>
#define MAX_N 100010 

using namespace std;

int n;
long long hap[MAX_N][3];
long long dp[MAX_N][3];


int main(int argc,char* argv[]){
    scanf("%d\n",&n);


    for(int i = 0; i < n; i++)
    {
        scanf("%lld %lld %lld",&hap[i][0],&hap[i][1],&hap[i][2]);
    }

    for(int i = n - 1;i >= 0; i--){
        dp[i][0] = hap[i][0] + max(dp[i+1][1],dp[i+1][2]);

        dp[i][1] = hap[i][1] + max(dp[i+1][0],dp[i+1][2]);

        dp[i][2] = hap[i][2] + max(dp[i+1][1],dp[i+1][0]);
    }

    // printf("\n");

    // for(int i = 0; i < n; i++)
    // {
    //     for(int k = 0; k < 3; k++)
    //     {
    //         printf("[%d] ",dp[i][k]);
    //     }
    //     printf("\n");
    // }
    
    long long out = max(dp[0][0],max(dp[0][1],dp[0][2]));
    printf("%lld",out);


    return 0;
}



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

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int a,b,c;
  cin>>a>>b>>c;
  int mx=0;
  mx=max(max(a,b),c);
  int ans=1e9;
  rep(i,mx,1000001)
    {
      int curr=0,cnt=0;
      if((i-a)%2==1) cnt++;
      curr+=(i-a)/2;
      if((i-b)%2==1) cnt++;
      curr+=(i-b)/2;
      if((i-c)%2==1) cnt++;
      curr+=(i-c)/2;
      if(cnt==0) ans=min(ans,curr);
      else if(cnt==2) ans=min(ans,curr+1);
    }
  cout<<ans<<endl;
  return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin()) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
	for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
	FASTIO
// 	///*
// #ifndef ONLINE_JUDGE
// 	freopen("in.txt", "r", stdin);
// 	freopen("out.txt", "w", stdout);
// 	freopen("error.txt", "w", stderr);
// #endif
//*/
	int T;
	//scanf("%d", &T);
	T = 1;
	for (int cs = 1; cs <= T; cs++) {
		int n;
		cin >> n;
		vector<int> a(n), b(n), c(n);
		for (int i = 0; i < n; i++) cin >> a[i], --a[i];
		for (int i = 0; i < n; i++) cin >> b[i];
		for (int i = 0; i < n - 1; i++) cin >> c[i];
		int ans = 0;
		for (int i = 0; i < n; i++) {
			ans += b[a[i]];
			if (i) {
				if (a[i] - a[i - 1] == 1)ans += c[a[i] - 1];
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    double x[n];
    double y[n];
    for(int i=0;i<n;i++)cin >> x[i] >> y[i];
    vector<int>v(n);
    for(int i=0;i<n;i++)v[i] = i;
    double summ = 0.0;
    double cnt = 0;
    do{
        cnt+=1.0;
        for(int i=0;i<n-1;i++){
            summ += sqrt((x[v[i]]-x[v[i+1]])*(x[v[i]]-x[v[i+1]]) + (y[v[i]]-y[v[i+1]])*(y[v[i]]-y[v[i+1]]));
        }
    }while(next_permutation(v.begin(),v.end()));

    printf("%.10lf", summ/cnt);
}

Measured memory_bytes: 3860
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

int main(){
    int H,W;
    cin>>H>>W;
    char C[100][100];
    for(int i=0;i<H;i++){
        for(int k=0;k<W;k++){
            cin>>C[i][k];
        }
    }
    for(int i=0;i<H;i++){
        for(int k=0;k<W;k++){
            cout<<C[i][k];
        }
        cout<<endl;
        for(int k=0;k<W;k++){
            cout<<C[i][k];
        }
        cout<<endl;
   }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
  int N;
  string S;
  cin>>N>>S;
  int num[26]={};
  
  for(int i='a';i<='z';i++){
    for(int j=0;j<N;j++){
      if(S[j]==i){
        num[i-'a']++;
      }
    }
  }
  long long ans=1;
  long long mod=1e9+7;
  for(int i=0;i<26;i++){
    if(num[i]!=0){
      ans*=(num[i]+1);
      ans%=mod;
    }
  }
  cout<<ans-1;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <cmath>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

int main(){

  int N; 
  string S;
  int sum = 1;

  cin >> N;
  cin >> S;

  for( int i = 0; i < N-1; i++ ){
    if( S[i] != S[i+1] ) sum++;
  }

  cout << sum << endl;

  return 0;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

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

int main() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;

  int mx = max({a1, a2, a3});

  int mn = min({a1, a2, a3});
  
  cout << mx  - mn;

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;

int gcd(int x,int y){
  if(y == 0){
    return x;
  }
  return gcd(y, x%y);
}

int main(){
  int N,X;
  cin >> N >> X;
  vector<int> x(N+1);
  for(int i=0; i<N; i++){
    cin >> x[i];
  }
  if(N == 1){
    cout << abs(X-x[0]) << endl;
    return 0;
  }
  x[N] = X;
  sort(x.begin(),x.end());
  int G;
  G = gcd(x[2]-x[1],x[1]-x[0]);
  for(int i=2; i<N; i++){
    G = gcd(G,x[i+1]-x[i]);
  }
  cout << G << endl;
  return 0;
}


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

using namespace std;

int main() {
    long long N; cin >> N;
    vector<long long> X(5);
    for(int i = 0; i < 5; i++) {
        cin >> X[i];
    }
    sort(X.begin(), X.end());

    long long ans = ceil((long double)N / X[0]) + 4;
    cout << ans << endl;

    return 0;
}

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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 1e6 + 69;
const int base = 311;

// dung inverse module de tinh nCk
// beginer 86
// mbeginer 162
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/

int main()
{
   int q;
   cin >> q;
   ll cur = 0;
   ll pre1 = 0;
   ll pre2 = 0;
   bool chk = true;
   while(q -- )
   {
       ll t, x, y;
       cin >> t >> x >> y;
       if(t - cur < abs(x - pre1) + abs(y - pre2) ||((t - cur) - abs(x - pre1) - abs(y - pre2))%2 != 0 )
       {
           //cout << t <<" "<<x<<" "<<y;
           chk = false;
       }
       pre1 = x;
       pre2 = y;
       cur = t;
   }
   if(chk == false) cout <<"No";
   else cout <<"Yes";
}
/*

*/


Measured memory_bytes: 256
#include <stdio.h>
#include<iostream>
#include<string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <map>
using namespace std;
int main() {
    string s;
    cin>>s;
    if(s=="RRR") printf("3\n");
    else if(s=="RRS"||s=="SRR") printf("2\n");
    else if(s=="SSS") printf("0\n");
    else printf("1\n");
    return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

using namespace std;

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

const int INF = 1001001001;
const int MAX = 400010;

struct segtree {
    int N, dat[2*MAX];
    segtree() {}
    segtree(int n) {
        N = 1;
        while(N < n) N *= 2;
        for(int i = 0; i < 2*N-1; i++)
            dat[i] = INF;
    }
    // update k th element
    void update(int k, int a) {
        k += N-1; // leaf
        dat[k] = a;
        while(k > 0) {
            k = (k - 1) / 2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
        }
    }
    // min [a, b)
    int query(int a, int b) { return query(a, b, 0, 0, N); }
    int query(int a, int b, int k, int l, int r) {
        if(r <= a or b <= l) return INF;
        if(a <= l and r <= b) return dat[k];
        int m = (l + r) / 2;
        return min(query(a, b, k*2+1, l, m), query(a, b, k*2+2, m, r));
    }
};

segtree even, odd;
vi dict;

struct Data
{
    int a, b;
    int x, y;
    
    bool operator< (const Data& d) const
    {
        return x > d.x;
    }
};

Data make(int a, int b)
{
    int x, y;
    //cout << "a = " << a << ", b = " << b << flush;

    if(a%2 == 0){
        x = even.query(a/2, b/2);
        y = odd.query(dict[x]/2, b/2);
    }
    else{
        // 01234567
        x = odd.query(a/2, b/2);
        y = even.query(dict[x]/2+1, b/2+1);
    }
    
    //cout << ", x = " << x << ", dict[x] = " << dict[x] << ", y = " << dict[y]  << endl;
    return {a, b, x, y};
}

signed main()
{
    int n;
    cin >> n;
    
    even = segtree(n);
    odd  = segtree(n);
    dict = vi(n+1);
    
    rep(i, n){
        int p;
        cin >> p;
        dict[p] = i;
        if(i%2 == 0) even.update(i/2, p);
        else         odd.update(i/2, p);
    }
    
    /*
    rep(i, n/2) cout << even.query(i, i+1) << ", ";
    cout << endl;
    rep(i, n/2) cout << odd.query(i, i+1) << ", ";
    cout << endl;
    */
    
    priority_queue<Data> segs;
    segs.push(make(0, n));
    
    
    while(!segs.empty())
    {
        Data d = segs.top();
        segs.pop();
        
        cout << d.x << ' ' << d.y << ' ';
        
        if(d.a < dict[d.x])         segs.push(make(d.a, dict[d.x]));
        if(dict[d.x]+1 < dict[d.y]) segs.push(make(dict[d.x]+1, dict[d.y]));
        if(dict[d.y]+1 < d.b)       segs.push(make(dict[d.y]+1, d.b));
    }
    
    cout << endl;
}


Measured memory_bytes: 12276
my %aa;
my $a = <>;
for (1..$a) {
    my $str = <>;
    chomp $str;
    $aa{$str}++;
}

my %bb;
my $b = <>;
for (1..$b) {
    my $str = <>;
    chomp $str;
    $bb{$str}++;
}

my $max = 0;
foreach (keys %aa) {
    my $tmp = $aa{$_} - $bb{$_};
    $max = $max < $tmp
        ? $tmp
        : $max
        ;
}

print $max;

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#define f cin
#define NMAX 200010
using namespace std;

//ifstream f("date.in");

long long int n, h[NMAX];
long long int dp[NMAX];

int main() {

    f >> n;
    for (int i = 0; i < n; ++i) {
        f >> h[i];
    }

    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for (int i = 2; i < n; ++i) {
        dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
    }

    cout << dp[n - 1];

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>
#include<string>

using namespace std;

int main() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0) {
			break;
		}
		int ue = 1, sita = 6, temae = 2, oku = 5, migi = 3, hidari = 4;
		int score = 1;
		for (int i = 0; i < n; ++i) {
			int keep = 0;
			string move;
			cin >> move;
			if (move == "South") {
				keep = ue;
				ue = oku;
				oku = sita;
				sita = temae;
				temae = keep;
			}
			else if (move == "North") {
				keep = ue;
				ue = temae;
				temae = sita;
				sita = oku;
				oku = keep;
			}
			else if (move == "East") {
				keep = ue;
				ue = hidari;
				hidari = sita;
				sita = migi;
				migi = keep;
			}
			else if (move == "West") {
				keep = ue;
				ue = migi;
				migi = sita;
				sita = hidari;
				hidari = keep;
			}
			else if (move == "Right") {
				keep = temae;
				temae = migi;
				migi = oku;
				oku = hidari;
				hidari = keep;
			}
			else {
				keep = temae;
				temae = hidari;
				hidari = oku;
				oku = migi;
				migi = keep;
			}
			score += ue;
		}
		cout << score << endl;
	}
	return 0;
}

Measured memory_bytes: 2988
use std::io::stdin;
use std::str::FromStr;
#[allow(dead_code, unused_mut)]
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().expect("1")
}
#[allow(dead_code, unused_mut)]
fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().expect("2"))
        .collect()
}
#[allow(dead_code, unused_mut)]
fn read_two<T: FromStr>() -> (T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code, unused_mut)]
fn read_three<T: FromStr>() -> (T, T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code)]
fn remove_whitespace(s: &str) -> String {
    s.chars().filter(|c| !c.is_whitespace()).collect()
}

#[allow(unused_imports)]
use std::io::{stdout, Write};
#[allow(unused_imports)]
use std::collections::HashMap;
fn gcd(mut x: u64, mut y: u64) -> u64 {
    let mut z = x;
    let mut gcd_num = x;
    while z != 0 {
        gcd_num = z;
        z = y % x;
        y = x;
        x = z;
    }
    gcd_num
}
fn main() {
    let x: i64 = read();
    let mut count :i32 = 0;
    let mut y:i64 = 100;
    while x > y {
        y = (y as f64 * 1.01) as i64;
        count += 1;
    }
    println!("{}", count);
}


Measured memory_bytes: 2108
sub f{($x,$i)=@_;$B[$i]+=$x,$i+=$i&-$i until$i>5e5}sub a{($i,$s)=@_;0while$s+=$B[$i],$i&=$i-1;$s}<>;f$_,++$%for glob<>;/ .* />$`?f$',$&+1:print$/,a($')-a$&for<>

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


    # divisors.sort()
    return divisors
  
i = input()
A = int(i.split(' ')[0])

print(min(make_divisors(A))-2)


    

Measured memory_bytes: 3060
### main

while true
  r, a = gets.strip.split(' ')
  break if r == '0' && a == '0'

  hit = blow = 0

  for i in (0..3)
    if r[i] == a[i]
      hit += 1
    elsif r.include? a[i]
      blow += 1
    end
  end

  puts [hit, blow].join(' ')
end

Measured memory_bytes: 6112
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

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

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    int H, W, K; cin >> H >> W >> K;
    int blackCnt = 0;
    vector<vector<char>> c(H, vector<char>(W));
    rep(i, H) {
        rep(j, W) {
            cin >> c[i][j];
            if (c[i][j] == '#') blackCnt++;
        }
    }

    int ans = 0;
    rep(h, 1 << H) { // bit 全探索（2 の H 乗通りのループ）
        rep(w, 1 << W) { // bit 全探索（2 の W 乗通りのループ）
            int decr = 0;
            rep(i, H) {
                rep(j, W) {
                    // i ビット目が立っているときだけ処理をおこなう
                    if (h >> i & 1 or w >> j & 1) {
                        if (c[i][j] == '#') decr++;
                    }
                }
            }
            int tmpans = blackCnt - decr;
            if (tmpans == K) ans++;
        }
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3624
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
int main()
{
	int h,w;
	cin>>h>>w;
	char s[105][105];
	for0(i,h){
		cin>>s[i];
		}
	for0(i,w+2)cout<<"#";
	cout<<nw;
	for0(i,h){
		cout<<"#";
		for0(j,w)cout<<s[i][j];
		cout<<"#";
		cout<<nw;
		}
	for0(i,w+2)cout<<"#";
	return 0;
}

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

#define N 500

int main()
{
	int n, c[N], s[N], f[N], ans[N] = { 0 }, sum, box = 0;

	cin >> n;

	for (int i = 0; i < n-1; i++)
		cin >> c[i] >> s[i] >> f[i];

	for (int i = 0; i < n - 1; i++){
		sum = s[i] + c[i];
		for (int j = i + 1; j < n - 1; j++){
			if (s[j] >= sum)
				sum = s[j];
			else{
				box = s[j];
				while (sum > box)
					box += f[j];
				sum = box;
			}
				sum += c[j];
		}
		ans[i] = sum;
	}

	for (int i = 0; i < n; i++)
		cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K; cin >> N >> K;
    double ans = 0.0;
    FOR(i, 1, N + 1){
        double tmp = 1.0 / (double)N;
        int i0 = i;
        while(i0 < K){
            tmp *= 0.5;
            i0 *= 2;
        }
        ans += tmp;
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int
main(int argc, const char *argv[])
{
    int H, W;
    while (scanf("%d%d", &H, &W) != EOF) {
        if (!H && !W) break;
        for (int i = 0; i != H; ++i) {
            for (int j = 0; j != W; ++j) {
                if (i == 0 || i == H - 1 || j == 0 || j == W - 1) putchar('#');
                else putchar('.');
            }
            putchar('\n');
        }
        putchar('\n');
    }

    return 0;
}

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

using namespace std;
int main(){

   int n;
   cin>>n;
   int ar[n+2];
   ar[0] =0;
   for(int i=1;i<=n;i++){
      cin>>ar[i];
      ar[i]+=ar[i-1];
   }
   int ans =ar[n];

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

      int val =ar[n]-ar[i];
      ans = min(ans,abs(val-ar[i]));
   }
   cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256