akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define nax 2000002
int divisors[nax];

void solve(){
    for(int i=1; i<nax; i++){
        divisors[i]=0;
    }
    for(int i=1; i<nax; i++){
        for(int j=1; j*i<nax; j++){
            divisors[i*j]++;
        }
    }
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    int n;
    cin >> n;

    int ans = 0;
    for(int c=1; c<=n-1; c++){
        int product = n-c;
        int divs = divisors[product];
        ans+=divs;
    }

    cout<<ans<<'\n';

    return 0;
}


Measured memory_bytes: 11428
/* This code is written by Nemlit */
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen("std.out","w",stdout)
#define rep(i, a, b) for(re int i = (a); i <= (b); ++ i)
#define drep(i, a, b) for(re int i = (b); i >= (a); -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define int long long
#define D double
#define inf 1023456789
#define mod 1000000007
#define lb(x) (x)&(-(x))
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
#define ls k * 2
#define rs k * 2 + 1
#define maxn 2333
namespace Graph {
	int head[maxn], cnt;
	struct edge { int v, next; }e[maxn << 1];
	il void add(int u, int v) { e[++ cnt] = (edge){v, head[u]}, head[u] = cnt, e[++ cnt] = (edge){u, head[v]}, head[v] = cnt; }
}
using namespace Graph;
int dep[maxn], n, m, ans = inf, dp[maxn], sz[maxn], flag, temp, Ma[maxn];
char c[maxn];
il void dfs(int u, int fr) {
	dep[u] = dep[fr] + 1, sz[u] = dp[u] = (c[u] == '1'), temp += dep[u] * dp[u], Ma[u] = dp[u];
	Next(i, u) if(e[i].v != fr) dfs(e[i].v, u), sz[u] += sz[e[i].v], Ma[u] += Ma[e[i].v] + sz[e[i].v];
}
il void check(int u, int fr) {
	int now = 0, sum = 0;
	Next(i, u) {
		int v = e[i].v;
		if(v == fr) continue;
		check(v, u), now = max(now, dp[v]);
	}
	Next(i, u) {
		int v = e[i].v;
		if(v == fr) continue;
		sum += (Ma[v] > now) ? now - (Ma[v] % 2 != now % 2) : Ma[v];
	}
	dp[u] = max(sum % 2, now * 2 - sum) + sz[u];
}
signed main() {
	n = read(), scanf("%s", c + 1);
	rep(i, 2, n) add(read(), read());
	rep(i, 1, n) {
		temp = 0, dep[i] = -1, dfs(i, i), check(i, i);
		if((temp % 2 == 0) && dp[i] == sz[i]) ans = min(ans, temp / 2);
	}
	cout << (ans == inf ? -1 : ans) << endl;
	return 0;
}


Measured memory_bytes: 512
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void fx(vector<int> &a,int n, int m){

}

// -----------------------------------------------------------------------

int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}

// -----------------------------------------------------------------------



void q1(){
	
	int a=0,b=0;
	int t;
	for(int i=0;i<3;++i){
		cin>>t;
		if(t==5)
		a++;
		else if(t==7)
		b++;
	}
	if(a==2 && b==1)
	cout<<"YES\n";
	else 
	cout<<"NO\n";
}
// -----------------------------------------------------------------------


void q2(){
	int n;
	cin>>n;
	vector<string> v(n);
	for(int i=0;i<n;++i)
	cin>>v[i];
	sort(all(v));
	for(int i=0;i<n;++i)
	cout<<v[i];
	cout<<endl;
}

// -----------------------------------------------------------------------

void q3(){
	int n,k;
	cin>>n>>k;
	int brr[10];
	for(int i=0;i<10;++i)
	brr[i]=1;
	while(k--){
		int t;
		cin>>t;
		brr[t]=0;
	}
	stack<int> st;
	while(n!=0){
		int num=n%10;
		n/=10;
		int next=num;
		while(brr[next]==0){
			next++;next%=10;
		}
		st.push(next);
		if(next<num)
			n++;	//carry	
	}
	while(!st.empty()){
		int t=st.top();
		st.pop();
		cout<<t;
	}
}


// -----------------------------------------------------------------------

void q4(){
	int h,w,A,b;
	cin>>h>>w>>A>>b;
	vector<int> a(w),ret(w),res(w-b);
	for(int i=0;i<w;++i)
	a[i]=1; ret[0]=1;
	int n,m;n=w;m=h-A-1;
	while(m--){
		for(int i=1;i<n;++i){
			ret[i]=ret[i-1]+a[i];
		}
		for(int i=0;i<n;++i){
			a[i]=ret[i];
		}
		ret[0]=1;
	}
	for(int i=0;i<n;++i)
	cout<<a[i]<<" ";
	cout<<endl;
	res[0]=a[b];
	for(int i=b+1;i<n;++i)
	res[i-b]=res[i-b-1]+a[i];
	m=A-1;	ret[0]=res[0];	n=n-b;
	while(m--){
		for(int i=1;i<n;++i){
			ret[i]=ret[i-1]+res[i];
		}
		for(int i=0;i<n;++i){
			res[i]=ret[i];
		}
	} 
	cout<<res[n-1];
}

// -----------------------------------------------------------------------


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	q1();
	return 0;
}


Measured memory_bytes: 256
#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b = mi()
    if a%2 != b%2:
        print('IMPOSSIBLE')
        exit()
    else:
        print((a+b)//2)

main()




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

int euclid(int a, int b){
    int r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    int k;
    cin >> k;

    int ans = 0;
    for (int x = 1; x <= k; ++x){
        for (int y = 1; y <= k; ++y){
            for (int z = 1; z <= k; ++z){
                int r1;
                if (x>y){
                    r1 = euclid(x, y);
                }else{
                    r1 = euclid(y, x);
                }

                int r2;
                if (r1>z){
                    r2 = euclid(r1, z);
                }else{
                    r2 = euclid(z, r1);
                }
                ans+=r2;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    h = A[0]
    ans = 0
    for a in A:
        h = max(h, a)
        ans += h - a
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 33292
#include <bits/stdc++.h>
#include <iostream>
#include<string>
#include<cmath>
#include<vector>
#include<set>
typedef long long ll;
#define ss ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
using namespace std;

int main()
{
ss
long long  n,d,t=0;
    cin>>n>>d;
    while(n--)
    {
       long long  a,b;
        cin>>a>>b;
        if((a*a+b*b)<=d*d)
            t++;
    }
    cout<<t;
	return 0;
}


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

int n;

int main(){
  cin >> n;
  set<int> st;
  rep(i, n){
    int a; cin >> a;
    st.insert(a);
  }
  if(st.size() == n){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};


const int MAX = 510000;
const int mod = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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 COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//a^n (mod m)
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//mod mでの a の逆元を求める
ll modinv(ll a) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll a[2],b[2];
    cin>>a[0]>>a[1]>>b[1]>>b[0];
    ll ans = -1e18;
    for(int i=0;i<2;i++)for(int j=0;j<2;j++)chmax(ans, a[i]*b[j]);
    cout << ans << endl;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 1e6+3;

int main() {
    Int n;
    cin >> n;
    vector<vector<Int>> a(2, vector<Int>(3));
    for (Int i = 0; i < 2; i++) {
        for (Int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }
    for (Int i = 0; i < 2; i++) {
        vector<Int> from = a[i];
        vector<Int> to = a[(i + 1) % 2];
        vector<Int> dp(n + 1);
        iota(dp.begin(), dp.end(), (Int)0);
        for (Int i = 0; i < 3; i++) {
            Int f = from[i];
            Int t = to[i];
            for (Int j = 0; j + f <= n; j++) {
                dp[j + f] = max(dp[j + f], dp[j] + t);
            }
        }
        n = dp[n];
    }
    dump(n);
    return 0;
}

Measured memory_bytes: 195584
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<pp> b(n);
    vector<pp> m;
    rep(i,n) {
        cin >> a.at(i);
        b.at(i).first=a.at(i);
        b.at(i).second=i+1;
    }
    cout << 2*n-1 << endl;
    sort(all(b));
    if (abs(b.at(0).first)>b.at(n-1).first){
        rep(i,n){
            cout << b.at(0).second << " " << i+1 << endl;
        }
        rep(i,n-1){
            cout << n-i << " " << n-i-1 << endl;
        }
    }
    else {
        rep(i,n){
            cout << b.at(n-1).second << " " << i+1 << endl;
        }
        rep(i,n-1){
            cout << i+1 << " " << i+2 << endl;
        }
    }
}


Measured memory_bytes: 256
// By Mohit Gupta
#include <bits/stdc++.h>
using namespace std;
//DEBUG 
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define all(v) (v).begin(), (v).end()
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 998244353;
int t,n,m,k,x,y;
 
 
int32_t main()
{
    IOS;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int turn1 = (c+b-1)/b;
    int turn2 = (a+d-1)/d;
    if(turn1<=turn2) cout<<"Yes"<<ln;
    else cout<<"No"<<ln;
}


Measured memory_bytes: 3656
J = "JOI"
I = "IOI"

while s = gets
  cnt_j = 0
  cnt_i = 0
  for i in 0..(s.length-3) do
    if s[i] == J[0]
      cnt_j += 1 if s[i+1] == J[1] && s[i+2] == J[2]
    end
    if s[i] == I[0]
      cnt_i += 1 if s[i+1] == I[1] && s[i+2] == I[2]
    end
  end
  puts cnt_j
  puts cnt_i
end

Measured memory_bytes: 8868
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(void) {
	int prc, num, i = 0, j, buf, ans = 0, len;
	bool bad;
	cin >> prc >> num;
	vector<bool> d(10, true);
	for (; i < num; i++) {
		cin >> buf;
		d[buf] = false;
	}
	ans = prc-1;
	do {
		ans++;
		buf = ans;
		len = 0;
		while (buf > 0) {
			buf /= 10;
			len++;
		}
		vector<int> k(len);
		bad = false;
		for (j = 0; j < len; j++) {
			k[j] = (ans / int(pow(10, len - 1 - j))) % 10;
			if (!d[k[j]])
				bad = true;
		}
	} while (bad);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
input_line = list(map(int,input().split()))
A = input_line[0]
B = input_line[1]
i = A
out = 0
test = []
while i <= B:
    key = 0
    target = list(str(i))
    if len(target)%2 == 0:
        for j in range(int(len(target)/2)):
            if not(target[j] == target[-(j+1)]):
                key +=1
    else:
        for j in range(int(len(target)/2)):
            if not(target[j] == target[-(j+1)]):
                key +=1

    if key < 1:
        out+=1
    i+=1

print(out)

Measured memory_bytes: 3188
#include <iostream>
#include <queue>

using namespace std;

typedef pair <int, int> pii;
queue <pii> q;

int sol [1005] [1005], h, w, bio [1005] [1005];
char mat [1005] [1005];

void bfs () {
	q.push(make_pair (0, 0));
	while (!q.empty()) {
		int x = q.front ().first;
		int y = q.front ().second;
		q.pop();
		if (x >= h || y >= w) continue;
		if (mat [x] [y] == '#') continue;
		if (bio [x] [y]) continue;
		bio [x] [y] = 1;
		if (x > 0) sol [x] [y] += sol [x-1] [y];
		if (y > 0) sol [x] [y] += sol [x] [y-1];
		sol [x] [y] %= 1000000007;
		q.push (make_pair(x+1, y));
		q.push (make_pair(x, y+1));
	}
}

int main () {
	int i;
	cin >> h >> w;
	for (i = 0; i < h; i++) {
		cin>>mat [i];
	}
	sol [0] [0] = 1;
	bfs();
	/*for (i = 0;i < h; i++) {
		for (int j = 0; j < w; j++) cout << sol [i] [j] << " ";
		cout << endl;
	}
	*/
	cout << sol [h-1] [w-1];
	return 0;
}


Measured memory_bytes: 9088
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct SegmentTree {
	int n;
	vector<int> d;
	SegmentTree(int m, int v = 0) {
		for (n = 1; n < m; n *= 2);
		d.assign(n * 2, v);
	}
	void update(int i, int x) {
		d[n + i] = x;
		for (int j = (n + i) / 2; j > 0; j >>= 1)
			d[j] = min(d[j * 2], d[j * 2 + 1]);
	}
	// [l, r)
	int query(int l, int r) {
		assert(l < r);
		int mini = get(l);
		for (; l && l + (l&-l) <= r; l += l&-l)
			mini = min(mini, d[(n + l) / (l&-l)]);
		for (; l < r; r -= r&-r)
			mini = min(mini, d[(n + r) / (r&-r) - 1]);
		return mini;
	}
	int get(int i) { return d[n + i]; }
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;
	SegmentTree st(n, INT_MAX);
	rep(i, 0, q) {
		int com, x, y; cin >> com >> x >> y;
		dump(com, x, y);
		if (com == 0) {
			st.update(x, y);
		}
		else {
			cout << st.query(x, y + 1) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3876
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define INF 0x7fffffff
#define LL_INF 0x7fffffffffffffff
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

int main(void)
{
	int cnt  = 0, n;
	ll d;
	cin >> n >> d;
	for(int i=0;i<n;i++) {
		ll x, y;
		cin >> x >> y;
		if(x * x + y * y <= d * d) cnt++;
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3624
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	static int x, y;
	static int px, py;
	static int mem;
	static int dir;
	static int loop[][][][];
	static String s[];

	static Queue<Q> queue = new LinkedList<Q>();

	static class Q {
		int px, py, mem, dir;

		Q(int px, int py, int mem, int dir) {
			this.px = px;
			this.py = py;
			this.mem = mem;
			this.dir = dir;
		}
	}

	public static boolean f(int px_, int py_, int mem_, int dir_) {
		if (loop[px_][py_][mem_][dir_] == 1) {
			return false;
		}
		if (s[py_].charAt(px_) == '@') {
			return true;
		}
		
		boolean f = false;
		while (true) {
			if (loop[px_][py_][mem_][dir_] == 1) {
				break;
			}
			if (s[py_].charAt(px_) == '@') {
				f = true;
				break;
			}
			loop[px_][py_][mem_][dir_] = 1;
			px = px_;
			py = py_;
			mem = mem_;
			dir = dir_;
			move();
			px_ = px;
			py_ = py;
			mem_ = mem;
			dir_ = dir;
			if (dir_ == 0) {
				px_ = (px_ + 1) % x;
			} else if (dir_ == 1) {
				py_ = (py_ + 1) % y;
			} else if (dir_ == 2) {
				px_ = (px_ + x - 1) % x;
			} else if (dir_ == 3) {
				py_ = (py_ + y - 1) % y;
			}
		}
		if (f) {
			return true;
		}
		while (!queue.isEmpty()) {
			Q q = queue.poll();
			if (f(q.px, q.py, q.mem, q.dir)) {
				return true;
			}
		}
		return false;
	}

	public static void move() {
		if (s[py].charAt(px) == '<') {
			dir = 2;
		} else if (s[py].charAt(px) == '>') {
			dir = 0;
		} else if (s[py].charAt(px) == '^') {
			dir = 3;
		} else if (s[py].charAt(px) == 'v') {
			dir = 1;
		} else if (s[py].charAt(px) == '_') {
			if (mem == 0) {
				dir = 0;
			} else {
				dir = 2;
			}
		} else if (s[py].charAt(px) == '|') {
			if (mem == 0) {
				dir = 1;
			} else {
				dir = 3;
			}
		} else if (s[py].charAt(px) == '?') {
			queue.add(new Q((px + 1) % x, py, mem, 0));
			queue.add(new Q((px + x - 1) % x, py, mem, 2));
			queue.add(new Q(px, (py + 1) % y, mem, 1));
			queue.add(new Q(px, (py + y - 1) % y, mem, 3));
		} else if ('0' <= s[py].charAt(px) && s[py].charAt(px) <= '9') {
			mem = s[py].charAt(px) - '0';
		} else if (s[py].charAt(px) == '+') {
			mem = (mem + 1) % 16;
		} else if (s[py].charAt(px) == '-') {
			mem = (mem + 15) % 16;
		}
	}

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

		y = sc.nextInt();
		x = sc.nextInt();
		s = new String[y];
		for (int i = 0; i < y; i++) {
			s[i] = sc.next();
		}
		px = py = 0;
		mem = 0;
		dir = 0;
		loop = new int[x + 1][y + 1][16][4];

		if (f(px, py, mem, dir)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 31792
r,c = [int(s) for s in input().split(' ')]
data = [[int(s) for s in input().split(' ')] for i in range(r)]
[row.append(sum(row)) for row in data]
T = [[row[i] for row in data] for i in range(c+1)]
bottom = [sum(t) for t in T]
data += [bottom]
data_s = [' '.join([str(i) for i in row]) for row in data]
[print(row) for row in data_s]

Measured memory_bytes: 7836
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a=sorted(a)
b=sorted(b)
c=sorted(c)
c.insert(0,-1)
c.append(10**10)
B=[0]*n
ans=0
for i in range(n):
    x=b[i]
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if c[m]>x:
            r=m
        elif c[m]<=x:
            l=m
    B[i]=n-l
g=[0]*n


g[n-1]=B[n-1]
for i in range(n-1):
    g[-2-i]=g[-1-i]+B[-2-i]
g.append(0)

b.insert(0,-1)
b.append(10**10)
for i in range(n):
    x=a[i]
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if b[m]>x:
            r=m
        elif b[m]<=x:
            l=m
    ans+=g[l]
print(ans)


Measured memory_bytes: 31460
h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]

dx = [-1,0,1,-1,1,-1,0,1]
dy = [-1,-1,-1,0,0,1,1,1]


for i in range(h):
    for j in range(w):
        cnt = 0
        if s[i][j] != '#':
            
            
            for k in range(8):
                nx = j + dx[k]
                ny = i + dy[k]
            
                if 0 <= nx < w and 0 <= ny < h and s[ny][nx] == "#":
                    cnt += 1
            s[i][j] = str(cnt)
for i in s:
    print(''.join(i))

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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N,X,T; cin >> N >> X >> T;
	int res = N/X;
	if(N%X)res++;
	cout << res*T << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 3588
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm.*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//typedef long long ll;
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define debug() cout << "Hi" << endl	// write debug(); in main()
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
/*		0. Go to main function first.
		1. Take all the inputs................................................
		2. Check Once whether the graph given is directed or undirected.......
		3. Tree can also be undirected.
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	//debug();
	int x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	vector<int> red;
	vector<int> green;
	vector<int> colorless;
	
	int i,r;
	for(i = 0;i < a; ++i){
		cin >> r;
		red.pb(r);
	}
	for(i = 0;i < b; ++i){
		cin >> r;
		green.pb(r);
	}
	for(i = 0;i < c; ++i){
		cin >> r;
		colorless.pb(r);
	}
	
	sort(all(red),greater<int>());
	sort(all(green),greater<int>());
	sort(all(colorless),greater<int>());
	
	priority_queue< int , vector<int> , greater<int> > pq;
	for(i = 0;i < x; ++i)
		pq.push(red[i]);
	for(i = 0;i < y; ++i)
		pq.push(green[i]);
		
	for(int j = 0;j < c; ++j){
		if(pq.top() < colorless[j]){
			pq.pop();
			pq.push(colorless[j]);
		}
	}
	
	int ans = 0;
	while(!pq.empty()){
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;
}
/*	memset() can be used to set all values as 0 or -1 for integer data types.*/

int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(12); std::cout << std::fixed;
	int t;
	// cin >> t;
	t = 1;
	while(t--){
		solve();
	}
	return 0;
}



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

int main(){
    int N;
    cin >> N;
    vector<int> A(N); 
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }

    int count = 0;
    bool flag = false;

    

    for(;;){
        for(int i = 0; i < N; i++){
            if(A.at(i) % 2 == 1){
                flag = true;
                break;
            }   
            A.at(i) = A.at(i) / 2;
        }
        if (flag) break;
        count++;
    }
    

    cout << count << endl;



}

Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
	    java.util.Scanner scanner = new java.util.Scanner(System.in);
	    int n = scanner.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scanner.nextInt();
		}
		java.util.Arrays.sort(a);
		int count = 0;
		int same = 0;
		int i = 0;
		for (i = 0; i < n - 1; i++) {
			if (a[i] == a[i + 1]) {	// 同じならセットで読み飛ばす
				i++;
			} else {
				count++;
			}
		}
		if ( i == (n - 1)) {
			count++;
		}
		System.out.println(count);

	}
}

Measured memory_bytes: 48548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
  int x,y,z;
  cin >> x>>y>>z;
  if(z>=x and y+x>=z)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
    // system("pause");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static int n;
	static int[] a = new int[50];
	static int[] b = new int[50];

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

		n = sc.nextInt();

		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		for (int i = 0; i < n; i++)
			b[i] = sc.nextInt();

		long ans = (1L << 51) - 1;//51桁

		if (!DrawEdge(ans)) {
			System.out.println(-1);
			return;
		}

		for (int i = 51; i >= 0; i--) {
			Long tmp = ans & ~(1L << i);
			if (DrawEdge(tmp)) {
				ans = tmp;
			}
		}

		System.out.println(ans);
	}

	static void priArr(boolean[][] arr) {
		for (boolean[] ar : arr) {
			for (boolean b : ar) {
				System.out.print(b ? "T " : "F ");
			}
			System.out.println();
		}
	}

	static boolean DrawEdge(long bit) {
		boolean[][] arr = new boolean[51][51];

		for (int i = 0; i <= 50; i++) {
			arr[i][i] = true;
		}

		for (int k = 1; k <= 50; k++) {
			if ((bit & (1L << k)) != 0) {
				for (int v1 = 0; v1 <= 50; v1++) {
					arr[v1][v1 % k] = true;
				}
			}
		}

		for (int k = 0; k <= 50; k++) {
			for (int i = 0; i <= 50; i++) {
				for (int j = 0; j <= 50; j++) {
					arr[i][j] |= arr[i][k] & arr[k][j];
				}
			}
		}

		for (int i = 0; i < n; i++) {
			if (!arr[a[i]][b[i]]) {
				return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 24296
n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
for i in reversed(range(0, n-1)):
    if h[i] > h[i+1]+1:
        ans = 'No'
    elif h[i] == h[i+1]+1:
        h[i] -= 1

print(ans)


Measured memory_bytes: 14224
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>

using namespace std;

using ll = long long int; 

void prime(vector<int> &num, int n){
    for(int i=0;i<=n;i++){
        num[i] = 1;
    }
    num[0] = 0;
    num[1] = 0;
    num[2] = 1;

    for(int i=2;i<=sqrt(n);i++){
        if(num[i] == 1){
            for(int j=2;j<=n/i;j++){
                num[i*j] = 0;
            }
        }
    }
}


ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

ll keta(ll a){
  ll ans = 1;
  while(1){
    if(a/10 > 0){
      ans++;
      a = a/10;
    }
    if(a<10) break;
  }
  return ans;
}

int main(void){
   
   int n;
   cin>>n;

   cout<<  n*n<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
const int mod = 987654323;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    string s, tmp;
    cin >> s;
    int res = 0;
    for (int i = 1; i < n; ++i)
    {
        if (s[i] != s[i - 1]) res++;
    }
    res = max(0, res - 2 * k);
    cout << n - 1 - res;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
  int N,Y;
  cin>>N>>Y;
  if(Y/1000<N){
    cout<<"-1 -1 -1\n";
    return 0;
  }
  int out=Y/1000-N;
  int count=0;
  while(out>=0){
    if(out%4==0&&out/4<=N-count){
      cout<< count<<" "<<out/4<<" "<<N-out/4-count;
      //cout<<"ok";
      return 0;
    }
    out=out-9;
    count++;
  }
  cout<<"-1 -1 -1\n";
  return 0;
}


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

const int N = 8;
const bool FREE = false;
const bool NOTFREE = true;
int row[N];
bool col[N],dpos[2*N-1],dneg[2*N-1];
int skip[N],k;

void init() {
    for(int i=0; i<N; i++) {
        row[i] = -1;
        col[i]=FREE;
    }
    for(int i=0; i<2*N-1; i++) dpos[i]=dneg[i]=FREE;
}

void print() {
    for(int i=0; i<N; i++) {
        for(int j=0; j<N; j++) {
            if(row[i]==j) cout << "Q";
            else cout << ".";
        }
        cout << endl;
    }
}

void putQueen(int i) {
    bool flg = true;
    if(i==N) {
        print();
        return;
    }

    for(int j=0; j<k; j++) {
        if(i == skip[j]) {flg = false; break;}
    }

    if(flg) {
        for(int j=0; j<N; j++) {
            if(col[j] == NOTFREE || dpos[i+j] == NOTFREE || dneg[i-j+N-1] == NOTFREE) continue;
            row[i] = j;
            col[j] = dpos[i+j] = dneg[i-j+N-1] = NOTFREE;
            putQueen(i+1);
            row[i] = -1;
            col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
        }
    }

    else putQueen(i+1);
}

int main() {
    init();

    cin >> k;
    for(int i=0; i<k; i++) {
        int r,c;
        cin >> r >> c;
        row[r] = c;
        skip[i] = r;
        col[c] = dpos[r+c] = dneg[r-c+N-1] = NOTFREE;
    }
    putQueen(0);

    return 0;
}



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

int max(int a,int b){
	if(a>b) return a;
	else return b;
}

int min(int a,int b){
	if(a>b) return b;
	else return a;
}

int min_array(int *array){
	int min=array[0];
	for(int i=1;i<sizeof(array)/sizeof(int);i++){
		if(min>array[i]) min=array[i];
	}
	return min;
}

int main(void){
	int n,h[100000],dp[100000];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	dp[0]=0;
	dp[1]=abs(h[0]-h[1]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]));
	}
	printf("%d\n",dp[n-1]);
	return 0;
}

Measured memory_bytes: 896
n , k , c = map(int,input().split())

s = input()

L = []
R = []

i = 0
j = n-1



while i<n and len(L)<k :
    if s[i] == "o" :
        L.append(i)
        i += c
    i += 1

while j>-1 and len(R)<k :
    if s[j] == "o" :
        R.append(j)
        j -= c
    j -= 1

R.reverse()

for x in range(k):
    if R[x] == L[x]:
        print(R[x]+1)

Measured memory_bytes: 20628
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N = 0;
	cin >> N;
	int t1 = 0, x1 = 0, y1 = 0, t2 = 0, x2 = 0, y2 = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> t2 >> x2 >> y2;
		if (!((x2 + y2 - x1 - y1) <= t2 - t1 && ((x2 + y2 - x1 - y1) - (t2 - t1)) % 2 == 0))
		{
			cout << "No" << "\n";
			break;
		}
		if (i == N - 1)
		{
			cout << "Yes" << "\n";
		}
		t1 = t2, x1 = x2, y1 = y2;
	}
}


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

int main() {
    string s;
    cin >> s;
    int counter[256] = {};
    for (auto c : s)
        counter[c]++;

    for (auto c : s)
        if (counter[c] != 2)
            goto fail;

    cout << "Yes";
    return 0;

fail:
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()


using namespace std;

const ll N = 121;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;
ll n;
ll a[N];
ll x = 0;
int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	if(a > 0) {
		ll y = min(a / c, b);
		a -= y * c;
		b -= y;
		if(b % 2)
			cout << abs(a - c)<< '\n';
		else
			cout << abs(a) << '\n';
	}
	else {
		ll y = min((-a) / c, b);
		a += y * c;
		b -= y;
		if(b % 2)
			cout << abs(a + c) << '\n';
		else
			cout << abs(a) << '\n';
	}
}

/*

*/



Measured memory_bytes: 3632
H,W = map(int,input().split())
maze = [list(input()) for j in range(H)]

def bfs(h,w):
  checked = [[False for i in range(W)] for j in range(H)]
  q = [(h,w,0)] if maze[h][w]=="." else []
  checked[h][w] = True
  g_n = 0
  while q:
    h_,w_,n = q.pop(0)
    g_n = max(n, g_n)
    for i,j in zip([0,0,-1,1],[-1,1,0,0]):
      if (0<=h_+i<H) and (0<=w_+j<W):
        if checked[h_+i][w_+j]: continue
        checked[h_+i][w_+j] = True
        if maze[h_+i][w_+j]==".": q.append((h_+i,w_+j,n+1))
  return g_n

n = 0
for i in range(H):
  for j in range(W):
    n = max(n, bfs(i,j))
print(n)

Measured memory_bytes: 3188
import sys
def main():
    input = sys.stdin.readline

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

    res = 0
    for i in range(N):
        a = A[i]
        b = B[i]

        if a >= b:
            res += b
            A[i] = A[i] - b
        elif a < b:
            res += a
            A[i] = A[i] - a
            a_nx = A[i + 1]
            b -= a
            if a_nx >= b:
                res += b
                A[i + 1] = A[i + 1] - b
            elif a_nx < b:
                res += a_nx
                A[i + 1] = A[i + 1] - a_nx
    print(res)

if __name__ == '__main__':
    main()

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  int n,m;
  cin >> n;
  
  vector<string> s(n),t(m);
  for ( int i = 0; i < n; i++){
    cin >> s[i];
  }
  
  cin >> m;
  
  for ( int i = 0; i < m; i++){
    cin >> t[i];
  }

  int saidai = 0;
  
  for ( int i = 0; i < n; i++){
    int count = 0;
    for ( int j = 0; j < n; j++){
      if ( s[i] == s[j] ){
        count++;
      }
    }
    for ( int j = 0; j < m; j++){
      if ( s[i] == t[j] ){
        count--;
      }
    }
    if ( saidai < count ){
      saidai = count;
    }
  }
  
  cout << saidai << endl;
  
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>

using namespace std;

typedef pair<int, int> pii;

int n, m, ss;
int a[34][34], s[35][35];
pii v[34][34][34][34];
int u[34][34][34][34], flag;

const int inf = (int)1e9;

inline pii combine(const pii &a, const pii &b) {
	return make_pair(a.first + b.first, min(a.second, b.second));
}

pii dp(int l, int b, int r, int t) {
	//cout << l << ' ' << r << ' ' << b << ' ' << t << ' ' << v[l][b][r][t]
	if (u[l][b][r][t] == flag)
		return v[l][b][r][t];
	u[l][b][r][t] = flag;
	int sum = s[l][b] + s[r][t] - s[l][t] - s[r][b];
	if (ss - s[0][0] + sum < 0) return make_pair(-inf, -inf);
	pair<int, int> res(1, ss - s[0][0] + sum);
	for (int i = l + 1; i < r; i++)
		res = max(res, combine(dp(l, b, i, t), dp(i, b, r, t)));
	for (int i = b + 1; i < t; i++)
		res = max(res, combine(dp(l, b, r, i), dp(l, i, r, t)));
	v[l][b][r][t] = res;
	return res;
}

int main() {
	while (cin >> n >> m >> ss) {
		if (!n && !m && !ss) break;
		for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
		memset(s, 0, sizeof(s));
		memset(u, 0, sizeof(u));
		memset(v, 0, sizeof(v));
		for (int i = n - 1; i >= 0; i--)
		for (int j = m - 1; j >= 0; j--)
			s[i][j] = s[i + 1][j] + s[i][j + 1] + a[i][j] - s[i + 1][j + 1];
		flag += 10;
		pii res = dp(0, 0, n, m);
		cout << res.first << ' ' << res.second << endl;
	}
	return 0;
}

Measured memory_bytes: 16848
using System;

class Program
{
    /// <summary>
    /// エントリポイント
    /// </summary>
    /// <param name="args"></param>
    static void Main(string[] args)
    {
        //アルファベットカウント格納用配列
        int[] counts = new int[26];
        
        while (true)
        {
            string line = Console.ReadLine();

            if (line == null || line.Length == 0)
                break;
            
            foreach (char ch in line)
            {
                int index = ch.ToString().ToLower()[0] - 'a';

                if (index >= 0 && index <= 25)
                    counts[index]++;
            }
        }
        
        //最終的な加算結果を出力
        for (int arrIndex = 0; arrIndex < counts.Length; arrIndex++)
            Console.WriteLine(ToAlphabet(arrIndex) + " : " + counts[arrIndex]);
    }

    /// <summary>
    /// 数値から文字列へ変換
    /// </summary>
    /// <param name="num"></param>
    /// <returns></returns>
    private static string ToAlphabet(int num)
    {
        string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        string columnStr = string.Empty;
        int m = 0;

        do
        {
            m = num % 26;
            columnStr = alphabet[m] + columnStr;
            num = num / 26;
        } while (0 < num && m != 0);

        columnStr = columnStr.ToLower();
        
        return columnStr;
    }
}




Measured memory_bytes: 9168
package main

import (
	"fmt"
)

func main() {
	var h, w, n int
	fmt.Scanf("%d", &h)
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)

	ans := 0
	if h > w {
		ans = n / h
		if n%h > 0 {
			ans++
		}
	} else {
		ans = n / w
		if n%w > 0 {
			ans++
		}
	}
	fmt.Println(ans)
}


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

using namespace std;

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

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


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int K, S;
	scanf("%d %d", &K, &S);
	
	int X, Y, Z;
	long long ans = 0;
	for (X = 0; X <= K; X++) {
		for (Y = X; Y <= K; Y++) {
			Z = S - X - Y;
			if (Z >= Y && Z <= K) {
				ans += 6;
				if (X == Y || Y == Z) ans -= 3;
				if (X == Y && Y == Z) ans -= 2;
			}
		}
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	a := iSScan(n + 1)
	d := make(map[int]struct{})
	m := -1
	for i := 0; i < n+1; i++ {
		if _, ok := d[a[i]]; ok {
			m = a[i]
		} else {
			d[a[i]] = struct{}{}
		}
	}
	x, y := mod, -1
	for i := 0; i < n+1; i++ {
		if a[i] == m {
			x = smaller(x, i+1)
			y = larger(y, i+1)
		}
	}
	f := make([]int, n+2)
	inv := make([]int, n+2)
	f[0] = 1
	inv[0] = 1
	for i := 1; i < n+2; i++ {
		f[i] = i * f[i-1] % mod
		inv[i] = modinv(f[i], mod)
	}
	for k := 1; k < n+2; k++ {
		p := f[n+1] * inv[n-k+1] % mod * inv[k] % mod
		rem := (n + 1 - y) + (x - 1)
		if rem >= k-1 {
			p -= f[rem] * inv[rem-(k-1)] % mod * inv[k-1] % mod
		}
		if p < 0 {
			p += mod
		}
		fmt.Println(p)
	}
}
func modinv(a, m int) int {
	b, u, v := m, 1, 0
	for {
		t := a / b
		a -= t * b
		u -= t * v
		a, b, u, v = b, a, v, u
		if b == 0 {
			break
		}
	}
	u %= m
	if u < 0 {
		u += m
	}
	return u
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

/////////////////////////////////////////////////////////
class UnionFind {
 public:
  static const int MAX_N_LIB = (int)(2e5 + 100);

  int uf_par[MAX_N_LIB];
  int uf_rank[MAX_N_LIB];
  int uf_size[MAX_N_LIB];

  UnionFind(int n) { init(n); }

  void init(int n) {
    for (int i = 0; i < n; ++i) {
      uf_par[i] = i;
      uf_rank[i] = 0;
      uf_size[i] = 1;
    }
  }

  int find(int x) {
    if (uf_par[x] == x)
      return x;
    else {
      return uf_par[x] = find(uf_par[x]);
    }
  }

  void unite(int leaf_x, int leaf_y) {
    int x = find(leaf_x);
    int y = find(leaf_y);

    if (x == y) return;

    if (uf_rank[x] < uf_rank[y]) {
      uf_par[x] = y;
      uf_size[y] += uf_size[x];
    } else if (uf_rank[x] > uf_rank[y]) {
      uf_par[y] = x;
      uf_size[x] += uf_size[y];
    } else {
      uf_par[y] = x;
      uf_size[x] += uf_size[y];
      uf_rank[x] += 1;
    }
  }

  bool same(int x, int y) { return find(x) == find(y); }

  int size(int x) { return uf_size[find(x)]; }
};
/////////////////////////////////////////////////////////

const int MAX_N = (int)(1e5 + 5);

int n, m;
vector<pair<int, int>> edge;

int out[MAX_N];
vector<int> graph[MAX_N];

UnionFind uf(MAX_N);

vector<pair<int, int>> ans;

void routine(int cur, int parent) {
  if (out[cur] % 2 == 1) {
    ans.push_back(make_pair(cur, parent));
    out[cur] += 1;
  } else {
    ans.push_back(make_pair(parent, cur));
    out[parent] += 1;
  }
  return;
}

void dfs(int cur, int parent) {
  if (graph[cur].size() > 1) {
    for (auto &e : graph[cur]) {
      if (e == parent) continue;
      dfs(e, cur);
    }
  }

  routine(cur, parent);
  return;
}

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);

    edge.push_back(make_pair(a, b));
  }

  if (m % 2 == 1) {
    printf("%d\n", -1);
    return 0;
  }

  for (int i = 1; i <= n; ++i) {
    out[i] = 0;
  }

  for (auto &e : edge) {
    if (uf.same(e.first, e.second)) {
      int inkey = min(e.first, e.second);
      int outkey = max(e.first, e.second);
      ans.push_back(make_pair(outkey, inkey));
      out[outkey] += 1;
    } else {
      graph[e.first].push_back(e.second);
      graph[e.second].push_back(e.first);
      uf.unite(e.first, e.second);
    }
  }

  // for (int i = 1; i <= n; ++i) {
  //   printf("%d: ", i);
  //   auto es = graph[i];
  //   for (auto e : es) {
  //     printf("%d ", e);
  //   }
  //   printf("\n");
  // }

  // for (int i = 1; i <= n; ++i) {
  //   printf("%d - %d\n", i, out[i]);
  // }

  for (auto &e: graph[1]) {
    dfs(e, 1);
  }

  for (auto &e : ans) {
    printf("%d %d\n", e.first, e.second);
  }

  return 0;
}


Measured memory_bytes: 15476
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int num(){
    char s[11];
    int i, n;
    for(i=0; i<sizeof(s); i++){
        s[i] = getchar();
        if(s[i] == ' ' || s[i] == '\n'){
            s[i] = '\0';
            break;
        }
    }
    sscanf(s, "%d", &n);
    return n;
}
int comp(char a[], char b[]){
    int i=0;
    while(a[i] != '\0'){
        if(a[i] != b[i]){
            return a[i] - b[i];
        }
        i++;
    }
    return 0;
}
void sort(char x[][101], int n){
    int i, j;
    char y[101];
    for(i=n; i>1; i--){
        for(j=0; j<=i-2; j++){
            if(0 < comp(x[j], x[j+1])){
                strcpy(y, x[j]);
                strcpy(x[j], x[j+1]);
                strcpy(x[j+1], y);
            }
        }
    }
}
int main(void){
    int n, l;
    int i;
    char s[100][101];
    n = num();
    l = num();
    for(i=0; i<n; i++){
        scanf("%s", s[i]);
    }
    
    sort(s, n);
    
    for(i=0; i<n; i++){
        printf("%s", s[i]);
    }
    printf("\n");
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include<cmath>
using namespace std;
int main(){
	int a,b[100000],c[100000],d[100000];
	long long int ans=0;
	cin>>a;
	for(int i=0;i<a;i++){
		cin>>b[i];
	}
	for(int i=0;i<a;i++){
		cin>>c[i];
	}
	for(int i=0;i<a;i++){
		cin>>d[i];
	}
	sort(b,b+a);
	sort(c,c+a);
	sort(d,d+a);
	for(int i=0;i<a;i++){
		int ok=0,ng=a;
		long long int res=1;
		if(!(b[ok]<c[i])){
			res=0;
		}else{
		while(abs(ok-ng)>1){
			int mid=(ok+ng)/2;
			if(b[mid]<c[i]){
				ok=mid;
			}else{
				ng=mid;
			}
		}
		res*=ok+1;
		}	

		 ok=a-1;
		 ng=-1;
		 if(!(c[i]<d[ok])){
		 	res=0;
		 }else{
		while(abs(ok-ng)>1){
			int mid=(ok+ng)/2;
			if(d[mid]>c[i]){
				ok=mid;
			}else{
				ng=mid;
			}
		}
		res*=a-(ok);
		}	

		ans+=res;
	
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1408