akhauriyash/Code-Regression huggingface dataset:
distance = (
    (),
    (0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6),
    (1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5),
    (2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3, 5, 4, 3, 4),
    (3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2, 6, 5, 4, 3),
    (1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5),
    (2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4),
    (3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2, 4, 3, 2, 3),
    (4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1, 5, 4, 3, 2),
    (2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4),
    (3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2, 2, 1, 2, 3),
    (4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1, 3, 2, 1, 2),
    (5, 4, 3, 2, 4, 3, 2, 1, 3, 2, 1, 0, 4, 3, 2, 1),
    (3, 4, 5, 6, 2, 3, 4, 5, 1, 2, 3, 4, 0, 1, 2, 3),
    (4, 3, 4, 5, 3, 2, 3, 4, 2, 1, 2, 3, 1, 0, 1, 2),
    (5, 4, 3, 4, 4, 3, 2, 3, 3, 2, 1, 2, 2, 1, 0, 1)
)

def get_distance(board):
    sd = 0
    for i in range(16):
        p = board[i]
        if p == 0:
            continue
        sd += distance[p][i]
    return sd

adjacent = (
    (1, 4),         # 0
    (0, 2, 5),      # 1
    (1, 3, 6),      # 2
    (2, 7),         # 3
    (0, 5, 8),      # 4
    (1, 4, 6, 9),   # 5
    (2, 5, 7, 10),  # 6
    (3, 6, 11),     # 7
    (4, 9, 12),     # 8
    (5, 8, 10, 13), # 9
    (6, 9, 11, 14), # 10
    (7, 10, 15),    # 11
    (8, 13),        # 12
    (9, 12, 14),    # 13
    (10, 13, 15),   # 14
    (11, 14)        # 15
)

GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0]

def df_lower_search(limit, move, space, lower, pre_p):
    if move == limit:
        if board == GOAL:
            return True
    else:
        for i in adjacent[space]:
            p = board[i]
            if p == pre_p:
                continue
            board[space] = p
            board[i] = 0
            new_lower = lower - distance[p][i] + distance[p][space]
            if new_lower + move <= limit:
                if df_lower_search(limit, move + 1, i, new_lower, p):
                    return True
            board[space] = 0
            board[i] = p

import sys

board = list(map(int, sys.stdin.read().split()))
n = get_distance(board)
for l in range(n, 46):
    if df_lower_search(l, 0, board.index(0), n, None):
        print(l)
        break

Measured memory_bytes: 7984
#include<cstdio>
#include<vector>
#include<cstring>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
const int N=303303;
int n,m,k;
int mx[N*8],a[N];
vector<int>v[N];
void build(int p,int l,int r){
	if (l==r){
		mx[p]=a[l];
		return;
	}
	int mid=(l+r)>>1;
	build(p*2,l,mid);
	build(p*2+1,mid+1,r);
	mx[p]=max(mx[p*2],mx[p*2+1]);
}
void modify(int p,int l,int r,int a,int c){
	if (l==r){
		mx[p]+=c;
		return;
	}
	int mid=(l+r)>>1;
	if (a<=mid)	modify(p*2,l,mid,a,c);
	else modify(p*2+1,mid+1,r,a,c);	
	mx[p]=max(mx[p*2],mx[p*2+1]);
}

int main(){
	int x,y;
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1; i<=k; i++){
		scanf("%d%d",&x,&y);
		v[x].push_back(y);
		a[y]++;
	}
	build(1,1,m);
	int ans=0;
	for (int i=1; i<=n; i++){
		int sum=(int)v[i].size();
		for (int j=0; j<(int)v[i].size(); j++)
			modify(1,1,m,v[i][j],-1);
		ans=max(ans,sum+mx[1]);
		for (int j=0; j<(int)v[i].size(); j++)
			modify(1,1,m,v[i][j],1);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 24972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

vector<pair<ll,ll>> prime_factorize(ll N){
    vector<pair<ll,ll>> ret;
    for(ll a = 2; a * a <= N; a++){
        if(N % a != 0) continue;
        ll ex = 0;
        while(N % a == 0){
            ex++;
            N /= a;
        }
        ret.push_back({a, ex});
    }
    if(N != 1) ret.push_back({N, 1});
    return ret;
}

int main(){
    ll n;
    cin >> n;
    auto v = prime_factorize(n);
    ll ans = 0;
    for(auto e : v){
        ll c = 1;
        while(true){
            if(e.second >= c) e.second -= c;
            else break;
            c++;
        }
        ans += c-1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

typedef long long LL;
const LL MOD = 1000000007;
static const size_t MAX_N = 2000001;

struct modll {
	long long x;
	modll() { }
	modll(int _x) : x(_x) { }
	operator int() const { return (int)x; }
	modll operator+(int y) { return (x + y + MOD) % MOD; }
	modll operator+=(int y) { x = (x + y + MOD) % MOD; return *this; }
	modll operator-(int y) { return (x - y + MOD) % MOD; }
	modll operator-=(int y) { x = (x - y + MOD) % MOD; return *this; }
	modll operator*(int y) { return (x * y) % MOD; }
	modll operator*=(int y) { x = (x * y) % MOD; return *this; }
	modll operator/(int y) { return (x * modpow(y, MOD - 2)) % MOD; }
	modll operator/=(int y) { x = (x * modpow(y, MOD - 2)) % MOD; return *this; }
	static modll modinv(int a) { return modpow(a, MOD - 2); }
	static modll modpow(int a, int b) {
		modll x = a, r = 1;
		for (; b; b >>= 1, x *= x) if (b & 1) r *= x;
		return r;
	}
};

modll combination(LL n, LL r) {
	static modll fact[MAX_N + 1], inv[MAX_N + 1];
	if (!fact[0]) {
		fact[0] = 1;
		for (int i = 1; i <= MAX_N; ++i) {
			fact[i] = fact[i - 1] * i;
		}
		inv[MAX_N] = modll::modinv(fact[MAX_N]);
		for (int i = MAX_N; i >= 1; --i) {
			inv[i - 1] = inv[i] * i;
		}
	}
	if (r > n) {
		return 0;
	}
	return (fact[n] * inv[r]) * inv[n - r];
}

// 重複組合せ
modll nHr(LL n, LL r) {
	return combination(n + r - 1, r);
}

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int k = -1;
		cin >> k;
		string s;
		cin >> s;
		if (k < 0) return 0;

		vector<modll> f25(k + 1), f26(k + 1);
		f25[0] = 1, f26[0] = 1;
		for (int i = 1; i <= k; ++i) {
			f25[i] = f25[i - 1] * 25;
			f26[i] = f26[i - 1] * 26;
		}

		int len = (int)s.length();
		modll ans = 0;
		for (int i = 0; i <= k; ++i) {
			ans += combination(len + i - 1, len - 1) * f25[i] * f26[k - i];
		}

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


Measured memory_bytes: 51172
package main

import (
	"fmt"
	"math"
)

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

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

	h := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &h[i])
	}

	dp := make([]int, n)
	for i := 0; i < n; i++ {
		dp[i] = 1000000000000000
	}
	dp[0] = 0

	for i := 0; i < n; i++ {
		for j := i + 1; j < i+3 && j < n; j++ {
			// fmt.Println("(i, j) dp[i], abs", i, j, dp[j], abs(h[i]-h[j]))
			dp[j] = min(dp[j], abs(h[i]-h[j])+dp[i])
		}
	}
	fmt.Println(dp[len(dp)-1])
}


Measured memory_bytes: 6320
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 200005;

int main()
{
	int N;
	scanf("%d", &N);
	map<int, int> L;
	for(int i = 1; i <= N; i++){
		int a;
		scanf("%d", &a);
		L[a] += 1;
	}
	int ans = 0;
	for(auto c : L){
		if( c.first <= c.second ) ans += c.second - c.first;
		else ans += c.second;
	}
	printf("%d\n", ans);
}


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

int main()
{
  int X, Y;
  cin >> X >> Y;
  if(Y >= 2 * X && Y <= 4 * X && !(Y % 2)) {
  	cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
  // combination: 2^X
  // 2^100=1267650600228229401496703205376
  // MIN value: all X are clanes : Y=2X
  // MAX value: all X are turtles : Y=4X
  // ALL value: if Y is one of 2X:2:4X then Yes else No

Measured memory_bytes: 3600
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,M;
ll cnt[100010];
int main(){
    cin>>N>>M;
    for(ll i=0;i<M;i++){
        ll a,b;
        cin>>a>>b;
        cnt[a]++;
        cnt[b]++;
    }
    for(ll i=0;i<N;i++){
        if(cnt[i]%2!=0){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#89c
import collections
import itertools

N = int(input())
S_list = []
for i in range(N):
    S = str(input())
    S_list.append(S[0])

counted = collections.Counter(S_list)
char_comb_list = list(itertools.combinations(["M","A","R","C","H"],3))

ans = 0

for char_comb in char_comb_list:
    ans += counted[char_comb[0]] * counted[char_comb[1]] * counted[char_comb[2]]
    
print(ans)

Measured memory_bytes: 4216
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

 /* Coding Space*/
int main(){
  string s; cin >> s;
  int ss = (int)s.size();
  int l = 0;
  int r = ss-1;
  int ans = 0;
  while(l <= r){
    if(s[l] == s[r]){
      l++,r--;
    }else if(s[l] == 'x'){
      ans++;
      l++;
    }else if(s[r] == 'x'){
      ans++;
      r--;
    }else{
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}

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

int main()
{
	int a, b , c,d , e , f;
	cin>>a>>b>>c>>d>>e>>f;
	vector<int > water , sugar;
	for(int i = 0; i <= f; i += 100*a)
	{
		for(int j = 0; j + i <= f ; j+= b*100)
		{
			if(i+j <= f) water.push_back(i+j);
		}
	}
	int lm = f/100;
	lm *=e;
	for(int i = 0;i <= lm; i += c)
	{
		for(int j = 0; j + i <= lm ; j+=d)
		{
			if(i+j <= lm) sugar.push_back(i+j);
		}
	}
	int mxS  = 0, mxW = a*100;
	for(int i = 0; i < water.size(); i++)
	{
		for(int j = 0; j < sugar.size()  ; j++)
		{
			if(water[i]+sugar[j] > f) continue;
			if(water[i]*e < 100*sugar[j]) continue;
			int tmp = water[i];
			if(tmp*mxS <= mxW*sugar[j]) 
			{
				mxW = tmp;
				mxS = sugar[j];
			}
		}
	}
	cout<<mxW+mxS<<" "<<mxS<<endl;
	
}


Measured memory_bytes: 1400
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

bool isPrime(int n) {

	if (n == 1) return false;
	if (n == 2) return true;


	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}

	return true;
}

int main() {

	while (true) {
		int a, d, n; cin >> a >> d >> n;

		if (a == 0 && d == 0 && n == 0)return 0;

		int x = a;
		int cnt = 0;

		while (true) {
			if (isPrime(x)) {
				cnt++;
			}

			if (cnt == n)break;

			x += d;
		}

		cout << x << endl;
	}

	return 0;
}


Measured memory_bytes: 2996
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 555

int n, m, ln, co, i, j;
ll ans[maxN][maxN], sum, bonus;


int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d%d%d%d", &n, &m, &ln, &co);

    if (ln * co == 1) {
        printf("No");
        return 0;
    }

    bonus = 1000000000 / (ln * co - 1);
    if (bonus * (ln * co - 1) + 1 > 1000000000) bonus--;

    for (i = 1; i <= n; i++)
        for (j = 1; j <= m; j++)
            ans[i][j] = bonus;

    for (i = ln; i <= n; i += ln) {
        for (j = co; j <= m; j += co) {
            ans[i][j] = -(bonus * (ln * co - 1) + 1);
        }
    }

    for (i = 1; i <= n; i++)
        for (j = 1; j <= m; j++)
            sum += ans[i][j];

    if (sum < 0) {
        printf("No");
        return 0;
    }

    printf("Yes\n");
    for (i = 1; i <= n; i++) {
        for (j = 1; j <= m; j++) {
            printf("%lld ", ans[i][j]);
        }
        printf("\n");
    }


    return 0;
}


Measured memory_bytes: 5120
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	int N, count = 0;
	int H, W;
	cin >> N >> H >> W;
	long int A[N], B[N];
	for(int i = 0; i < N; i++){
		cin >> A[i] >> B[i];
		if(A[i] >= H && B[i] >= W){
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
 double x1,y1,x2,y2,ans;
 scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
 ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
 printf("%f\n",sqrt(ans));
}




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

using namespace std;

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

    string S="Sunny";
    string C="Cloudy";
    string R="Rainy";

    if(s==S){
        puts("Cloudy");
    }else if(s==C){
        puts("Rainy");
    }else{
        puts("Sunny");
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rgi register int
#define ll long long
class fastin{
	private: int _ch,_f;
	public: template<typename _Tp> inline fastin& operator>>(_Tp&_x){
		_x=0; while(!isdigit(_ch)) _f|=(_ch==45),_ch=getchar();
		while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
		_f&&(_x=-_x,_f=0); return *this;}
	fastin() {_ch=_f=0;}
}fin;
class fastout{
	private: int _num[32],_head;
	public: int SUF; template<typename _Tp> inline fastout& operator<<(_Tp _x){
		_Tp _k; if(_x==0) {putchar('0'),putchar(SUF);return *this;} if(_x<0) putchar('-'),_x=-_x;
		while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
		while(_head>0) putchar(_num[_head]),--_head; putchar(SUF); return *this;}
	fastout() {_head=0,SUF=' ';}
}fout;
// ----------------------------
// #define int ll
using namespace std;
const int maxn=200004;
const int mod=998244353,inf=1000000007;


long long a,b,c;
signed main()
{
	fin>>a>>b>>c;
	if(c<=a+b)
	{
		cout<<"No";
		return 0;
	}
	if(4ll*a*b<(c-a-b)*(c-a-b))
	{
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
}

// ----------------------------
// by imzzy


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	int n, i;
	cin >> n;
	int arr[n], b[n - 1];
	fo(i, 0, n - 1)
	cin >> b[i];
	arr[0] = b[0];
	arr[n - 1] = b[n - 2];
	fo(i, 0, n - 2){
		arr[i + 1] = min(b[i], b[i + 1]);
	}
	cout << accumulate(arr, arr + n, 0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n,m;
int arr[100001];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    long double ans=(long double)n/3;
    cout<<fixed<<setprecision(10);
    cout<<ans*ans*ans;
    /*
    for (int i=1;i<=n;i++){
        cin>>arr[i];
    }
    */
    cout<<(n*(n-1))/2+(m*(m-1))/2;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
void solve(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    int size;
    size = s.size();
    for(int i = 0; i < size; i++){
        int a;
        a = s.at(i) - 'A';
        char b;
        b = 'A';
        b += (a + n) % 26;
        cout << b;
    }
    cout << endl;
}
int main(){
    solve();
    return 0;
}


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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int H, W;
    cin >> H >> W;
    std::vector<string> s(H);
    REP(i, H) {
        std::cin >> s[i];
    }

    vector<vector<int>> dp(H, vector<int>(W));
    REP(i, H) {
        REP(j, W) {
            dp[i][j] = INF;
        }
    }

    dp[0][0] = (s[0][0] == '#') ? 1 : 0;
    REP(i, H) {
        REP(j, W) {
            if(i == 0 && j == 0) continue;
            if(0 < i) {
                if(s[i - 1][j] == '.' && s[i][j] == '#') {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
                }
                else {
                    dp[i][j] = min(dp[i][j], dp[i - 1][j]);
                }
            }
            if(0 < j) {
                if(s[i][j - 1] == '.' && s[i][j] == '#') {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
                }
                else {
                    dp[i][j] = min(dp[i][j], dp[i][j - 1]);
                }
            }
        }
    }

    cout << dp[H - 1][W - 1] << endl;

    return 0;
}


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

long long ans=0LL;

void solve(long long a,long long b)
{
	if (a==0LL)
	{
		return;
	}
	ans+=b;
	solve(a/2LL,b*2LL);
	return;
}

int main(int argc, char const *argv[])
{
	long long h;
	cin>>h;
	solve(h,1LL);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
A = dict()
B = [0 for i in range(5)]
for i in range(10):
    A[i] = []
for i in range(5):
    B[i] = int(input())
for i in range(5):
    A[B[i]% 10].append(B[i])
cur_time = 0
count = 0
if len(A[0]) > 0:
    for j in A[0]:
        count += 1
        cur_time += j
for i in range(9,0,-1):
    if len(A[i]) > 0:
        for j in A[i]:
            count += 1
            if count < 5:
                cur_time += j + (10-i)
            else:
                cur_time += j
print(cur_time)

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()	
	{
		long N = GetLong();
		long M = GetLong();

		if(N >= M/2)
		{
			Console.WriteLine(M/2);
		}
		else
		{
			Console.WriteLine(N + (M - 2 * N)/4);
		}
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <utility>
#include <map>
#include <unordered_map>
#include <string>

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)
#define all(c) begin(c),end(c)
#define vmax(c) *max_element(all(c))
#define vmin(c) *min_element(all(c))
 
template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}

template<typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::map<T1, T2>& map)
{
    for (typename std::map<T1, T2>::const_iterator it = map.begin();
         it != map.end();
         ++it)
    {
        out << (*it);
    }
    return out;
}

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const long long INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9; 

// 2次元配列を作る
// vector<vi> my_vector(n, vi(m, 0));

// 多次元配列の dump
// for (auto v : my_vector) {
//     cout << v;
// }

string S;
// vector<vll> DP;

bool checkHeisei() {
    int m10;
    int m1;
    int d;
    m10 = (int)S[5] - 48;
    if (m10 > 0) {
        return false;
    }

    m1 = (int)S[6] - 48;
    if (m1 > 4) {
        return false;
    }
    if (m1 < 4) {
        return true;
    }
    
    d = stoi(S.substr(8, 10));
    if (d > 30) {
        return false;
    }
    return true;
}

auto solve() {
    string sep = "/";
    cin >> S;
    bool c = checkHeisei();
    if (c) {
        cout << "Heisei";
    } else {
        cout << "TBD";
    }
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // cout << solve();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll n,k;
  cin >> n >> k;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  vector<P> p(2*n+2);
  p[0].second=0;
  p[0].first=1;
  rep(i,2*n+1){
    p[i+1].second=i+1;
    p[i+1].first=a[p[i].first-1];
  }
  if(k<2*n+2){
    cout << p[k].first;
  }
  else{
  vl A(2*n+2);
  rep(i,2*n+2){
    A[i]=p[i].first;
  }
  sort(p.begin(),p.end());
  ll d=INF;
  rep(i,2*n+1){
    if(p[i].first==p[i+1].first){
      d=min(d,p[i+1].second-p[i].second);
    }
  }
    ll x=2*n+1;
    while((k-x)%d!=0){
      x--;
    }
    cout << A[x] << endl;
  }
}

Measured memory_bytes: 14348
#include<stdio.h>

int main(void)
{
	int i,j,k,N,K,A[101],B[101],dp[101][3][2],d,temp,h,S;
	
	scanf("%d%d",&N,&K);
	d=0;
	S=0;
	for(i=0;i<=K-1;i++) 
	{
		scanf("%d%d",&A[i],&B[i]);
		if(A[i]==1) d=B[i];
	}
	for(i=0;i<=N-1;i++)
	{
		for(j=0;j<=2;j++)
		{
			for(k=0;k<=1;k++)
			{
				dp[i][j][k]=0;
			}
		}
	}
	if(d==0)
	{
		dp[0][0][0]=1;
		dp[0][1][0]=1;
		dp[0][2][0]=1;
		h=0;
	}
	else
	{
		dp[0][d-1][0]=1;
		h=1;
	}
	for(i=0;i<=K-1;i++)
	{
		for(j=0;j<=K-2;j++)
		{
			if(A[j]>A[j+1])
			{
				temp=A[j];
				A[j]=A[j+1];
				A[j+1]=temp;
				temp=B[j];
				B[j]=B[j+1];
				B[j+1]=temp;
			}
		}
	}
	for(i=1;i<=N-1;i++)
	{
		if(A[h]==i+1)
		{
			for(j=0;j<=2;j++)
			{
				if(j!=B[h]-1)
				{
					dp[i][B[h]-1][0]=(dp[i][B[h]-1][0]+dp[i-1][j][0]+dp[i-1][j][1])%10000;
				}
			}
			dp[i][B[h]-1][1]=dp[i-1][B[h]-1][0]%10000;
			h++;
		}
		else
		{
			dp[i][0][0]=(dp[i-1][1][0]+dp[i-1][1][1]+dp[i-1][2][0]+dp[i-1][2][1])%10000;
			dp[i][0][1]=dp[i-1][0][0]%10000;
			dp[i][1][0]=(dp[i-1][0][0]+dp[i-1][0][1]+dp[i-1][2][0]+dp[i-1][2][1])%10000;
			dp[i][1][1]=dp[i-1][1][0]%10000;
			dp[i][2][0]=(dp[i-1][1][0]+dp[i-1][1][1]+dp[i-1][0][0]+dp[i-1][0][1])%10000;
			dp[i][2][1]=dp[i-1][2][0]%10000;
		}
	}
	for(i=0;i<=2;i++)
	{
		for(j=0;j<=1;j++)
		{
			S+=dp[N-1][i][j];
			S%=10000;
		}
	}
	printf("%d\n",S);
	return 0;
}

Measured memory_bytes: 596
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n, m; cin >> n >> m;
	vector<vector<int>> tb(n, vector<int>(m));

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> tb[i][j];
		}
	}

	set<int> s;
	for (int i = 0; i < 10000; i++) {
		s.insert(i*i);
	}

	int ans = 0;

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int val = 0;
			for (int k = 0; k < m; k++) {
				int diff = abs(tb[i][k] - tb[j][k]);
				val += diff * diff;
			}
			if (s.count(val))ans++;

		}
	}
	

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

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

using ll = long long;

int main() {
  int x, y;
  cin >> x>>y;
  cout << x*y<<" "<<2*(x+y) << endl;
  return 0;
}


Measured memory_bytes: 3016
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#define LLMAX 9223372036854775807

using namespace std;
using ll = long long;

int main() {
	ll argN;
	cin >> argN;

	vector<int> argT(argN);
	vector<int> argX(argN);
	vector<int> argY(argN);

	for (ll i = 0; i < argN; ++i) {
		cin >> argT.at(i) >> argX.at(i) >> argY.at(i);
	}

	ll posX = 0;
	ll posY = 0;
	ll time = 0;
	for (ll i = 0; i < argN; ++i) {
		ll diff = abs(argX.at(i) - posX) + abs(argY.at(i) - posY);
		ll diffWithT = diff - (argT.at(i) - time);

		if (diffWithT > 0) {
			cout << "No" << endl;
			return 0;
		}
		else if (diffWithT == 0) {
			posX = argX.at(i);
			posY = argY.at(i);
			time = argT.at(i);
			continue;
		}
		else if (abs(diffWithT) % 2 == 0) {
			posX = argX.at(i);
			posY = argY.at(i);
			time = argT.at(i);
			continue;
		}
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<string>
using namespace std;
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int cnt = 0;
  int ans = 0;
  for (int i=0; i<N; i++) {
    if (s[i] == 'I') ans++;
    else if (s[i] == 'D') ans--;
    cnt = max(ans,cnt);
  }
  cout << cnt << endl;
}

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

int main() {
  int N;
  int c = 0, flag = 1;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  
  while(flag){
    for(int i=0; i<N; i++){
      if(A.at(i)%2 != 0){
        flag = 0;
      }
    }
    if(flag){
      for(int i=0; i<N; i++){
        A.at(i) = A.at(i)/2;
      }
      c++;
    }
      
  }
  cout << c << endl;
}




Measured memory_bytes: 256
"""
// Author : snape_here - Susanta Mukherjee
     
 """
 
from __future__ import division, print_function
 
import os,sys
from io import BytesIO, IOBase
 
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
 
 
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())
 
 
def read():
    sys.stdin = open('input.txt', 'r')  
    sys.stdout = open('output.txt', 'w') 
 
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

mod=1000000007

import math

import bisect

abc="abcdefghijklmnopqrstuvwxyz"

def main():

    r=ii()
    ans=3.141592653589793238*r*2 
    print(ans)

        
# region fastio

 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
 
 
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
 
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
 
if __name__ == "__main__":
    #read()
    main()

Measured memory_bytes: 65856
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

constexpr ll MOD = 998244353;

int main() {
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    reverse(s.begin(), s.end());

    int oneCount = 0;
    while (oneCount < n && s[oneCount] == '1')oneCount++;

    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1));
    for (int i = 0; i <= oneCount; i++) dp[i][oneCount - i] = 1;
    for (int i = 0; i < n; i++) {
        if (s[i] == '1') continue;

        int followingOne = 0;
        while (i + followingOne + 1 < n && s[i + followingOne + 1] == '1')followingOne++;

        vector<vector<ll>> after(n + 1, vector<ll>(n + 1));
        for (int prevCount = 0; prevCount <= oneCount; prevCount++) {
            for (int nowCount = prevCount; nowCount <= oneCount + followingOne; nowCount++) {
                for (int prevCost = 0; prevCost <= n; prevCost++) {
                    int add = nowCount - prevCount, nowCost = -1;
                    if (add <= followingOne) {
                        nowCost = prevCost + (followingOne - add);
                    } else {
                        int remain = oneCount - prevCount;
                        nowCost = prevCost + max(0, (add - followingOne) - remain);
                    }

                    if (nowCost > n)continue;
                    after[nowCount][nowCost] += dp[prevCount][prevCost];
                    after[nowCount][nowCost] %= MOD;
                }
            }
        }

        oneCount += followingOne;
        dp = after;
    }

    ll ret = 0;
    for (int j = 0; j <= min(n, k); j++)ret += dp[oneCount][j], ret %= MOD;
    cout << ret << endl;
    return 0;
}

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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define dbg(x) std::cerr<<#x<<" = " << (x) << std::endl
#define pnl(x) std::cout << x << "\n"

typedef	std::vector<int>	vi;
typedef std::pair<int,int>	ii;
typedef std::vector<std::string>	vs;
typedef std::vector<ii>	vii;
typedef std::vector<long long>	vl;
typedef	long long ll;


const int	NB_D = 4;
const int	DY[] = {-1, 1, 0, 0};
const int	DX[] = {0, 0, -1, 1};

int		main(void)
{
	std::ios_base::sync_with_stdio(false);
	int	N, A, B;
	std::cin >> N >> A >> B;

	pnl(std::min(A * N, B));
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
  string s;
  cin >> s;
  int count = 0;
  if(s[0]== 'o')count++;
  if(s[1]== 'o')count++;
  if(s[2]== 'o')count++;
  int price = 700;
  price = price + (count*100);
  cout << price << endl;

  return 0;
}


Measured memory_bytes: 256
//encoding:utf-8
#include <iostream> //c++
#include<time.h> //時間にかんして
#include<stack> //スタックに関して　最新のデータから捨てる
#include<queue> //キューに関して　最古のデータから捨てる
#include<math.h>

#define ll long long
using namespace std;


int n,x;
int m[100];
int donut;
int min_value = pow(10,5);

int main(){
  donut = 0;
  cin>>n>>x;

  for(int i=0;i<n;i++){
    cin>>m[i];
    x-=m[i];
    donut++;
    if(min_value>m[i]){
      min_value = m[i];
    }
  }
  donut+=x/min_value;
  cout<<donut<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int r,c,px,py,ex,ey;
char a[1009][1009];
bool visited[1009][1009];
int ox[4]= {0,0,1,-1},oy[]= {1,-1,0,0};
bool ok(int x,int y)
{
    if (x>=0&&x<r&&y>=0&&y<c&&a[x][y]!='#')
        return 1;
    return 0;
}
void bfs()
{
    deque<pair<pair<int,int>,int>>d;
    d.push_back({{px-1,py-1},0});
    while (!d.empty())
    {
        pair<pair<int,int>,int>t=d.front();
        d.pop_front();
        int cx=t.first.first;
        int cy=t.first.second;
        int cnt=t.second;
        if (cx==ex-1&&cy==ey-1)
        {
            cout<<cnt<<endl;
            exit(0);
        }
        if (visited[cx][cy])
            continue;
        visited[cx][cy]=1;
        for (int i=0; i<4; i++)
        {
            int x=cx+ox[i];
            int y=cy+oy[i];
            if (ok(x,y))
                d.push_front({{x,y},cnt});
        }
        for (int i=-2; i<=2; i++)
        {
            for (int j=-2; j<=2; j++)
            {
                int x=cx+i;
                int y=cy+j;
                if (ok(x,y))
                    d.push_back({{x,y},cnt+1});
            }
        }
    }
    cout<<-1<<endl;
    exit(0);
}
int main()
{
    FASTINOUT;
    cin>>r>>c>>px>>py>>ex>>ey;
    for (int i=0; i<r; i++)
    {
        for (int j=0; j<c; j++)
        {
            cin>>a[i][j];
        }
    }
    bfs();
    return 0;
}


Measured memory_bytes: 7316
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int l = (int)s.size();
    int ans = 1000;
    REP(i,26){
        char c = 'a'+i;
        int now = -1;
        int tmp = 0;
        REP(j,l){
            if(s[j]==c){
                tmp = max(tmp, j-now-1);
                now = j;
            }
        }
        tmp = max(tmp, l-now-1);
        ans = min(ans,tmp);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val k = scanner.nextInt()
    val q = scanner.nextInt()
    val a = IntArray(q) { scanner.nextInt() }

    val c = IntArray(n) { 0 }
    a.forEach { c[it - 1]++ }

    val sb = StringBuilder()
    c.forEach { count ->
        val r = if (q - count >= k) "No" else "Yes"
        sb.append(r).append("\n")
    }
    sb.deleteCharAt(sb.lastIndex)

    println(sb.toString())
}

Measured memory_bytes: 55052
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int l = in.nextInt();

            int n = Integer.toBinaryString(l).length();
            int m = (n - 1) * 2 + Integer.bitCount(l) - 1;

            out.println(n + " " + m);

            int pow2 = 1;
            for (int i = 1; i < n; i++) {
                out.println(i + " " + (i + 1) + " " + 0);
                out.println(i + " " + (i + 1) + " " + pow2);
                if (((l >> (i - 1)) & 1) == 1) {
                    out.println(i + " " + n + " " + (l & (-1 << i)));
                }
                pow2 <<= 1;
            }
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



Measured memory_bytes: 21332
fun main(args: Array<String>) {
    while (true) {
        val x = readLine()!!.split(" ")
        val a = x[0].toInt()
        val op = x[1]
        val b = x[2].toInt()

        if (op.equals("?")) break
        
        when (op) {
            "+" -> println(a+b)
            "-" -> println(a-b)
            "*" -> println(a*b)
            "/" -> println(a/b)
        }
    }
}


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

int main(){
  string s, tmp;
  cin >> s;
  tmp = s;
  reverse(tmp.begin(), tmp.end());
  int ans = 0;
  for(int i=0;i<s.size();i++){
    if(s[i]!=tmp[i])
      ans++;
  }
  cout << ans/2 << endl;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    while(str.length() != 0){
      int tmp = str.length();
      str = str.replace(str.charAt(0) + "", "");
      if(str.length() - tmp != -1){
        System.out.println("no");
        System.exit(0);
      }
    }
    System.out.println("yes");
  }
}


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

int main() {
    int N, K;
    string S;
    cin >> N >> S >> K;
    char s = S[K - 1];
    rep(i, N) {
        if (S[i] == s) cout << S[i];
        else cout << '*';
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <ctime>
#include <numeric>


#ifndef M_PI
#define M_PI 3.141592653589
#endif
#define int long long
#define double long double

#ifdef TIME
#define start cin.tie(NULL); cout.tie(NULL); cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false);int32_t START = clock()
#define finish cout << "\ntime: " << (clock() - START) / (CLOCKS_PER_SEC * 1.0); return 0
#endif

#ifndef TIME
#define start cin.tie(NULL); cout.tie(NULL); cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false)
#define finish return 0
#endif

using namespace std;


//vector input
template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &i : vec) {
        cin >> i;
    }
    return is;
}

//pair output
template<typename E>
ostream &operator<<(ostream &os, pair<E, E> &t) {
    os << t.first << ' ' << t.second;
    return os;
}

//"map" pair output
template<typename E>
ostream &operator<<(ostream &os, pair<const E, E> &t) {
    os << t.first << ' ' << t.second;
    return os;
}

//vector output
template<typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
    for (T i : vec) {
        os << i << ' ';
    }
    return os;
}

//2 dimensional vector output
template<typename T>
ostream &operator<<(ostream &os, vector<vector<T> > &vec) {
    for (vector<T> i : vec) {
        os << i << '\n';
    }
    return os;
}


int32_t main() {
    start;

    double d, t, s;
    cin >> d >> t >> s;

    if (d / t <= s) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }

    finish;
}

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

int main(){
  int n,m,i;
  cin >> n >> m;
  vector<int> a(m),b(m),x(n,0);
  for(i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i);
    if(a.at(i)==1){
      x.at(b.at(i))++;
    }
    if(b.at(i)==n){
      x.at(a.at(i))++;
    }
  }
  for(i=2;i<=n-1;i++){
    if(x.at(i)==2){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 5600
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

int main() {
	int N, M;
	cin >> N >> M;
	int imos[100100];
	for (int i = 0; i < 100100; ++i) {
		imos[i] = 0;
	}
	for (int i = 0; i < M; ++i) {
		int l, r; cin >> l >> r;
		l--, r--;
		imos[l]++;
		imos[r+1]--;
	}
	for (int i = 1; i < N; ++i) {
		imos[i] = imos[i - 1] + imos[i];
	}
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (imos[i] == M) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640