akhauriyash/Code-Regression huggingface dataset:
h, w = map(int, input().split())
g = [ list(input()) for _ in range(h) ]

for y in range(h):
    for x in range(w):
        if g[y][x] == '.':
            cnt = 0
            for dx in range(-1, 2):
                for dy in range(-1, 2):
                    nx = x + dx
                    ny = y + dy
                    if nx < 0 or w <= nx or ny < 0 or h <= ny:
                        continue
                    if g[ny][nx] == "#":
                        cnt += 1
            g[y][x] = str(cnt)

for i in range(h):
    print("".join(g[i]))

Measured memory_bytes: 3188
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var K = input[1];

        var h = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        var result = 0;
        foreach (var item in h)
        {
            if (item >= K)
            {
                result++;
            }
        }
        Console.WriteLine(result);
    }
}


Measured memory_bytes: 19040
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

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

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll n[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

void solve() {
	ll K;
	cin >> K;
	cout << n[K - 1] << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


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

int main(){
    string A;
    long n_alphabets[27]={};
    long long int count = 0;
    const string alphabets="abcdefghijklmnopqrstuvwxyz";
    unordered_map<char,int> alphamp;
    for(int i=0;i<26;i++){
        alphamp[alphabets[i]] = i;
    }
    cin >> A;
    for(long i=0;i<A.size();i++){
        //cout << alphamp[A[i]] << "\n";
        n_alphabets[alphamp[A[i]]]++;
    }
    for(int i=0;i<26;i++){
        count += n_alphabets[i]*(n_alphabets[i]-1)/2;
        //cout << n_alphabets[i]*(n_alphabets[i]-1)/2 << endl;
    }
    //cout << A.size();
    cout << A.size()*(A.size()-1)/2 - count + 1 << "\n";
    
    return 0;
}

Measured memory_bytes: 640
n = int(input())
s = [input() for i in range(n)]
dict = {}
count = 0
for word in s:
    sorted_word = sorted(word)
    sorted_word = "".join(sorted_word)
    if sorted_word not in dict:
        dict[sorted_word] = 0
    else:
        dict[sorted_word] += 1
        count += dict[sorted_word]
print(count)

Measured memory_bytes: 24976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef complex<double> pt;
int k,n,m;
vector<int>ret; int cnt = 0;
void calc(int k,int n,int par){
	if(k<=0 || n<=0) return;
	if(k%2==0){
		ret.pb(k/2);
		while(ret.size()<m) ret.pb(k);
		return;
	}
	if(k%2==1&&n%2==0){
		ret.pb((k+1)/2);
		calc(k,n-1,1); cnt++;
		return;
	}
	else{
		ret.pb((k+1)/2);
		calc(k,n-1,0);
		return;
	}
}
int main(){
	cin>>k>>n; m = n;
	int flag = 1;
	if(k%2 == 1) flag += n;
	flag %= 2;
	if(flag%2 == 0) calc(k,n,1);
	else calc(k,n,0); //for(int i=0;i<ret.size();i++)cout<<ret[i]<<endl;
	while(cnt){
		{
			int i = ret.size()-1;
			if(ret[i] != 1){
				ret[i]--;
				cnt--;
			}
			else{
				while(ret[i] == 1){
					i--;
					ret.pop_back();
					cnt--;
					if(cnt == 0){
						goto nxt;
					}
				}//cout<<cnt<<endl;
				ret[i]--;
				while(ret.size()!=n) ret.pb(k);
				cnt--;
			}
		}
	}nxt:;
	for(int i=0;i<ret.size();i++) printf("%d ",ret[i]);
	puts("");
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  string s,t;
  cin >> s >> t ;
  int N(s.size()),M(t.size());
  vi s1(N+1),s2(M+1);
  rep(i,N) s1[i+1] = int(s[i]-'A')+1;
  rep(i,M) s2[i+1] = int(t[i]-'A')+1;
  rep(i,N) (s1[i+1] += s1[i]) %= 3;
  rep(i,M) (s2[i+1] += s2[i]) %= 3;
  int q; cin >> q ;
  rep(i,q){
    int a,b,c,d; cin >> a >> b >> c >> d ;
    a--; b--; c--; d--;
    cout << ((s1[b+1]-s1[a]+3)%3 == (s2[d+1]-s2[c]+3)%3 ? "YES" : "NO") << endl;
  }
}

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

using namespace std;

//#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

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

    string s;
    cin >> s;
    int sum = 0;
    for (auto &el : s) {
        sum += (el - '0');
    }
    cout << (sum % 9 == 0 ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)




//UnionFind Template
struct UnionFind{ //構造体の定義
    vector<int> d; 
    UnionFind(int n=0): d(n,-1) {} //コンストラクタ
    int find(int x){
        if(d[x]<0) return x;
        return d[x]=find(d[x]);
    }
    bool unite(int x, int y){
        x=find(x); y=find(y);
        if(x==y) return false;
        if(d[x]<d[y]) swap(x,y);//d[x] is smaller. Then, connect d[x] to d[y].
        d[y]+=d[x];
        d[x]=y;
        return true;
    }
    bool same(int x, int y){
        return find(x)==find(y);
    }
    int size(int x){
        return -(d[find(x)]);   
    }
    int rootsize(){
        int cnt=0;
        for(auto& v: d){
            if(v<0) cnt++;
        }
        return cnt;
    }
};
//How to use
//UnionFind uf(n); などと書けば使えるようになる.ufというobjectが生成される
//uf.unite(a,b);などで中の関数を使える



int main(){
    int n,m; cin>>n>>m;
    vector<int> a(m), b(m);
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
    }
    int cnt=0;
    rep(i,m){
        UnionFind uf(n);
        rep(j,m){
            if(i==j) continue;
            uf.unite(a[j], b[j]); 
        }
        if(uf.rootsize()>1){
            cnt++;
        }
    }
    cout<< cnt <<endl;
    return 0;


}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int,int>;
constexpr ll mod = 1000000007;
void pPRINTl(ostream& ost) { ost << endl; }
template <class T>void pPRINTL(ostream& ost,T t){ost<<t<<endl;}
template <class T, class... U>void pPRINTl(ostream& ost, T t, U... u) {ost << t << " ";pPRINTl(ost, u...);}
//template <class... T>void PRINTl(T... t) { pPRINTl(cout, t...); }
#define PRINTl //
void pPRINT(ostream& ost) {}
template <class T>void pPRINT(ostream& ost, T t){ost<<t;}
template <class T, class... U>void pPRINT(ostream& ost, T t, U... u) {ost << t << " ";pPRINT(ost, u...);}
template <class... T>void PRINT(T... t) { pPRINT(cout, t...); }
 
 
 
int main(){
  
  ll r;
  cin>>r;
  PRINT(3*r*r);
  
  
  return 0;
}

Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right; sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n, c = wi()
xv = mi(n)
#下準備，時計回り
cwli = []; cal = 0
for i in range(n):
    cal += xv[i][1] - xv[i][0]
    if i > 0:
        cal += xv[i - 1][0]#戻す，復元
    cwli.append([cal, i])
#下準備，反時計回り
ccwli = []; cal = 0
for i in range(n - 1, -1, -1):
    cal += xv[i][1] - (c - xv[i][0])
    if i < n - 1:
        cal += (c - xv[i + 1][0])
    ccwli.append([cal, i])

cwli2 = sorted(cwli, reverse=True)
ccwli2 = sorted(ccwli, reverse=True)

#時計回りから
nowp = 0
#cwansli = [-INF] * n
for i in range(n):
    while nowp < n:
        if ccwli2[nowp][1] > i:
            ans = max(cwli[i][0] - xv[i][0] + ccwli2[nowp][0], ans)
            break
        else:
            nowp += 1
#反時計回りから
#ccwansli = [-INF] * n
nowp = 0
for i in range(n - 1, -1, -1):
    while nowp < n:
        if cwli2[nowp][1] < i:
            ans = max(ccwli[n - i - 1][0] - (c - xv[i][0]) + cwli2[nowp][0], ans)
            break
        else:
            nowp += 1

ans = max(cwli2[0][0], ccwli2[0][0], ans)

print(ans)

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

int main(){
    int x[4], y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    int hen_x = x[1] - x[0];
    int hen_y = y[1] - y[0];
    x[2] = x[1] - hen_y;
    y[2] = y[1] + hen_x;
    x[3] = x[2] - hen_x;
    y[3] = y[2] - hen_y;
    cout << x[2] << " " << y[2] << " " << x[3] << " "<< y[3] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    string in; cin >> in;
    int n = in.size();
    int ai = in.find('A');
    reverse(_all(in));
    int zi = n - 1 - in.find('Z');

    cout << zi - ai + 1 << endl;

    return 0;
}


Measured memory_bytes: 720
#ARC73-C
n,T=map(int,input().split())
t=list(map(int,input().split()))
e=T
total=T
for i in range(1,n):
    if t[i]<e:
        total=total-(e-t[i])+T
        e=t[i]+T
    else:
        e=t[i]+T
        total+=T
print(total)

Measured memory_bytes: 85456
#include <bits/stdc++.h>
#define fr first
#define sc second

using namespace std;

int n,a[100005],cnt1[100005],cnt2[100005],m;

pair <int,int> p1,p2,p3,p4; 

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        m=max(m,a[i]);
    }
    for (int i = 1; i <= n; i+=2)
        cnt1[a[i]]++;
    for (int i = 2; i <= n; i+=2)
        cnt2[a[i]]++;
    for (int i = 1; i <= m; i++)
    {
        if (cnt1[i]>=p1.sc) p2.fr=p1.fr, p2.sc=p1.sc, p1.fr=i, p1.sc=cnt1[i];
        else if (cnt1[i]>=p2.sc) p2.fr=i, p2.sc=cnt1[i];
        if (cnt2[i]>=p3.sc) p4.fr=p3.fr, p4.sc=p3.sc, p3.fr=i, p3.sc=cnt2[i];
        else if (cnt2[i]>=p4.sc) p4.fr=i, p4.sc=cnt2[i];
        
    }
    if (p1.fr!=p3.fr) cout << n-p1.sc-p3.sc;
    else cout << n-max(p1.sc+p4.sc,p3.sc+p2.sc);
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (a < b) {
        if (a + v * t >= b + w * t) cout << "YES" << endl;
        else cout << "NO" << endl;
    } else {
        if (a - v * t <= b - w * t) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

}


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

int INF = 1234567890;

int L[300000];
int R[300000];
int cnt;

void merge(int A[],int left,int mid,int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; ++i) L[i] = A[left + i];
    for (int i = 0; i < n2; ++i) R[i] = A[mid + i];
    L[n1] = INF;
    R[n2] = INF;

    int i = 0;
    int j = 0;

    for (int k = left; k < right; ++k) {
        cnt ++ ;
        if(L[i] <= R[j]) A[k] = L[i++];
        else A[k] = R[j++];
    }
}

void mergeSort(int A[], int left,int right){
    if(left + 1 < right){
        int mid = (left + right) / 2;
        mergeSort(A,left,mid);
        mergeSort(A,mid,right);
        merge(A,left,mid,right);
    }
}

int main(){
    int n,A[600000];
    cnt = 0;

    cin >> n;
    for (int i = 0; i < n ; ++i)  cin >> A[i];
    mergeSort(A,0,n);

    for (int i = 0; i < n ; ++i) {
        if( i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl << cnt << endl;
    return 0;
}

Measured memory_bytes: 5076
s = int(input())

A = []

for i in range(1, 1000000):
  if i == 1:
    a = s
  elif a % 2 == 0:
    a = a / 2
  else:
    a = 3 * a + 1
  if a in A:
    print(i)
    break
  A.append(a)
  #print(A)


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

int main(){
  int n; cin >> n;
  ll ans = 0;
  for(int i = 1; i < n; i++){
    int m = 0;
    if(n%i==0)m = n/i -1;
    else m = n/i;
    ans += m;
  }
  cout << ans << endl;
  return 0;
}
    
  

Measured memory_bytes: 3596
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

from collections import deque
que = deque()
que.append(0)
seen = [-1] * n
seen[0] = 0
while len(que) > 0:
    i = que.popleft()
    for gi in G[i]:
        if seen[gi] != -1:
            continue
        seen[gi] = i
        que.append(gi)
print('Yes')
for i in range(1, n):
    print(seen[i] + 1)



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

int main()
{
    int a, b;
    cin >> a >> b;
    int c = a + b;
    int d = a - b;
    int e = a * b;
    c = max(c, d);
    c = max(c, e);
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
//#include <multiset>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll a, b, c, d;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>a>>b>>c>>d;
    cout<<max(max(a*c, a*d), max(b*c, b*d));
}


Measured memory_bytes: 3644
import math

def factorize(p):
    l = []
    while p % 2 == 0:
        p //= 2
        l.append(2)

    r = 3
    while r < int(math.sqrt(p)+1):
        if p % r == 0:
            p //= r
            l.append(r)
        else:
            r += 2

    if p != 1:
        l.append(p)

    return l

n = int(input())
l = factorize(n)

print(str(n)+":",*l)

Measured memory_bytes: 7764
import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt

  def rec(acc:Int, num:Int):Int = {
    if(num == 0) acc
    else rec(acc+num%10, num/10)
  }

  val ans = if(n % rec(0,n) == 0) "Yes" else "No"
  println(ans)
}

Measured memory_bytes: 25544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a;
    double b;
    cin >> a >> b;
    ll c = llround(b * 100);
    cout << a * c / 100 << '\n';
    return 0;
}


Measured memory_bytes: 3760
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

const double PI = 3.141592653589793;

void solve()
{
	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2 ;
	int u = y2 - y1;
	for(int i=0;i<u;i++) cout << "U";
	int r = x2 - x1 ;
	for(int i=0;i<r;i++) cout << "R";
	for(int i=0;i<u;i++) cout << "D";
	for(int i=0;i<r;i++) cout << "L";
	cout << "L";
	u++;
	for(int i=0;i<u;i++) cout << "U";
	r++;
	for(int i=0;i<r;i++) cout << "R";
	cout << "DR";
	for(int i=0;i<u;i++) cout << "D";
	for(int i=0;i<r;i++) cout << "L";
	cout << "U";
}

int32_t main()
{
	FastIO;
	Fast_D;
	solve();
	return 0;
}


Measured memory_bytes: 3664
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CMinCostCycle {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> A(N), B(N);
        REP(i, N) cin >> A[i] >> B[i];

        vector<P> v;
        REP(i, N) {
            v.emplace_back(A[i], i);
            v.emplace_back(B[i], i);
        }
        sort(v.begin(), v.end());

        int res = INF;
        {
            int tmp = 0;
            REP(i, N) tmp += A[i];
            res = min(res, tmp);
        }
        {
            int tmp = 0;
            REP(i, N) tmp += B[i];
            res = min(res, tmp);
        }
        {
            int tmp = 0;
            bool ok = false;
            set<int> s;
            REP(i, N) {
                auto kv = v[i];
                if (s.count(kv.second)) ok = true;
                tmp += kv.first;
                s.insert(kv.second);
            }
            if (ok) {
                res = min(res, tmp);
            }
        }
        {
            if (v[N - 1].second == v[N].second) {
                int tmp1, tmp2;
                tmp1 = 0, tmp2 = 0;

                REP(i, N - 1) tmp1 += v[i].first;
                tmp1 += v[N + 1].first;

                REP(i, N - 2) tmp2 += v[i].first;
                tmp2 += v[N - 1].first + v[N].first;

                res = min({res, tmp1, tmp2});
            } else {
                int tmp = 0;
                REP(i, N - 1) tmp += v[i].first;
                tmp += v[N].first;
                res = min(res, tmp);
            }
        }

        cout << res << endl;

    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CMinCostCycle solver;
    solver.solve(in, out);
    return 0;
}


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

int main() {
	string s;
	cin >> s;

	int cnt = 0;
	int ans = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T') {
			cnt++;
		} else {
			if (ans < cnt) {
				ans = cnt;
			}
			cnt = 0;
		}
	}
	if (ans < cnt) {
		ans = cnt;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
vector<ll> V;
int pre[maxn],a[maxn],b[maxn];
map<ll,ll> M;
int main() {
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>pre[i];
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=M[i-pre[i]];
        M[pre[i]+i]++;
    }cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 27076
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = (int)1e9 + 7;
int INF = (int)2e18;


signed main() {
    int X, A;
    cin >> X >> A;
    if (X < A) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
}


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

string s;

int main(){
    vector<int> t;
    cin >> s;

    for(int i = 0; i < s.length(); i++){
        if(s[i] == '0'){ //0
            t.push_back(0);
        }else if(s[i] == '1'){//1
            t.push_back(1);
        } else if(!t.empty()){ //B
            t.pop_back();
        }
    }

    int x = t.size();

    for(int i = 0; i < x; i++){ //top then pop (but reverse) 
        cout << t[i];
    }

}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func Palindrome(s string)bool {
    judge := true
    for i := 0; i < len(s) / 2; i++ {
      if s[i] != s[len(s)-1-i] {
        judge = false
      }
    }
  	return judge
}

func main() {
	var s string
  	fmt.Scan(&s)
  	
    if Palindrome(s) && Palindrome(s[:(len(s)-1)/2]) && Palindrome(s[(len(s)-1+3)/2:]) {
      fmt.Println("Yes")
      return
    }
    fmt.Println("No")
}

Measured memory_bytes: 512
using System;

namespace abc130_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();

            var items = input.Split(' ');

            var x = 0;
            if (items.Length > 0)
            {
                if (!int.TryParse(items[0], out x))
                {
                    x = 0;
                }
            }

            var a = 0;
            if (items.Length > 1)
            {
                if (!int.TryParse(items[1], out a))
                {
                    a = 0;
                }
            }

            var answer = 0;
            if (x < a)
            {
                answer = 0;
            }
            else
            {
                answer = 10;
            }

            Console.WriteLine($"{answer}");
        }
    }
}


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

int main() {
  LL n;
  cin >> n;
  vector<LL> a(n);
  LL sum = 0;
  for (int i = 0; i < n; i ++) {
    cin >> a[i];
    sum += a[i];
  }

  LL x = sum;
  for (int i = 1; i < n; i += 2) x -= 2 * a[i];

  cout << x;
  for (int i = 1; i < n; i ++) {
    x = 2 * a[i - 1] - x;
    cout << " " << x; 
  }
  cout << endl;
}

Measured memory_bytes: 2048
#include<iostream>
#include<vector>

using namespace std;
int main(void){
  int n,j = 0,i,c,a[10000],b[10000];
  /* vector <int> a;
     vector <int> b;*/
  vector <int> d;
  vector <int> sa(10000,0);
  vector <int> sb(10000,0);
  while(cin >> n,n != 0){
    for(i=0;i<n;i++){
      cin >> a[i];
      cin >> b[i];
    }
    
    i=0;
    for(i=0;i<n;i++){
      c = a[i] + b[i];
      if(a[i] > b[i]) sa[j] = sa[j] + c;
      else if(a[i] < b[i]) sb[j] = sb[j] + c;
      else{
	sa[j] = sa[j] + c/2;
	sb[j] = sb[j] + c/2;
      }
    }
    j++;

    cout << sa[j-1] << " " << sb[j-1] << endl;
  }
}

Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
 
 
int main(void){
	string s;
	int n;
	cin>>n;
	cin>>s;
	int count[26];
	rep(i,26){
		count[i] = 0;
	}
	rep(i,n){
		count[s[i] - 'a'] += 1;
	}
	ll ans = 1;

	rep(i,26){
		ans *= (count[i] + 1);
		ans = ans % MOD;
	}
	if(ans == 0){
		ans = MOD;
	}
	cout<<ans - 1<<endl;
	return 0;
}

Measured memory_bytes: 512
public class
Main
{
  public void
  run (
    final java.io.BufferedReader in,
    final java.io.PrintStream out
    )
  throws java.io.IOException
  {
    int i;

    for ( ; ; )
    {
      java.util.List<Pair<String,Integer>> lis;
      java.util.Map<String,Integer> h;
      char ch;
      int n;

      n = ( new java.util.Scanner ( in.readLine ( ) ) ).nextInt ( );
      if ( n == 0 ) break ;

      h = new java.util.HashMap<String,Integer> ( );
      for ( i = 0; i < n; ++i )
      {
        final java.util.StringTokenizer tok = new java.util.StringTokenizer ( in.readLine ( ) );

        while ( tok.hasMoreTokens ( ) )
        {
          final String t = tok.nextToken ( );

          if ( h.containsKey ( t ) )
            h.put ( t, h.get ( t ) + 1 );
          else
            h.put ( t, 1 );
        }
      }

      lis = new java.util.LinkedList<Pair<String,Integer>> ( );
      for ( java.util.Iterator<String> it = h.keySet ( ).iterator ( ); it.hasNext ( ); )
      {
        final String key = it.next ( );

        lis.add ( new Pair<String,Integer> ( key, h.get ( key ) ) );
      }
      java.util.Collections.sort ( lis );

      i = 0;
      ch = in.readLine ( ).charAt ( 0 );
      for ( java.util.Iterator<Pair<String,Integer>> it = lis.iterator ( ); it.hasNext ( ) && i < 5; )
      {
        final Pair<String,Integer> p = it.next ( );

        if ( p.key.charAt ( 0 ) == ch )
        {
          if ( i > 0 )
            out.print ( " " );
          out.print ( p.key );
          ++i;
        }
      }
      out.println ( i == 0 ? "NA" : "" );
    }
  }

  public static void
  main (
    final String[ ] args
    )
  {
    try
    {
      ( new Main ( ) ).run ( new java.io.BufferedReader ( new java.io.InputStreamReader ( System.in ) ), System.out );
    }
    catch ( Exception e ) { }
  }

  private class
  Pair<K extends Comparable<K>, V extends Comparable<V>>
  implements Comparable<Pair<K,V>>
  {
    public final K key;
    public final V value;

    public
    Pair (
      K key,
      V value
      )
    {
      this.key   = key;
      this.value = value;
    }

    public int
    compareTo (
      Pair<K,V> obj
      )
    {
      if ( this.value.equals ( obj.value ) )
        return ( this.key.compareTo ( obj.key ) );
      return ( obj.value.compareTo ( this.value ) );
    }
  }
}

Measured memory_bytes: 35276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


int main(){
    ll n;   cin >> n;
    vector<ll> dp(n+1, 0);
    dp[0] = 1;
    rep(i, n){
        for(ll k=3; i+k<=n; k++){
            dp[i+k] += dp[i];
            dp[i+k] %= MOD;
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3588
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>

using namespace std;

int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    int f=0;
    if((abs(b-a)<=d&&abs(b-c)<=d)||abs(a-c)<=d)
        f=1;
    printf(f==1?"Yes\n":"No\n");
    return 0;
}


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

int main()
{
    int n; cin>>n;
    double up=1,down=0;
    for(int i=0;i<n;i++)
    {
        double x; cin>>x;
        down+=(1/x);
    }
    cout<<fixed<<setprecision(15)<<1/down;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pll;
const int N = 1e5 + 5;
ll n, k;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i = 0;i < n;++i)
    {
        ll x;
        cin >> x;
    }
    --n, --k;
    cout << (n / k) + (n % k != 0);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  long X;
  cin >> X;
  long zan=100;
  int ans=0;

  while(zan<X){
    zan=zan*1.01;
    ans++;
  }

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

Measured memory_bytes: 3600
N = int(input())
scores = []
valid_min = 200
for i in range(N):
    score = int(input())
    scores.append(score)
    if score < valid_min and score%10 != 0 :
        valid_min = score

if valid_min == 200:
    print(0)
else:
    result = sum(scores)
    if result%10 == 0:
        print(result - valid_min)
    else:
        print(result)


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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n;
    double d;
    cin >> n >> d;
    vector<double> x(n);
    vector<double> y(n);
    rep(i, n) {
        cin >> x.at(i) >> y.at(i);
    }
    int ans = 0;
    rep(i, n) {
        double a;
        a = x.at(i) * x.at(i) + y.at(i) * y.at(i);
        if (a <= d * d) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6492
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  int forbidden[10] = {0};
  for (int i=0; i<k; i++) {
    int t;
    cin >> t;
    forbidden[t] = 1;
  }
  for (int res = n; ; res ++) {
    int ok = 1;
    int j = res;
    while (j) {
      if (forbidden[j%10]) ok = 0;
      j /= 10;
    }
    if (ok) {
      printf("%d\n", res);
      return 0;
    }
  }
}


Measured memory_bytes: 764
import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12f}".format(ans))

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main{
    public static void main(String[] args) throws IOException {
        
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()){
            int v1 = scan.nextInt();
            int v2 = scan.nextInt();
            String s = String.valueOf(v1 + v2);
            System.out.println(s.length());
        }
    }
}

Measured memory_bytes: 20560
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

bool solve(){
  int n,m;
  int max_v[SIZE] ={};
  
  scanf("%d%d",&n,&m);

  if(n == 0) return false;
  
  for(int i=0;i<n;i++){
    int d,v;
    scanf("%d%d",&d,&v);

    max_v[d] = max(max_v[d], v);
  }

  int ans = 0;
  
  for(int i=1;i<=m;i++){
    ans += max_v[i];
  }

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

  return true;
}

int main(){
  while(solve());
  
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	int A,B,K;
	cin >> A >> B >> K;
	vector<int> CommonDivisor;
	for(int i = 1;i <= min(A,B);i++){
		if(A%i == 0 && B%i == 0){
			CommonDivisor.push_back(i);
		}
	}
	cout << CommonDivisor[CommonDivisor.size()-K] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#define N 600

int
main(int argc, char** argv)
{
	int d;

	while (scanf("%d", &d) != EOF)
	{
		int i;

		int a = 0;
		for (i = 0; i < N; i += d)
			a += i * i * d;

		printf("%d\n", a);
	}

	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
 
int main(void) {
  int H, W, i, j;
 
  for (; scanf("%d %d", &H, &W); ) {
    if (H == W && H == 0) {
      break;
    }
 
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        putchar((i + j) % 2 ? '.' : '#');
      }
 
      putchar('\n');
    }
 
    putchar('\n');
  }
 
  return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順


int main(){
	string s;
	cin >> s;
	int n = s.size();
	string s2 = s;
	reverse(ALL(s2));
	if(s != s2){
		cout << "No" << endl;
		return 0;
	}
	string a = s.substr(0,n/2);
	string b = s.substr(n/2+1);

	

	string b2 = b;
	reverse(ALL(b));
	if(b != b2){
		cout << "No" << endl;
		return 0;
	}

	if(a == b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  int n;
  cin>>n;
  map<string, int> m;
  string s;
  for(auto&& i:irange(0,n)) {
    cin>>s;
    ++m[s];
  }
  int mx = 0;
  for(auto&& p:m) {
    mx = max(mx, p.second);
  }
  for(auto&& p:m) {
    if(p.second != mx) continue;
    cout<<p.first<<'\n';
  }
  cout<<flush;
  return 0;
}


Measured memory_bytes: 25216
def resolve():
    N = int(input())
    S = [input() for i in range(N)]
    import collections
    d = collections.Counter(S[0])
    for i in range(1, len(S)):
        d = (d & collections.Counter(S[i]))
    # print(d)
    s = ""
    for k in d.keys():
        for j in range(d[k]):
            s += k 
    print("".join(sorted(s)))
    



if '__main__' == __name__:
    resolve()

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


int N, K;

int main() {
    cin >> N >> K;
    vector<bool> A(N, true);
    for (int i = 0; i < K; i++)
    {
        int d;
        cin >> d;
        for (int i = 0; i < d; i++)
        {
            int a;
            cin >> a;
            A[a-1] = false;
        }
        
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += A[i];
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#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 ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    string n;
    cin >> n;
    int i = n.back() - '0';

    if (i == 2 or i == 4 or i == 5 or i == 7 or i == 9) {
        cout << "hon" << endl;
    } else if (i == 3) {
        cout << "bon" << endl;
    } else cout << "pon" << endl;

    return 0;
}


Measured memory_bytes: 3652
import java.io.*;
import java.util.*;

class Main {

    // Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long[] h = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                h[i] = sc.nextLong();
        }
        solve(N, h);
    }

    static void solve(long N, long[] h){
	int ans = 0;
	while(!isAllZero(h)) {
	    int left = 0;
	    while(left < h.length) {
		//System.out.println(Arrays.toString(h));
		int right = left;
		while(right < h.length && h[right] != 0) { right++; }
		if (left != right) { ans++; }
		for(int i = left; i < right; i++) {
		    h[i]--;
		}
		left = right + 1;
	    }
	}
	System.out.println(ans);
    }

    static boolean isAllZero(long[] h) {
	for(long i: h) {
	    if (i != 0) {
		return false;
	    }
	}
	return true;
    }
}


Measured memory_bytes: 23892